Closed mfunyu closed 3 months ago
socket.on("joinRoom", (roomName: string, username: string) => { console.log("joinRoom", roomName); const user = this.userController.createAndAddUser(username, socket); const room = this.roomController.joinRoom(roomName, user); console.log("room", room); }); // emit "boardInfo" to each player, after, receive "boardInfo" each 1 sec socket.on("startGame", (roomName: string) => { console.log("startGame", roomName); const room = this.roomController.findRoomByName(roomName); if (!room) { throw new Error("Room not found"); } room.game.startGame(); });
emitCurrentBoard() { const boardCurrentState = this._board.screenShot(); this.socket.emit("boardInfo", boardCurrentState); }
export type types = "O" | "S" | "Z" | "T" | "J" | "L" | "I" | "-";
Open the branch in Web Editor • VS Code • Insiders Open Preview