This commit is contained in:
itanasi 2025-01-22 07:32:31 -08:00 committed by GitHub
parent 35b21d98c6
commit 05d246cdbe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

View File

@ -102,7 +102,7 @@ enum class KeyboardBinding(
// Unit actions - name MUST correspond to UnitActionType.name because the shorthand constructor
// there looks up bindings here by name - which also means we must not use UnitActionType
// here as it will not be guaranteed to already be fully initialized.
SwapUnits(Category.UnitActions,"Swap units", 'y'),
SwapUnits(Category.UnitActions, "Swap units", 'y'),
Automate(Category.UnitActions, 'm'),
ConnectRoad(Category.UnitActions, "Connect road", 'c'),
StopAutomation(Category.UnitActions,"Stop automation", 'm'),

View File

@ -33,8 +33,7 @@ class IdleUnitButton (
add(image).size(imageSize).pad(10f,20f)
enable()
keyShortcuts.add(keyShortcutBind)
addTooltip(keyShortcutBind)
onActivation {
onActivation (binding = keyShortcutBind) {
val idleUnits = unitTable.worldScreen.viewingCiv.units.getIdleUnits()
if (idleUnits.none()) return@onActivation

View File

@ -28,8 +28,10 @@ import com.unciv.ui.screens.pickerscreens.UnitRenamePopup
import com.unciv.ui.screens.worldscreen.WorldScreen
class UnitTable(val worldScreen: WorldScreen) : Table() {
private val prevIdleUnitButton = IdleUnitButton(this,worldScreen.mapHolder,true, KeyboardBinding.PrevIdleButton)
private val nextIdleUnitButton = IdleUnitButton(this,worldScreen.mapHolder,false, KeyboardBinding.NextIdleButton)
private val prevIdleUnitButton =
IdleUnitButton(this, worldScreen.mapHolder, true, KeyboardBinding.PrevIdleButton)
private val nextIdleUnitButton =
IdleUnitButton(this, worldScreen.mapHolder, false, KeyboardBinding.NextIdleButton)
private val unitIconHolder = Table()
private val unitNameLabel = "".toLabel(fontSize = 24)
private val unitIconNameGroup = Table()