diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-05-24 12:04:38 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-05-24 12:04:38 +0200 |
commit | 23ba9bbb8bb36aa3e0db8f0063a90d2ce87022b5 (patch) | |
tree | 83d2e1f31b66d2a1a264b28940ba69d5d9a796e7 /sw-ui/src/main | |
parent | Add built wonder stage (cards below wonder) (diff) | |
download | seven-wonders-23ba9bbb8bb36aa3e0db8f0063a90d2ce87022b5.tar.gz seven-wonders-23ba9bbb8bb36aa3e0db8f0063a90d2ce87022b5.tar.bz2 seven-wonders-23ba9bbb8bb36aa3e0db8f0063a90d2ce87022b5.zip |
Add hand rotation irection indicator
Diffstat (limited to 'sw-ui/src/main')
-rw-r--r-- | sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt | 36 | ||||
-rw-r--r-- | sw-ui/src/main/resources/images/hand-cards5.png | bin | 0 -> 5519 bytes |
2 files changed, 35 insertions, 1 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 46d6b4c1..2422e66f 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 @@ -10,6 +10,7 @@ import org.luxons.sevenwonders.model.PlayerMove import org.luxons.sevenwonders.model.PlayerTurnInfo import org.luxons.sevenwonders.model.api.PlayerDTO import org.luxons.sevenwonders.model.cards.HandCard +import org.luxons.sevenwonders.model.cards.HandRotationDirection import org.luxons.sevenwonders.ui.components.GlobalStyles import org.luxons.sevenwonders.ui.redux.* import react.* @@ -59,6 +60,7 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, RSta } actionInfo(turnInfo.message) boardComponent(board = board) + handRotationIndicator(turnInfo.table.handRotationDirection) val hand = turnInfo.hand if (hand != null) { handComponent( @@ -80,7 +82,7 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, RSta } } - private fun RDOMBuilder<DIV>.actionInfo(message: String) { + private fun RBuilder.actionInfo(message: String) { styledDiv { css { classes.add("bp3-dark") @@ -96,6 +98,38 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, RSta } } + private fun RBuilder.handRotationIndicator(direction: HandRotationDirection) { + styledDiv { + css { + position = Position.absolute + display = Display.flex + alignItems = Align.center + bottom = 25.vh + } + val sideDistance = 2.rem + when (direction) { + HandRotationDirection.LEFT -> { + css { left = sideDistance } + bpIcon("arrow-left", size = 25) + handCardsImg() + } + HandRotationDirection.RIGHT -> { + css { right = sideDistance } + handCardsImg() + bpIcon("arrow-right", size = 25) + } + } + } + } + + private fun RBuilder.handCardsImg() { + styledImg(src = "images/hand-cards5.png") { + css { + width = 4.rem + } + } + } + private fun RBuilder.preparedMove(card: HandCard, move: PlayerMove) { bpOverlay(isOpen = true, onClose = props.unprepareMove) { styledDiv { diff --git a/sw-ui/src/main/resources/images/hand-cards5.png b/sw-ui/src/main/resources/images/hand-cards5.png Binary files differnew file mode 100644 index 00000000..1e2199cd --- /dev/null +++ b/sw-ui/src/main/resources/images/hand-cards5.png |