From 06b44140b82faa9b62d0da7eae70f691df235cd3 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 9 Apr 2019 16:49:24 +0300 Subject: [PATCH] Resolved #603 - Move unit icons back above city label --- android/build.gradle | 4 ++-- core/src/com/unciv/ui/tilegroups/CityButton.kt | 5 +++-- core/src/com/unciv/ui/tilegroups/TileGroup.kt | 6 +++++- core/src/com/unciv/ui/worldscreen/TileGroupMap.kt | 5 ++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index d1effbb5ea..665ebf202f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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 diff --git a/core/src/com/unciv/ui/tilegroups/CityButton.kt b/core/src/com/unciv/ui/tilegroups/CityButton.kt index b59108956f..4b18123e64 100644 --- a/core/src/com/unciv/ui/tilegroups/CityButton.kt +++ b/core/src/com/unciv/ui/tilegroups/CityButton.kt @@ -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) diff --git a/core/src/com/unciv/ui/tilegroups/TileGroup.kt b/core/src/com/unciv/ui/tilegroups/TileGroup.kt index 01b6b690a6..90fc0cde9c 100644 --- a/core/src/com/unciv/ui/tilegroups/TileGroup.kt +++ b/core/src/com/unciv/ui/tilegroups/TileGroup.kt @@ -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() private val borderImages = HashMap>() // 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 diff --git a/core/src/com/unciv/ui/worldscreen/TileGroupMap.kt b/core/src/com/unciv/ui/worldscreen/TileGroupMap.kt index 47f7e0fbd1..45ac5c30bf 100644 --- a/core/src/com/unciv/ui/worldscreen/TileGroupMap.kt +++ b/core/src/com/unciv/ui/worldscreen/TileGroupMap.kt @@ -30,6 +30,7 @@ class TileGroupMap(tileGroups:Collection, padding:Float): Group val baseLayers = ArrayList() val featureLayers = ArrayList() val miscLayers = ArrayList() + val unitLayers = ArrayList() val circleCrosshairFogLayers = ArrayList() for(group in tileGroups.sortedByDescending { it.tileInfo.position.x + it.tileInfo.position.y }){ @@ -37,13 +38,15 @@ class TileGroupMap(tileGroups:Collection, 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",