Added more unit icons =)

Organized tileset image locations
This commit is contained in:
Yair Morgenstern 2019-10-13 11:49:34 +03:00
parent 538e53883c
commit fb768682fe
40 changed files with 624 additions and 534 deletions

View File

Before

Width:  |  Height:  |  Size: 876 B

After

Width:  |  Height:  |  Size: 876 B

View File

Before

Width:  |  Height:  |  Size: 402 B

After

Width:  |  Height:  |  Size: 402 B

View File

Before

Width:  |  Height:  |  Size: 787 B

After

Width:  |  Height:  |  Size: 787 B

View File

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 387 B

View File

Before

Width:  |  Height:  |  Size: 682 B

After

Width:  |  Height:  |  Size: 682 B

View File

Before

Width:  |  Height:  |  Size: 386 B

After

Width:  |  Height:  |  Size: 386 B

View File

Before

Width:  |  Height:  |  Size: 876 B

After

Width:  |  Height:  |  Size: 876 B

View File

Before

Width:  |  Height:  |  Size: 572 B

After

Width:  |  Height:  |  Size: 572 B

View File

Before

Width:  |  Height:  |  Size: 871 B

After

Width:  |  Height:  |  Size: 871 B

View File

Before

Width:  |  Height:  |  Size: 510 B

After

Width:  |  Height:  |  Size: 510 B

View File

Before

Width:  |  Height:  |  Size: 388 B

After

Width:  |  Height:  |  Size: 388 B

View File

Before

Width:  |  Height:  |  Size: 876 B

After

Width:  |  Height:  |  Size: 876 B

View File

Before

Width:  |  Height:  |  Size: 861 B

After

Width:  |  Height:  |  Size: 861 B

View File

Before

Width:  |  Height:  |  Size: 634 B

After

Width:  |  Height:  |  Size: 634 B

View File

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 641 B

View File

Before

Width:  |  Height:  |  Size: 569 B

After

Width:  |  Height:  |  Size: 569 B

View File

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 394 B

View File

Before

Width:  |  Height:  |  Size: 864 B

After

Width:  |  Height:  |  Size: 864 B

View File

Before

Width:  |  Height:  |  Size: 776 B

After

Width:  |  Height:  |  Size: 776 B

View File

Before

Width:  |  Height:  |  Size: 804 B

After

Width:  |  Height:  |  Size: 804 B

View File

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 387 B

View File

Before

Width:  |  Height:  |  Size: 895 B

After

Width:  |  Height:  |  Size: 895 B

View File

Before

Width:  |  Height:  |  Size: 726 B

After

Width:  |  Height:  |  Size: 726 B

View File

Before

Width:  |  Height:  |  Size: 698 B

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 B

View File

Before

Width:  |  Height:  |  Size: 368 B

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

View File

Before

Width:  |  Height:  |  Size: 368 B

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

View File

Before

Width:  |  Height:  |  Size: 375 B

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

View File

Before

Width:  |  Height:  |  Size: 377 B

After

Width:  |  Height:  |  Size: 377 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1016 KiB

After

Width:  |  Height:  |  Size: 1017 KiB

View File

@ -47,7 +47,7 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
}
}
featureLayerGroup.color.a=0.5f
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)

View File

@ -40,6 +40,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
protected var terrainFeature:String?=null
protected var cityImage: Image? = null
protected var pixelMilitaryUnitImage: Image? = null
protected var pixelCivilianUnitImage: Image? = null
val miscLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize) }
var resourceImage: Actor? = null
@ -213,6 +214,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
updateTerrainBaseImage()
updateTerrainFeatureImage()
updatePixelMilitaryUnit(showMilitaryUnit)
updatePixelCivilianUnit()
updateCityImage()
updateTileColor(tileIsViewable)
@ -407,7 +409,12 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
} else {
if (pixelMilitaryUnitImage == null) {
var imageLocation = ""
if (tileInfo.militaryUnit!!.type.isLandUnit() && ImageGetter.imageExists(tileSetStrings.landUnit))
val specificUnitIconLocation = tileSetStrings.unitsLocation+tileInfo.militaryUnit!!.name
if(ImageGetter.imageExists(specificUnitIconLocation))
imageLocation = specificUnitIconLocation
else if (tileInfo.militaryUnit!!.type.isLandUnit() && ImageGetter.imageExists(tileSetStrings.landUnit))
imageLocation = tileSetStrings.landUnit
else if (tileInfo.militaryUnit!!.type.isWaterUnit() && ImageGetter.imageExists(tileSetStrings.waterUnit))
imageLocation = tileSetStrings.waterUnit
@ -422,6 +429,29 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
}
}
fun updatePixelCivilianUnit() {
if (tileInfo.civilianUnit==null) {
if (pixelCivilianUnitImage != null) {
pixelCivilianUnitImage!!.remove()
pixelCivilianUnitImage = null
}
} else {
if (pixelCivilianUnitImage == null) {
var imageLocation = ""
val specificUnitIconLocation = tileSetStrings.unitsLocation+tileInfo.civilianUnit!!.name
if(ImageGetter.imageExists(specificUnitIconLocation))
imageLocation = specificUnitIconLocation
if (imageLocation != "") {
val pixelUnitImage = ImageGetter.getImage(imageLocation)
terrainFeatureLayerGroup.addActor(pixelUnitImage)
setHexagonImageSize(pixelUnitImage)// Treat this as A TILE, which gets overlayed on the base tile.
pixelCivilianUnitImage=pixelUnitImage
}
}
}
}
private fun updateImprovementImage(showResourcesAndImprovements: Boolean) {
if (improvementImage != null) {
improvementImage!!.remove()

View File

@ -6,19 +6,23 @@ class TileSetStrings {
// this is so that when we have 100s of TileGroups, they won't all individually come up with all these strings themselves,
// it gets pretty memory-intensive (10s of MBs which is a lot for lower-end phones)
val tileSetLocation = "TileSets/"+ UnCivGame.Current.settings.tileSet +"/"
val hexagon = tileSetLocation+"Hexagon"
val crosshatchHexagon = tileSetLocation+"CrosshatchHexagon"
val cityTile = tileSetLocation+"City"
val cityOverlay = tileSetLocation+"CityOverlay"
val railroad = tileSetLocation+"Railroad"
val landUnit = tileSetLocation+"LandUnit"
val waterUnit = tileSetLocation+"WaterUnit"
val tilesLocation = tileSetLocation+"Tiles/"
val cityTile = tilesLocation+"City"
val unitsLocation = tileSetLocation+"Units/"
val landUnit = unitsLocation+"LandUnit"
val waterUnit = unitsLocation+"WaterUnit"
private val baseTerrainToTile = HashMap<String,String>()
fun getBaseTerrainTile(baseTerrain:String): String {
if(!baseTerrainToTile.containsKey(baseTerrain))
baseTerrainToTile[baseTerrain] = "$tileSetLocation$baseTerrain"
baseTerrainToTile[baseTerrain] = "$tilesLocation$baseTerrain"
return baseTerrainToTile[baseTerrain]!!
}
@ -33,7 +37,7 @@ class TileSetStrings {
private val baseTerrainToCityTile = HashMap<String,String>()
fun getCityTile(baseTerrain:String): String {
if(!baseTerrainToCityTile.containsKey(baseTerrain))
baseTerrainToCityTile[baseTerrain] = "$tileSetLocation$baseTerrain+City"
baseTerrainToCityTile[baseTerrain] = "$tilesLocation$baseTerrain+City"
return baseTerrainToCityTile[baseTerrain]!!
}