diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-30 11:30:32 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-30 11:35:10 +0200 |
commit | 0ca4028cdb58cc7649da04c0c2b16479ecd83d79 (patch) | |
tree | f027e587b2c4d8d30acdb4e6205d0319fe5df9b4 /sw-server/src/main/kotlin | |
parent | Rename GameState -> TableState (diff) | |
download | seven-wonders-0ca4028cdb58cc7649da04c0c2b16479ecd83d79.tar.gz seven-wonders-0ca4028cdb58cc7649da04c0c2b16479ecd83d79.tar.bz2 seven-wonders-0ca4028cdb58cc7649da04c0c2b16479ecd83d79.zip |
Send turn info without hands when entering game
Diffstat (limited to 'sw-server/src/main/kotlin')
-rw-r--r-- | sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt | 4 | ||||
-rw-r--r-- | sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt | 6 |
2 files changed, 6 insertions, 4 deletions
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 803cca78..733259b9 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.Action import org.luxons.sevenwonders.model.PlayerTurnInfo import org.luxons.sevenwonders.model.api.actions.PrepareMoveAction 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.PlayerRepository @@ -92,9 +93,6 @@ class GameController @Autowired constructor( } } - private fun Collection<PlayerTurnInfo>.hideHandsAndWaitForReadiness() = - map { it.copy(action = Action.SAY_READY, hand = null) } - companion object { private val logger = LoggerFactory.getLogger(GameController::class.java) } 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 04fb2228..ee1c6271 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 @@ -3,6 +3,7 @@ package org.luxons.sevenwonders.server.controllers import org.hildan.livedoc.core.annotations.Api import org.luxons.sevenwonders.model.api.actions.ReorderPlayersAction import org.luxons.sevenwonders.model.api.actions.UpdateSettingsAction +import org.luxons.sevenwonders.model.hideHandsAndWaitForReadiness import org.luxons.sevenwonders.server.api.toDTO import org.luxons.sevenwonders.server.lobby.Lobby import org.luxons.sevenwonders.server.lobby.Player @@ -101,7 +102,10 @@ class LobbyController @Autowired constructor( val game = lobby.startGame() logger.info("Game {} successfully started", game.id) - template.convertAndSend("/topic/lobby/" + lobby.id + "/started", Unit) + game.getCurrentTurnInfo().hideHandsAndWaitForReadiness().forEach { + val player = lobby.getPlayers()[it.playerIndex] + template.convertAndSendToUser(player.username, "/queue/lobby/" + lobby.id + "/started", it) + } } companion object { |