mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-23 14:19:15 +07:00
Add descriptor (you, friend name, or unknown) to current turn for mp games
This commit is contained in:
@ -1469,6 +1469,8 @@ Somewhere around [city] =
|
|||||||
Far away =
|
Far away =
|
||||||
Status =
|
Status =
|
||||||
Current turn =
|
Current turn =
|
||||||
|
You =
|
||||||
|
Unknown =
|
||||||
Turn [turnNumber] =
|
Turn [turnNumber] =
|
||||||
Location =
|
Location =
|
||||||
Unimproved =
|
Unimproved =
|
||||||
|
@ -47,7 +47,17 @@ object MultiplayerHelpers {
|
|||||||
val preview = multiplayerGame.preview
|
val preview = multiplayerGame.preview
|
||||||
if (preview?.currentPlayer != null) {
|
if (preview?.currentPlayer != null) {
|
||||||
val currentTurnStartTime = Instant.ofEpochMilli(preview.currentTurnStartTime)
|
val currentTurnStartTime = Instant.ofEpochMilli(preview.currentTurnStartTime)
|
||||||
descriptionText.appendLine("Current Turn: [${preview.currentPlayer}] since [${Duration.between(currentTurnStartTime, Instant.now()).formatShort()}] ago".tr())
|
val currentPlayer = preview.getCurrentPlayerCiv()
|
||||||
|
val playerDescriptor = if (currentPlayer.playerId == UncivGame.Current.settings.multiplayer.userId) {
|
||||||
|
"You"
|
||||||
|
} else {
|
||||||
|
val friend = UncivGame.Current.settings.multiplayer.friendList
|
||||||
|
.firstOrNull{ it.playerID == currentPlayer.playerId }
|
||||||
|
friend?.name ?: "Unknown"
|
||||||
|
}
|
||||||
|
val playerText = "{${preview.currentPlayer}}{ }({$playerDescriptor})"
|
||||||
|
|
||||||
|
descriptionText.appendLine("Current Turn: [$playerText] since [${Duration.between(currentTurnStartTime, Instant.now()).formatShort()}] ago".tr())
|
||||||
}
|
}
|
||||||
return descriptionText
|
return descriptionText
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user