diff options
Diffstat (limited to 'sw-ui/src/main')
3 files changed, 26 insertions, 0 deletions
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt index 2dd6135a..9c1c852a 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt @@ -57,6 +57,9 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, RSta styledDiv { css { height = 100.pct + if (turnInfo.everyoneIsWaitingForMe()) { + +GameStyles.pulsatingRed + } } turnInfo.scoreBoard?.let { scoreTableOverlay(it, props.players, props.leaveGame) @@ -90,6 +93,15 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, RSta } } + private fun PlayerTurnInfo.everyoneIsWaitingForMe(): Boolean { + val onlyMeInTheGame = props.players.count { it.isHuman } == 1 + if (onlyMeInTheGame || preparedMove != null) { + return false + } + val gameState = props.gameState ?: return false + return gameState.preparedCardsByUsername.values.count { it != null } == props.players.size - 1 + } + private fun playerNeighbours(): Pair<PlayerDTO, PlayerDTO> { val me = props.currentPlayer?.username ?: error("we shouldn't be trying to display this if there is no player") val players = props.players diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameStyles.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameStyles.kt index 443396d1..92445764 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameStyles.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameStyles.kt @@ -3,6 +3,7 @@ package org.luxons.sevenwonders.ui.components.game import kotlinx.css.* import kotlinx.css.properties.* import styled.StyleSheet +import styled.animation object GameStyles : StyleSheet("GameStyles", isStatic = true) { @@ -84,4 +85,16 @@ object GameStyles : StyleSheet("GameStyles", isStatic = true) { private fun scoreTagColorCss(color: Color) = css { backgroundColor = color } + + val pulsatingRed by css { + animation( + duration = 2.s, + iterationCount = IterationCount.infinite, + direction = AnimationDirection.alternate, + ) { + to { + boxShadowInset(color = Color.red, blurRadius = 20.px, spreadRadius = 8.px) + } + } + } } diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt index 61d7a60c..91dbf61f 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt @@ -95,6 +95,7 @@ private fun gameStateReducer(gameState: GameState?, action: RAction): GameState? is TurnInfoEvent -> gameState?.copy( players = gameState.players.map { p -> p.copy(isReady = false) }, turnInfo = action.turnInfo, + preparedCardsByUsername = emptyMap(), currentPreparedMove = null, ) is StartTransactionSelection -> gameState?.copy(transactionSelector = action.transactionSelector) |