mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Added icon to city tiles
This commit is contained in:
parent
0054ccc49e
commit
4d27f7f769
BIN
android/assets/OtherIcons/City.png
Normal file
BIN
android/assets/OtherIcons/City.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
@ -18,6 +18,7 @@ import com.unciv.ui.utils.colorFromRGB
|
||||
open class TileGroup(var tileInfo: TileInfo) : Group() {
|
||||
protected val hexagon = ImageGetter.getImage("TerrainIcons/Hexagon.png")
|
||||
protected var terrainFeatureImage:Image?=null
|
||||
protected var cityImage:Image?=null
|
||||
|
||||
protected var resourceImage: Image? = null
|
||||
protected var improvementImage: Image? =null
|
||||
@ -110,6 +111,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
|
||||
}
|
||||
|
||||
updateTerrainFeatureImage()
|
||||
updateCityImage()
|
||||
updateTileColor(isViewable)
|
||||
|
||||
updateResourceImage(isViewable)
|
||||
@ -129,6 +131,21 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
|
||||
fogImage.isVisible=!(isViewable || UnCivGame.Current.viewEntireMapForDebug)
|
||||
}
|
||||
|
||||
private fun updateCityImage() {
|
||||
if(cityImage==null && tileInfo.isCityCenter()){
|
||||
cityImage = ImageGetter.getImage("OtherIcons/City.png")
|
||||
addActor(cityImage)
|
||||
cityImage!!.run {
|
||||
setSize(60f, 60f)
|
||||
center(this@TileGroup)
|
||||
}
|
||||
}
|
||||
if(cityImage!=null && !tileInfo.isCityCenter()){
|
||||
cityImage!!.remove()
|
||||
cityImage = null
|
||||
}
|
||||
}
|
||||
|
||||
var previousTileOwner:CivilizationInfo?=null
|
||||
private fun updateBorderImages() {
|
||||
// This is longer than it could be, because of performance -
|
||||
|
@ -35,7 +35,6 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
||||
|
||||
|
||||
override fun update(isViewable: Boolean) {
|
||||
|
||||
val city = tileInfo.getCity()
|
||||
|
||||
removePopulationIcon()
|
||||
@ -52,6 +51,16 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
||||
yieldGroup.isVisible = !UnCivGame.Current.settings.showResourcesAndImprovements
|
||||
if(yieldGroup.isVisible)
|
||||
yieldGroup.setStats(tileInfo.getTileStats(UnCivGame.Current.gameInfo.getPlayerCivilization()))
|
||||
|
||||
// order by z index!
|
||||
cityImage?.toFront()
|
||||
terrainFeatureImage?.toFront()
|
||||
yieldGroup.toFront()
|
||||
improvementImage?.toFront()
|
||||
resourceImage?.toFront()
|
||||
cityButton?.toFront()
|
||||
civilianUnitImage?.toFront()
|
||||
militaryUnitImage?.toFront()
|
||||
}
|
||||
|
||||
private fun updateCityButton(city: CityInfo?, viewable: Boolean) {
|
||||
|
Loading…
Reference in New Issue
Block a user