mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-03 21:40:31 +07:00
"Jump To Destination" Unit Action Button for units that are moving (#9955)
* Added "Jump To Destination" UnitActionButton for moving unit This commit also fixes the situation where the player is unable to open the Show More unit actions list while the unit is moving and out of moves for the turn. Previously, clicking Show More in this scenario would jump to the next active unit. * Added Jump To Destination to translation file * Changed Jump to Destination to Show Unit Destination, updated icon, credits
This commit is contained in:
parent
7952366afb
commit
a6142ec482
@ -1292,6 +1292,13 @@ UnitActionIcons/StopMove
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
UnitActionIcons/ShowUnitDestination
|
||||
rotate: false
|
||||
xy: 980, 0
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
UnitActionIcons/Swap
|
||||
rotate: false
|
||||
xy: 1702, 646
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 903 KiB After Width: | Height: | Size: 1021 KiB |
@ -1067,6 +1067,7 @@ Range =
|
||||
XP =
|
||||
Move unit =
|
||||
Stop movement =
|
||||
Show unit destination =
|
||||
Swap units =
|
||||
Construct improvement =
|
||||
Automate =
|
||||
|
@ -18,7 +18,7 @@ open class UnitAction(
|
||||
val title: String = type.value,
|
||||
val isCurrentAction: Boolean = false,
|
||||
val uncivSound: UncivSound = type.uncivSound,
|
||||
/** Action is Null is this unit *can* execute the action but *not right now* - it's embarked, out of moves, etc */
|
||||
/** Action is Null if this unit *can* execute the action but *not right now* - it's embarked, out of moves, etc */
|
||||
val action: (() -> Unit)? = null
|
||||
) {
|
||||
fun getIcon(): Actor {
|
||||
@ -103,6 +103,8 @@ enum class UnitActionType(
|
||||
{ ImageGetter.getUnitActionPortrait("Stop") }, false),
|
||||
StopMovement("Stop movement",
|
||||
{ ImageGetter.getUnitActionPortrait("StopMove") }, false),
|
||||
ShowUnitDestination("Show unit destination",
|
||||
{ ImageGetter.getUnitActionPortrait("ShowUnitDestination")}, false),
|
||||
Sleep("Sleep",
|
||||
{ ImageGetter.getUnitActionPortrait("Sleep") }),
|
||||
SleepUntilHealed("Sleep until healed",
|
||||
|
@ -90,6 +90,7 @@ enum class KeyboardBinding(
|
||||
Automate(Category.UnitActions, 'm'),
|
||||
StopAutomation(Category.UnitActions,"Stop automation", 'm'),
|
||||
StopMovement(Category.UnitActions,"Stop movement", '.'),
|
||||
ShowUnitDestination(Category.UnitActions, "Show unit destination", 'j'),
|
||||
Sleep(Category.UnitActions, 'f'),
|
||||
SleepUntilHealed(Category.UnitActions,"Sleep until healed", 'h'),
|
||||
Fortify(Category.UnitActions, 'f'),
|
||||
|
@ -60,8 +60,9 @@ object UnitActions {
|
||||
addTriggerUniqueActions(unit, actionList)
|
||||
addAddInCapitalAction(unit, actionList, tile)
|
||||
|
||||
if (unit.isMoving())
|
||||
if (unit.isMoving()) {
|
||||
actionList += UnitAction(UnitActionType.StopMovement) { unit.action = null }
|
||||
}
|
||||
if (unit.isExploring())
|
||||
actionList += UnitAction(UnitActionType.StopExploration) { unit.action = null }
|
||||
if (unit.isAutomated())
|
||||
@ -87,6 +88,11 @@ object UnitActions {
|
||||
val tile = unit.getTile()
|
||||
val actionList = ArrayList<UnitAction>()
|
||||
|
||||
if (unit.isMoving()) {
|
||||
actionList += UnitAction(UnitActionType.ShowUnitDestination) {
|
||||
GUI.getMap().setCenterPosition(unit.getMovementDestination().position,true)
|
||||
}
|
||||
}
|
||||
addSleepActions(actionList, unit, true)
|
||||
addFortifyActions(actionList, unit, true)
|
||||
addAutomateAction(unit, actionList, false)
|
||||
|
@ -65,12 +65,12 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table() {
|
||||
// overlay, since the user definitely wants to interact with the new unit.
|
||||
worldScreen.mapHolder.removeUnitActionOverlay()
|
||||
if (UncivGame.Current.settings.autoUnitCycle
|
||||
&& (unit.isDestroyed || unitAction.type.isSkippingToNextUnit || unit.currentMovement == 0f)) {
|
||||
&& (unit.isDestroyed || (unit.isMoving() && unit.currentMovement == 0f && unitAction.type.isSkippingToNextUnit) || (!unit.isMoving() && unitAction.type.isSkippingToNextUnit))) {
|
||||
worldScreen.switchToNextUnit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return actionButton
|
||||
return actionButton
|
||||
}
|
||||
}
|
||||
|
@ -730,6 +730,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
|
||||
- [Keyboard](https://thenounproject.com/icon/keyboard-2685534/) by Twenty Foo Studio for Options Keys
|
||||
- [charts](https://thenounproject.com/icon/charts-2312023/) by Srinivas Agra (gimped to appear bolder) for the Charts page
|
||||
- [framed image](https://thenounproject.com/icon/framed-image-2332187/) by Jose Dean for Victory Illustrations page
|
||||
- [down](https://thenounproject.com/icon/down-39378/) by Cengiz SARI for Show unit destination
|
||||
|
||||
|
||||
### Main menu
|
||||
|
Loading…
Reference in New Issue
Block a user