Tilesets: Separated unexplored tiles from not visible tiles

This commit is contained in:
Yair Morgenstern 2023-03-17 12:06:15 +02:00
parent c3b8eaa6d2
commit 20e1b9b978
3 changed files with 17 additions and 3 deletions

View File

@ -27,6 +27,7 @@ class TileSetStrings(tileSet: String = UncivGame.Current.settings.tileSet, unitS
val hexagon: String by lazy { orFallback {tileSetLocation + "Hexagon"} }
val hexagonList by lazy { listOf(hexagon) }
val crosshatchHexagon by lazy { orFallback { tileSetLocation + "CrosshatchHexagon" } }
val unexploredTile by lazy { orFallback { tileSetLocation + "UnexploredTile" } }
val crosshair by lazy { orFallback { getString(tileSetLocation, "Crosshair") } }
val highlight by lazy { orFallback { getString(tileSetLocation, "Highlight") } }
val roadsMap = RoadStatus.values()

View File

@ -3,10 +3,9 @@ package com.unciv.ui.components.tilegroups.layers
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Actor
import com.unciv.Constants
import com.unciv.UncivGame
import com.unciv.logic.civilization.Civilization
import com.unciv.ui.images.ImageGetter
import com.unciv.ui.components.tilegroups.TileGroup
import com.unciv.ui.images.ImageGetter
class TileLayerOverlay(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup, size) {
@ -16,6 +15,7 @@ class TileLayerOverlay(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup,
private val highlight = ImageGetter.getImage(strings().highlight).setHexagonSize() // for blue and red circles/emphasis on the tile
private val crosshair = ImageGetter.getImage(strings().crosshair).setHexagonSize() // for when a unit is targeted
private val fog = ImageGetter.getImage(strings().crosshatchHexagon ).setHexagonSize()
private val unexplored = ImageGetter.getImage(strings().unexploredTile ).setHexagonSize()
init {
@ -24,6 +24,8 @@ class TileLayerOverlay(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup,
fog.isVisible = false
fog.color = Color.WHITE.cpy().apply { a = 0.2f }
if (ImageGetter.imageExists(strings().unexploredTile))
addActor(unexplored)
addActor(highlight)
addActor(fog)
addActor(crosshair)
@ -64,13 +66,13 @@ class TileLayerOverlay(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup,
}
override fun doUpdate(viewingCiv: Civilization?) {
val isViewable = viewingCiv == null || isViewable(viewingCiv)
fog.isVisible = !isViewable && !tileGroup.isForceVisible
if (viewingCiv == null)
return
unexplored.isVisible = !viewingCiv.hasExplored(tile())
if (tile().getShownImprovement(viewingCiv) == Constants.barbarianEncampment
&& tile().isExplored(viewingCiv))
showHighlight(Color.RED)

View File

@ -100,6 +100,17 @@ The ruleVariants are the most powerful part of the tileset config. With this, yo
An example is given in the code above. For the tile "Grassland+Jungle+Dyes+Trading post" we then use the images "Grassland", "JungleForGrasslandBack", "Dyes+Trading post" and "JungleForGrasslandFront" in that order.
## Fog and unexplored tiles
Unciv distinguishes between "unexplored" tiles, which are tiles the Civ has never seen,
and "not visible" tiles, which are those that were seen once but now are not.
Not visible tiles are grayed out by design, and on top of that have the `CrosshatchHexagon.png` image applied to them.
Unexplored tiles display the `UnexploredTile.png` image, on top of which `CrosshatchHexagon.png` is applied.
You can set the CrosshatchHexagon to be functionally invisible by replacing it with a 1px by 1px invisible image.
## Unit images
Unit images can be changed according to civ-specific styles (if a mod specifies a "style" variable for each civilization) and according to the owning civ's current era. Unciv attempts to load the unit images in the following order (where unitName is the unit name given in Units.json, styleName is optionally specified in Nations.json, and eraName is the era name given in Eras.json (including " era")).