From 7a8bf68885b374f5dd7ff6896b56723eadbce698 Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Thu, 6 May 2021 15:09:19 +0200 Subject: [PATCH] Option Screen choices visible on minimap toggle buttons immediately - ugly (#3881) --- core/src/com/unciv/ui/worldscreen/Minimap.kt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/ui/worldscreen/Minimap.kt b/core/src/com/unciv/ui/worldscreen/Minimap.kt index d2725129b2..402aa80b3b 100644 --- a/core/src/com/unciv/ui/worldscreen/Minimap.kt +++ b/core/src/com/unciv/ui/worldscreen/Minimap.kt @@ -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) } -} \ No newline at end of file +}