mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
City screen stats double separators (#4821)
This commit is contained in:
parent
e59db3ada3
commit
3c4bb1a558
@ -989,6 +989,7 @@ Found Religion =
|
|||||||
Found Pantheon =
|
Found Pantheon =
|
||||||
Follow [belief] =
|
Follow [belief] =
|
||||||
Religions and Beliefs =
|
Religions and Beliefs =
|
||||||
|
Majority Religion: [name] =
|
||||||
|
|
||||||
# Religion overview screen
|
# Religion overview screen
|
||||||
Religion Name: =
|
Religion Name: =
|
||||||
|
@ -2,6 +2,7 @@ package com.unciv.ui.cityscreen
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
|
import com.unciv.logic.civilization.ReligionState
|
||||||
import com.unciv.models.stats.Stat
|
import com.unciv.models.stats.Stat
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.utils.ImageGetter
|
import com.unciv.ui.utils.ImageGetter
|
||||||
@ -29,24 +30,24 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
|
|||||||
fun update() {
|
fun update() {
|
||||||
innerTable.clear()
|
innerTable.clear()
|
||||||
|
|
||||||
val ministatsTable = Table()
|
val miniStatsTable = Table()
|
||||||
for ((stat, amount) in cityInfo.cityStats.currentCityStats.toHashMap()) {
|
for ((stat, amount) in cityInfo.cityStats.currentCityStats.toHashMap()) {
|
||||||
if (stat == Stat.Faith && !cityInfo.civInfo.gameInfo.hasReligionEnabled()) continue
|
if (stat == Stat.Faith && !cityInfo.civInfo.gameInfo.hasReligionEnabled()) continue
|
||||||
ministatsTable.add(ImageGetter.getStatIcon(stat.name)).size(20f).padRight(5f)
|
miniStatsTable.add(ImageGetter.getStatIcon(stat.name)).size(20f).padRight(5f)
|
||||||
val valueToDisplay = if (stat == Stat.Happiness) cityInfo.cityStats.happinessList.values.sum() else amount
|
val valueToDisplay = if (stat == Stat.Happiness) cityInfo.cityStats.happinessList.values.sum() else amount
|
||||||
ministatsTable.add(round(valueToDisplay).toInt().toString().toLabel()).padRight(10f)
|
miniStatsTable.add(round(valueToDisplay).toInt().toLabel()).padRight(10f)
|
||||||
}
|
}
|
||||||
innerTable.add(ministatsTable)
|
innerTable.add(miniStatsTable)
|
||||||
|
|
||||||
innerTable.addSeparator()
|
innerTable.addSeparator()
|
||||||
addText()
|
addText()
|
||||||
|
if (!cityInfo.population.getMaxSpecialists().isEmpty()) {
|
||||||
innerTable.addSeparator()
|
innerTable.addSeparator()
|
||||||
innerTable.add(SpecialistAllocationTable(cityScreen).apply { update() })
|
innerTable.add(SpecialistAllocationTable(cityScreen).apply { update() })
|
||||||
if (cityInfo.civInfo.gameInfo.hasReligionEnabled()) {
|
|
||||||
innerTable.addSeparator()
|
|
||||||
addReligionInfo()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addReligionInfo()
|
||||||
|
|
||||||
pack()
|
pack()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,8 +86,10 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
|
|||||||
|
|
||||||
private fun addReligionInfo() {
|
private fun addReligionInfo() {
|
||||||
// This will later become large enough to be its own class, but for now it is small enough to fit inside a single function
|
// This will later become large enough to be its own class, but for now it is small enough to fit inside a single function
|
||||||
val majorityReligion = cityInfo.religion.getMajorityReligion()
|
if(cityInfo.civInfo.religionManager.religionState == ReligionState.None) return
|
||||||
val label = majorityReligion ?: "None"
|
innerTable.addSeparator()
|
||||||
innerTable.add("Majority Religion: $label".toLabel())
|
val label = cityInfo.religion.getMajorityReligion()
|
||||||
|
?: "None"
|
||||||
|
innerTable.add("Majority Religion: [$label]".toLabel())
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user