mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 07:17:50 +07:00
Now can't see units that we're not supposed to see =)
This commit is contained in:
@ -4,11 +4,11 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.scenes.scene2d.Group
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.ui.UnCivGame
|
||||
import com.unciv.ui.cityscreen.CityScreen
|
||||
import com.unciv.ui.cityscreen.addClickListener
|
||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||
import com.unciv.ui.utils.ImageGetter
|
||||
import com.unciv.ui.worldscreen.WorldScreen
|
||||
|
||||
|
||||
class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
||||
@ -20,11 +20,13 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
||||
setColor(0f, 0f, 0f, 1f) // Only alpha really changes anything
|
||||
tileInfo.explored = true
|
||||
update()
|
||||
} else
|
||||
} else{
|
||||
setColor(0f, 0f, 0f, 0.6f)
|
||||
update()
|
||||
}
|
||||
}
|
||||
|
||||
fun update(worldScreen: WorldScreen) {
|
||||
override fun update() {
|
||||
super.update()
|
||||
|
||||
if (tileInfo.workingCity != null && populationImage == null) addPopulationIcon()
|
||||
@ -38,8 +40,7 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
||||
cityButton = TextButton("", CameraStageBaseScreen.skin)
|
||||
cityButton!!.label.setFontScale(buttonScale)
|
||||
|
||||
val game = worldScreen.game
|
||||
cityButton!!.addClickListener { game.screen = CityScreen(city!!)}
|
||||
cityButton!!.addClickListener { UnCivGame.Current.screen = CityScreen(city!!)}
|
||||
|
||||
addActor(cityButton)
|
||||
zIndex = parent.children.size // so this tile is rendered over neighboring tiles
|
||||
|
@ -80,20 +80,16 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
||||
}
|
||||
|
||||
internal fun updateTiles() {
|
||||
for (WG in tileGroups.values) WG.update(worldScreen)
|
||||
for (WG in tileGroups.values) WG.setIsViewable(false) // also updates them
|
||||
|
||||
for (WG in tileGroups.values) WG.setIsViewable(false)
|
||||
val viewablePositions: List<Vector2>
|
||||
if(worldScreen.unitTable.currentlyExecutingAction == null)
|
||||
viewablePositions = civInfo.getViewableTiles().map { it.position }
|
||||
|
||||
else
|
||||
viewablePositions = worldScreen.unitTable.getViewablePositionsForExecutingAction()
|
||||
|
||||
|
||||
for (string in viewablePositions.map { it.toString() }.filter { tileGroups.containsKey(it) })
|
||||
tileGroups[string]!!.setIsViewable(true)
|
||||
|
||||
}
|
||||
|
||||
fun setCenterPosition(vector: Vector2) {
|
||||
|
Reference in New Issue
Block a user