Resolved #603 - Move unit icons back above city label

This commit is contained in:
Yair Morgenstern 2019-04-09 16:49:24 +03:00
parent 7fa24a8f17
commit 06b44140b8
4 changed files with 14 additions and 6 deletions

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.app"
minSdkVersion 14
targetSdkVersion 28
versionCode 225
versionName "2.14.5"
versionCode 226
versionName "2.14.6"
}
// Had to add this crap for Travis to build, it wanted to sign the app

View File

@ -93,8 +93,9 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski
group.addActor(image)
val secondaryColor = cityConstructions.cityInfo.civInfo.getNation().getSecondaryColor()
if(cityConstructions.getCurrentConstruction() !is SpecialConstruction) {
val turnsToConstruction = cityConstructions.turnsToConstruction(cityConstructions.currentConstruction)
val cityCurrentConstruction = cityConstructions.getCurrentConstruction()
if(cityCurrentConstruction !is SpecialConstruction) {
val turnsToConstruction = cityConstructions.turnsToConstruction(cityCurrentConstruction.name)
val label = turnsToConstruction.toString().toLabel()
label.setFontColor(secondaryColor)
label.setFontSize(10)

View File

@ -3,6 +3,7 @@ package com.unciv.ui.tilegroups
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Actor
import com.badlogic.gdx.scenes.scene2d.Group
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.Image
import com.badlogic.gdx.utils.Align
import com.unciv.UnCivGame
@ -49,6 +50,8 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
var populationImage: Image? = null //reuse for acquire icon
private val roadImages = HashMap<TileInfo, RoadImage>()
private val borderImages = HashMap<TileInfo, List<Image>>() // map of neighboring tile to border images
val unitLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize);touchable=Touchable.disabled }
protected var civilianUnitImage: UnitGroup? = null
protected var militaryUnitImage: UnitGroup? = null
@ -71,6 +74,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
this.addActor(baseLayerGroup)
this.addActor(featureLayerGroup)
this.addActor(miscLayerGroup)
this.addActor(unitLayerGroup)
this.addActor(circleCrosshairFogLayerGroup)
updateTileImage(false)
@ -426,7 +430,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
newImage.blackSpinningCircle = ImageGetter.getCircle()
.apply { rotation= oldUnitGroup.blackSpinningCircle!!.rotation}
}
miscLayerGroup.addActor(newImage)
unitLayerGroup.addActor(newImage)
newImage.center(this)
newImage.y += yFromCenter

View File

@ -30,6 +30,7 @@ class TileGroupMap<T: TileGroup>(tileGroups:Collection<T>, padding:Float): Group
val baseLayers = ArrayList<Group>()
val featureLayers = ArrayList<Group>()
val miscLayers = ArrayList<Group>()
val unitLayers = ArrayList<Group>()
val circleCrosshairFogLayers = ArrayList<Group>()
for(group in tileGroups.sortedByDescending { it.tileInfo.position.x + it.tileInfo.position.y }){
@ -37,13 +38,15 @@ class TileGroupMap<T: TileGroup>(tileGroups:Collection<T>, padding:Float): Group
baseLayers.add(group.baseLayerGroup.apply { setPosition(group.x,group.y) })
featureLayers.add(group.featureLayerGroup.apply { setPosition(group.x,group.y) })
miscLayers.add(group.miscLayerGroup.apply { setPosition(group.x,group.y) })
unitLayers.add(group.unitLayerGroup.apply { setPosition(group.x,group.y) })
circleCrosshairFogLayers.add(group.circleCrosshairFogLayerGroup.apply { setPosition(group.x,group.y) })
}
for(group in baseLayers) addActor(group)
for(group in featureLayers) addActor(group)
for(group in miscLayers) addActor(group)
for(group in circleCrosshairFogLayers) addActor(group)
for(group in tileGroups) addActor(group) // The above layers are for the visual layers, this is for the cli
for(group in tileGroups) addActor(group) // The above layers are for the visual layers, this is for the clickability
for(group in unitLayers) addActor(group) // Aaand units above everything else.
// there are tiles "below the zero",