From baed1e50cdd9787521e963681382ceada6ce6e2a Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 22 Jan 2019 21:48:30 +0200 Subject: [PATCH] Returned tile info table in the city screen, construction scroll now translated, added city screen translations to translations file - #417 --- android/assets/jsons/Translations.json | 21 ++++++++++++++++--- .../com/unciv/ui/cityscreen/CityInfoTable.kt | 10 ++++----- .../src/com/unciv/ui/cityscreen/CityScreen.kt | 19 +++++++++-------- .../unciv/ui/cityscreen/ConstructionsTable.kt | 4 ++-- .../desktop/DesktopLauncher.java | 0 5 files changed, 35 insertions(+), 19 deletions(-) rename desktop/src/com/unciv/{game => app}/desktop/DesktopLauncher.java (100%) diff --git a/android/assets/jsons/Translations.json b/android/assets/jsons/Translations.json index b8aa61abf3..a2d9a336b9 100644 --- a/android/assets/jsons/Translations.json +++ b/android/assets/jsons/Translations.json @@ -738,7 +738,19 @@ Spanish:"Nada" Simplified_Chinese:"无" Portuguese:"Nada" - } + } + + "Specialist Buildings":{} + "Specialist Allocation":{} + "Free population":{} // as in "Free population: 2/13 + "[turnsToExpansion] turns to expansion":{} + "Stopped expansion":{} // if culture is 0 + "[turnsToPopulation] turns to new population":{} + "[turnsToStarvation] turns to lose population":{} + "Stopped population growth":{} + "In resistance for another [numberOfTurns] turns":{} + + // todo // Tech picker "Pick a tech":{ @@ -4023,12 +4035,15 @@ Romanian:"Minuni" Spanish:"Maravillas" German:"Wunder" -} + } "Specialist Buildings":{ Romanian:"Clădiri specializate" Spanish:"Edificios Ocupables" German:"Gebäude der Spezialisten" -} + } + "Other":{ // Used for "other constructions" - Gold, Science, Nothing + + } "Population":{ Italian:"Popolazione" Russian:"Население" diff --git a/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt b/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt index 3296379ddd..d58d6ecc06 100644 --- a/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt +++ b/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt @@ -24,13 +24,13 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS val cityInfo = cityScreen.city val wonders = mutableListOf() val specialistBuildings = mutableListOf() - val others = mutableListOf() + val otherBuildings = mutableListOf() for (building in cityInfo.cityConstructions.getBuiltBuildings()) { when { building.isWonder -> wonders.add(building) building.specialistSlots != null -> specialistBuildings.add(building) - else -> others.add(building) + else -> otherBuildings.add(building) } } @@ -62,9 +62,9 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS addSpecialistAllocation(skin, cityInfo) } - if (!others.isEmpty()) { + if (!otherBuildings.isEmpty()) { val buildingsExpanderTab = ExpanderTab("Buildings".tr(),skin) - for (building in others) { + for (building in otherBuildings) { buildingsExpanderTab.innerTable.add(ImageGetter.getConstructionImage(building.name).surroundWithCircle(30f)) buildingsExpanderTab.innerTable.add(Label(building.name.tr(), skin)).pad(5f).row() } @@ -110,7 +110,7 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS } private fun addSpecialistAllocation(skin: Skin, cityInfo: CityInfo) { - val specialistAllocationExpander = ExpanderTab("Specialist allocation", skin) + val specialistAllocationExpander = ExpanderTab("Specialist Allocation".tr(), skin) specialistAllocationExpander.innerTable.defaults().pad(5f) diff --git a/core/src/com/unciv/ui/cityscreen/CityScreen.kt b/core/src/com/unciv/ui/cityscreen/CityScreen.kt index bf019d4efe..32f87f78c1 100644 --- a/core/src/com/unciv/ui/cityscreen/CityScreen.kt +++ b/core/src/com/unciv/ui/cityscreen/CityScreen.kt @@ -31,11 +31,9 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() { init { onBackButtonClicked { UnCivGame.Current.setWorldScreen(); dispose() } addTiles() - stage.addActor(tileTable) - val tableBackgroundColor = ImageGetter.getBlue().lerp(Color.BLACK,0.5f) - tileTable.background = ImageGetter.getBackground(tableBackgroundColor) + var buildingsTableContainer = Table() buildingsTableContainer.pad(3f) @@ -94,7 +92,7 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() { table.defaults().pad(5f) table.background=ImageGetter.getBackground(Color.BLACK.cpy().apply { a=0.8f }) val columns = Stats().toHashMap().size - table.add(Label("Free population:" + table.add(Label("{Free population}:".tr() +city.population.getFreePopulation().toString() + "/" + city.population.population,skin)) .colspan(columns).row() @@ -102,7 +100,7 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() { if (city.cityStats.currentCityStats.culture > 0) { val turnsToExpansion = ceil((city.expansion.getCultureToNextTile() - city.expansion.cultureStored) / city.cityStats.currentCityStats.culture).toInt() - turnsToExpansionString = turnsToExpansion.toString() + " turns to expansion" + turnsToExpansionString = "[$turnsToExpansion] turns to expansion".tr() } else { turnsToExpansionString = "Stopped expansion" } @@ -113,18 +111,18 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() { if (city.cityStats.currentCityStats.food > 0) { val turnsToPopulation = ceil((city.population.getFoodToNextPopulation()-city.population.foodStored) / city.cityStats.currentCityStats.food).toInt() - turnsToPopString = turnsToPopulation.toString()+ " turns to new population" + turnsToPopString = "[$turnsToPopulation] turns to new population".tr() } else if (city.cityStats.currentCityStats.food < 0) { val turnsToStarvation = ceil(city.population.foodStored / -city.cityStats.currentCityStats.food).toInt() - turnsToPopString = turnsToStarvation.toString()+ " turns to lose population" + turnsToPopString = "[$turnsToStarvation] turns to lose population" } else { - turnsToPopString = "Stopped population growth" + turnsToPopString = "Stopped population growth".tr() } table.add(Label(turnsToPopString + " (" + city.population.foodStored + "/" + city.population.getFoodToNextPopulation() + ")" ,skin)).colspan(columns).row() if (city.resistanceCounter > 0) { - table.add(Label("In resistance for another ${city.resistanceCounter} turns",skin)).colspan(columns).row() + table.add(Label("In resistance for another [${city.resistanceCounter}] turns".tr(),skin)).colspan(columns).row() } table.addSeparator() @@ -293,6 +291,7 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() { } private fun updateTileTable() { + tileTable.remove() if (selectedTile == null) return val tile = selectedTile!! tileTable.clearChildren() @@ -325,8 +324,10 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() { tileTable.add(acquireTileButton) } + tileTable.background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK,0.5f)) tileTable=tileTable.addBorder(2f, Color.WHITE) tileTable.setPosition(stage.width - 5f - tileTable.width, 5f) + stage.addActor(tileTable) } companion object { diff --git a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt index d1e68f06b2..cb03a85bac 100644 --- a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt +++ b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt @@ -79,7 +79,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre val units = ArrayList() for (unit in GameBasics.Units.values.filter { it.isBuildable(cityConstructions) }) units += getProductionButton(unit.name, - unit.name + "\r\n" + cityConstructions.turnsToConstruction(unit.name) + " {turns}".tr()) + unit.name.tr() + "\r\n" + cityConstructions.turnsToConstruction(unit.name) + " {turns}".tr()) constructionPickerTable.addCategory("Units",units) @@ -160,7 +160,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre description = currentConstruction.getDescription(true) else if (currentConstruction is Building) description = currentConstruction.getDescription(true, city.civInfo.policies.adoptedPolicies) - else description = currentConstruction.description + else description = currentConstruction.description.tr() val descriptionLabel = Label(description, CameraStageBaseScreen.skin) descriptionLabel.setWrap(true) diff --git a/desktop/src/com/unciv/game/desktop/DesktopLauncher.java b/desktop/src/com/unciv/app/desktop/DesktopLauncher.java similarity index 100% rename from desktop/src/com/unciv/game/desktop/DesktopLauncher.java rename to desktop/src/com/unciv/app/desktop/DesktopLauncher.java