Added different city tiles for different locations

This commit is contained in:
Yair Morgenstern 2019-03-20 15:15:55 +02:00
parent 2503da2ed0
commit 973cfd50a2
19 changed files with 128 additions and 72 deletions

View File

@ -3,7 +3,9 @@
Flag Icons made by [Freepik](https://www.flaticon.com/authors/freepik) from [www.flaticon.com](https://www.flaticon.com)
and licensed by Creative Commons 3.0
Tile icons for the "Fantasy Hex" tileset belong to CuddlyClover @ https://cuddlyclover.itch.io/fantasy-hex-tiles
Base tile icons for the "Fantasy Hex" tileset belong to CuddlyClover @ https://cuddlyclover.itch.io/fantasy-hex-tiles with a few additions by me
Trees for the jungle tiles in the "Fantasy Hex" are extracted from [Desert Strike for the Amiga](http://eab.abime.net/showthread.php?t=67078&styleid=4)
Tile icons for the "ThorfMaps tileset belong to Thorfinn Tait and are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Based on work at www.thorfmaps.com.

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 613 B

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

View File

@ -746,7 +746,21 @@ ImprovementIcons/Railroad
orig: 100, 100
offset: 0, 0
index: -1
OtherIcons/Railroad
TileSets/Default/Railroad
rotate: false
xy: 1938, 824
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TileSets/FantasyHex/Railroad
rotate: false
xy: 1938, 824
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TileSets/ThorfMaps/Railroad
rotate: false
xy: 1938, 824
size: 100, 100
@ -788,13 +802,6 @@ OtherIcons/Circle
orig: 178, 178
offset: 0, 0
index: -1
OtherIcons/City
rotate: false
xy: 306, 946
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
OtherIcons/Crosshair
rotate: false
xy: 640, 1438
@ -1175,21 +1182,21 @@ PolicyIcons/Total War
index: -1
PolicyIcons/Trade Unions
rotate: false
xy: 1458, 533
xy: 1458, 532
size: 50, 50
orig: 50, 50
offset: 0, 0
index: -1
PolicyIcons/Universal Suffrage
rotate: false
xy: 1458, 481
xy: 1458, 480
size: 50, 50
orig: 50, 50
offset: 0, 0
index: -1
PolicyIcons/Warrior Code
rotate: false
xy: 1458, 429
xy: 1458, 428
size: 50, 50
orig: 50, 50
offset: 0, 0
@ -2013,6 +2020,20 @@ TechIcons/Writing
orig: 100, 100
offset: 0, 0
index: -1
TileSets/Default/City
rotate: false
xy: 306, 946
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TileSets/ThorfMaps/City
rotate: false
xy: 306, 946
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TileSets/Default/CrosshatchHexagon
rotate: false
xy: 2, 1568
@ -2155,7 +2176,21 @@ TileSets/ThorfMaps/road
index: -1
TileSets/FantasyHex/City
rotate: false
xy: 1458, 585
xy: 1492, 584
size: 32, 35
orig: 32, 35
offset: 0, 0
index: -1
TileSets/FantasyHex/Grassland+City
rotate: false
xy: 1492, 584
size: 32, 35
orig: 32, 35
offset: 0, 0
index: -1
TileSets/FantasyHex/Hill+City
rotate: false
xy: 1492, 584
size: 32, 35
orig: 32, 35
offset: 0, 0
@ -2174,23 +2209,30 @@ TileSets/FantasyHex/Desert
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Desert+City
rotate: false
xy: 1966, 1135
size: 32, 35
orig: 32, 35
offset: 0, 0
index: -1
TileSets/FantasyHex/Desert+Flood plains
rotate: false
xy: 1458, 365
xy: 1458, 327
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Desert+Oasis
rotate: false
xy: 1560, 591
xy: 912, 30
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Grassland
rotate: false
xy: 878, 30
xy: 946, 30
size: 32, 28
orig: 32, 28
offset: 0, 0
@ -2204,7 +2246,7 @@ TileSets/FantasyHex/Grassland+Forest
index: -1
TileSets/FantasyHex/Grassland+Jungle
rotate: false
xy: 1492, 585
xy: 1526, 585
size: 32, 34
orig: 32, 34
offset: 0, 0
@ -2218,7 +2260,7 @@ TileSets/FantasyHex/Grassland+Marsh
index: -1
TileSets/FantasyHex/Hill
rotate: false
xy: 1458, 395
xy: 1458, 357
size: 32, 32
orig: 32, 32
offset: 0, 0
@ -2232,56 +2274,70 @@ TileSets/FantasyHex/Hill+Forest
index: -1
TileSets/FantasyHex/Lakes
rotate: false
xy: 1458, 335
xy: 980, 30
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Mountain
rotate: false
xy: 132, 542
xy: 1458, 584
size: 32, 36
orig: 32, 36
offset: 0, 0
index: -1
TileSets/FantasyHex/Ocean
rotate: false
xy: 912, 30
xy: 1014, 30
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Plains
rotate: false
xy: 946, 30
xy: 1048, 30
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Plains+City
rotate: false
xy: 810, 23
size: 32, 35
orig: 32, 35
offset: 0, 0
index: -1
TileSets/FantasyHex/Plains+Forest
rotate: false
xy: 810, 25
xy: 844, 25
size: 32, 33
orig: 32, 33
offset: 0, 0
index: -1
TileSets/FantasyHex/Plains+Jungle
rotate: false
xy: 1966, 1135
xy: 1458, 391
size: 32, 35
orig: 32, 35
offset: 0, 0
index: -1
TileSets/FantasyHex/Tundra
rotate: false
xy: 1526, 587
xy: 1560, 587
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
TileSets/FantasyHex/Tundra+City
rotate: false
xy: 132, 541
size: 32, 37
orig: 32, 37
offset: 0, 0
index: -1
TileSets/FantasyHex/Tundra+Forest
rotate: false
xy: 844, 26
xy: 878, 26
size: 32, 32
orig: 32, 32
offset: 0, 0
@ -2799,7 +2855,7 @@ UnitPromotionIcons/Boarding_Party_I_(Civ5)
index: -1
UnitPromotionIcons/Bombardment_III_(Civ5)
rotate: false
xy: 980, 38
xy: 1082, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2834,7 +2890,7 @@ UnitPromotionIcons/Coastal_Raider_III_(Civ5)
index: -1
UnitPromotionIcons/Coastal_Raider_II_(Civ5)
rotate: false
xy: 1002, 38
xy: 1104, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2855,7 +2911,7 @@ UnitPromotionIcons/Cover_II_(Civ5)
index: -1
UnitPromotionIcons/Cover_I_(Civ5)
rotate: false
xy: 1024, 38
xy: 1126, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2869,7 +2925,7 @@ UnitPromotionIcons/Drill_III_(Civ5)
index: -1
UnitPromotionIcons/Drill_II_(Civ5)
rotate: false
xy: 1046, 38
xy: 1148, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2883,7 +2939,7 @@ UnitPromotionIcons/Drill_I_(Civ5)
index: -1
UnitPromotionIcons/Formation_II_(Civ5)
rotate: false
xy: 1068, 38
xy: 1170, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2897,7 +2953,7 @@ UnitPromotionIcons/Formation_I_(Civ5)
index: -1
UnitPromotionIcons/Indirect_Fire_(Civ5)
rotate: false
xy: 1090, 38
xy: 1192, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2911,7 +2967,7 @@ UnitPromotionIcons/Logistics_(Civ5)
index: -1
UnitPromotionIcons/March_(Civ5)
rotate: false
xy: 1112, 38
xy: 1214, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2925,7 +2981,7 @@ UnitPromotionIcons/Mobility_(Civ5)
index: -1
UnitPromotionIcons/Range_(Civ5)
rotate: false
xy: 1134, 38
xy: 1236, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2939,98 +2995,98 @@ UnitPromotionIcons/Scouting_III_(Civ5)
index: -1
UnitPromotionIcons/Scouting_II_(Civ5)
rotate: false
xy: 1156, 38
xy: 1258, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Scouting_I_(Civ5)
rotate: false
xy: 1178, 38
xy: 1280, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Sentry_(Civ5)
rotate: false
xy: 1200, 38
xy: 1302, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_III_(Civ5)
rotate: false
xy: 1222, 38
xy: 1324, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_II_(Civ5)
rotate: false
xy: 1244, 38
xy: 1346, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_I_(Civ5)
rotate: false
xy: 1266, 38
xy: 2000, 1150
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Siege_(Civ5)
rotate: false
xy: 1288, 38
xy: 1492, 406
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Targeting_III_(Civ5)
rotate: false
xy: 1310, 38
xy: 1492, 384
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Targeting_II_(Civ5)
rotate: false
xy: 1332, 38
xy: 1492, 362
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Targeting_I_(Civ5)
rotate: false
xy: 2000, 1150
xy: 1492, 340
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Volley_(Civ5)
rotate: false
xy: 1492, 407
xy: 442, 752
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Wolfpack_III_(Civ5)
rotate: false
xy: 1492, 385
xy: 1510, 562
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Wolfpack_II_(Civ5)
rotate: false
xy: 1492, 363
xy: 1510, 540
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Wolfpack_I_(Civ5)
rotate: false
xy: 1492, 341
xy: 1510, 518
size: 20, 20
orig: 20, 20
offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 931 KiB

After

Width:  |  Height:  |  Size: 940 KiB

View File

@ -17,7 +17,7 @@ class UnCivGame : Game() {
* This exists so that when debugging we can see the entire map.
* Remember to turn this to false before commit and upload!
*/
val viewEntireMapForDebug = true
val viewEntireMapForDebug = false
// For when you need to test something in an advanced game and don't have time to faff around
val superchargedForDebug = false

View File

@ -114,6 +114,7 @@ class CivilizationInfo {
fun getCapital()=cities.first { it.isCapital() }
fun isPlayerCivilization() = playerType==PlayerType.Human
fun isCurrentPlayer() = gameInfo.getCurrentPlayerCivilization()==this
fun isBarbarianCivilization() = gameInfo.getBarbarianCivilization()==this
fun getStatsForNextTurn():Stats{

View File

@ -19,7 +19,7 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski
background = ImageGetter.getDrawable("OtherIcons/civTableBackground.png")
.tint(city.civInfo.getNation().getColor())
isTransform = true // If this is not set then the city button won't scale!
touchable= Touchable.enabled // So you can click anywhere on the button to go to the city
touchable= Touchable.disabled
}
fun update(isCityViewable:Boolean) {
@ -30,7 +30,8 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski
label.setFontColor(city.civInfo.getNation().getSecondaryColor())
clear()
if (city.civInfo.isPlayerCivilization()) {
if (city.civInfo.isCurrentPlayer()) {
Touchable.enabled // So you can click anywhere on the button to go to the city
onClick {
if (!tileGroup.selectCity(city)) {
UnCivGame.Current.screen = CityScreen(city)

View File

@ -20,6 +20,7 @@ import com.unciv.ui.utils.centerX
open class TileGroup(var tileInfo: TileInfo) : Group() {
val groupSize = 54f
val tileSetLocation = "TileSets/"+UnCivGame.Current.settings.tileSet +"/"
/*
@ -30,18 +31,18 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
Circle, Crosshair, Fog layer
City name
*/
val baseLayerGroup = Group().apply { isTransform=false }
val baseLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize) }
protected var tileBaseImage :Image= ImageGetter.getImage(tileSetLocation+"Hexagon")
var currentTileBaseImageLocation = ""
protected var baseTerrainOverlayImage: Image? = null
protected var baseTerrain:String=""
val featureLayerGroup = Group().apply { isTransform=false }
val featureLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize) }
protected var terrainFeatureOverlayImage: Image? = null
protected var terrainFeature:String?=null
protected var cityImage: Image? = null
val miscLayerGroup = Group().apply { isTransform=false }
val miscLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize) }
var resourceImage: Actor? = null
var resource:String?=null
var improvementImage: Actor? = null
@ -51,7 +52,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
protected var civilianUnitImage: UnitGroup? = null
protected var militaryUnitImage: UnitGroup? = null
val circleCrosshairFogLayerGroup = Group().apply { isTransform=false }
val circleCrosshairFogLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize) }
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 targete
protected val fogImage = ImageGetter.getImage(tileSetLocation+"CrosshatchHexagon")
@ -65,7 +66,6 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
var image: Image? = null
}
val groupSize = 54f
init {
this.setSize(groupSize, groupSize)
this.addActor(baseLayerGroup)
@ -114,8 +114,12 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
fun getTileBaseImageLocation(isRevealed: Boolean): String {
if(!isRevealed) return tileSetLocation+"Hexagon"
if(tileInfo.isCityCenter() && ImageGetter.imageExists(tileSetLocation+"City"))
return tileSetLocation+"City"
if(tileInfo.isCityCenter()){
if(ImageGetter.imageExists(tileSetLocation+tileInfo.baseTerrain+"+City"))
return tileSetLocation+tileInfo.baseTerrain+"+City"
if(ImageGetter.imageExists(tileSetLocation+"City"))
return tileSetLocation+"City"
}
val baseTerrainTileLocation = tileSetLocation+tileInfo.baseTerrain
val baseTerrainAndFeatureTileLocation = baseTerrainTileLocation+"+"+tileInfo.terrainFeature
if(tileInfo.terrainFeature!=null && ImageGetter.imageExists(baseTerrainAndFeatureTileLocation))
@ -197,14 +201,8 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
updateRoadImages()
updateBorderImages()
crosshairImage.toFront()
crosshairImage.isVisible = false
fogImage.toFront()
fogImage.isVisible = !(isViewable || showEntireMap)
circleImage.toFront()
for(borderImage in borderImages.flatMap { it.value })
borderImage.toFront()
}
private fun updateTerrainBaseImage() {
@ -227,11 +225,11 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
}
private fun updateCityImage() {
if(currentTileBaseImageLocation == tileSetLocation+"City") // have a city tile, don't need an overlay
if(!ImageGetter.imageExists(tileSetLocation+"City")) // have a city tile, don't need an overlay
return
if (cityImage == null && tileInfo.isCityCenter()) {
cityImage = ImageGetter.getImage("OtherIcons/City.png")
cityImage = ImageGetter.getImage(tileSetLocation+"City")
featureLayerGroup.addActor(cityImage)
cityImage!!.run {
setSize(60f, 60f)
@ -322,7 +320,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
if (roadStatus == RoadStatus.None) continue // no road image
val image = if (roadStatus == RoadStatus.Road) ImageGetter.getDot(Color.BROWN)
else ImageGetter.getImage("OtherIcons/Railroad.png")
else ImageGetter.getImage(tileSetLocation+"Railroad.png")
roadImage.image = image
val relativeHexPosition = tileInfo.position.cpy().sub(neighbor.position)

View File

@ -10,6 +10,7 @@ import com.unciv.ui.worldscreen.WorldScreen
class WorldTileGroup(internal val worldScreen: WorldScreen, tileInfo: TileInfo) : TileGroup(tileInfo) {
var cityButton: CityButton? = null
fun selectUnit(unit: MapUnit) {
@ -67,12 +68,10 @@ class WorldTileGroup(internal val worldScreen: WorldScreen, tileInfo: TileInfo)
if (cityButton == null) {
cityButton = CityButton(city, this, CameraStageBaseScreen.skin)
addActor(cityButton)
toFront() // so this tile is rendered over neighboring tiles
}
cityButton!!.update(viewable)
cityButton!!.center(this)
}
}

View File

@ -43,8 +43,7 @@ class TileGroupMap<T: TileGroup>(tileGroups:Collection<T>, padding:Float): Group
for(group in featureLayers) addActor(group)
for(group in miscLayers) addActor(group)
for(group in circleCrosshairFogLayers) addActor(group)
for(group in tileGroups) addActor(group) // The above layers are for the visual layers, this is for the clicks
for(group in tileGroups) addActor(group) // The above layers are for the visual layers, this is for the cli
// there are tiles "below the zero",