mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-30 14:48:56 +07:00
Explored but unvisible tiles now fade to black, instead of to background olor (which is blueish)
This commit is contained in:
@ -8,7 +8,6 @@ import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener
|
||||
import com.badlogic.gdx.utils.Align
|
||||
import com.unciv.logic.city.CityInfo
|
||||
import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.ui.tilegroups.TileGroup
|
||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||
import com.unciv.ui.utils.HexMath
|
||||
import com.unciv.ui.utils.ImageGetter
|
||||
@ -23,7 +22,7 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() {
|
||||
private var statExplainer = Table(skin)
|
||||
private var cityPickerTable = Table()
|
||||
private var goToWorldButton = TextButton("Exit city", CameraStageBaseScreen.skin)
|
||||
private var tileGroups = ArrayList<TileGroup>()
|
||||
private var tileGroups = ArrayList<CityTileGroup>()
|
||||
|
||||
init {
|
||||
Label("", CameraStageBaseScreen.skin).style.font.data.setScale(game.settings.labelScale)
|
||||
|
@ -19,8 +19,8 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo) : TileGroup(
|
||||
}
|
||||
}
|
||||
|
||||
override fun update() {
|
||||
super.update()
|
||||
fun update() {
|
||||
super.update(true)
|
||||
|
||||
if (populationImage != null) {
|
||||
populationImage!!.setSize(30f, 30f)
|
||||
|
@ -51,7 +51,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
|
||||
}
|
||||
|
||||
|
||||
open fun update() {
|
||||
open fun update(isViewable: Boolean) {
|
||||
if (!tileInfo.explored) {
|
||||
hexagon.color = Color.BLACK
|
||||
return
|
||||
@ -76,6 +76,8 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
|
||||
|
||||
val RGB= tileInfo.getBaseTerrain().RGB!!
|
||||
hexagon.color = Color(RGB[0]/255f,RGB[1]/255f,RGB[2]/255f,1f)
|
||||
if(!isViewable) hexagon.color = hexagon.color.lerp(Color.BLACK,0.6f)
|
||||
|
||||
|
||||
if (tileInfo.hasViewableResource(tileInfo.tileMap!!.gameInfo!!.getPlayerCivilization()) && resourceImage == null) { // Need to add the resource image!
|
||||
val fileName = "ResourceIcons/" + tileInfo.resource + "_(Civ5).png"
|
||||
@ -119,7 +121,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
|
||||
|
||||
// This is some crazy voodoo magic so I'll explain.
|
||||
image.moveBy(25f, 25f) // Move road to center of tile
|
||||
// in addTiles, we set the position of groups by relative world position *0.8*groupSize, filter groupSize = 50
|
||||
// in addTiles, we set the position of groups by relative world position *0.8*groupSize, filter groupSize = 50
|
||||
// Here, we want to have the roads start HALFWAY THERE and extend towards the tiles, so we give them a position of 0.8*25.
|
||||
image.moveBy(-relativeWorldPosition.x * 0.8f * 25f, -relativeWorldPosition.y * 0.8f * 25f)
|
||||
image.setSize(10f, 2f)
|
||||
|
@ -36,19 +36,9 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
||||
|
||||
fun hideCircle(){circleImage.isVisible=false}
|
||||
|
||||
fun setIsViewable(isViewable: Boolean) {
|
||||
if (isViewable) {
|
||||
setColor(0f, 0f, 0f, 1f) // Only alpha really changes anything
|
||||
tileInfo.explored = true
|
||||
update()
|
||||
} else{
|
||||
setColor(0f, 0f, 0f, 0.6f)
|
||||
update()
|
||||
}
|
||||
}
|
||||
|
||||
override fun update() {
|
||||
super.update()
|
||||
override fun update(isViewable: Boolean) {
|
||||
super.update(isViewable)
|
||||
|
||||
if (populationImage != null) removePopulationIcon()
|
||||
if (tileInfo.workingCity != null && !tileInfo.isCityCenter && populationImage == null) addPopulationIcon()
|
||||
|
@ -84,14 +84,19 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
||||
|
||||
internal fun updateTiles() {
|
||||
for (WG in tileGroups.values){
|
||||
WG.setIsViewable(false)
|
||||
WG.hideCircle()
|
||||
} // also updates them
|
||||
WG.update(false)
|
||||
}
|
||||
|
||||
for (string in civInfo.getViewableTiles()
|
||||
.map { it.position.toString() }
|
||||
.filter { tileGroups.containsKey(it) })
|
||||
tileGroups[string]!!.setIsViewable(true)
|
||||
.filter { tileGroups.containsKey(it) }) {
|
||||
|
||||
tileGroups[string]!!.run {
|
||||
update(true)
|
||||
tileInfo.explored = true
|
||||
}
|
||||
}
|
||||
|
||||
if(worldScreen.unitTable.currentlyExecutingAction!=null)
|
||||
for(tile: TileInfo in worldScreen.unitTable.getTilesForCurrentlyExecutingAction())
|
||||
|
Reference in New Issue
Block a user