Skip to content

Commit

Permalink
refactor(view): calculate round number on the fly
Browse files Browse the repository at this point in the history
  • Loading branch information
xeruf committed Jun 27, 2024
1 parent 186cabe commit 1d12fb9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/main/kotlin/sc/gui/model/GameModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/sc/gui/view/StatusView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1d12fb9

Please sign in to comment.