mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 21:30:20 +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 =
|
||||
Status =
|
||||
Current turn =
|
||||
You =
|
||||
Unknown =
|
||||
Turn [turnNumber] =
|
||||
Location =
|
||||
Unimproved =
|
||||
|
@ -47,7 +47,17 @@ object MultiplayerHelpers {
|
||||
val preview = multiplayerGame.preview
|
||||
if (preview?.currentPlayer != null) {
|
||||
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user