Fantasy hex tileset is go!

This commit is contained in:
Yair Morgenstern 2019-03-19 18:35:58 +02:00
parent 21377f63e7
commit d6f3ab3f40
41 changed files with 571 additions and 460 deletions

View file

@ -3,6 +3,8 @@
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
All the following are from [the Noun Project](https://thenounproject.com) licenced under either Creative Commons or Public Domain

View file

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

Before

Width:  |  Height:  |  Size: 140 B

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 882 KiB

After

Width:  |  Height:  |  Size: 882 KiB

View file

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.app"
minSdkVersion 14
targetSdkVersion 28
versionCode 216
versionName "2.13.14"
versionCode 217
versionName "2.13.15"
}
// Had to add this crap for Travis to build, it wanted to sign the app

View file

@ -6,6 +6,7 @@ import com.badlogic.gdx.utils.Json
import com.unciv.GameSettings
import com.unciv.logic.map.TileMap
import com.unciv.ui.saves.Gzip
import com.unciv.ui.utils.ImageGetter
class GameSaver {
private val saveFilesFolder = "SaveFiles"
@ -54,7 +55,12 @@ class GameSaver {
fun getGeneralSettings(): GameSettings {
val settingsFile = getGeneralSettingsFile()
if(!settingsFile.exists()) return GameSettings()
return json().fromJson(GameSettings::class.java, settingsFile)
val settings = json().fromJson(GameSettings::class.java, settingsFile)
val currentTileSets = ImageGetter.atlas.regions.filter { it.name.startsWith("TileSets") }
.map { it.name.split("/")[1] }.distinct()
if(settings.tileSet !in currentTileSets) settings.tileSet = "Default"
return settings
}
fun setGeneralSettings(gameSettings: GameSettings){

View file

@ -7,6 +7,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
import com.unciv.GameParameters
import com.unciv.UnCivGame
import com.unciv.logic.GameSaver
import com.unciv.logic.map.TileMap
import com.unciv.models.gamebasics.GameBasics
@ -23,6 +24,8 @@ import com.unciv.ui.utils.onClick
import com.unciv.ui.worldscreen.TileGroupMap
class MapEditorScreen(): CameraStageBaseScreen(){
val tileSetLocation = "TileSets/"+UnCivGame.Current.settings.tileSet +"/"
var clearTerrainFeature=false
var selectedTerrain : Terrain?=null
var clearResource=false
@ -39,7 +42,7 @@ class MapEditorScreen(): CameraStageBaseScreen(){
}
fun getHex(color: Color, image: Actor?=null): Group {
val hex = ImageGetter.getImage("TerrainIcons/Hexagon.png")
val hex = ImageGetter.getImage(tileSetLocation + "Hexagon")
hex.color = color
hex.width*=0.3f
hex.height*=0.3f
@ -149,10 +152,10 @@ class MapEditorScreen(): CameraStageBaseScreen(){
var color = Color.WHITE
if (terrain.type == TerrainType.TerrainFeature)
iconPath = "TerrainIcons/${terrain.name}.png"
iconPath = tileSetLocation + terrain.name+"Overlay"
else {
color = terrain.getColor()
val imagePath = "TerrainIcons/" + terrain.name
val imagePath = tileSetLocation + terrain.name+"Overlay"
if (ImageGetter.imageExists(imagePath)) {
iconPath = imagePath
}

View file

@ -17,15 +17,16 @@ import com.unciv.ui.utils.UnitGroup
import com.unciv.ui.utils.center
open class TileGroup(var tileInfo: TileInfo) : Group() {
val tileSetLocation = "TerrainIcons/"+UnCivGame.Current.settings.tileSet +"/"
val tileSetLocation = "TileSets/"+UnCivGame.Current.settings.tileSet +"/"
protected var hexagon :Image= ImageGetter.getImage("TerrainIcons/Hexagon.png")
protected var hexagon :Image= ImageGetter.getImage(tileSetLocation+"Hexagon.png")
protected var baseTerrainImage: Image? = null
protected var baseTerrain:String=""
protected var terrainFeatureImage: Image? = null
protected var terrainFeature:String?=null
protected var cityImage: Image? = null
var resourceImage: Actor? = null
var resource:String?=null
var improvementImage: Actor? = null
@ -36,8 +37,9 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
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
protected val fogImage = ImageGetter.getImage("TerrainIcons/CrosshatchHexagon")
protected val fogImage = ImageGetter.getImage(tileSetLocation+"CrosshatchHexagon")
var yieldGroup = YieldGroup()
var lastIsRevealed = false
var showEntireMap = UnCivGame.Current.viewEntireMapForDebug
@ -46,11 +48,11 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
var image: Image? = null
}
val groupSize = 54f
init {
val groupSize = 54f
this.setSize(groupSize, groupSize)
addHexagon(groupSize)
updateTileImage(false)
addCircleImage()
addFogImage(groupSize)
@ -68,6 +70,7 @@ 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)
@ -89,9 +92,10 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
crosshairImage.isVisible = true
}
private fun addHexagon(groupSize: Float) {
private fun updateTileImage(isRevealed: Boolean) {
hexagon.remove()
val terrainTileLocation = tileSetLocation+tileInfo.baseTerrain
if(ImageGetter.imageExists(terrainTileLocation))
if(!lastIsRevealed && isRevealed && ImageGetter.imageExists(terrainTileLocation))
hexagon = ImageGetter.getImage(terrainTileLocation)
val imageScale = groupSize * 1.5f / hexagon.width
@ -142,6 +146,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
return
}
updateTileImage(true)
updateTerrainBaseImage()
updateTerrainFeatureImage()
updateCityImage()
@ -162,6 +167,11 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
fogImage.toFront()
fogImage.isVisible = !(isViewable || showEntireMap)
circleImage.toFront()
for(borderImage in borderImages.flatMap { it.value })
borderImage.toFront()
lastIsRevealed = true
}
private fun updateTerrainBaseImage() {
@ -299,9 +309,11 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
}
private fun updateTileColor(isViewable: Boolean) {
hexagon.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)
else if(ImageGetter.imageExists(tileSetLocation+tileInfo.baseTerrain)) return // no need to color it, it's already colored
else hexagon.color = tileInfo.getBaseTerrain().getColor()
}
private fun updateTerrainFeatureImage() {

View file

@ -33,7 +33,7 @@ class Minimap(val tileMapHolder: TileMapHolder) : ScrollPane(null){
var bottomY = 0f
for (tileInfo in tileMapHolder.tileMap.values) {
val hex = ImageGetter.getImage("TerrainIcons/Hexagon.png")
val hex = ImageGetter.getImage("OtherIcons/Hexagon")
val positionalVector = HexMath().hex2WorldCoords(tileInfo.position)
val groupSize = 10f

View file

@ -56,6 +56,8 @@ class WorldScreenOptionsTable(screen:WorldScreen) : PopupTable(screen){
addAutosaveTurnsSelectBox()
addTileSetSelectBox()
addSoundEffectsVolumeSlider()
addButton("Close"){ remove() }
@ -101,6 +103,29 @@ class WorldScreenOptionsTable(screen:WorldScreen) : PopupTable(screen){
})
}
private fun addTileSetSelectBox() {
add("Tileset".toLabel())
val tileSetSelectBox = SelectBox<String>(skin)
val tileSetArray = Array<String>()
val tileSets = ImageGetter.atlas.regions.filter { it.name.startsWith("TileSets") }
.map { it.name.split("/")[1] }.distinct()
for(tileset in tileSets) tileSetArray.add(tileset)
tileSetSelectBox.items = tileSetArray
tileSetSelectBox.selected = UnCivGame.Current.settings.tileSet
add(tileSetSelectBox).pad(10f).row()
tileSetSelectBox.addListener(object : ChangeListener() {
override fun changed(event: ChangeEvent?, actor: Actor?) {
UnCivGame.Current.settings.tileSet = tileSetSelectBox.selected
UnCivGame.Current.settings.save()
UnCivGame.Current.worldScreen = WorldScreen()
UnCivGame.Current.setWorldScreen()
WorldScreenOptionsTable(UnCivGame.Current.worldScreen)
}
})
}
private fun addAutosaveTurnsSelectBox() {
add("Turns between autosaves".toLabel())