diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-05-26 02:39:20 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-05-26 02:40:44 +0200 |
commit | d26ecccf690d33c3cf71412395a257ebb40d29e7 (patch) | |
tree | 70349cd50bd5812e0895af11c536fb096472e2da /sw-common-model/src | |
parent | Fix player positions in lobby (diff) | |
download | seven-wonders-d26ecccf690d33c3cf71412395a257ebb40d29e7.tar.gz seven-wonders-d26ecccf690d33c3cf71412395a257ebb40d29e7.tar.bz2 seven-wonders-d26ecccf690d33c3cf71412395a257ebb40d29e7.zip |
Add other players' board summary
Resolves:
https://github.com/joffrey-bion/seven-wonders/issues/21
Diffstat (limited to 'sw-common-model/src')
3 files changed, 23 insertions, 9 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt index 0d02c5fd..8b339788 100644 --- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt +++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt @@ -1,6 +1,8 @@ package org.luxons.sevenwonders.model import kotlinx.serialization.Serializable +import org.luxons.sevenwonders.model.boards.Board +import org.luxons.sevenwonders.model.boards.RelativeBoardPosition import org.luxons.sevenwonders.model.cards.HandCard import org.luxons.sevenwonders.model.cards.TableCard import org.luxons.sevenwonders.model.resources.ResourceTransactions @@ -33,6 +35,11 @@ data class PlayerTurnInfo( val wonderBuildability: WonderBuildability = table.boards[playerIndex].wonder.buildability } +fun PlayerTurnInfo.getOwnBoard(): Board = table.boards[playerIndex] + +fun PlayerTurnInfo.getBoard(position: RelativeBoardPosition): Board = + table.boards[position.getIndexFrom(playerIndex, table.boards.size)] + // TODO move to server code fun Collection<PlayerTurnInfo>.hideHandsAndWaitForReadiness() = map { it.copy(action = Action.SAY_READY, hand = null) } diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Api.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Api.kt index 7a337f9a..d22a350a 100644 --- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Api.kt +++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Api.kt @@ -44,19 +44,25 @@ data class Actionability( val tooltip: String ) +interface BasicPlayerInfo { + val username: String + val displayName: String + val icon: Icon? +} + @Serializable data class ConnectedPlayer( - val username: String, - val displayName: String, - val icon: Icon? -) + override val username: String, + override val displayName: String, + override val icon: Icon? +) : BasicPlayerInfo @Serializable data class PlayerDTO( - val username: String, - val displayName: String, - val icon: Icon?, + override val username: String, + override val displayName: String, + override val icon: Icon?, val index: Int, val isGameOwner: Boolean, val isReady: Boolean -) +) : BasicPlayerInfo diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt index cdf5b65c..2fdb40b6 100644 --- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt +++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt @@ -15,7 +15,8 @@ data class Board( val science: Science, val military: Military, val playedCards: List<List<TableCard>>, - val gold: Int + val gold: Int, + val bluePoints: Int ) @Serializable |