Added keyboard shortcut to toggle World Screen UI elements (#8211)

* AbsoluteUnits - Mongolian Uniques

* Added keyboard shortcut to toggle World Screen UI elements

Ctrl+U to toggle

* Update WorldScreen.kt

* Added a pesky space

* Remove "Experimental" warning text

* Revert "Remove "Experimental" warning text"

This reverts commit 3c8456db95.
This commit is contained in:
letstalkaboutdune 2022-12-24 09:41:35 -08:00 committed by GitHub
parent 994169944a
commit 8d0acd0647
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 24 deletions

View File

@ -232,7 +232,7 @@
"If you have a keyboard, some shortcut keys become available. Unit command or improvement picker keys, for example, are shown directly in their corresponding buttons.",
"On the world screen the hotkeys are as follows:", "Space or 'N' - Next unit or turn\n'E' - Empire overview (last viewed page)\n'+', '-' - Zoom in / out\nHome - center on capital or open its city screen if already centered",
"F1 - Open Civilopedia\nF2 - Empire overview Trades\nF3 - Empire overview Units\nF4 - Empire overview Diplomacy\nF5 - Social policies\nF6 - Technologies\nF7 - Empire overview Cities\nF8 - Victory Progress\nF9 - Empire overview Stats\nF10 - Empire overview Resources\nF11 - Quicksave\nF12 - Quickload",
"Ctrl-R - Toggle tile resource display\nCtrl-Y - Toggle tile yield display\nCtrl-O - Game options\nCtrl-S - Save game\nCtrl-L - Load game"
"Ctrl-R - Toggle tile resource display\nCtrl-Y - Toggle tile yield display\nCtrl-O - Game options\nCtrl-S - Save game\nCtrl-L - Load game\nCtrl-U - Toggle UI (World Screen only)"
]
},
{

View File

@ -1425,6 +1425,7 @@ Pillaging this improvement yields [stats] =
Pillaging this improvement yields approximately [stats] =
Needs removal of terrain features to be built =
Unit type =
Toggle UI (World Screen only) =
# Policies

View File

@ -133,6 +133,8 @@ class WorldScreen(
private val events = EventBus.EventReceiver()
var uiEnabled = true
init {
// notifications are right-aligned, they take up only as much space as necessary.
@ -254,6 +256,21 @@ class WorldScreen(
globalShortcuts.add(KeyCharAndCode.ctrl('Q')) { game.popScreen() } // WorldScreen is the last screen, so this quits
globalShortcuts.add(Input.Keys.NUMPAD_ADD) { this.mapHolder.zoomIn() } // '+' Zoom
globalShortcuts.add(Input.Keys.NUMPAD_SUBTRACT) { this.mapHolder.zoomOut() } // '-' Zoom
globalShortcuts.add(KeyCharAndCode.ctrl('U')){
uiEnabled = !uiEnabled
topBar.isVisible = uiEnabled
statusButtons.isVisible = uiEnabled
techPolicyAndDiplomacy.isVisible = uiEnabled
tutorialTaskTable.isVisible = uiEnabled
bottomTileInfoTable.isVisible = uiEnabled
unitActionsTable.isVisible = uiEnabled
notificationsScroll.isVisible = uiEnabled
minimapWrapper.isVisible = uiEnabled
bottomUnitTable.isVisible = uiEnabled
battleTable.isVisible = uiEnabled && battleTable.update() != hide()
fogOfWarButton.isVisible = uiEnabled && viewingCiv.isSpectator()
}
}
private fun addKeyboardListener() {
@ -362,35 +379,37 @@ class WorldScreen(
// and we don't get any silly concurrency problems!
private fun update() {
displayTutorialsOnUpdate()
if(uiEnabled){
displayTutorialsOnUpdate()
bottomUnitTable.update()
bottomTileInfoTable.updateTileTable(mapHolder.selectedTile)
bottomTileInfoTable.x = stage.width - bottomTileInfoTable.width
bottomTileInfoTable.y = if (game.settings.showMinimap) minimapWrapper.height else 0f
battleTable.update()
bottomUnitTable.update()
bottomTileInfoTable.updateTileTable(mapHolder.selectedTile)
bottomTileInfoTable.x = stage.width - bottomTileInfoTable.width
bottomTileInfoTable.y = if (game.settings.showMinimap) minimapWrapper.height else 0f
battleTable.update()
updateSelectedCiv()
updateSelectedCiv()
tutorialTaskTable.clear()
val tutorialTask = getCurrentTutorialTask()
if (tutorialTask == "" || !game.settings.showTutorials || viewingCiv.isDefeated()) {
tutorialTaskTable.isVisible = false
} else {
tutorialTaskTable.isVisible = true
tutorialTaskTable.add(tutorialTask.toLabel()
tutorialTaskTable.clear()
val tutorialTask = getCurrentTutorialTask()
if (tutorialTask == "" || !game.settings.showTutorials || viewingCiv.isDefeated()) {
tutorialTaskTable.isVisible = false
} else {
tutorialTaskTable.isVisible = true
tutorialTaskTable.add(tutorialTask.toLabel()
.apply { setAlignment(Align.center) }).pad(10f)
tutorialTaskTable.pack()
tutorialTaskTable.centerX(stage)
tutorialTaskTable.y = topBar.y - tutorialTaskTable.height
tutorialTaskTable.pack()
tutorialTaskTable.centerX(stage)
tutorialTaskTable.y = topBar.y - tutorialTaskTable.height
}
if (fogOfWar) minimapWrapper.update(selectedCiv)
else minimapWrapper.update(viewingCiv)
unitActionsTable.update(bottomUnitTable.selectedUnit)
unitActionsTable.y = bottomUnitTable.height
}
if (fogOfWar) minimapWrapper.update(selectedCiv)
else minimapWrapper.update(viewingCiv)
unitActionsTable.update(bottomUnitTable.selectedUnit)
unitActionsTable.y = bottomUnitTable.height
mapHolder.resetArrows()
if (UncivGame.Current.settings.showUnitMovements) {
val allUnits = gameInfo.civilizations.asSequence().flatMap { it.getCivUnits() }