Skip to content

Connect to game server#7

Open
TP-O wants to merge 2 commits intomainfrom
connectAccount
Open

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

Conversation

@TP-O
Copy link
Owner

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

No description provided.

@TP-O TP-O added the enhancement New feature or request label Aug 24, 2023
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
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

#[derive(Debug, Clone)]
pub struct Game {
pub users: Arc<RwLock<HashMap<usize, User>>>,
pub connected_users: Arc<RwLock<HashMap<usize, String>>>,
Copy link
Owner Author

@TP-O TP-O Sep 8, 2023

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

{
"1": {
"id": 1,
"players": [1,0,5,0,0]
Copy link
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

Copy link
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

Copy link
Owner Author

@TP-O TP-O Sep 8, 2023

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



#[derive(Debug, Clone)]
pub struct Game {
Copy link
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