Organized TileGroup icons (for improvements, resources and units) into a separate class

This commit is contained in:
Yair Morgenstern
2019-10-17 00:05:10 +03:00
parent e95fbc3fb9
commit 33805ca6f8
15 changed files with 223 additions and 183 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

View File

@ -1168,7 +1168,7 @@ OtherIcons/tileTableBackground
index: -1
OtherIcons/whiteDot
rotate: false
xy: 2317, 1545
xy: 281, 1901
size: 1, 1
orig: 1, 1
offset: 0, 0
@ -2442,7 +2442,7 @@ TileSets/FantasyHex/Tiles/Grassland
index: -1
TileSets/FantasyHex/Tiles/Grassland+Forest
rotate: false
xy: 2351, 1514
xy: 2351, 1506
size: 31, 29
orig: 31, 29
offset: 0, 0
@ -2524,30 +2524,72 @@ TileSets/FantasyHex/Tiles/Plains+Jungle
orig: 32, 35
offset: 0, 0
index: -1
TileSets/FantasyHex/Tiles/River-Bottom
rotate: false
xy: 2321, 1727
size: 32, 30
orig: 32, 30
offset: 0, 0
index: -1
TileSets/FantasyHex/Tiles/River-BottomLeft
rotate: false
xy: 2321, 1695
size: 32, 30
orig: 32, 30
offset: 0, 0
index: -1
TileSets/FantasyHex/Tiles/River-BottomRight
rotate: false
xy: 2321, 1663
size: 32, 30
orig: 32, 30
offset: 0, 0
index: -1
TileSets/FantasyHex/Tiles/River-Top
rotate: false
xy: 2321, 1631
size: 32, 30
orig: 32, 30
offset: 0, 0
index: -1
TileSets/FantasyHex/Tiles/River-TopLeft
rotate: false
xy: 2321, 1599
size: 32, 30
orig: 32, 30
offset: 0, 0
index: -1
TileSets/FantasyHex/Tiles/River-TopRight
rotate: false
xy: 2321, 1567
size: 32, 30
orig: 32, 30
offset: 0, 0
index: -1
TileSets/FantasyHex/Tiles/Tundra
rotate: false
xy: 2321, 1545
xy: 2344, 1413
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
TileSets/FantasyHex/Tiles/Tundra+City
rotate: false
xy: 2317, 1508
xy: 2344, 1376
size: 32, 35
orig: 32, 35
offset: 0, 0
index: -1
TileSets/FantasyHex/Tiles/Tundra+Forest
rotate: false
xy: 2317, 1474
xy: 2344, 1342
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
TileSets/FantasyHex/TopBorder
rotate: false
xy: 2321, 1609
xy: 2317, 1447
size: 32, 28
orig: 32, 28
offset: 0, 0
@ -2750,14 +2792,14 @@ TileSets/FantasyHex/Units/Rifleman
index: -1
TileSets/FantasyHex/Units/Scout
rotate: false
xy: 2321, 1729
xy: 2342, 1861
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Units/Spearman
rotate: false
xy: 2321, 1699
xy: 2321, 1537
size: 32, 28
orig: 32, 28
offset: 0, 0
@ -2771,49 +2813,49 @@ TileSets/FantasyHex/Units/Submarine
index: -1
TileSets/FantasyHex/Units/Swordsman
rotate: false
xy: 2321, 1669
xy: 2317, 1507
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Units/Tank
rotate: false
xy: 2321, 1639
xy: 2317, 1477
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Units/Trebuchet
rotate: false
xy: 2321, 1579
xy: 440, 1234
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Units/War Elephant
rotate: false
xy: 2342, 1861
xy: 2344, 1312
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Units/Work Boats
rotate: false
xy: 440, 1236
xy: 2344, 1256
size: 32, 26
orig: 32, 26
offset: 0, 0
index: -1
TileSets/FantasyHex/WaterUnit
rotate: false
xy: 2317, 1446
xy: 2344, 1284
size: 32, 26
orig: 32, 26
offset: 0, 0
index: -1
TileSets/FantasyHex/Units/WaterUnit
rotate: false
xy: 2317, 1446
xy: 2344, 1284
size: 32, 26
orig: 32, 26
offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -35,7 +35,6 @@ open class TileInfo {
var roadStatus = RoadStatus.None
var turnsToImprovement: Int = 0
fun clone(): TileInfo {
val toReturn = TileInfo()
if(militaryUnit!=null) toReturn.militaryUnit=militaryUnit!!.clone()

View File

@ -139,23 +139,6 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
private fun addStatInfo() {
val cityStats = cityScreen.city.cityStats
//
// for(stats in unifiedStatList.values) stats.happiness=0f
//
// // add happiness to stat list
// for(entry in cityStats.happinessList.filter { it.value!=0f }){
// if(!unifiedStatList.containsKey(entry.key))
// unifiedStatList[entry.key]= Stats()
// unifiedStatList[entry.key]!!.happiness=entry.value
// }
// Add maintenance if relevant
//
// val maintenance = cityStats.cityInfo.cityConstructions.getMaintenanceCosts()
// if(maintenance>0)
// unifiedStatList["Maintenance"]=Stats().add(Stat.Gold,-maintenance.toFloat())
for(stat in Stat.values().filter { it!=Stat.Happiness }){
val relevantBaseStats = cityStats.baseStatList.filter { it.value.get(stat)!=0f }
@ -208,14 +191,6 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
statValuesTable.addSeparator()
statValuesTable.add("Total".toLabel())
statValuesTable.add(DecimalFormat("0.#").format(finalTotal).toLabel()).row()
// if(stat==Stat.Food){
// val growthBonus = cityStats.getGrowthBonusFromPolicies()
// if(growthBonus>0){
// statValuesTable.add("Growth bonus".toLabel())
// statValuesTable.add(("+"+((growthBonus*100).toInt().toString())+"%").toLabel())
// }
// }
}
}

View File

@ -7,19 +7,20 @@ import com.unciv.logic.map.TileInfo
import com.unciv.ui.tilegroups.TileGroup
import com.unciv.ui.tilegroups.TileSetStrings
import com.unciv.ui.utils.ImageGetter
import com.unciv.ui.utils.center
import com.unciv.ui.utils.centerX
class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrings: TileSetStrings) : TileGroup(tileInfo,tileSetStrings) {
var isWorkable = false
var yieldGroup = YieldGroup()
private var yieldGroup = YieldGroup()
init {
isTransform=false // performance helper - nothing here is rotated or scaled
addActor(yieldGroup)
if (city.location == tileInfo.position) {
populationImage = ImageGetter.getImage("StatIcons/City_Center_(Civ6)")
addActor(populationImage)
icons.populationIcon = ImageGetter.getImage("StatIcons/City_Center_(Civ6)")
addActor(icons.populationIcon)
}
}
@ -41,19 +42,19 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
baseLayerGroup.color.a = 0.5f
}
!tileInfo.isCityCenter() && populationImage==null -> { // workable
addPopulationIcon()
isWorkable=true
!tileInfo.isCityCenter() && icons.populationIcon==null -> { // workable
icons.addPopulationIcon()
isWorkable = true
}
}
terrainFeatureLayerGroup.color.a=0.5f
if (improvementImage != null) improvementImage!!.setColor(1f, 1f, 1f, 0.5f)
if (resourceImage != null) resourceImage!!.setColor(1f, 1f, 1f, 0.5f)
if (cityImage != null) cityImage!!.setColor(1f, 1f, 1f, 0.5f)
if (civilianUnitImage != null) civilianUnitImage!!.setColor(1f, 1f, 1f, 0.5f)
if (militaryUnitImage!= null) militaryUnitImage!!.setColor(1f, 1f, 1f, 0.5f)
updatePopulationImage()
icons.improvementIcon?.setColor(1f, 1f, 1f, 0.5f)
resourceImage?.setColor(1f, 1f, 1f, 0.5f)
cityImage?.setColor(1f, 1f, 1f, 0.5f)
icons.civilianUnitIcon?.setColor(1f, 1f, 1f, 0.5f)
icons.militaryUnitIcon?.setColor(1f, 1f, 1f, 0.5f)
updatePopulationIcon()
updateYieldGroup()
}
@ -73,21 +74,34 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
}
}
private fun updatePopulationImage() {
if (populationImage != null) {
populationImage!!.setSize(30f, 30f)
populationImage!!.setPosition(width / 2 - populationImage!!.width / 2,
height * 0.85f - populationImage!!.height / 2)
private fun updatePopulationIcon() {
val populationIcon = icons.populationIcon
if (populationIcon != null) {
populationIcon.setSize(30f, 30f)
populationIcon.setPosition(width / 2 - populationIcon.width / 2,
height * 0.85f - populationIcon.height / 2)
if (tileInfo.isWorked() || city.canAcquireTile(tileInfo)) {
populationImage!!.color = Color.WHITE
populationIcon.color = Color.WHITE
}
else if(!tileInfo.isCityCenter()){
populationImage!!.color = Color.GRAY.cpy()
populationIcon.color = Color.GRAY.cpy()
}
populationImage!!.toFront()
populationIcon.toFront()
}
}
private fun addAcquirableIcon() {
icons.populationIcon = ImageGetter.getStatIcon("Acquire")
icons.populationIcon!!.run {
color = Color.GREEN.cpy().lerp(Color.BLACK, 0.5f)
setSize(20f, 20f)
center(this@CityTileGroup)
x += 20 // right
}
miscLayerGroup.addActor(this)
}
}

View File

@ -9,12 +9,10 @@ import com.badlogic.gdx.utils.Align
import com.unciv.UnCivGame
import com.unciv.logic.HexMath
import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.logic.map.MapUnit
import com.unciv.logic.map.RoadStatus
import com.unciv.logic.map.TileInfo
import com.unciv.models.gamebasics.unit.UnitType
import com.unciv.ui.utils.ImageGetter
import com.unciv.ui.utils.UnitGroup
import com.unciv.ui.utils.center
import com.unciv.ui.utils.centerX
@ -49,14 +47,12 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
val miscLayerGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize) }
var resourceImage: Actor? = null
var resource: String? = null
var improvementImage: Actor? = null
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 icons = TileGroupIcons(this)
val unitLayerGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize);touchable = Touchable.disabled }
protected var civilianUnitImage: UnitGroup? = null
protected var militaryUnitImage: UnitGroup? = null
val cityButtonLayerGroup = Group().apply { isTransform = true; setSize(groupSize, groupSize);touchable = Touchable.childrenOnly }
@ -91,6 +87,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
isTransform = false // performance helper - nothing here is rotated or scaled
}
//region init functions
private fun addCircleImage() {
circleImage.width = 50f
@ -166,35 +163,6 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
tileBaseImage.toBack()
}
fun addAcquirableIcon() {
populationImage = ImageGetter.getStatIcon("Acquire")
populationImage!!.run {
color = Color.GREEN.cpy().lerp(Color.BLACK, 0.5f)
setSize(20f, 20f)
center(this@TileGroup)
x += 20 // right
}
miscLayerGroup.addActor(populationImage)
}
fun addPopulationIcon() {
this.populationImage = ImageGetter.getStatIcon("Population")
populationImage!!.run {
color = Color.GREEN.cpy().lerp(Color.BLACK, 0.5f)
setSize(20f, 20f)
center(this@TileGroup)
x += 20 // right
}
miscLayerGroup.addActor(populationImage)
}
protected fun removePopulationIcon() {
if (populationImage != null) {
populationImage!!.remove()
populationImage = null
}
}
fun showMilitaryUnit(viewingCiv: CivilizationInfo) = showEntireMap
|| viewingCiv.viewableInvisibleUnitsTiles.contains(tileInfo)
|| (!tileInfo.hasEnemySubmarine(viewingCiv))
@ -220,16 +188,11 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
updatePixelMilitaryUnit(tileIsViewable && showMilitaryUnit)
updatePixelCivilianUnit(tileIsViewable)
icons.update(showResourcesAndImprovements, tileIsViewable, showMilitaryUnit)
updateCityImage()
updateTileColor(tileIsViewable)
updateResourceImage(showResourcesAndImprovements)
updateImprovementImage(showResourcesAndImprovements)
civilianUnitImage = newUnitImage(tileInfo.civilianUnit, civilianUnitImage, tileIsViewable, -20f)
militaryUnitImage = newUnitImage(tileInfo.militaryUnit, militaryUnitImage, tileIsViewable && showMilitaryUnit, 20f)
updateRoadImages()
updateBorderImages()
@ -471,73 +434,6 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
}
}
private fun updateImprovementImage(showResourcesAndImprovements: Boolean) {
if (improvementImage != null) {
improvementImage!!.remove()
improvementImage = null
}
if (tileInfo.improvement != null && showResourcesAndImprovements) {
improvementImage = ImageGetter.getImprovementIcon(tileInfo.improvement!!)
miscLayerGroup.addActor(improvementImage)
improvementImage!!.run {
setSize(20f, 20f)
center(this@TileGroup)
this.x -= 22 // left
this.y -= 10 // bottom
}
}
if (improvementImage != null) {
improvementImage!!.color = Color.WHITE.cpy().apply { a = 0.7f }
}
}
private fun updateResourceImage(showResourcesAndImprovements: Boolean) {
if (resource != tileInfo.resource) {
resource = tileInfo.resource
if (resourceImage != null) resourceImage!!.remove()
if (resource == null) resourceImage = null
else {
resourceImage = ImageGetter.getResourceImage(tileInfo.resource!!, 20f)
resourceImage!!.center(this)
resourceImage!!.x = resourceImage!!.x - 22 // left
resourceImage!!.y = resourceImage!!.y + 10 // top
miscLayerGroup.addActor(resourceImage!!)
}
}
if (resourceImage != null) { // This could happen on any turn, since resources need certain techs to reveal them
val shouldDisplayResource =
if (showEntireMap) tileInfo.resource != null
else showResourcesAndImprovements
&& tileInfo.hasViewableResource(UnCivGame.Current.worldScreen.viewingCiv)
resourceImage!!.isVisible = shouldDisplayResource
}
}
protected fun newUnitImage(unit: MapUnit?, oldUnitGroup: UnitGroup?, isViewable: Boolean, yFromCenter: Float): UnitGroup? {
var newImage: UnitGroup? = null
// The unit can change within one update - for instance, when attacking, the attacker replaces the defender!
oldUnitGroup?.remove()
if (unit != null && isViewable) { // Tile is visible
newImage = UnitGroup(unit, 25f)
if (oldUnitGroup?.blackSpinningCircle != null) {
newImage.blackSpinningCircle = ImageGetter.getCircle()
.apply { rotation = oldUnitGroup.blackSpinningCircle!!.rotation }
}
unitLayerGroup.addActor(newImage)
newImage.center(this)
newImage.y += yFromCenter
// Instead of fading out the entire unit with its background, we just fade out its central icon,
// that way it remains much more visible on the map
if (!unit.isIdle() && unit.civInfo == UnCivGame.Current.worldScreen.viewingCiv)
newImage.unitBaseImage.color.a = 0.5f
}
return newImage
}
fun showCircle(color: Color, alpha: Float = 0.3f) {

View File

@ -0,0 +1,115 @@
package com.unciv.ui.tilegroups
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Actor
import com.badlogic.gdx.scenes.scene2d.ui.Image
import com.unciv.UnCivGame
import com.unciv.logic.map.MapUnit
import com.unciv.ui.utils.ImageGetter
import com.unciv.ui.utils.UnitGroup
import com.unciv.ui.utils.center
/** Helper class for TileGroup, which was getting too full */
class TileGroupIcons(val tileGroup: TileGroup){
var improvementIcon: Actor? = null
var populationIcon: Image? = null //reuse for acquire icon
var civilianUnitIcon: UnitGroup? = null
var militaryUnitIcon: UnitGroup? = null
fun update(showResourcesAndImprovements: Boolean, tileIsViewable: Boolean, showMilitaryUnit: Boolean) {
updateResourceIcon(showResourcesAndImprovements)
updateImprovementIcon(showResourcesAndImprovements)
civilianUnitIcon = newUnitIcon(tileGroup.tileInfo.civilianUnit, civilianUnitIcon, tileIsViewable, -20f)
militaryUnitIcon = newUnitIcon(tileGroup.tileInfo.militaryUnit, militaryUnitIcon, tileIsViewable && showMilitaryUnit, 20f)
}
fun addPopulationIcon() {
populationIcon = ImageGetter.getStatIcon("Population")
populationIcon!!.run {
color = Color.GREEN.cpy().lerp(Color.BLACK, 0.5f)
setSize(20f, 20f)
center(tileGroup)
x += 20 // right
}
tileGroup.miscLayerGroup.addActor(populationIcon)
}
fun removePopulationIcon() {
populationIcon?.remove()
populationIcon = null
}
fun newUnitIcon(unit: MapUnit?, oldUnitGroup: UnitGroup?, isViewable: Boolean, yFromCenter: Float): UnitGroup? {
var newImage: UnitGroup? = null
// The unit can change within one update - for instance, when attacking, the attacker replaces the defender!
oldUnitGroup?.remove()
if (unit != null && isViewable) { // Tile is visible
newImage = UnitGroup(unit, 25f)
if (oldUnitGroup?.blackSpinningCircle != null) {
newImage.blackSpinningCircle = ImageGetter.getCircle()
.apply { rotation = oldUnitGroup.blackSpinningCircle!!.rotation }
}
tileGroup.unitLayerGroup.addActor(newImage)
newImage.center(tileGroup)
newImage.y += yFromCenter
// Instead of fading out the entire unit with its background, we just fade out its central icon,
// that way it remains much more visible on the map
if (!unit.isIdle() && unit.civInfo == UnCivGame.Current.worldScreen.viewingCiv)
newImage.unitBaseImage.color.a = 0.5f
}
return newImage
}
fun updateImprovementIcon(showResourcesAndImprovements: Boolean) {
improvementIcon?.remove()
improvementIcon = null
if (tileGroup.tileInfo.improvement != null && showResourcesAndImprovements) {
val newImprovementImage = ImageGetter.getImprovementIcon(tileGroup.tileInfo.improvement!!)
tileGroup.miscLayerGroup.addActor(newImprovementImage)
newImprovementImage .run {
setSize(20f, 20f)
center(tileGroup)
this.x -= 22 // left
this.y -= 10 // bottom
}
improvementIcon = newImprovementImage
}
if (improvementIcon != null) {
improvementIcon!!.color = Color.WHITE.cpy().apply { a = 0.7f }
}
}
fun updateResourceIcon(showResourcesAndImprovements: Boolean) {
if (tileGroup.resource != tileGroup.tileInfo.resource) {
tileGroup.resource = tileGroup.tileInfo.resource
tileGroup.resourceImage?.remove()
if (tileGroup.resource == null) tileGroup.resourceImage = null
else {
val newResourceIcon = ImageGetter.getResourceImage(tileGroup.tileInfo.resource!!, 20f)
newResourceIcon.center(tileGroup)
newResourceIcon.x = newResourceIcon.x - 22 // left
newResourceIcon.y = newResourceIcon.y + 10 // top
tileGroup.miscLayerGroup.addActor(newResourceIcon)
tileGroup.resourceImage = newResourceIcon
}
}
if (tileGroup.resourceImage != null) { // This could happen on any turn, since resources need certain techs to reveal them
val shouldDisplayResource =
if (tileGroup.showEntireMap) tileGroup.tileInfo.resource != null
else showResourcesAndImprovements
&& tileGroup.tileInfo.hasViewableResource(UnCivGame.Current.worldScreen.viewingCiv)
tileGroup.resourceImage!!.isVisible = shouldDisplayResource
}
}
}

View File

@ -16,19 +16,19 @@ class WorldTileGroup(internal val worldScreen: WorldScreen, tileInfo: TileInfo,
fun selectUnit(unit: MapUnit) {
if(unit.type.isAirUnit()) return // doesn't appear on map so nothing to select
val unitImage = if (unit.type.isCivilian()) civilianUnitImage
else militaryUnitImage
val unitImage = if (unit.type.isCivilian()) icons.civilianUnitIcon
else icons.militaryUnitIcon
unitImage?.selectUnit()
}
fun update(viewingCiv: CivilizationInfo) {
val city = tileInfo.getCity()
removePopulationIcon()
icons.removePopulationIcon()
val tileIsViewable = isViewable(viewingCiv)
if (tileIsViewable && tileInfo.isWorked() && UnCivGame.Current.settings.showWorkedTiles
&& city!!.civInfo.isPlayerCivilization())
addPopulationIcon()
icons.addPopulationIcon()
val currentPlayerCiv = worldScreen.viewingCiv
if (UnCivGame.Current.viewEntireMapForDebug
@ -41,11 +41,11 @@ class WorldTileGroup(internal val worldScreen: WorldScreen, tileInfo: TileInfo,
// order by z index!
cityImage?.toFront()
terrainFeatureOverlayImage?.toFront()
improvementImage?.toFront()
icons.improvementIcon?.toFront()
resourceImage?.toFront()
cityButton?.toFront()
civilianUnitImage?.toFront()
militaryUnitImage?.toFront()
icons.civilianUnitIcon?.toFront()
icons.militaryUnitIcon?.toFront()
fogImage.toFront()
}

View File

@ -26,6 +26,7 @@ import com.unciv.ui.tilegroups.WorldTileGroup
import com.unciv.ui.utils.*
import com.unciv.ui.worldscreen.unit.UnitContextMenu
import kotlin.concurrent.thread
import kotlin.math.sqrt
class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: TileMap) : ScrollPane(null) {
internal var selectedTile: TileInfo? = null
@ -84,7 +85,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
lastInitialDistance = initialDistance
lastScale = scaleX
}
val scale: Float = Math.sqrt((distance / initialDistance).toDouble()).toFloat() * lastScale
val scale: Float = sqrt((distance / initialDistance).toDouble()).toFloat() * lastScale
if (scale < 0.5f) return
setScale(scale)
for (tilegroup in tileGroups.values.filter { it.cityButton != null })
@ -104,7 +105,6 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
val previousSelectedCity = unitTable.selectedCity
unitTable.tileSelected(tileInfo)
val newSelectedUnit = unitTable.selectedUnit
val newSelectedCity = unitTable.selectedCity
if (previousSelectedUnit != null && previousSelectedUnit.getTile() != tileInfo
&& worldScreen.isPlayersTurn
@ -241,7 +241,6 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
internal fun updateTiles(viewingCiv: CivilizationInfo) {
val playerViewableTilePositions = viewingCiv.viewableTiles.map { it.position }.toHashSet()
val playerViewableInvisibleUnitsTilePositions = viewingCiv.viewableInvisibleUnitsTiles.map { it.position }.toHashSet()
for (tileGroup in tileGroups.values){
tileGroup.update(viewingCiv)
@ -310,10 +309,10 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
val fadeout = if (unit.type.isCivilian()) 1f
else 0.5f
for (tile in tileGroups.values) {
if (tile.populationImage != null) tile.populationImage!!.color.a = fadeout
if (tile.improvementImage != null && tile.tileInfo.improvement!=Constants.barbarianEncampment
if (tile.icons.populationIcon != null) tile.icons.populationIcon!!.color.a = fadeout
if (tile.icons.improvementIcon != null && tile.tileInfo.improvement!=Constants.barbarianEncampment
&& tile.tileInfo.improvement!=Constants.ancientRuins)
tile.improvementImage!!.color.a = fadeout
tile.icons.improvementIcon!!.color.a = fadeout
if (tile.resourceImage != null) tile.resourceImage!!.color.a = fadeout
}
}