Added pixel sprites for land and water units!
BIN
android/Images/TileSets/FantasyHex/CivilianLandUnit.png
Normal file
After Width: | Height: | Size: 368 B |
BIN
android/Images/TileSets/FantasyHex/LandUnit.png
Normal file
After Width: | Height: | Size: 368 B |
BIN
android/Images/TileSets/FantasyHex/Settler.png
Normal file
After Width: | Height: | Size: 375 B |
BIN
android/Images/TileSets/FantasyHex/WaterUnit.png
Normal file
After Width: | Height: | Size: 230 B |
BIN
android/Images/TileSets/FantasyHex/Worker.png
Normal file
After Width: | Height: | Size: 377 B |
|
@ -2449,7 +2449,7 @@ TileSets/FantasyHex/TopRightBorder
|
|||
index: -1
|
||||
TileSets/FantasyHex/Grassland+Forest
|
||||
rotate: false
|
||||
xy: 226, 12
|
||||
xy: 294, 12
|
||||
size: 31, 29
|
||||
orig: 31, 29
|
||||
offset: 0, 0
|
||||
|
@ -2489,23 +2489,30 @@ TileSets/FantasyHex/Lakes
|
|||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/LandUnit
|
||||
rotate: false
|
||||
xy: 750, 1395
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Mountain
|
||||
rotate: false
|
||||
xy: 750, 1387
|
||||
xy: 972, 1345
|
||||
size: 32, 36
|
||||
orig: 32, 36
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Ocean
|
||||
rotate: false
|
||||
xy: 972, 1353
|
||||
xy: 1698, 76
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Plains
|
||||
rotate: false
|
||||
xy: 1698, 76
|
||||
xy: 666, 69
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
|
@ -2519,46 +2526,53 @@ TileSets/FantasyHex/Plains+City
|
|||
index: -1
|
||||
TileSets/FantasyHex/Plains+Forest
|
||||
rotate: false
|
||||
xy: 666, 64
|
||||
xy: 570, 36
|
||||
size: 32, 33
|
||||
orig: 32, 33
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Plains+Jungle
|
||||
rotate: false
|
||||
xy: 570, 34
|
||||
xy: 874, 20
|
||||
size: 32, 35
|
||||
orig: 32, 35
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/TopBorder
|
||||
rotate: false
|
||||
xy: 874, 27
|
||||
xy: 604, 17
|
||||
size: 32, 28
|
||||
orig: 32, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tundra
|
||||
rotate: false
|
||||
xy: 604, 13
|
||||
xy: 158, 10
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tundra+City
|
||||
rotate: false
|
||||
xy: 158, 7
|
||||
xy: 192, 7
|
||||
size: 32, 35
|
||||
orig: 32, 35
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/Tundra+Forest
|
||||
rotate: false
|
||||
xy: 192, 10
|
||||
xy: 226, 9
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TileSets/FantasyHex/WaterUnit
|
||||
rotate: false
|
||||
xy: 260, 15
|
||||
size: 32, 26
|
||||
orig: 32, 26
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
UnitIcons/Anti-Aircraft Gun
|
||||
rotate: false
|
||||
xy: 1344, 1433
|
||||
|
|
Before Width: | Height: | Size: 1,015 KiB After Width: | Height: | Size: 1,016 KiB |
|
@ -18,7 +18,6 @@ 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
|
||||
|
||||
|
@ -36,10 +35,11 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||
protected var baseTerrainOverlayImage: Image? = null
|
||||
protected var baseTerrain:String=""
|
||||
|
||||
val featureLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize) }
|
||||
val terrainFeatureLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize) }
|
||||
protected var terrainFeatureOverlayImage: Image? = null
|
||||
protected var terrainFeature:String?=null
|
||||
protected var cityImage: Image? = null
|
||||
protected var pixelMilitaryUnitImage: Image? = null
|
||||
|
||||
val miscLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize) }
|
||||
var resourceImage: Actor? = null
|
||||
|
@ -72,7 +72,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||
init {
|
||||
this.setSize(groupSize, groupSize)
|
||||
this.addActor(baseLayerGroup)
|
||||
this.addActor(featureLayerGroup)
|
||||
this.addActor(terrainFeatureLayerGroup)
|
||||
this.addActor(miscLayerGroup)
|
||||
this.addActor(unitLayerGroup)
|
||||
this.addActor(cityButtonLayerGroup)
|
||||
|
@ -138,6 +138,16 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||
return tileSetStrings.hexagon
|
||||
}
|
||||
|
||||
// Used for both the underlying tile and unit overlays, perhaps for other things in the future
|
||||
// Parent should already be set when calling
|
||||
fun setHexagonImageSize(hexagonImage:Image){
|
||||
val imageScale = groupSize * 1.5f / hexagonImage.width
|
||||
// Using "scale" can get really confusing when positioning, how about no
|
||||
hexagonImage.setSize(hexagonImage.width*imageScale, hexagonImage.height*imageScale)
|
||||
hexagonImage.centerX(hexagonImage.parent)
|
||||
hexagonImage.y = -groupSize/6
|
||||
}
|
||||
|
||||
private fun updateTileImage(isRevealed: Boolean) {
|
||||
val tileBaseImageLocation = getTileBaseImageLocation(isRevealed)
|
||||
if(tileBaseImageLocation==currentTileBaseImageLocation) return
|
||||
|
@ -146,14 +156,9 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||
tileBaseImage = ImageGetter.getImage(tileBaseImageLocation)
|
||||
currentTileBaseImageLocation = tileBaseImageLocation
|
||||
|
||||
val imageScale = groupSize * 1.5f / tileBaseImage.width
|
||||
// Using "scale" can get really confusing when positioning, how about no
|
||||
tileBaseImage.setSize(tileBaseImage.width*imageScale, tileBaseImage.height*imageScale)
|
||||
tileBaseImage.centerX(this)
|
||||
|
||||
tileBaseImage.y = -groupSize/6
|
||||
tileBaseImage.toBack()
|
||||
baseLayerGroup.addActor(tileBaseImage)
|
||||
setHexagonImageSize(tileBaseImage)
|
||||
tileBaseImage.toBack()
|
||||
}
|
||||
|
||||
fun addAcquirableIcon(){
|
||||
|
@ -207,6 +212,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||
updateTileImage(true)
|
||||
updateTerrainBaseImage()
|
||||
updateTerrainFeatureImage()
|
||||
updatePixelMilitaryUnit(showMilitaryUnit)
|
||||
updateCityImage()
|
||||
updateTileColor(tileIsViewable)
|
||||
|
||||
|
@ -251,7 +257,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||
return
|
||||
|
||||
cityImage = ImageGetter.getImage(cityOverlayLocation)
|
||||
featureLayerGroup.addActor(cityImage)
|
||||
terrainFeatureLayerGroup.addActor(cityImage)
|
||||
cityImage!!.run {
|
||||
setSize(60f, 60f)
|
||||
center(this@TileGroup)
|
||||
|
@ -358,7 +364,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||
image.setOrigin(0f, 1f) // This is so that the rotation is calculated from the middle of the road and not the edge
|
||||
|
||||
image.rotation = (180 / Math.PI * Math.atan2(relativeWorldPosition.y.toDouble(), relativeWorldPosition.x.toDouble())).toFloat()
|
||||
featureLayerGroup.addActor(image)
|
||||
terrainFeatureLayerGroup.addActor(image)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -382,7 +388,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||
val terrainFeatureOverlayLocation = tileSetStrings.getTerrainFeatureOverlay(terrainFeature!!)
|
||||
if(!ImageGetter.imageExists(terrainFeatureOverlayLocation)) return
|
||||
terrainFeatureOverlayImage = ImageGetter.getImage(terrainFeatureOverlayLocation)
|
||||
featureLayerGroup.addActor(terrainFeatureOverlayImage)
|
||||
terrainFeatureLayerGroup.addActor(terrainFeatureOverlayImage)
|
||||
terrainFeatureOverlayImage!!.run {
|
||||
setSize(30f, 30f)
|
||||
setColor(1f, 1f, 1f, 0.5f)
|
||||
|
@ -392,6 +398,30 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||
}
|
||||
}
|
||||
|
||||
fun updatePixelMilitaryUnit(showMilitaryUnit: Boolean) {
|
||||
if (tileInfo.militaryUnit==null || !showMilitaryUnit) {
|
||||
if (pixelMilitaryUnitImage != null) {
|
||||
pixelMilitaryUnitImage!!.remove()
|
||||
pixelMilitaryUnitImage = null
|
||||
}
|
||||
} else {
|
||||
if (pixelMilitaryUnitImage == null) {
|
||||
var imageLocation = ""
|
||||
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
|
||||
|
||||
if (imageLocation != "") {
|
||||
val pixelUnitImage = ImageGetter.getImage(imageLocation)
|
||||
terrainFeatureLayerGroup.addActor(pixelUnitImage)
|
||||
setHexagonImageSize(pixelUnitImage)// Treat this as A TILE, which gets overlayed on the base tile.
|
||||
pixelMilitaryUnitImage=pixelUnitImage
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateImprovementImage(showResourcesAndImprovements: Boolean) {
|
||||
if (improvementImage != null) {
|
||||
improvementImage!!.remove()
|
||||
|
|
|
@ -12,6 +12,9 @@ class TileSetStrings {
|
|||
val cityOverlay = tileSetLocation+"CityOverlay"
|
||||
val railroad = tileSetLocation+"Railroad"
|
||||
|
||||
val landUnit = tileSetLocation+"LandUnit"
|
||||
val waterUnit = tileSetLocation+"WaterUnit"
|
||||
|
||||
private val baseTerrainToTile = HashMap<String,String>()
|
||||
fun getBaseTerrainTile(baseTerrain:String): String {
|
||||
if(!baseTerrainToTile.containsKey(baseTerrain))
|
||||
|
|
|
@ -131,10 +131,8 @@ object ImageGetter {
|
|||
if(imageExists("UnitPromotionIcons/$basePromotionName")) {
|
||||
val icon = getImage("UnitPromotionIcons/$basePromotionName")
|
||||
icon.color = colorFromRGB(255,226,0)
|
||||
var circle = icon.surroundWithCircle(30f)
|
||||
val circle = icon.surroundWithCircle(30f)
|
||||
circle.circle.color = colorFromRGB(0,12,49)
|
||||
// circle = circle.surroundWithCircle(40f)
|
||||
// circle.circle.color = colorFromRGB(255,226,0)
|
||||
if(level!=0){
|
||||
val starTable = Table().apply { defaults().pad(2f) }
|
||||
for(i in 1..level) starTable.add(getImage("OtherIcons/Star")).size(8f)
|
||||
|
|
|
@ -37,7 +37,7 @@ class TileGroupMap<T: TileGroup>(val tileGroups:Collection<T>, padding:Float): G
|
|||
for(group in tileGroups.sortedByDescending { it.tileInfo.position.x + it.tileInfo.position.y }){
|
||||
// now, we steal the subgroups from all the tilegroups, that's how we form layers!
|
||||
baseLayers.add(group.baseLayerGroup.apply { setPosition(group.x,group.y) })
|
||||
featureLayers.add(group.featureLayerGroup.apply { setPosition(group.x,group.y) })
|
||||
featureLayers.add(group.terrainFeatureLayerGroup.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) })
|
||||
cityButtonLayers.add(group.cityButtonLayerGroup.apply { setPosition(group.x,group.y) })
|
||||
|
|