UI bugfixes: city info and aircrafts (#2289)
* Display aircraft icon even for full carriers * Do not reveal strategic city information like aircrafts or units near by
This commit is contained in:
parent
62e78dec1c
commit
b212f2bfd0
2 changed files with 9 additions and 5 deletions
|
@ -28,15 +28,16 @@ class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup, skin
|
||||||
private val listOfHiddenUnitMarkers: MutableList<Actor> = mutableListOf()
|
private val listOfHiddenUnitMarkers: MutableList<Actor> = mutableListOf()
|
||||||
private lateinit var iconTable: Table
|
private lateinit var iconTable: Table
|
||||||
private var isButtonMoved = false
|
private var isButtonMoved = false
|
||||||
|
private var showAdditionalInfoTags = false
|
||||||
|
|
||||||
fun update(isCityViewable:Boolean) {
|
fun update(isCityViewable:Boolean) {
|
||||||
|
showAdditionalInfoTags = isCityViewable
|
||||||
|
|
||||||
clear()
|
clear()
|
||||||
|
|
||||||
setButtonActions()
|
setButtonActions()
|
||||||
|
|
||||||
addAirUnitTable()
|
addAirUnitTable()
|
||||||
|
|
||||||
if (isCityViewable && city.health < city.getMaxHealth().toFloat()) {
|
if (showAdditionalInfoTags && 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).row()
|
add(healthBar).row()
|
||||||
}
|
}
|
||||||
|
@ -58,6 +59,9 @@ class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup, skin
|
||||||
for (marker in listOfHiddenUnitMarkers)
|
for (marker in listOfHiddenUnitMarkers)
|
||||||
iconTable.removeActor(marker)
|
iconTable.removeActor(marker)
|
||||||
listOfHiddenUnitMarkers.clear()
|
listOfHiddenUnitMarkers.clear()
|
||||||
|
|
||||||
|
if (!showAdditionalInfoTags) return
|
||||||
|
|
||||||
// detect civilian in the city center
|
// detect civilian in the city center
|
||||||
if (!isButtonMoved && (tileGroup.tileInfo.civilianUnit != null))
|
if (!isButtonMoved && (tileGroup.tileInfo.civilianUnit != null))
|
||||||
insertHiddenUnitMarker(HiddenUnitMarkerPosition.Center)
|
insertHiddenUnitMarker(HiddenUnitMarkerPosition.Center)
|
||||||
|
@ -111,7 +115,7 @@ class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup, skin
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addAirUnitTable() {
|
private fun addAirUnitTable() {
|
||||||
if (tileGroup.tileInfo.airUnits.isEmpty()) return
|
if (!showAdditionalInfoTags || tileGroup.tileInfo.airUnits.isEmpty()) return
|
||||||
val secondarycolor = city.civInfo.nation.getInnerColor()
|
val secondarycolor = city.civInfo.nation.getInnerColor()
|
||||||
val airUnitTable = Table().apply { defaults().pad(5f) }
|
val airUnitTable = Table().apply { defaults().pad(5f) }
|
||||||
airUnitTable.background = ImageGetter.getRoundedEdgeTableBackground(city.civInfo.nation.getOuterColor())
|
airUnitTable.background = ImageGetter.getRoundedEdgeTableBackground(city.civInfo.nation.getOuterColor())
|
||||||
|
|
|
@ -66,7 +66,7 @@ class TileGroupIcons(val tileGroup: TileGroup){
|
||||||
newImage.y += yFromCenter
|
newImage.y += yFromCenter
|
||||||
|
|
||||||
// Display number of carried air units
|
// Display number of carried air units
|
||||||
if (unit.getTile().airUnits.any { unit.canTransport(it) } && !unit.getTile().isCityCenter()) {
|
if (unit.getTile().airUnits.any { unit.isTransportTypeOf(it) } && !unit.getTile().isCityCenter()) {
|
||||||
val holder = Table()
|
val holder = Table()
|
||||||
val secondarycolor = unit.civInfo.nation.getInnerColor()
|
val secondarycolor = unit.civInfo.nation.getInnerColor()
|
||||||
val airUnitTable = Table().apply { defaults().pad(5f) }
|
val airUnitTable = Table().apply { defaults().pad(5f) }
|
||||||
|
|
Loading…
Reference in a new issue