Skip to content

Feat: Room#3

Open
duyanh14 wants to merge 1 commit into
masterfrom
feat/room
Open

Feat: Room#3
duyanh14 wants to merge 1 commit into
masterfrom
feat/room

Conversation

@duyanh14

@duyanh14 duyanh14 commented Jul 3, 2022

Copy link
Copy Markdown
Member
  • Notice of connected players
  • Clear the room when all players leave

currentRoom.set(playerId,player);
currentRoom.set(playerId, player);

//

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove uneccessary comment mark

currentRoom.set(playerId, player);

//
currentRoom.forEach((rplayer) => {

@GiveMeSomething GiveMeSomething Jul 3, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Đang không hiểu đoạn forEach có chức năng gì 😵‍💫

Nếu được thì ông thêm explanation vào đây và thêm comments nhé

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

forEach được chạy khi có player bất kì ngắt kết nối. Nhiệm vụ gửi thông báo cho các player còn lại trong room về việc người chơi này đã ngắt kết nối

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hình như nhầm đoạn forEach rồi thì phải. Tôi thấy đoạn này gửi message type là SUBSCRIBE

Cái t không hiểu lắm là tại sao tại phải có message type là SUBSCRIBE

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

image

currentRoom.forEach((rplayer) => {

@GiveMeSomething

GiveMeSomething commented Jul 3, 2022

Copy link
Copy Markdown
Contributor

Về phần message, có thể mình sẽ tạo ra một function riêng để tạo message và format.

e.g. makeMessage<T>(type: MessageType, msg: T)

Trong đó thì mình sẽ map từ MessageType thành các kiểu như SUBSCRIBE , MESSAGE, ... và format JSON các thứ

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants