mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-14 01:39:40 +07:00
Resolve #7817 - don't show unexplored tiles at all
This commit is contained in:
@ -351,7 +351,7 @@ open class TileGroup(
|
||||
|
||||
@Suppress("BooleanLiteralArgument") // readable enough as is
|
||||
fun clearUnexploredTiles() {
|
||||
updateTileImage(null)
|
||||
baseLayerGroup.isVisible = false
|
||||
updateRivers(false,false, false)
|
||||
|
||||
updatePixelMilitaryUnit(false)
|
||||
@ -365,9 +365,17 @@ open class TileGroup(
|
||||
}
|
||||
|
||||
hideHighlight()
|
||||
|
||||
val allGroups = listOf(baseLayerGroup,
|
||||
terrainFeatureLayerGroup, borderLayerGroup, miscLayerGroup,
|
||||
pixelMilitaryUnitGroup, pixelCivilianUnitGroup, unitLayerGroup,
|
||||
cityButtonLayerGroup, highlightFogCrosshairLayerGroup)
|
||||
for (group in allGroups) group.isVisible = true
|
||||
|
||||
if (viewingCiv != null && !isExplored(viewingCiv)) {
|
||||
clearUnexploredTiles()
|
||||
for(image in tileBaseImages) image.color = tileSetStrings.tileSetConfig.unexploredTileColor
|
||||
if (tileInfo.neighbors.any { it.position in viewingCiv.exploredTiles })
|
||||
clearUnexploredTiles()
|
||||
else for (group in allGroups) group.isVisible = false
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,6 @@ import com.unciv.models.AttackableTile
|
||||
import com.unciv.models.UncivSound
|
||||
import com.unciv.models.helpers.MapArrowType
|
||||
import com.unciv.models.helpers.MiscArrowTypes
|
||||
import com.unciv.models.ruleset.unique.UniqueType
|
||||
import com.unciv.ui.UncivStage
|
||||
import com.unciv.ui.audio.SoundPlayer
|
||||
import com.unciv.ui.images.ImageGetter
|
||||
@ -171,6 +170,11 @@ class WorldMapHolder(
|
||||
}
|
||||
|
||||
private fun onTileClicked(tileInfo: TileInfo) {
|
||||
|
||||
if (tileInfo.position !in worldScreen.viewingCiv.exploredTiles
|
||||
&& tileInfo.neighbors.all { it.position !in worldScreen.viewingCiv.exploredTiles })
|
||||
return // This tile doesn't exist for you
|
||||
|
||||
removeUnitActionOverlay()
|
||||
selectedTile = tileInfo
|
||||
unitMovementPaths.clear()
|
||||
|
@ -17,20 +17,16 @@ import kotlin.math.PI
|
||||
import kotlin.math.atan
|
||||
|
||||
internal class MinimapTile(val tileInfo: TileInfo, tileSize: Float, val onClick: () -> Unit) {
|
||||
companion object {
|
||||
val UNREVEALED_COLOR = Color.DARK_GRAY!!
|
||||
}
|
||||
|
||||
val image: Image = ImageGetter.getImage("OtherIcons/Hexagon")
|
||||
private var cityCircleImage: IconCircleGroup? = null
|
||||
var owningCiv: CivilizationInfo? = null
|
||||
private var neighborToBorderImage = HashMap<TileInfo, Image>()
|
||||
val isUnrevealed get() = image.color == UNREVEALED_COLOR
|
||||
val isUnrevealed get() = !image.isVisible
|
||||
|
||||
init {
|
||||
val positionalVector = HexMath.hex2WorldCoords(tileInfo.position)
|
||||
|
||||
image.color = UNREVEALED_COLOR
|
||||
image.isVisible = false
|
||||
image.setSize(tileSize, tileSize)
|
||||
image.setPosition(
|
||||
positionalVector.x * 0.5f * tileSize,
|
||||
@ -40,8 +36,9 @@ internal class MinimapTile(val tileInfo: TileInfo, tileSize: Float, val onClick:
|
||||
}
|
||||
|
||||
fun updateColor(isTileUnrevealed: Boolean) {
|
||||
image.isVisible = UncivGame.Current.viewEntireMapForDebug || !isTileUnrevealed
|
||||
if (!image.isVisible) return
|
||||
image.color = when {
|
||||
!UncivGame.Current.viewEntireMapForDebug && isTileUnrevealed -> UNREVEALED_COLOR
|
||||
tileInfo.isCityCenter() && !tileInfo.isWater -> tileInfo.getOwner()!!.nation.getInnerColor()
|
||||
tileInfo.getCity() != null && !tileInfo.isWater -> tileInfo.getOwner()!!.nation.getOuterColor()
|
||||
else -> tileInfo.getBaseTerrain().getColor().lerp(Color.GRAY, 0.5f)
|
||||
@ -58,8 +55,8 @@ internal class MinimapTile(val tileInfo: TileInfo, tileSize: Float, val onClick:
|
||||
fun updateBorders(): ActorChange {
|
||||
val imagesBefore = neighborToBorderImage.values.toSet()
|
||||
for (neighbor in tileInfo.neighbors) {
|
||||
val shouldHaveBorderDisplayed = tileInfo.getOwner() != null &&
|
||||
neighbor.getOwner() != tileInfo.getOwner()
|
||||
val shouldHaveBorderDisplayed = tileInfo.getOwner() != null
|
||||
&& neighbor.getOwner() != tileInfo.getOwner()
|
||||
if (!shouldHaveBorderDisplayed) {
|
||||
neighborToBorderImage.remove(neighbor)
|
||||
continue
|
||||
|
Reference in New Issue
Block a user