Skip to content

Connect to game server#7

Open
TP-O wants to merge 2 commits into
mainfrom
connectAccount
Open

Connect to game server#7
TP-O wants to merge 2 commits into
mainfrom
connectAccount

Conversation

@TP-O

@TP-O TP-O commented Aug 24, 2023

Copy link
Copy Markdown
Owner

No description provided.

@TP-O TP-O added the enhancement New feature or request label Aug 24, 2023
Comment thread game-server/src/user/mod.rs Outdated
pub struct Game {
pub users: Arc<RwLock<HashMap<usize, User>>>,
pub connected_users: Arc<RwLock<HashMap<usize, String>>>,
pub rooms: Arc<RwLock<HashMap<usize, Room>>>,

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Một game có 1 room thôi

Comment thread game-server/src/user/mod.rs Outdated
#[derive(Debug, Clone)]
pub struct Game {
pub users: Arc<RwLock<HashMap<usize, User>>>,
pub connected_users: Arc<RwLock<HashMap<usize, String>>>,

@TP-O TP-O Sep 8, 2023

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thêm 1 field is_connected trong User thay vì tạo 1 list riêng trong Game

Comment thread game-server/src/user/rooms.json Outdated
{
"1": {
"id": 1,
"players": [1,0,5,0,0]

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lưu player ID

Comment thread game-server/src/user/users.json Outdated

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lưu trong DB rồi query ra nha

Comment thread game-server/src/user/rooms.json Outdated

@TP-O TP-O Sep 8, 2023

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tạo biến global rồi lưu data của room

Comment thread game-server/src/user/mod.rs Outdated


#[derive(Debug, Clone)]
pub struct Game {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Struct Game đã sẵn rồi mà nhở? Nên chắc ko cần phải tạo cái này nữa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants