mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-26 23:50:45 +07:00
Skip next unit button (#11244)
* Added a next turn menu to skip all the next unit actions * Added a move automated units button * Added whitespace * Added unique NextTurnMenu KeyboardBindings
This commit is contained in:
parent
b5a39bbb39
commit
28e0e7ee2c
@ -142,6 +142,10 @@ enum class KeyboardBinding(
|
||||
AutoPlayMenuCivilians(Category.AutoPlayMenu, "AutoPlay Civilians Once", 'c'),
|
||||
AutoPlayMenuEconomy(Category.AutoPlayMenu, "AutoPlay Economy Once", 'e'),
|
||||
|
||||
// NextTurnMenu
|
||||
NextTurnMenuNextTurn(Category.NextTurnMenu, "Next Turn", 'n'),
|
||||
NextTurnMenuMoveAutomatedUnits(Category.NextTurnMenu, "Move Automated Units", 'm'),
|
||||
|
||||
// City Screen
|
||||
AddConstruction(Category.CityScreen, "Add to or remove from queue", KeyCharAndCode.RETURN),
|
||||
RaisePriority(Category.CityScreen, "Raise queue priority", Input.Keys.UP),
|
||||
@ -217,6 +221,9 @@ enum class KeyboardBinding(
|
||||
AutoPlayMenu {
|
||||
override val label = "AutoPlay menu" // adapt to existing usage
|
||||
},
|
||||
NextTurnMenu {
|
||||
override val label = "NextTurn menu" // adapt to existing usage
|
||||
},
|
||||
MapPanning {
|
||||
override fun checkConflictsIn() = sequenceOf(this, WorldScreen)
|
||||
},
|
||||
|
@ -9,6 +9,7 @@ import com.unciv.ui.components.extensions.setSize
|
||||
import com.unciv.ui.components.input.KeyboardBinding
|
||||
import com.unciv.ui.components.input.keyShortcuts
|
||||
import com.unciv.ui.components.input.onActivation
|
||||
import com.unciv.ui.components.input.onRightClick
|
||||
import com.unciv.ui.images.IconTextButton
|
||||
import com.unciv.ui.images.ImageGetter
|
||||
import com.unciv.ui.popups.hasOpenPopups
|
||||
@ -22,6 +23,7 @@ class NextTurnButton(
|
||||
// label.setFontSize(30)
|
||||
labelCell.pad(10f)
|
||||
onActivation { nextTurnAction.action(worldScreen) }
|
||||
onRightClick { NextTurnMenu(stage, this, this, worldScreen) }
|
||||
keyShortcuts.add(KeyboardBinding.NextTurn)
|
||||
keyShortcuts.add(KeyboardBinding.NextTurnAlternate)
|
||||
// Let unit actions override this for command "Wait".
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.unciv.ui.screens.worldscreen.status
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.unciv.ui.components.input.KeyboardBinding
|
||||
import com.unciv.ui.popups.AnimatedMenuPopup
|
||||
import com.unciv.ui.screens.worldscreen.WorldScreen
|
||||
|
||||
class NextTurnMenu(
|
||||
stage: Stage,
|
||||
positionNextTo: Actor,
|
||||
private val nextTurnButton: NextTurnButton,
|
||||
private val worldScreen: WorldScreen
|
||||
) : AnimatedMenuPopup(stage, getActorTopRight(positionNextTo)) {
|
||||
override fun createContentTable(): Table {
|
||||
val table = super.createContentTable()!!
|
||||
table.add(getButton("Next Turn", KeyboardBinding.NextTurnMenuNextTurn) {
|
||||
worldScreen.nextTurn()
|
||||
}).row()
|
||||
val automateUnitsAction = NextTurnAction.MoveAutomatedUnits
|
||||
if (automateUnitsAction.isChoice(worldScreen))
|
||||
table.add(getButton("Move automated units", KeyboardBinding.NextTurnMenuMoveAutomatedUnits) {
|
||||
automateUnitsAction.action(worldScreen)
|
||||
}).row()
|
||||
return table
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user