Option Screen choices visible on minimap toggle buttons immediately - ugly (#3881)

This commit is contained in:
SomeTroglodyte 2021-05-06 15:09:19 +02:00 committed by GitHub
parent 7c34c5f440
commit 7a8bf68885
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.Batch
import com.badlogic.gdx.math.MathUtils
import com.badlogic.gdx.math.Vector2
import com.badlogic.gdx.scenes.scene2d.Actor
import com.badlogic.gdx.scenes.scene2d.Group
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.Image
@ -121,6 +122,10 @@ class MinimapHolder(mapHolder: WorldMapHolder): Table() {
val minimap = Minimap(mapHolder)
val worldScreen = mapHolder.worldScreen
var yieldImageButton: Actor? = null
var populationImageButton: Actor? = null
var resourceImageButton: Actor? = null
init {
add(getToggleIcons()).align(Align.bottom)
add(getWrappedMinimap())
@ -225,12 +230,22 @@ class MinimapHolder(mapHolder: WorldMapHolder): Table() {
}
toggleIconTable.add(resourceImage)
toggleIconTable.pack()
yieldImageButton = yieldImage.actor
populationImageButton = populationImage.actor
resourceImageButton = resourceImage.actor
return toggleIconTable
}
fun update(civInfo: CivilizationInfo) {
isVisible = UncivGame.Current.settings.showMinimap
minimap.update(civInfo)
with(UncivGame.Current.settings) {
yieldImageButton?.color?.a = if (showTileYields) 1f else 0.5f
populationImageButton?.color?.a = if (showWorkedTiles) 1f else 0.5f
resourceImageButton?.color?.a = if (showResourcesAndImprovements) 1f else 0.5f
}
}
@ -238,4 +253,4 @@ class MinimapHolder(mapHolder: WorldMapHolder): Table() {
override fun draw(batch: Batch?, parentAlpha: Float) {
super.draw(batch, parentAlpha)
}
}
}