mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-10 19:09:06 +07:00
We can now have "layered" images for the base tile, such as grassland + manufactory!
This commit is contained in:
parent
6eaa4c320f
commit
e21d7eb54a
BIN
android/Images/TileSets/FantasyHex/Tiles/Manufactory.png
Normal file
BIN
android/Images/TileSets/FantasyHex/Tiles/Manufactory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 744 B |
@ -2671,65 +2671,72 @@ TileSets/FantasyHex/Tiles/Lakes
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Manufactory
|
||||
rotate: false
|
||||
xy: 2010, 82
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Mountain
|
||||
rotate: false
|
||||
xy: 1592, 2
|
||||
xy: 1992, 44
|
||||
size: 32, 36
|
||||
orig: 32, 36
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Ocean
|
||||
rotate: false
|
||||
xy: 1660, 13
|
||||
xy: 1992, 14
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Plains
|
||||
rotate: false
|
||||
xy: 1958, 52
|
||||
xy: 2026, 52
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Plains+City
|
||||
rotate: false
|
||||
xy: 1992, 45
|
||||
xy: 2026, 15
|
||||
size: 32, 35
|
||||
orig: 32, 35
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Plains+Customs house
|
||||
rotate: false
|
||||
xy: 1958, 22
|
||||
xy: 1592, 13
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Plains+Farm
|
||||
rotate: false
|
||||
xy: 1992, 15
|
||||
xy: 1626, 13
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Plains+Forest
|
||||
rotate: false
|
||||
xy: 2026, 47
|
||||
xy: 1660, 8
|
||||
size: 32, 33
|
||||
orig: 32, 33
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Plains+Jungle
|
||||
rotate: false
|
||||
xy: 2026, 10
|
||||
xy: 2044, 112
|
||||
size: 32, 35
|
||||
orig: 32, 35
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Plains+Jungle+Trading post
|
||||
rotate: false
|
||||
xy: 2044, 112
|
||||
xy: 2078, 114
|
||||
size: 32, 35
|
||||
orig: 32, 35
|
||||
offset: 0, 0
|
||||
@ -2743,119 +2750,119 @@ TileSets/FantasyHex/Tiles/Plains+Mine
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Plains+Plantation
|
||||
rotate: false
|
||||
xy: 2060, 52
|
||||
xy: 2078, 84
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Plains+Trading post
|
||||
rotate: false
|
||||
xy: 2060, 22
|
||||
xy: 2060, 52
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/River-Bottom
|
||||
rotate: false
|
||||
xy: 2078, 89
|
||||
xy: 2094, 52
|
||||
size: 32, 30
|
||||
orig: 32, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/River-BottomLeft
|
||||
rotate: false
|
||||
xy: 2112, 124
|
||||
xy: 2094, 20
|
||||
size: 32, 30
|
||||
orig: 32, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/River-BottomRight
|
||||
rotate: false
|
||||
xy: 2112, 92
|
||||
xy: 2112, 124
|
||||
size: 32, 30
|
||||
orig: 32, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/River-Top
|
||||
rotate: false
|
||||
xy: 2094, 57
|
||||
xy: 2112, 92
|
||||
size: 32, 30
|
||||
orig: 32, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/River-TopLeft
|
||||
rotate: false
|
||||
xy: 2094, 25
|
||||
xy: 1694, 10
|
||||
size: 32, 30
|
||||
orig: 32, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/River-TopRight
|
||||
rotate: false
|
||||
xy: 2128, 60
|
||||
xy: 1728, 10
|
||||
size: 32, 30
|
||||
orig: 32, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Tundra
|
||||
rotate: false
|
||||
xy: 2126, 438
|
||||
xy: 2126, 348
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Tundra+Camp
|
||||
rotate: false
|
||||
xy: 2126, 408
|
||||
xy: 2126, 318
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Tundra+City
|
||||
rotate: false
|
||||
xy: 2126, 371
|
||||
xy: 2126, 281
|
||||
size: 32, 35
|
||||
orig: 32, 35
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Tundra+Customs house
|
||||
rotate: false
|
||||
xy: 2126, 341
|
||||
xy: 2126, 251
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Tundra+Forest
|
||||
rotate: false
|
||||
xy: 2126, 307
|
||||
xy: 2130, 217
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Tundra+Forest+Camp
|
||||
rotate: false
|
||||
xy: 2126, 273
|
||||
xy: 2130, 183
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Tundra+Mine
|
||||
rotate: false
|
||||
xy: 1796, 10
|
||||
xy: 2128, 62
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tiles/Tundra+Trading post
|
||||
rotate: false
|
||||
xy: 1830, 10
|
||||
xy: 2128, 32
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/TopBorder
|
||||
rotate: false
|
||||
xy: 2124, 498
|
||||
xy: 2126, 408
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
@ -3037,35 +3044,35 @@ TileSets/FantasyHex/Units/Longswordsman
|
||||
index: -1
|
||||
TileSets/FantasyHex/Units/Mechanized Infantry
|
||||
rotate: false
|
||||
xy: 2010, 82
|
||||
xy: 1958, 52
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Units/Musketman
|
||||
rotate: false
|
||||
xy: 1626, 13
|
||||
xy: 1958, 22
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Units/Rifleman
|
||||
rotate: false
|
||||
xy: 2078, 121
|
||||
xy: 2060, 22
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Units/Scout
|
||||
rotate: false
|
||||
xy: 2128, 30
|
||||
xy: 1762, 12
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Units/Spearman
|
||||
rotate: false
|
||||
xy: 1694, 12
|
||||
xy: 2124, 498
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
@ -3079,28 +3086,28 @@ TileSets/FantasyHex/Units/Submarine
|
||||
index: -1
|
||||
TileSets/FantasyHex/Units/Swordsman
|
||||
rotate: false
|
||||
xy: 1728, 12
|
||||
xy: 2124, 468
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Units/Tank
|
||||
rotate: false
|
||||
xy: 1762, 12
|
||||
xy: 2126, 438
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Units/Trebuchet
|
||||
rotate: false
|
||||
xy: 2124, 468
|
||||
xy: 2126, 378
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Units/War Elephant
|
||||
rotate: false
|
||||
xy: 1864, 10
|
||||
xy: 2128, 2
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
@ -3114,7 +3121,7 @@ TileSets/FantasyHex/Units/WaterUnit
|
||||
index: -1
|
||||
TileSets/FantasyHex/Units/Work Boats
|
||||
rotate: false
|
||||
xy: 2128, 2
|
||||
xy: 1796, 2
|
||||
size: 32, 26
|
||||
orig: 32, 26
|
||||
offset: 0, 0
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
@ -17,24 +17,34 @@ import com.unciv.ui.utils.center
|
||||
import com.unciv.ui.utils.centerX
|
||||
|
||||
|
||||
|
||||
open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings) : Group() {
|
||||
val groupSize = 54f
|
||||
|
||||
/*
|
||||
Layers:
|
||||
Base image + overlay
|
||||
Base image (+ overlay)
|
||||
Feature overlay / city overlay
|
||||
Misc: Units, improvements, resources, border
|
||||
Circle, Crosshair, Fog layer
|
||||
City name
|
||||
*/
|
||||
val baseLayerGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize) }
|
||||
protected var tileBaseImage: Image = ImageGetter.getImage(tileSetStrings.hexagon)
|
||||
var currentTileBaseImageLocation = ""
|
||||
protected var tileBaseImages: ArrayList<Image> = ArrayList()
|
||||
/** List of ;-delimited image locations comprising the layers -
|
||||
* for instance, "desert+flood plains" might have an improvment for which there is a certain image eg "desert+flood plains+farm"
|
||||
* or it might use a generic image, in which case you'd have the "desert+flood plains;academy"
|
||||
* Easier to save and compare than with lists */
|
||||
var tileImagesIdentifier = ""
|
||||
|
||||
// This is for OLD tiles - the "mountain" symbol on mountains for instance
|
||||
protected var baseTerrainOverlayImage: Image? = null
|
||||
protected var baseTerrain: String = ""
|
||||
|
||||
|
||||
val terrainFeatureLayerGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize) }
|
||||
|
||||
// These are for OLD tiles - for instance the "forest" symbol on the forest
|
||||
protected var terrainFeatureOverlayImage: Image? = null
|
||||
protected var terrainFeature: String? = null
|
||||
protected var cityImage: Image? = null
|
||||
@ -120,37 +130,51 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
||||
crosshairImage.isVisible = true
|
||||
}
|
||||
|
||||
fun getTileBaseImageLocation(isRevealed: Boolean): String {
|
||||
if (!isRevealed) return tileSetStrings.hexagon
|
||||
|
||||
fun getTileBaseImageLocations(isRevealed: Boolean): List<String>{
|
||||
if (!isRevealed) return listOf(tileSetStrings.hexagon)
|
||||
if (tileInfo.isCityCenter()) {
|
||||
val terrainAndCity = tileSetStrings.getCityTile(tileInfo.baseTerrain)
|
||||
if (ImageGetter.imageExists(terrainAndCity))
|
||||
return terrainAndCity
|
||||
return listOf(terrainAndCity)
|
||||
if (ImageGetter.imageExists(tileSetStrings.cityTile))
|
||||
return tileSetStrings.cityTile
|
||||
return listOf(tileSetStrings.cityTile)
|
||||
}
|
||||
val baseTerrainTileLocation = tileSetStrings.getBaseTerrainTile(tileInfo.baseTerrain)
|
||||
val shouldShowImprovement = tileInfo.improvement!=null && UnCivGame.Current.settings.showPixelImprovements
|
||||
val baseTerrainTileLocation = tileSetStrings.getTile(tileInfo.baseTerrain)
|
||||
if (tileInfo.terrainFeature != null) {
|
||||
val baseTerrainAndFeatureTileLocation = "$baseTerrainTileLocation+${tileInfo.terrainFeature}"
|
||||
if(tileInfo.improvement!=null && UnCivGame.Current.settings.showPixelImprovements){
|
||||
if(shouldShowImprovement){
|
||||
val basefeatureAndImprovementTileLocation = "$baseTerrainAndFeatureTileLocation+${tileInfo.improvement}"
|
||||
if (ImageGetter.imageExists(basefeatureAndImprovementTileLocation))
|
||||
return basefeatureAndImprovementTileLocation
|
||||
return listOf(basefeatureAndImprovementTileLocation)
|
||||
}
|
||||
|
||||
if (ImageGetter.imageExists(baseTerrainAndFeatureTileLocation))
|
||||
return baseTerrainAndFeatureTileLocation
|
||||
if (ImageGetter.imageExists(baseTerrainAndFeatureTileLocation)) {
|
||||
if(shouldShowImprovement){
|
||||
val improvementImageLocation = tileSetStrings.getTile(tileInfo.improvement!!)
|
||||
if(ImageGetter.imageExists(improvementImageLocation))
|
||||
return listOf(baseTerrainAndFeatureTileLocation, improvementImageLocation)
|
||||
}
|
||||
return listOf(baseTerrainAndFeatureTileLocation)
|
||||
}
|
||||
}
|
||||
|
||||
if(tileInfo.improvement != null && UnCivGame.Current.settings.showPixelImprovements){
|
||||
if(shouldShowImprovement){
|
||||
val baseTerrainAndImprovement = "$baseTerrainTileLocation+${tileInfo.improvement}"
|
||||
|
||||
if (ImageGetter.imageExists(baseTerrainAndImprovement))
|
||||
return baseTerrainAndImprovement
|
||||
return listOf(baseTerrainAndImprovement)
|
||||
}
|
||||
|
||||
if (ImageGetter.imageExists(baseTerrainTileLocation)) return baseTerrainTileLocation
|
||||
return tileSetStrings.hexagon
|
||||
if (ImageGetter.imageExists(baseTerrainTileLocation)){
|
||||
if(shouldShowImprovement){
|
||||
val improvementImageLocation = tileSetStrings.getTile(tileInfo.improvement!!)
|
||||
if(ImageGetter.imageExists(improvementImageLocation))
|
||||
return listOf(baseTerrainTileLocation, improvementImageLocation)
|
||||
}
|
||||
return listOf(baseTerrainTileLocation)
|
||||
}
|
||||
return listOf(tileSetStrings.hexagon)
|
||||
}
|
||||
|
||||
// Used for both the underlying tile and unit overlays, perhaps for other things in the future
|
||||
@ -164,16 +188,20 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
||||
}
|
||||
|
||||
private fun updateTileImage(isRevealed: Boolean) {
|
||||
val tileBaseImageLocation = getTileBaseImageLocation(isRevealed)
|
||||
if (tileBaseImageLocation == currentTileBaseImageLocation) return
|
||||
val tileBaseImageLocations = getTileBaseImageLocations(isRevealed)
|
||||
val identifier = tileBaseImageLocations.joinToString(";")
|
||||
if (identifier == tileImagesIdentifier) return
|
||||
|
||||
tileBaseImage.remove()
|
||||
tileBaseImage = ImageGetter.getImage(tileBaseImageLocation)
|
||||
currentTileBaseImageLocation = tileBaseImageLocation
|
||||
|
||||
baseLayerGroup.addActor(tileBaseImage)
|
||||
setHexagonImageSize(tileBaseImage)
|
||||
tileBaseImage.toBack()
|
||||
for(image in tileBaseImages) image.remove()
|
||||
tileBaseImages.clear()
|
||||
for(location in tileBaseImageLocations.reversed()) { // reversed because we send each one to back
|
||||
val image = ImageGetter.getImage(location)
|
||||
tileBaseImages.add(image)
|
||||
baseLayerGroup.addActor(image)
|
||||
setHexagonImageSize(image)
|
||||
image.toBack()
|
||||
}
|
||||
tileImagesIdentifier = identifier
|
||||
}
|
||||
|
||||
fun showMilitaryUnit(viewingCiv: CivilizationInfo) = showEntireMap
|
||||
@ -187,7 +215,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
||||
hideCircle()
|
||||
if (viewingCiv != null && !showEntireMap
|
||||
&& !viewingCiv.exploredTiles.contains(tileInfo.position)) {
|
||||
tileBaseImage.color = Color.DARK_GRAY
|
||||
tileBaseImages.firstOrNull()?.color = Color.DARK_GRAY
|
||||
return
|
||||
}
|
||||
|
||||
@ -354,12 +382,13 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
||||
}
|
||||
|
||||
private fun updateTileColor(isViewable: Boolean) {
|
||||
tileBaseImage.color =
|
||||
if (ImageGetter.imageExists(tileSetStrings.getBaseTerrainTile(tileInfo.baseTerrain)))
|
||||
var color =
|
||||
if (ImageGetter.imageExists(tileSetStrings.getTile(tileInfo.baseTerrain)))
|
||||
Color.WHITE // no need to color it, it's already colored
|
||||
else tileInfo.getBaseTerrain().getColor()
|
||||
|
||||
if (!isViewable) tileBaseImage.color = tileBaseImage.color.lerp(Color.BLACK, 0.6f)
|
||||
if (!isViewable) color =color.cpy().lerp(Color.BLACK, 0.6f)
|
||||
tileBaseImages.firstOrNull()?.color = color
|
||||
}
|
||||
|
||||
private fun updateTerrainFeatureImage() {
|
||||
|
@ -23,7 +23,7 @@ class TileSetStrings {
|
||||
val waterUnit = unitsLocation+"WaterUnit"
|
||||
|
||||
private val baseTerrainToTile = HashMap<String,String>()
|
||||
fun getBaseTerrainTile(baseTerrain:String): String {
|
||||
fun getTile(baseTerrain:String): String {
|
||||
if(!baseTerrainToTile.containsKey(baseTerrain))
|
||||
baseTerrainToTile[baseTerrain] = "$tilesLocation$baseTerrain"
|
||||
return baseTerrainToTile[baseTerrain]!!
|
||||
|
Loading…
Reference in New Issue
Block a user