From 08166c0a6436c3a9cc9c3ded98d06805069a73e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Fri, 6 Dec 2013 09:07:51 +0100 Subject: [PATCH 1/2] added a new hotkey to select all units on screen closes #4182 --- CHANGELOG | 1 + OpenRA.Game/GameRules/Settings.cs | 1 + OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs | 6 ++++++ OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs | 1 + 4 files changed, 9 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 5ddc3ec2a6..f60f441d25 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,7 @@ NEW: Re-added move flashes. Added a setting to always display unit status bars (can also be toggled by hotkey). Added a setting for team health bar colors. + Added a new hotkey to select all units on screen (default: CTRL + A). Asset Browser: Fixed crashes when trying to load invalid filenames or sprites with just 1 frame. Added support for all sprite types. diff --git a/OpenRA.Game/GameRules/Settings.cs b/OpenRA.Game/GameRules/Settings.cs index 373d42b6f9..1f7f20528c 100644 --- a/OpenRA.Game/GameRules/Settings.cs +++ b/OpenRA.Game/GameRules/Settings.cs @@ -149,6 +149,7 @@ namespace OpenRA.GameRules public Hotkey ToLastEventKey = new Hotkey(Keycode.SPACE, Modifiers.None); public Hotkey ToSelectionKey = new Hotkey(Keycode.HOME, Modifiers.None); public Hotkey ToggleStatusBarsKey = new Hotkey(Keycode.INSERT, Modifiers.None); + public Hotkey SelectAllUnitsKey = new Hotkey(Keycode.A, Modifiers.Ctrl); public Hotkey PauseKey = new Hotkey(Keycode.F9, Modifiers.None); public Hotkey SellKey = new Hotkey(Keycode.F10, Modifiers.None); diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index b2dec7acef..893177e572 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -202,6 +202,12 @@ namespace OpenRA.Widgets } else if (Hotkey.FromKeyInput(e) == Game.Settings.Keys.PauseKey && World.LocalPlayer != null) // Disable pausing for spectators World.SetPauseState(!World.Paused); + else if (Hotkey.FromKeyInput(e) == Game.Settings.Keys.SelectAllUnitsKey) + { + var ownUnitsOnScreen = SelectActorsInBox(World, worldRenderer.Viewport.TopLeft, worldRenderer.Viewport.BottomRight, + a => a.Owner == World.RenderPlayer); + World.Selection.Combine(World, ownUnitsOnScreen, false, false); + } } return false; diff --git a/OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs index de42055b9a..c8a4ebb9d2 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs @@ -243,6 +243,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic { "CycleBaseKey", "Jump to base" }, { "ToLastEventKey", "Jump to last radar event" }, { "ToSelectionKey", "Jump to selection" }, + { "SelectAllUnitsKey", "Select all units on screen" }, { "SellKey", "Sell mode" }, { "PowerDownKey", "Power-down mode" }, { "RepairKey", "Repair mode" }, From 4b704488235f712b1a52674f2f97c3a5bb5a367e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Fri, 6 Dec 2013 09:09:18 +0100 Subject: [PATCH 2/2] reorder hotkeys the way they appear in the GUI and similiar ones together --- OpenRA.Game/GameRules/Settings.cs | 7 ++++--- OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/OpenRA.Game/GameRules/Settings.cs b/OpenRA.Game/GameRules/Settings.cs index 1f7f20528c..bb3d8adbc6 100644 --- a/OpenRA.Game/GameRules/Settings.cs +++ b/OpenRA.Game/GameRules/Settings.cs @@ -148,7 +148,6 @@ namespace OpenRA.GameRules public Hotkey CycleBaseKey = new Hotkey(Keycode.BACKSPACE, Modifiers.None); public Hotkey ToLastEventKey = new Hotkey(Keycode.SPACE, Modifiers.None); public Hotkey ToSelectionKey = new Hotkey(Keycode.HOME, Modifiers.None); - public Hotkey ToggleStatusBarsKey = new Hotkey(Keycode.INSERT, Modifiers.None); public Hotkey SelectAllUnitsKey = new Hotkey(Keycode.A, Modifiers.Ctrl); public Hotkey PauseKey = new Hotkey(Keycode.F9, Modifiers.None); @@ -156,14 +155,16 @@ namespace OpenRA.GameRules public Hotkey PowerDownKey = new Hotkey(Keycode.F11, Modifiers.None); public Hotkey RepairKey = new Hotkey(Keycode.F12, Modifiers.None); + public Hotkey CycleTabsKey = new Hotkey(Keycode.TAB, Modifiers.None); + + public Hotkey ToggleStatusBarsKey = new Hotkey(Keycode.INSERT, Modifiers.None); + public Hotkey AttackMoveKey = new Hotkey(Keycode.A, Modifiers.None); public Hotkey StopKey = new Hotkey(Keycode.S, Modifiers.None); public Hotkey ScatterKey = new Hotkey(Keycode.X, Modifiers.None); public Hotkey DeployKey = new Hotkey(Keycode.F, Modifiers.None); public Hotkey StanceCycleKey = new Hotkey(Keycode.Z, Modifiers.None); public Hotkey GuardKey = new Hotkey(Keycode.D, Modifiers.None); - - public Hotkey CycleTabsKey = new Hotkey(Keycode.TAB, Modifiers.None); } public class IrcSettings diff --git a/OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs index c8a4ebb9d2..925ca3d366 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs @@ -239,15 +239,18 @@ namespace OpenRA.Mods.RA.Widgets.Logic // TODO: Extract these to a yaml file var specialHotkeys = new Dictionary() { - { "PauseKey", "Pause / Unpause" }, { "CycleBaseKey", "Jump to base" }, { "ToLastEventKey", "Jump to last radar event" }, { "ToSelectionKey", "Jump to selection" }, { "SelectAllUnitsKey", "Select all units on screen" }, + + { "PauseKey", "Pause / Unpause" }, { "SellKey", "Sell mode" }, { "PowerDownKey", "Power-down mode" }, { "RepairKey", "Repair mode" }, + { "CycleTabsKey", "Cycle production tabs" }, + { "ToggleStatusBarsKey", "Toggle status bars" } };