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