Add hotkey settings panel with a hotkey remap dialog
* Add HotkeyDialogLogic.cs * Add dialog-hotkey.yaml to all mods * Add `GetFirstDuplicate` method to HotkeyManager to aid in validation * Add "Player" and/or "Spectator" type to all hotkeys to allow for validation based on overlapping types * Change settings.yaml and SettingsLogic.cs to work with the new dialog
This commit is contained in:
committed by
abcdefg30
parent
9783fdaf78
commit
c9ff54bfd5
83
mods/cnc/chrome/dialog-hotkey.yaml
Normal file
83
mods/cnc/chrome/dialog-hotkey.yaml
Normal file
@@ -0,0 +1,83 @@
|
||||
Background@HOTKEY_DIALOG:
|
||||
Logic: HotkeyDialogLogic
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
Background: panel-gray
|
||||
Children:
|
||||
Label@HOTKEY_LABEL:
|
||||
X: 15
|
||||
Y: 14
|
||||
Width: PARENT_RIGHT - 40
|
||||
Height: 25
|
||||
Font: Bold
|
||||
HotkeyEntry@HOTKEY_ENTRY:
|
||||
X: 15
|
||||
Y: 40
|
||||
Width: 382
|
||||
Height: 25
|
||||
Container@NOTICES:
|
||||
X: 15
|
||||
Y: 65
|
||||
Width: PARENT_RIGHT - 40
|
||||
Height: 25
|
||||
Children:
|
||||
Label@DEFAULT_NOTICE:
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
Font: Tiny
|
||||
Align: Left
|
||||
Text: This is the default hotkey.
|
||||
Label@ORIGINAL_NOTICE:
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
Font: Tiny
|
||||
Align: Left
|
||||
Text: The default is "{0}"
|
||||
Label@DUPLICATE_NOTICE:
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
Font: Tiny
|
||||
Align: Left
|
||||
Text: This hotkey is already used for "{0}"
|
||||
Button@CLEAR_BUTTON:
|
||||
X: PARENT_RIGHT - 65 - 15 - 2 * (WIDTH + 10)
|
||||
Y: 40
|
||||
Width: 25
|
||||
Height: 25
|
||||
TooltipText: Unbind the hotkey
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Children:
|
||||
Image:
|
||||
ImageCollection: lobby-bits
|
||||
ImageName: kick
|
||||
X: 7
|
||||
Y: 8
|
||||
IgnoreMouseOver: True
|
||||
Button@RESET_BUTTON:
|
||||
X: PARENT_RIGHT - 65 - 15 - WIDTH - 10
|
||||
Y: 40
|
||||
Width: 25
|
||||
Height: 25
|
||||
TooltipText: Reset to default
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Children:
|
||||
Image@IMAGE_RELOAD:
|
||||
X: 5
|
||||
Y: 5
|
||||
Width: 16
|
||||
Height: 16
|
||||
ImageCollection: reload-icon
|
||||
ImageName: enabled
|
||||
IgnoreMouseOver: True
|
||||
Button@CANCEL_BUTTON:
|
||||
X: PARENT_RIGHT - WIDTH - 15
|
||||
Y: 40
|
||||
Width: 65
|
||||
Height: 25
|
||||
Text: Cancel
|
||||
TooltipText: Cancel the operation
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
TooltipContainer@TOOLTIP_CONTAINER:
|
||||
@@ -40,22 +40,27 @@ Container@SETTINGS_PANEL:
|
||||
Container@TAB_CONTAINER:
|
||||
Children:
|
||||
Button@DISPLAY_TAB:
|
||||
Width: 140
|
||||
Width: 110
|
||||
Height: 35
|
||||
Text: Display
|
||||
Button@AUDIO_TAB:
|
||||
X: 150
|
||||
Width: 140
|
||||
X: WIDTH + 10
|
||||
Width: 110
|
||||
Height: 35
|
||||
Text: Audio
|
||||
Button@INPUT_TAB:
|
||||
X: 300
|
||||
Width: 140
|
||||
X: 2 * (WIDTH + 10)
|
||||
Width: 110
|
||||
Height: 35
|
||||
Text: Input
|
||||
Button@HOTKEYS_TAB:
|
||||
X: 3 * (WIDTH + 10)
|
||||
Width: 110
|
||||
Height: 35
|
||||
Text: Hotkeys
|
||||
Button@ADVANCED_TAB:
|
||||
X: 450
|
||||
Width: 140
|
||||
X: 4 * (WIDTH + 10)
|
||||
Width: 110
|
||||
Height: 35
|
||||
Text: Advanced
|
||||
Background@bg:
|
||||
@@ -459,13 +464,17 @@ Container@SETTINGS_PANEL:
|
||||
Font: Bold
|
||||
Text: Hotkeys
|
||||
Align: Center
|
||||
Container@HOTKEYS_PANEL:
|
||||
X: 15
|
||||
Y: 15
|
||||
Width: PARENT_RIGHT - 15
|
||||
Height: PARENT_BOTTOM - 15
|
||||
Children:
|
||||
ScrollPanel@HOTKEY_LIST:
|
||||
X: 15
|
||||
Y: 185
|
||||
Width: 560
|
||||
Width: PARENT_RIGHT - 15
|
||||
TopBottomSpacing: 4
|
||||
ItemSpacing: 4
|
||||
Height: 160
|
||||
Height: 210
|
||||
Children:
|
||||
ScrollItem@HEADER:
|
||||
Width: 528
|
||||
@@ -489,10 +498,12 @@ Container@SETTINGS_PANEL:
|
||||
Width: PARENT_RIGHT - 85
|
||||
Height: 25
|
||||
Align: Right
|
||||
HotkeyEntry@HOTKEY:
|
||||
Button@HOTKEY:
|
||||
X: PARENT_RIGHT - WIDTH
|
||||
Width: 80
|
||||
Height: 25
|
||||
Align: Left
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
Container@THREE_COLUMN:
|
||||
Width: 173
|
||||
Height: 25
|
||||
@@ -503,10 +514,29 @@ Container@SETTINGS_PANEL:
|
||||
Width: PARENT_RIGHT - 84
|
||||
Height: 25
|
||||
Align: Right
|
||||
HotkeyEntry@HOTKEY:
|
||||
Button@HOTKEY:
|
||||
X: PARENT_RIGHT - WIDTH + 1
|
||||
Width: 80
|
||||
Height: 25
|
||||
Align: Left
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
Background@HOTKEY_DIALOG_PLACEHOLDER:
|
||||
Y: 225
|
||||
Width: PARENT_RIGHT - 15
|
||||
Height: 105
|
||||
Background: panel-gray
|
||||
Children:
|
||||
Label@HOTKEY_DIALOG_HELPTEXT:
|
||||
Y: PARENT_BOTTOM / 2 - 12
|
||||
Width: PARENT_RIGHT
|
||||
Height: 25
|
||||
Font: Tiny
|
||||
Align: Center
|
||||
Text: Click on a hotkey to start rebinding
|
||||
Container@HOTKEY_DIALOG_ROOT:
|
||||
Y: 225
|
||||
Width: PARENT_RIGHT - 15
|
||||
Height: 105
|
||||
Container@ADVANCED_PANEL:
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
@@ -648,3 +678,4 @@ Container@SETTINGS_PANEL:
|
||||
Width: 140
|
||||
Height: 35
|
||||
Text: Reset
|
||||
TooltipContainer@TOOLTIP_CONTAINER:
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
ProductionTypeBuilding: E
|
||||
Description: Building Tab
|
||||
Types: Production
|
||||
Types: Production, Player
|
||||
|
||||
ProductionTypeDefense: R
|
||||
Description: Defense Tab
|
||||
Types: Production
|
||||
Types: Production, Player
|
||||
|
||||
ProductionTypeInfantry: T
|
||||
Description: Infantry Tab
|
||||
Types: Production
|
||||
Types: Production, Player
|
||||
|
||||
ProductionTypeVehicle: Y
|
||||
Description: Vehicle Tab
|
||||
Types: Production
|
||||
Types: Production, Player
|
||||
|
||||
ProductionTypeAircraft: U
|
||||
Description: Aircraft Tab
|
||||
Types: Production
|
||||
Types: Production, Player
|
||||
|
||||
@@ -128,6 +128,7 @@ ChromeLayout:
|
||||
cnc|chrome/assetbrowser.yaml
|
||||
cnc|chrome/missionbrowser.yaml
|
||||
cnc|chrome/editor.yaml
|
||||
cnc|chrome/dialog-hotkey.yaml
|
||||
|
||||
Voices:
|
||||
cnc|audio/voices.yaml
|
||||
|
||||
Reference in New Issue
Block a user