Added fogOfWarColor and unexploredTileColor (#3833)

* Added fogOfWarColor and unexploredTileColor

* update updateConfig function
This commit is contained in:
GGGuenni 2021-04-26 20:16:18 +02:00 committed by GitHub
parent 86fafd59db
commit 29dfa338ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -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<String, Array<String>> = HashMap()
fun updateConfig(other: TileSetConfig){
useColorAsBaseTerrain = other.useColorAsBaseTerrain
unexploredTileColor = other.unexploredTileColor
fogOfWarColor = other.fogOfWarColor
for ((tileSetString, renderOrder) in other.ruleVariants){
ruleVariants[tileSetString] = renderOrder
}

View File

@ -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
}