fix untranslated string about politics (#7901)

* fix untranslated string about politics

* update shortcut about textbutton

* check all usage of template "[numberOfTurns] Truns Left"

* revert textbotton and add click event by chain.
This commit is contained in:
nacro711072
2022-10-07 17:36:00 +08:00
committed by GitHub
parent c4bac19bb2
commit ad72c42911
2 changed files with 11 additions and 10 deletions

View File

@ -1219,6 +1219,7 @@ Number of your cities celebrating\n'We Love The King Day' thanks\nto access to t
WLTK demand =
WLTK- =
Number of your cities\ndemanding this resource for\n'We Love The King Day' =
Politics =
Show global politics =
Show diagram =
At war with [enemy] =

View File

@ -19,6 +19,7 @@ import com.unciv.ui.images.ImageGetter
import com.unciv.ui.trade.DiplomacyScreen
import com.unciv.ui.utils.AutoScrollPane
import com.unciv.ui.utils.BaseScreen
import com.unciv.ui.utils.Fonts
import com.unciv.ui.utils.UncivTooltip.Companion.addTooltip
import com.unciv.ui.utils.extensions.addBorder
import com.unciv.ui.utils.extensions.addSeparator
@ -66,8 +67,7 @@ class GlobalPoliticsOverviewTable (
clear()
getFixedContent().clear()
val diagramButton = TextButton("Show diagram", skin)
diagramButton.onClick { updateDiagram() }
val diagramButton = "Show diagram".toTextButton().onClick(::updateDiagram)
add()
addSeparatorVertical(Color.GRAY)
@ -132,7 +132,7 @@ class GlobalPoliticsOverviewTable (
val policiesTable = Table(skin)
for (policy in civ.policies.branchCompletionMap) {
if (policy.value != 0)
policiesTable.add("${policy.key.name}: ${policy.value}".toLabel()).row()
policiesTable.add("[${policy.key.name}]: ${policy.value}".toLabel()).row()
}
return policiesTable
}
@ -164,7 +164,7 @@ class GlobalPoliticsOverviewTable (
// wars
for (otherCiv in civ.getKnownCivs()) {
if(civ.diplomacy[otherCiv.civName]?.hasFlag(DiplomacyFlags.DeclaredWar) == true) {
val warText = "At war with ${otherCiv.civName}".toLabel()
val warText = "At war with [${otherCiv.civName}]".toLabel()
warText.color = Color.RED
politicsTable.add(warText).row()
}
@ -174,9 +174,9 @@ class GlobalPoliticsOverviewTable (
// declaration of friendships
for (otherCiv in civ.getKnownCivs()) {
if(civ.diplomacy[otherCiv.civName]?.hasFlag(DiplomacyFlags.DeclarationOfFriendship) == true) {
val friendtext = "Friends with ${otherCiv.civName} ".toLabel()
val friendtext = "Friends with [${otherCiv.civName}]".toLabel()
friendtext.color = Color.GREEN
val turnsLeftText = "({${civ.diplomacy[otherCiv.civName]?.getFlag(DiplomacyFlags.DeclarationOfFriendship)} Turns Left})".toLabel()
val turnsLeftText = " (${civ.diplomacy[otherCiv.civName]?.getFlag(DiplomacyFlags.DeclarationOfFriendship)} ${Fonts.turn})".toLabel()
politicsTable.add(friendtext)
politicsTable.add(turnsLeftText).row()
}
@ -186,9 +186,9 @@ class GlobalPoliticsOverviewTable (
// denounced civs
for (otherCiv in civ.getKnownCivs()) {
if(civ.diplomacy[otherCiv.civName]?.hasFlag(DiplomacyFlags.Denunciation) == true) {
val denouncedText = "Denounced ${otherCiv.civName} ".toLabel()
val denouncedText = "Denounced [${otherCiv.civName}]".toLabel()
denouncedText.color = Color.RED
val turnsLeftText = "({${civ.diplomacy[otherCiv.civName]?.getFlag(DiplomacyFlags.Denunciation)} Turns Left})".toLabel()
val turnsLeftText = "(${civ.diplomacy[otherCiv.civName]?.getFlag(DiplomacyFlags.Denunciation)} ${Fonts.turn})".toLabel()
politicsTable.add(denouncedText)
politicsTable.add(turnsLeftText).row()
}
@ -198,7 +198,7 @@ class GlobalPoliticsOverviewTable (
//allied CS
for (cityState in gameInfo.getAliveCityStates()) {
if (cityState.diplomacy[civ.civName]?.relationshipLevel() == RelationshipLevel.Ally) {
val alliedText = "Allied with ${cityState.civName}".toLabel()
val alliedText = "Allied with [${cityState.civName}]".toLabel()
alliedText.color = Color.GREEN
politicsTable.add(alliedText).row()
}
@ -211,7 +211,7 @@ class GlobalPoliticsOverviewTable (
// Refresh content and determine landscape/portrait layout
private fun updateDiagram() {
val politicsButton = TextButton("Show global politics", skin).apply { onClick { updatePoliticsTable() } }
val politicsButton = "Show global politics".toTextButton().onClick(::updatePoliticsTable)
val toggleCityStatesButton: TextButton = Constants.cityStates.toTextButton().apply {
onClick {