From d7ef0ea06e9c35ed719e3953c0fdaef2cab8a68f Mon Sep 17 00:00:00 2001 From: student079 <102852555+student079@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:42:23 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=83=88=EC=A3=BC=EC=8B=9C=20=ED=83=88?= =?UTF-8?q?=EB=9D=BD=EC=B2=98=EB=A6=AC=20(#223)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- be/gameServer/src/modules/games/games.gateway.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/be/gameServer/src/modules/games/games.gateway.ts b/be/gameServer/src/modules/games/games.gateway.ts index 22cb71b..95c9b3a 100644 --- a/be/gameServer/src/modules/games/games.gateway.ts +++ b/be/gameServer/src/modules/games/games.gateway.ts @@ -363,6 +363,17 @@ export class GamesGateway implements OnGatewayDisconnect { this.server.to(roomId).emit('updateUsers', gameData.players); if (playerNickname === gameData.currentPlayer) { + updatePreviousPlayers(gameData, playerNickname); + gameData.currentTurn++; + this.logger.log(`Turn updated: ${gameData.currentTurn}`); + gameData.currentPlayer = selectCurrentPlayer( + gameData.alivePlayers, + gameData.previousPlayers, + ); + await this.redisService.set( + `game:${roomId}`, + JSON.stringify(gameData), + ); this.logger.log(`leaved player === currentPlayer: ${playerNickname}`); setTimeout(() => { this.server.to(roomId).emit('voiceProcessingResult', {