Added tile feature tiles to tilesets!

This commit is contained in:
Yair Morgenstern
2019-03-20 11:06:08 +02:00
parent 9d5c6911fd
commit fe9fc110d8
23 changed files with 186 additions and 126 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 B

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 495 B

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 666 B

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 413 B

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 B

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 732 B

After

Width:  |  Height:  |  Size: 698 B

View File

@ -902,7 +902,7 @@ OtherIcons/tileTableBackground
index: -1
OtherIcons/whiteDot
rotate: false
xy: 132, 537
xy: 1531, 1946
size: 1, 1
orig: 1, 1
offset: 0, 0
@ -1175,21 +1175,21 @@ PolicyIcons/Total War
index: -1
PolicyIcons/Trade Unions
rotate: false
xy: 1458, 534
xy: 1458, 533
size: 50, 50
orig: 50, 50
offset: 0, 0
index: -1
PolicyIcons/Universal Suffrage
rotate: false
xy: 1458, 482
xy: 1458, 481
size: 50, 50
orig: 50, 50
offset: 0, 0
index: -1
PolicyIcons/Warrior Code
rotate: false
xy: 1458, 430
xy: 1458, 429
size: 50, 50
orig: 50, 50
offset: 0, 0
@ -2062,13 +2062,6 @@ TileSets/Default/ForestOverlay
orig: 100, 100
offset: 0, 0
index: -1
TileSets/FantasyHex/ForestOverlay
rotate: false
xy: 1048, 1336
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TileSets/ThorfMaps/ForestOverlay
rotate: false
xy: 1048, 1336
@ -2153,13 +2146,6 @@ TileSets/Default/MountainOverlay
orig: 100, 100
offset: 0, 0
index: -1
TileSets/FantasyHex/MountainOverlay
rotate: false
xy: 612, 826
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TileSets/Default/OasisOverlay
rotate: false
xy: 918, 826
@ -2167,13 +2153,6 @@ TileSets/Default/OasisOverlay
orig: 100, 100
offset: 0, 0
index: -1
TileSets/FantasyHex/OasisOverlay
rotate: false
xy: 918, 826
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TileSets/ThorfMaps/OasisOverlay
rotate: false
xy: 918, 826
@ -2202,60 +2181,109 @@ TileSets/ThorfMaps/road
orig: 61, 11
offset: 0, 0
index: -1
TileSets/FantasyHex/City
rotate: false
xy: 1458, 585
size: 32, 35
orig: 32, 35
offset: 0, 0
index: -1
TileSets/FantasyHex/Coast
rotate: false
xy: 1966, 1141
size: 32, 29
orig: 32, 29
xy: 912, 31
size: 32, 27
orig: 32, 27
offset: 0, 0
index: -1
TileSets/FantasyHex/Desert
rotate: false
xy: 488, 538
size: 32, 30
orig: 32, 30
xy: 488, 540
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Desert+Flood plains
rotate: false
xy: 334, 1050
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Desert+Oasis
rotate: false
xy: 408, 744
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Grassland
rotate: false
xy: 334, 1048
size: 32, 30
orig: 32, 30
xy: 1458, 365
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Grassland+Forest
rotate: false
xy: 2015, 1813
size: 31, 29
orig: 31, 29
offset: 0, 0
index: -1
TileSets/FantasyHex/Hill
rotate: false
xy: 1531, 1960
size: 32, 34
orig: 32, 34
xy: 810, 26
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
TileSets/FantasyHex/Hill+Forest
rotate: false
xy: 1531, 1949
size: 32, 45
orig: 32, 45
offset: 0, 0
index: -1
TileSets/FantasyHex/Mountain
rotate: false
xy: 132, 540
size: 32, 38
orig: 32, 38
xy: 132, 542
size: 32, 36
orig: 32, 36
offset: 0, 0
index: -1
TileSets/FantasyHex/Ocean
rotate: false
xy: 810, 29
size: 32, 29
orig: 32, 29
xy: 878, 30
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Plains
rotate: false
xy: 408, 742
size: 32, 30
orig: 32, 30
xy: 1458, 335
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Plains+Forest
rotate: false
xy: 1966, 1137
size: 32, 33
orig: 32, 33
offset: 0, 0
index: -1
TileSets/FantasyHex/Tundra
rotate: false
xy: 1458, 586
size: 32, 34
orig: 32, 34
xy: 1458, 395
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
TileSets/FantasyHex/Tundra+Forest
rotate: false
xy: 844, 26
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
TileSets/ThorfMaps/Coast
@ -2764,245 +2792,245 @@ UnitPromotionIcons/Boarding_Party_II_(Civ5)
index: -1
UnitPromotionIcons/Boarding_Party_I_(Civ5)
rotate: false
xy: 2015, 1822
xy: 2015, 1791
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Bombardment_III_(Civ5)
rotate: false
xy: 1458, 408
xy: 946, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Bombardment_II_(Civ5)
rotate: false
xy: 844, 38
xy: 2018, 780
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Bombardment_I_(Civ5)
rotate: false
xy: 2018, 780
xy: 460, 782
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Charge_(Civ5)
rotate: false
xy: 460, 782
xy: 106, 16
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Coastal_Raider_III_(Civ5)
rotate: false
xy: 106, 16
xy: 2015, 1769
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Coastal_Raider_II_(Civ5)
rotate: false
xy: 2015, 1800
xy: 968, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Coastal_Raider_I_(Civ5)
rotate: false
xy: 1458, 386
xy: 2018, 758
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Cover_II_(Civ5)
rotate: false
xy: 1480, 408
xy: 2015, 1747
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Cover_I_(Civ5)
rotate: false
xy: 866, 38
xy: 990, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Drill_III_(Civ5)
rotate: false
xy: 2018, 758
xy: 2018, 736
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Drill_II_(Civ5)
rotate: false
xy: 2015, 1778
xy: 1012, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Drill_I_(Civ5)
rotate: false
xy: 1458, 364
xy: 2018, 714
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Formation_II_(Civ5)
rotate: false
xy: 1480, 386
xy: 1034, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Formation_I_(Civ5)
rotate: false
xy: 888, 38
xy: 2018, 692
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Indirect_Fire_(Civ5)
rotate: false
xy: 2018, 736
xy: 1056, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Logistics_(Civ5)
rotate: false
xy: 2015, 1756
xy: 2018, 670
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/March_(Civ5)
rotate: false
xy: 1458, 342
xy: 1078, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Mobility_(Civ5)
rotate: false
xy: 1480, 364
xy: 2018, 648
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Range_(Civ5)
rotate: false
xy: 910, 38
xy: 1100, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Scouting_III_(Civ5)
rotate: false
xy: 2018, 714
xy: 2018, 626
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Scouting_II_(Civ5)
rotate: false
xy: 1458, 320
xy: 1122, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Scouting_I_(Civ5)
rotate: false
xy: 1480, 342
xy: 1144, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Sentry_(Civ5)
rotate: false
xy: 932, 38
xy: 1166, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_III_(Civ5)
rotate: false
xy: 2018, 692
xy: 1188, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_II_(Civ5)
rotate: false
xy: 1480, 320
xy: 1210, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_I_(Civ5)
rotate: false
xy: 954, 38
xy: 1232, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Siege_(Civ5)
rotate: false
xy: 2018, 670
xy: 1254, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Targeting_III_(Civ5)
rotate: false
xy: 976, 38
xy: 1276, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Targeting_II_(Civ5)
rotate: false
xy: 2018, 648
xy: 1298, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Targeting_I_(Civ5)
rotate: false
xy: 998, 38
xy: 1320, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Volley_(Civ5)
rotate: false
xy: 2018, 626
xy: 1342, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Wolfpack_III_(Civ5)
rotate: false
xy: 1020, 38
xy: 2000, 1150
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Wolfpack_II_(Civ5)
rotate: false
xy: 1042, 38
xy: 1492, 407
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Wolfpack_I_(Civ5)
rotate: false
xy: 1064, 38
xy: 1492, 385
size: 20, 20
orig: 20, 20
offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 926 KiB

After

Width:  |  Height:  |  Size: 925 KiB

View File

@ -8,10 +8,13 @@ import com.unciv.ui.utils.ImageGetter
import com.unciv.ui.utils.surroundWithCircle
class YieldGroup : HorizontalGroup() {
init {
isTransform = false // performance helper - nothing here is rotated or scaled
}
fun setStats(stats: Stats) {
clearChildren()
for (entry in stats.toHashMap().filter { it.value>0 }) {
for (entry in stats.toHashMap().filter { it.value > 0 }) {
addActor(getStatIconsTable(entry.key.toString(), entry.value.toInt()))
}
pack()
@ -19,7 +22,7 @@ class YieldGroup : HorizontalGroup() {
fun getIcon(statName: String) =
ImageGetter.getStatIcon(statName).surroundWithCircle(20f)
.apply { circle.color= Color.BLACK;circle.color.a=0.5f }
.apply { circle.color = Color.BLACK;circle.color.a = 0.5f }
private fun getStatIconsTable(statName: String, number: Int): Table {
val table = Table()
@ -48,4 +51,4 @@ class YieldGroup : HorizontalGroup() {
table.pack()
return table
}
}
}

View File

@ -15,18 +15,33 @@ import com.unciv.ui.cityscreen.YieldGroup
import com.unciv.ui.utils.ImageGetter
import com.unciv.ui.utils.UnitGroup
import com.unciv.ui.utils.center
import com.unciv.ui.utils.centerX
open class TileGroup(var tileInfo: TileInfo) : Group() {
val tileSetLocation = "TileSets/"+UnCivGame.Current.settings.tileSet +"/"
protected var hexagon :Image= ImageGetter.getImage(tileSetLocation+"Hexagon.png")
protected var baseTerrainImage: Image? = null
/*
Layers:
Base image + overlay
Feature overlay / city overlay
Units, improvements, resources, border
Circle, Crosshair, Fog layer
City name
*/
val baseLayerGroup = Group().apply { isTransform=false }
protected var tileBaseImage :Image= ImageGetter.getImage(tileSetLocation+"Hexagon")
var currentTileBaseImageLocation = ""
protected var baseTerrainOverlayImage: Image? = null
protected var baseTerrain:String=""
protected var terrainFeatureImage: Image? = null
val featureLayerGroup = Group().apply { isTransform=false }
protected var terrainFeatureOverlayImage: Image? = null
protected var terrainFeature:String?=null
protected var cityImage: Image? = null
val miscLayerGroup = Group().apply { isTransform=false }
var resourceImage: Actor? = null
var resource:String?=null
var improvementImage: Actor? = null
@ -35,11 +50,13 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
private val borderImages = HashMap<TileInfo, List<Image>>() // map of neighboring tile to border images
protected var civilianUnitImage: UnitGroup? = null
protected var militaryUnitImage: UnitGroup? = null
private val circleImage = ImageGetter.getCircle() // for blue and red circles on the tile
private val crosshairImage = ImageGetter.getImage("OtherIcons/Crosshair.png") // for when a unit is targeted
private val crosshairImage = ImageGetter.getImage("OtherIcons/Crosshair.png") // for when a unit is targete
protected val fogImage = ImageGetter.getImage(tileSetLocation+"CrosshatchHexagon")
var yieldGroup = YieldGroup()
var lastIsRevealed = false
var showEntireMap = UnCivGame.Current.viewEntireMapForDebug
@ -70,7 +87,6 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
}
private fun addFogImage(groupSize: Float) {
print("Adding fog image")
val imageScale = groupSize * 1.5f / fogImage.width
fogImage.setScale(imageScale)
fogImage.setOrigin(Align.center)
@ -92,18 +108,33 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
crosshairImage.isVisible = true
}
private fun updateTileImage(isRevealed: Boolean) {
hexagon.remove()
val terrainTileLocation = tileSetLocation+tileInfo.baseTerrain
if(!lastIsRevealed && isRevealed && ImageGetter.imageExists(terrainTileLocation))
hexagon = ImageGetter.getImage(terrainTileLocation)
fun getTileBaseImageLocation(isRevealed: Boolean): String {
if(!isRevealed) return tileSetLocation+"Hexagon"
val imageScale = groupSize * 1.5f / hexagon.width
hexagon.setScale(imageScale)
hexagon.setOrigin(Align.center)
hexagon.center(this)
hexagon.zIndex = 0
addActor(hexagon)
val baseTerrainTileLocation = tileSetLocation+tileInfo.baseTerrain
val baseTerrainAndFeatureTileLocation = baseTerrainTileLocation+"+"+tileInfo.terrainFeature
if(tileInfo.terrainFeature!=null && ImageGetter.imageExists(baseTerrainAndFeatureTileLocation))
return baseTerrainAndFeatureTileLocation
if(ImageGetter.imageExists(baseTerrainTileLocation)) return baseTerrainTileLocation
return tileSetLocation+"Hexagon"
}
private fun updateTileImage(isRevealed: Boolean) {
val tileBaseImageLocation = getTileBaseImageLocation(isRevealed)
if(tileBaseImageLocation==currentTileBaseImageLocation) return
tileBaseImage.remove()
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()
addActor(tileBaseImage)
}
fun addAcquirableIcon(){
@ -142,7 +173,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
hideCircle()
if (!showEntireMap
&& !tileInfo.tileMap.gameInfo.getCurrentPlayerCivilization().exploredTiles.contains(tileInfo.position)) {
hexagon.color = Color.BLACK
tileBaseImage.color = Color.BLACK
return
}
@ -170,27 +201,25 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
circleImage.toFront()
for(borderImage in borderImages.flatMap { it.value })
borderImage.toFront()
lastIsRevealed = true
}
private fun updateTerrainBaseImage() {
if (tileInfo.baseTerrain == baseTerrain) return
if(baseTerrainImage!=null){
baseTerrainImage!!.remove()
baseTerrainImage=null
if(baseTerrainOverlayImage!=null){
baseTerrainOverlayImage!!.remove()
baseTerrainOverlayImage=null
}
val imagePath = tileSetLocation + tileInfo.baseTerrain + "Overlay"
if (!ImageGetter.imageExists(imagePath)) return
baseTerrainImage = ImageGetter.getImage(imagePath)
baseTerrainImage!!.run {
baseTerrainOverlayImage = ImageGetter.getImage(imagePath)
baseTerrainOverlayImage!!.run {
color.a = 0.25f
setSize(40f, 40f)
center(this@TileGroup)
}
addActor(baseTerrainImage)
addActor(baseTerrainOverlayImage)
}
private fun updateCityImage() {
@ -251,7 +280,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
// So we set it to 0.75
image.moveBy(-relativeWorldPosition.x * 0.75f * 25f, -relativeWorldPosition.y * 0.75f * 25f)
// And now, move it within the hexagon side according to i.
// And now, move it within the tileBaseImage side according to i.
// Remember, if from the center of the heagon to the middle of the side is an (a,b) vecctor,
// Then within the side, which is of course perpendicular to the (a,b) vector,
// we can move with multiples of (b,-a) which is perpendicular to (a,b)
@ -309,23 +338,25 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
}
private fun updateTileColor(isViewable: Boolean) {
hexagon.color =
tileBaseImage.color =
if (ImageGetter.imageExists(tileSetLocation + tileInfo.baseTerrain)) Color.WHITE // no need to color it, it's already colored
else tileInfo.getBaseTerrain().getColor()
if (!isViewable) hexagon.color = hexagon.color.lerp(Color.BLACK, 0.6f)
if (!isViewable) tileBaseImage.color = tileBaseImage.color.lerp(Color.BLACK, 0.6f)
}
private fun updateTerrainFeatureImage() {
if (tileInfo.terrainFeature != terrainFeature) {
terrainFeature = tileInfo.terrainFeature
if(terrainFeatureImage!=null) terrainFeatureImage!!.remove()
terrainFeatureImage = null
if(terrainFeatureOverlayImage!=null) terrainFeatureOverlayImage!!.remove()
terrainFeatureOverlayImage = null
if(terrainFeature!=null) {
terrainFeatureImage = ImageGetter.getImage(tileSetLocation +"$terrainFeature"+"Overlay")
addActor(terrainFeatureImage)
terrainFeatureImage!!.run {
val terrainFeatureOverlayLocation = tileSetLocation +"$terrainFeature"+"Overlay"
if(!ImageGetter.imageExists(terrainFeatureOverlayLocation)) return
terrainFeatureOverlayImage = ImageGetter.getImage(terrainFeatureOverlayLocation)
addActor(terrainFeatureOverlayImage)
terrainFeatureOverlayImage!!.run {
setSize(30f, 30f)
setColor(1f, 1f, 1f, 0.5f)
center(this@TileGroup)
@ -402,9 +433,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
fun showCircle(color: Color) {
circleImage.isVisible = true
val colorCopy = color.cpy()
colorCopy.a = 0.3f
circleImage.color = colorCopy
circleImage.color = color.cpy().apply { a=0.3f }
}
fun hideCircle() {

View File

@ -46,7 +46,7 @@ class WorldTileGroup(internal val worldScreen: WorldScreen, tileInfo: TileInfo)
// order by z index!
cityImage?.toFront()
terrainFeatureImage?.toFront()
terrainFeatureOverlayImage?.toFront()
yieldGroup.toFront()
improvementImage?.toFront()
resourceImage?.toFront()