From dbc3bcb5a1c956ce0e5dccc2c255562dad411d35 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 6 May 2021 17:53:06 +0300 Subject: [PATCH] Fixed 'dead code' that got in on one of the PRs --- core/src/com/unciv/ui/worldscreen/Minimap.kt | 46 ------------------- .../com/unciv/ui/worldscreen/WorldScreen.kt | 3 -- 2 files changed, 49 deletions(-) diff --git a/core/src/com/unciv/ui/worldscreen/Minimap.kt b/core/src/com/unciv/ui/worldscreen/Minimap.kt index 402aa80b3b..13ff03d51b 100644 --- a/core/src/com/unciv/ui/worldscreen/Minimap.kt +++ b/core/src/com/unciv/ui/worldscreen/Minimap.kt @@ -132,52 +132,6 @@ class MinimapHolder(mapHolder: WorldMapHolder): Table() { pack() } - enum class MinimapToggleButtons(val icon: String) { - YIELD ("Food"), - WORKED ("Population"), - RESOURCES ("ResourceIcons/Cattle"); - } - - // "Api" when external code wants to toggle something together with our buttons - private fun getButtonState(button: MinimapToggleButtons): Boolean { - val info = toggleButtonInfo[button] ?: return false - return info.getSetting() - } - private fun setButtonState(button: MinimapToggleButtons, value: Boolean) { - val info = toggleButtonInfo[button] ?: return - info.setSetting(value) - info.actor.color.a = if (value) 1f else 0.5f - worldScreen.shouldUpdate = true - } - private fun syncButtonState(button: MinimapToggleButtons) = setButtonState(button,getButtonState(button)) - internal fun syncButtonStates() { - MinimapToggleButtons.values().forEach { syncButtonState(it) } - } - fun toggleButtonState(button: MinimapToggleButtons) = setButtonState(button,!getButtonState(button)) - - private fun addToggleButton(table:Table, button: MinimapToggleButtons) { - val image = - if ('/' in button.icon) { - ImageGetter.getImage(button.icon) - .surroundWithCircle(30f).apply { circle.color = Color.GREEN } - .surroundWithCircle(40f, false) - } else { - ImageGetter.getStatIcon(button.icon).surroundWithCircle(40f) - } - image.apply { circle.color = Color.BLACK } - toggleButtonInfo[button] = with(UncivGame.Current.settings) { - when (button) { - MinimapToggleButtons.YIELD -> ToggleButtonInfo(image, {showTileYields}, {showTileYields = it}) - MinimapToggleButtons.WORKED -> ToggleButtonInfo(image, {showWorkedTiles}, {showWorkedTiles = it}) - else -> ToggleButtonInfo(image, {showResourcesAndImprovements}, {showResourcesAndImprovements = it}) - } - } - syncButtonState(button) - image.onClick { - toggleButtonState(button) - } - table.add(image).row() - } private fun getWrappedMinimap(): Table { val internalMinimapWrapper = Table() diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index 437c2ff0b5..0192e14b45 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -37,7 +37,6 @@ import com.unciv.ui.saves.SaveGameScreen import com.unciv.ui.trade.DiplomacyScreen import com.unciv.ui.utils.* import com.unciv.ui.victoryscreen.VictoryScreen -import com.unciv.ui.worldscreen.MinimapHolder.MinimapToggleButtons import com.unciv.ui.worldscreen.bottombar.BattleTable import com.unciv.ui.worldscreen.bottombar.TileInfoTable import com.unciv.ui.worldscreen.mainmenu.OnlineMultiplayer @@ -238,8 +237,6 @@ class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : Cam keyPressDispatcher[Input.Keys.F11] = quickSave // Quick Save keyPressDispatcher[Input.Keys.F12] = quickLoad // Quick Load keyPressDispatcher[Input.Keys.HOME] = { mapHolder.setCenterPosition(gameInfo.currentPlayerCiv.getCapital().location) } // Capital City View - keyPressDispatcher['\u0012'] = { minimapWrapper.toggleButtonState(MinimapToggleButtons.RESOURCES) } // Ctrl-R: Show Resources Icons - keyPressDispatcher['\u0019'] = { minimapWrapper.toggleButtonState(MinimapToggleButtons.YIELD) } // Ctrl-Y: Yield Icons keyPressDispatcher['\u000F'] = { OptionsPopup(this).open() } // Ctrl-O: Game Options keyPressDispatcher['\u0013'] = { game.setScreen(SaveGameScreen(gameInfo)) } // Ctrl-S: Save keyPressDispatcher['\u000C'] = { game.setScreen(LoadGameScreen(this)) } // Ctrl-L: Load