From 29108d0adc59fb6467935dd35ebd184843d27faf Mon Sep 17 00:00:00 2001 From: metablaster <44481081+metablaster@users.noreply.github.com> Date: Tue, 15 Jul 2025 10:51:38 +0200 Subject: [PATCH] Display city defense and health in cities overview tab (#13609) * add city defense column in city overview * apply reviewed changes * fix totals row * totals for garisson * WLTK shows count of WLTK's * test and apply reviewed change --- .../overviewscreen/CityOverviewTabColumn.kt | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTabColumn.kt b/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTabColumn.kt index 1672f4f8fd..6e80efa655 100644 --- a/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTabColumn.kt +++ b/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTabColumn.kt @@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.scenes.scene2d.Actor import com.badlogic.gdx.utils.Align import com.unciv.logic.GameInfo +import com.unciv.logic.battle.CityCombatant import com.unciv.logic.city.City import com.unciv.logic.city.CityFlags import com.unciv.models.stats.Stat @@ -46,8 +47,7 @@ enum class CityOverviewTabColumn : ISortableGridContentProvider) = - "{Total} ${items.count()}".toLabel() + override fun getTotalsActor(items: Iterable) = "{Total} ${items.count()}".toLabel() }, Status { @@ -69,7 +69,7 @@ enum class CityOverviewTabColumn : ISortableGridContentProvider) = null + override fun getTotalsActor(items: Iterable) = null // an intended empty space }, ConstructionIcon { @@ -81,7 +81,7 @@ enum class CityOverviewTabColumn : ISortableGridContentProvider) = null + override fun getTotalsActor(items: Iterable) = null // an intended empty space }, Construction { @@ -97,30 +97,25 @@ enum class CityOverviewTabColumn : ISortableGridContentProvider) = null + override fun getTotalsActor(items: Iterable) = null // an intended empty space }, Population { - override fun getEntryValue(item: City) = - item.population.population + override fun getEntryValue(item: City) = item.population.population }, - Food { - override fun getTotalsActor(items: Iterable) = null // an intended empty space - }, + Food, Gold, Science, - Production{ - override fun getTotalsActor(items: Iterable) = null // an intended empty space - }, + Production, Culture, Happiness { override fun getEntryValue(item: City) = - item.cityStats.happinessList.values.sum().roundToInt() + item.cityStats.happinessList.values.sum().roundToInt() }, Faith { override fun isVisible(gameInfo: GameInfo) = - gameInfo.isReligionEnabled() + gameInfo.isReligionEnabled() }, WLTK { @@ -172,7 +167,17 @@ enum class CityOverviewTabColumn : ISortableGridContentProvider() { getEntryValue(it) }.thenBy { it.getMaxHealth() } + override fun getHeaderActor(iconSize: Float) = getCircledIcon("BuildingIcons/Walls", iconSize) + override fun getEntryValue(item: City) = CityCombatant(item).getDefendingStrength() + override fun getEntryActor(item: City, iconSize: Float, actionContext: EmpireOverviewScreen) = + "${getEntryValue(item)}/${item.getMaxHealth()}".toLabel() + override fun getTotalsActor(items: Iterable) = null // an intended empty space + }; //endregion