From 629838b1870442b91ace0f41895021302b08d511 Mon Sep 17 00:00:00 2001 From: joffrey-bion Date: Wed, 10 Feb 2021 02:36:32 +0100 Subject: Fix lobby state updates in game browser Resolves: https://github.com/joffrey-bion/seven-wonders/issues/97 --- .../kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt | 2 ++ .../org/luxons/sevenwonders/server/controllers/LobbyController.kt | 1 + 2 files changed, 3 insertions(+) diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt index 60307962..bd6e300e 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt @@ -6,6 +6,7 @@ import org.luxons.sevenwonders.model.api.actions.PrepareMoveAction import org.luxons.sevenwonders.model.api.wrap import org.luxons.sevenwonders.model.cards.PreparedCard import org.luxons.sevenwonders.model.hideHandsAndWaitForReadiness +import org.luxons.sevenwonders.server.api.toDTO import org.luxons.sevenwonders.server.lobby.Player import org.luxons.sevenwonders.server.repositories.LobbyRepository import org.luxons.sevenwonders.server.repositories.PlayerRepository @@ -100,6 +101,7 @@ class GameController( if (game.endOfGameReached()) { logger.info("Game {}: end of game, displaying score board", game.id) player.lobby.setEndOfGame() + template.convertAndSend("/topic/games", GameListEvent.CreateOrUpdate(lobby.toDTO()).wrap()) } } else { template.convertAndSendToUser(player.username, "/queue/game/preparedMove", action.move) diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt index f2124009..5c2d4dd6 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt @@ -191,6 +191,7 @@ class LobbyController( val player = lobby.getPlayers()[it.playerIndex] template.convertAndSendToUser(player.username, "/queue/lobby/started", it) } + template.convertAndSend("/topic/games", GameListEvent.CreateOrUpdate(lobby.toDTO()).wrap()) } private fun Lobby.initializePlayersReadyState() { -- cgit