From 1d12fb9f18ee1edf8cd208facaf08322aa4a60ab Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Thu, 27 Jun 2024 13:06:20 +0300 Subject: [PATCH] refactor(view): calculate round number on the fly --- backend | 2 +- src/main/kotlin/sc/gui/model/GameModel.kt | 1 - src/main/kotlin/sc/gui/view/StatusView.kt | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/backend b/backend index 8f18737..3e8b3ba 160000 --- a/backend +++ b/backend @@ -1 +1 @@ -Subproject commit 8f1873732a53514c83225f42248c9c28cbbeab17 +Subproject commit 3e8b3ba1170483a385d5047e28b67bdad383dd0d diff --git a/src/main/kotlin/sc/gui/model/GameModel.kt b/src/main/kotlin/sc/gui/model/GameModel.kt index 8ca5e37..5a9f5bc 100644 --- a/src/main/kotlin/sc/gui/model/GameModel.kt +++ b/src/main/kotlin/sc/gui/model/GameModel.kt @@ -25,7 +25,6 @@ class GameModel: ViewModel() { val stepSpeed = objectProperty(5.0) val currentTurn = integerBinding(gameState) { value?.turn ?: 0 } - val currentRound = integerBinding(gameState) { value?.round ?: 0 } val currentTeam = nonNullObjectBinding(gameState) { value?.currentTeam ?: Team.ONE } val isHumanTurn = booleanProperty(false) diff --git a/src/main/kotlin/sc/gui/view/StatusView.kt b/src/main/kotlin/sc/gui/view/StatusView.kt index f79f8fd..403c0c2 100644 --- a/src/main/kotlin/sc/gui/view/StatusView.kt +++ b/src/main/kotlin/sc/gui/view/StatusView.kt @@ -40,7 +40,7 @@ class ScoreBinding(private val game: GameModel): StringBinding() { override fun computeValue(): String = if(game.gameStarted.value) - "Runde ${game.currentRound.get()} - " + + "Runde ${(game.currentTurn.get() + 1) / 2} - " + (game.gameState.value?.let { "${it.teamStats(it.startTeam).firstOrNull()?.value} : ${ it.teamStats(it.startTeam.opponent()).firstOrNull()?.value