From 29dfa338ba045be84e06dd95e27bc460296481dd Mon Sep 17 00:00:00 2001 From: GGGuenni Date: Mon, 26 Apr 2021 20:16:18 +0200 Subject: [PATCH] Added fogOfWarColor and unexploredTileColor (#3833) * Added fogOfWarColor and unexploredTileColor * update updateConfig function --- core/src/com/unciv/models/tilesets/TileSetConfig.kt | 6 ++++++ core/src/com/unciv/ui/tilegroups/TileGroup.kt | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/core/src/com/unciv/models/tilesets/TileSetConfig.kt b/core/src/com/unciv/models/tilesets/TileSetConfig.kt index 6aa3489ab7..76c1a7975a 100644 --- a/core/src/com/unciv/models/tilesets/TileSetConfig.kt +++ b/core/src/com/unciv/models/tilesets/TileSetConfig.kt @@ -1,11 +1,17 @@ package com.unciv.models.tilesets +import com.badlogic.gdx.graphics.Color + class TileSetConfig { var useColorAsBaseTerrain = true + var unexploredTileColor: Color = Color.DARK_GRAY + var fogOfWarColor: Color = Color.BLACK var ruleVariants: HashMap> = HashMap() fun updateConfig(other: TileSetConfig){ useColorAsBaseTerrain = other.useColorAsBaseTerrain + unexploredTileColor = other.unexploredTileColor + fogOfWarColor = other.fogOfWarColor for ((tileSetString, renderOrder) in other.ruleVariants){ ruleVariants[tileSetString] = renderOrder } diff --git a/core/src/com/unciv/ui/tilegroups/TileGroup.kt b/core/src/com/unciv/ui/tilegroups/TileGroup.kt index 52052651b5..2ccb5ea615 100644 --- a/core/src/com/unciv/ui/tilegroups/TileGroup.kt +++ b/core/src/com/unciv/ui/tilegroups/TileGroup.kt @@ -413,7 +413,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings, hideCircle() if (viewingCiv != null && !isExplored(viewingCiv)) { clearUnexploredTiles() - for(image in tileBaseImages) image.color = Color.DARK_GRAY + for(image in tileBaseImages) image.color = tileSetStrings.tileSetConfig.unexploredTileColor return } @@ -661,11 +661,11 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings, private fun updateTileColor(isViewable: Boolean) { var color = - if (ImageGetter.imageExists(tileSetStrings.getTile(tileInfo.baseTerrain))) - Color.WHITE // no need to color it, it's already colored - else tileInfo.getBaseTerrain().getColor() + if (tileSetStrings.tileSetConfig.useColorAsBaseTerrain) + tileInfo.getBaseTerrain().getColor() + else Color.WHITE // no need to color it, it's already colored - if (!isViewable) color =color.cpy().lerp(Color.BLACK, 0.6f) + if (!isViewable) color = color.cpy().lerp(tileSetStrings.tileSetConfig.fogOfWarColor, 0.6f) for(image in tileBaseImages) image.color = color }