mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-18 11:49:19 +07:00
City button now looks normal when being razed or in resistance - before the health bar positioning ade the entire button totally out of whack
This commit is contained in:
@ -95,39 +95,38 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski
|
|||||||
|
|
||||||
if (isCityViewable && city.health < city.getMaxHealth().toFloat()) {
|
if (isCityViewable && city.health < city.getMaxHealth().toFloat()) {
|
||||||
val healthBar = ImageGetter.getHealthBar(city.health.toFloat(), city.getMaxHealth().toFloat(), 100f)
|
val healthBar = ImageGetter.getHealthBar(city.health.toFloat(), city.getMaxHealth().toFloat(), 100f)
|
||||||
add(healthBar).colspan(3).row()
|
add(healthBar).row()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val iconTable = Table()
|
||||||
if(city.resistanceCounter > 0){
|
if(city.resistanceCounter > 0){
|
||||||
val resistanceImage = ImageGetter.getImage("StatIcons/Resistance.png")
|
val resistanceImage = ImageGetter.getImage("StatIcons/Resistance.png")
|
||||||
add(resistanceImage).size(20f).pad(2f).padLeft(5f)
|
iconTable.add(resistanceImage).size(20f).pad(2f).padLeft(5f)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (city.isBeingRazed) {
|
if (city.isBeingRazed) {
|
||||||
val fireImage = ImageGetter.getImage("OtherIcons/Fire.png")
|
val fireImage = ImageGetter.getImage("OtherIcons/Fire.png")
|
||||||
add(fireImage).size(20f).pad(2f).padLeft(5f)
|
iconTable.add(fireImage).size(20f).pad(2f).padLeft(5f)
|
||||||
}
|
}
|
||||||
if (city.isCapital()) {
|
if (city.isCapital()) {
|
||||||
if (city.civInfo.isCityState()) {
|
if (city.civInfo.isCityState()) {
|
||||||
val cityStateImage = ImageGetter.getImage("OtherIcons/CityState.png").apply { color = Color.LIGHT_GRAY }
|
val cityStateImage = ImageGetter.getImage("OtherIcons/CityState.png").apply { color = Color.LIGHT_GRAY }
|
||||||
add(cityStateImage).size(20f).pad(2f).padLeft(10f)
|
iconTable.add(cityStateImage).size(20f).pad(2f).padLeft(10f)
|
||||||
} else {
|
} else {
|
||||||
val starImage = ImageGetter.getImage("OtherIcons/Star.png").apply { color = Color.LIGHT_GRAY }
|
val starImage = ImageGetter.getImage("OtherIcons/Star.png").apply { color = Color.LIGHT_GRAY }
|
||||||
add(starImage).size(20f).pad(2f).padLeft(10f)
|
iconTable.add(starImage).size(20f).pad(2f).padLeft(10f)
|
||||||
}
|
}
|
||||||
} else if (city.civInfo.isCurrentPlayer() && city.cityStats.isConnectedToCapital(RoadStatus.Road)) {
|
} else if (city.civInfo.isCurrentPlayer() && city.cityStats.isConnectedToCapital(RoadStatus.Road)) {
|
||||||
val connectionImage = ImageGetter.getStatIcon("CityConnection")
|
val connectionImage = ImageGetter.getStatIcon("CityConnection")
|
||||||
add(connectionImage).size(20f).pad(2f).padLeft(10f)
|
iconTable.add(connectionImage).size(20f).pad(2f).padLeft(10f)
|
||||||
} else {
|
}
|
||||||
add()
|
|
||||||
} // this is so the health bar is always 2 columns wide
|
iconTable.add(label).pad(10f) // sufficient horizontal padding
|
||||||
add("".toLabel()).padTop(10f).padBottom(10f) // sufficient vertical padding
|
|
||||||
add(label)
|
|
||||||
.padLeft(10f).padRight(10f) // sufficient horizontal padding
|
|
||||||
.fillY() // provide full-height clicking area
|
.fillY() // provide full-height clicking area
|
||||||
if (UnCivGame.Current.viewEntireMapForDebug || city.civInfo.isCurrentPlayer()) {
|
if (UnCivGame.Current.viewEntireMapForDebug || city.civInfo.isCurrentPlayer()) {
|
||||||
add(getConstructionGroup(city.cityConstructions)).padRight(10f)
|
iconTable.add(getConstructionGroup(city.cityConstructions)).padRight(10f)
|
||||||
}
|
}
|
||||||
|
add(iconTable).row()
|
||||||
pack()
|
pack()
|
||||||
setOrigin(Align.center)
|
setOrigin(Align.center)
|
||||||
center(tileGroup)
|
center(tileGroup)
|
||||||
|
Reference in New Issue
Block a user