From 0f5f3366ed4c829c33841fa9e4fd4ef3b5a34af0 Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Thu, 19 Aug 2021 08:51:26 +0200 Subject: [PATCH] Small changes to city screen (#4902) --- core/src/com/unciv/models/ruleset/Building.kt | 13 +++++++++---- core/src/com/unciv/ui/cityscreen/CityInfoTable.kt | 3 ++- core/src/com/unciv/ui/cityscreen/CityStatsTable.kt | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/core/src/com/unciv/models/ruleset/Building.kt b/core/src/com/unciv/models/ruleset/Building.kt index 1ab4fbf0f7..29fd21494e 100644 --- a/core/src/com/unciv/models/ruleset/Building.kt +++ b/core/src/com/unciv/models/ruleset/Building.kt @@ -75,10 +75,10 @@ class Building : NamedStats(), INonPerpetualConstruction, ICivilopediaText { override var civilopediaText = listOf() + /** Used for AlertType.WonderBuilt, and as sub-text in Nation and Tech descriptions */ fun getShortDescription(ruleset: Ruleset): String { // should fit in one line val infoList = mutableListOf() - val str = getStats(null).toString() - if (str.isNotEmpty()) infoList += str + getStats(null).toString().also { if (it.isNotEmpty()) infoList += it } for (stat in getStatPercentageBonuses(null).toHashMap()) if (stat.value != 0f) infoList += "+${stat.value.toInt()}% ${stat.key.name.tr()}" @@ -114,13 +114,18 @@ class Building : NamedStats(), INonPerpetualConstruction, ICivilopediaText { )) } private fun getUniquesStringsWithoutDisablers() = getUniquesStrings() - .filterNot { it.startsWith("Hidden ") && it.endsWith(" disabled") || it == "Unbuildable" } + .filterNot { + it.startsWith("Hidden ") && it.endsWith(" disabled") || + it == "Unbuildable" || + it == "Will not be displayed in Civilopedia" + } /** used in CityScreen (CityInfoTable and ConstructionInfoTable) */ fun getDescription(cityInfo: CityInfo?, ruleset: Ruleset): String { val stats = getStats(cityInfo) val lines = ArrayList() - if (uniqueTo != null) lines += "Unique to [$uniqueTo], replaces [$replaces]" + if (uniqueTo != null) lines += if (replaces == null) "Unique to [$uniqueTo]" + else "Unique to [$uniqueTo], replaces [$replaces]" if (isWonder) lines += "Wonder" if (isNationalWonder) lines += "National Wonder" for ((resource, amount) in getResourceRequirements()) { diff --git a/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt b/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt index 9045c416cc..05cab808b0 100644 --- a/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt +++ b/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt @@ -5,6 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.utils.Align import com.unciv.UncivGame import com.unciv.logic.city.CityInfo +import com.unciv.models.UncivSound import com.unciv.models.ruleset.Building import com.unciv.models.stats.Stat import com.unciv.models.translations.tr @@ -71,7 +72,7 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS val sellBuildingButton = "Sell for [$sellAmount] gold".toTextButton() it.add(sellBuildingButton).pad(5f).row() - sellBuildingButton.onClick { + sellBuildingButton.onClick(UncivSound.Coin) { sellBuildingButton.disable() cityScreen.closeAllPopups() diff --git a/core/src/com/unciv/ui/cityscreen/CityStatsTable.kt b/core/src/com/unciv/ui/cityscreen/CityStatsTable.kt index 00d9c3315f..59330b8125 100644 --- a/core/src/com/unciv/ui/cityscreen/CityStatsTable.kt +++ b/core/src/com/unciv/ui/cityscreen/CityStatsTable.kt @@ -90,6 +90,6 @@ class CityStatsTable(val cityScreen: CityScreen): Table() { innerTable.addSeparator() val label = cityInfo.religion.getMajorityReligion() ?: "None" - innerTable.add("Majority Religion: [$label]".toLabel()) + innerTable.add("Majority Religion: [$label]".toLabel()).padTop(5f) } } \ No newline at end of file