mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Fixed 'dead code' that got in on one of the PRs
This commit is contained in:
parent
7a8bf68885
commit
dbc3bcb5a1
@ -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()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user