Resolved #311 - translate victory screen

This commit is contained in:
Yair Morgenstern
2019-01-06 22:48:24 +02:00
parent 567786c125
commit 84007533fc
2 changed files with 28 additions and 15 deletions

View File

@ -6444,4 +6444,19 @@
Russian:"+15% К производству военных юнитов, Военные юниты начинают с 15 опыта" Russian:"+15% К производству военных юнитов, Военные юниты начинают с 15 опыта"
} }
// Victory Screen
"Science victory":{}
"Cultural victory":{}
"Conquest victory":{}
"Complete all the spaceship parts\n to win!":{}
"Complete 4 policy branches\n to win!":{}
"Destroy all enemies\n to win!":{}
"You have won a scientific victory!":{}
"You have won a cultural victory!":{}
"You have won a conquest victory!":{}
"One more turn...!":{}
"Built Apollo Program":{}
"Destroy [civName]":{}
} }

View File

@ -12,24 +12,22 @@ import com.unciv.ui.utils.onClick
class VictoryScreen : PickerScreen() { class VictoryScreen : PickerScreen() {
// todo translate this screen
val playerCivInfo = UnCivGame.Current.gameInfo.getPlayerCivilization() val playerCivInfo = UnCivGame.Current.gameInfo.getPlayerCivilization()
init { init {
topTable.skin=skin topTable.skin=skin
topTable.defaults().pad(10f) topTable.defaults().pad(10f)
topTable.add("Science victory") topTable.add("Science victory".tr())
topTable.add("Cultural victory") topTable.add("Cultural victory".tr())
topTable.add("Conquest victory") topTable.add("Conquest victory".tr())
topTable.row() topTable.row()
topTable.add(scienceVictoryColumn()) topTable.add(scienceVictoryColumn())
topTable.add(culturalVictoryColumn()) topTable.add(culturalVictoryColumn())
topTable.add(conquestVictoryColumn()) topTable.add(conquestVictoryColumn())
topTable.row() topTable.row()
topTable.add("Complete all the spaceship parts\n to win!") topTable.add("Complete all the spaceship parts\n to win!".tr())
topTable.add("Complete 4 policy branches\n to win!") topTable.add("Complete 4 policy branches\n to win!".tr())
topTable.add("Destroy all enemies\n to win!") topTable.add("Destroy all enemies\n to win!".tr())
rightSideButton.isVisible=false rightSideButton.isVisible=false
@ -47,14 +45,14 @@ class VictoryScreen : PickerScreen() {
} }
fun won(description: String) { fun won(description: String) {
descriptionLabel.setText(description) descriptionLabel.setText(description.tr())
rightSideButton.setText("Start new game".tr()) rightSideButton.setText("Start new game".tr())
rightSideButton.isVisible = true rightSideButton.isVisible = true
rightSideButton.enable() rightSideButton.enable()
rightSideButton.onClick { UnCivGame.Current.startNewGame() } rightSideButton.onClick { UnCivGame.Current.startNewGame() }
closeButton.setText("One more turn...!") closeButton.setText("One more turn...!".tr())
closeButton.onClick { closeButton.onClick {
playerCivInfo.gameInfo.oneMoreTurnMode = true playerCivInfo.gameInfo.oneMoreTurnMode = true
UnCivGame.Current.setWorldScreen() UnCivGame.Current.setWorldScreen()
@ -64,7 +62,7 @@ class VictoryScreen : PickerScreen() {
fun scienceVictoryColumn():Table{ fun scienceVictoryColumn():Table{
val t = Table() val t = Table()
t.defaults().pad(5f) t.defaults().pad(5f)
t.add(getMilestone("Built Apollo Program",playerCivInfo.getBuildingUniques().contains("Enables construction of Spaceship parts"))).row() t.add(getMilestone("Built Apollo Program".tr(),playerCivInfo.getBuildingUniques().contains("Enables construction of Spaceship parts"))).row()
val victoryManager= playerCivInfo.victoryManager val victoryManager= playerCivInfo.victoryManager
@ -86,16 +84,16 @@ class VictoryScreen : PickerScreen() {
} }
fun conquestVictoryColumn():Table{ fun conquestVictoryColumn():Table{
val t=Table() val table=Table()
t.defaults().pad(5f) table.defaults().pad(5f)
for (civ in playerCivInfo.gameInfo.civilizations) { for (civ in playerCivInfo.gameInfo.civilizations) {
if (civ.isPlayerCivilization() || civ.isBarbarianCivilization()) continue if (civ.isPlayerCivilization() || civ.isBarbarianCivilization()) continue
val civName = val civName =
if (playerCivInfo.diplomacy.containsKey(civ.civName)) civ.civName if (playerCivInfo.diplomacy.containsKey(civ.civName)) civ.civName
else "???" else "???"
t.add(getMilestone("Destroy $civName", civ.isDefeated())).row() table.add(getMilestone("Destroy [$civName]".tr(), civ.isDefeated())).row()
} }
return t return table
} }
fun getMilestone(text:String, achieved:Boolean): TextButton { fun getMilestone(text:String, achieved:Boolean): TextButton {