mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-18 03:38:55 +07:00
Add descriptor (you, friend name, or unknown) to current turn for mp games
This commit is contained in:
@ -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