Hide irrelevant items from CityInfoTable stats (#6254)

This commit is contained in:
SomeTroglodyte
2022-03-05 19:02:54 +01:00
committed by GitHub
parent 115a7f84bf
commit c503f840d1

View File

@ -159,7 +159,9 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(BaseScreen.skin)
private fun Table.addStatInfo() { private fun Table.addStatInfo() {
val cityStats = cityScreen.city.cityStats val cityStats = cityScreen.city.cityStats
val showFaith = cityScreen.city.civInfo.gameInfo.isReligionEnabled()
for (stat in Stat.values()) { for (stat in Stat.values()) {
if (stat == Stat.Faith && !showFaith) continue
val statValuesTable = Table() val statValuesTable = Table()
statValuesTable.touchable = Touchable.enabled statValuesTable.touchable = Touchable.enabled
addCategory(stat.name, statValuesTable) addCategory(stat.name, statValuesTable)
@ -241,12 +243,15 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(BaseScreen.skin)
} }
statValuesTable.pack() statValuesTable.pack()
val toggleButtonChar = if (showDetails) "-" else "+"
val toggleButton = toggleButtonChar.toLabel().apply { setAlignment(Align.center) } if (stat != Stat.Happiness) {
.surroundWithCircle(25f, color = ImageGetter.getBlue()) val toggleButtonChar = if (showDetails) "-" else "+"
.surroundWithCircle(27f, false) val toggleButton = toggleButtonChar.toLabel().apply { setAlignment(Align.center) }
statValuesTable.addActor(toggleButton) .surroundWithCircle(25f, color = ImageGetter.getBlue())
toggleButton.setPosition(0f, statValuesTable.height, Align.topLeft) .surroundWithCircle(27f, false)
statValuesTable.addActor(toggleButton)
toggleButton.setPosition(0f, statValuesTable.height, Align.topLeft)
}
statValuesTable.padBottom(4f) statValuesTable.padBottom(4f)
} }