diff --git a/OpenRA.Game/FieldLoader.cs b/OpenRA.Game/FieldLoader.cs
index bc45436a1b..b48c890472 100644
--- a/OpenRA.Game/FieldLoader.cs
+++ b/OpenRA.Game/FieldLoader.cs
@@ -273,9 +273,9 @@ namespace OpenRA
return InvalidValueAction(value, fieldType, fieldName);
}
- else if (fieldType == typeof(NamedHotkey))
+ else if (fieldType == typeof(HotkeyReference))
{
- return new NamedHotkey(value, Game.Settings.Keys);
+ return new HotkeyReference(value, Game.Settings.Keys);
}
else if (fieldType == typeof(WDist))
{
diff --git a/OpenRA.Game/Input/NamedHotkey.cs b/OpenRA.Game/Input/HotkeyReference.cs
similarity index 90%
rename from OpenRA.Game/Input/NamedHotkey.cs
rename to OpenRA.Game/Input/HotkeyReference.cs
index a104f0c187..8d1f081f72 100644
--- a/OpenRA.Game/Input/NamedHotkey.cs
+++ b/OpenRA.Game/Input/HotkeyReference.cs
@@ -16,18 +16,18 @@ namespace OpenRA
///
/// A reference to either a named hotkey (defined in the game settings) or a statically assigned hotkey
///
- public class NamedHotkey
+ public class HotkeyReference
{
static readonly Func Invalid = () => Hotkey.Invalid;
readonly Func getValue;
- public NamedHotkey()
+ public HotkeyReference()
{
getValue = Invalid;
}
- public NamedHotkey(string name, KeySettings settings)
+ public HotkeyReference(string name, KeySettings settings)
{
// Try parsing the value as a reference to a named hotkey
getValue = settings.GetHotkeyReference(name);
diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj
index 6a67c3ff35..4aab0ea06b 100644
--- a/OpenRA.Game/OpenRA.Game.csproj
+++ b/OpenRA.Game/OpenRA.Game.csproj
@@ -225,7 +225,7 @@
-
+
diff --git a/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs b/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs
index 97d319b411..4e18d8484f 100644
--- a/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs
+++ b/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Lint
// Build the list of widget keys to validate
var checkWidgetFields = modData.ObjectCreator.GetTypesImplementing()
.SelectMany(w => w.GetFields()
- .Where(f => f.FieldType == typeof(NamedHotkey))
+ .Where(f => f.FieldType == typeof(HotkeyReference))
.Select(f => Pair.New(w.Name.Substring(0, w.Name.Length - 6), f.Name)))
.ToArray();
diff --git a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs
index 9d1364c8fd..2e67a79723 100644
--- a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs
+++ b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Widgets
public readonly string TooltipContainer;
public readonly string TooltipTemplate = "BUTTON_TOOLTIP";
- public NamedHotkey Key = new NamedHotkey();
+ public HotkeyReference Key = new HotkeyReference();
public bool DisableKeyRepeat = false;
public bool DisableKeySound = false;
diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorLogic.cs
index 5243b269cc..19eb3ce86a 100644
--- a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorLogic.cs
+++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorLogic.cs
@@ -26,9 +26,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public MapEditorLogic(Widget widget, World world, WorldRenderer worldRenderer, Dictionary logicArgs)
{
MiniYaml yaml;
- var changeZoomKey = new NamedHotkey();
+ var changeZoomKey = new HotkeyReference();
if (logicArgs.TryGetValue("ChangeZoomKey", out yaml))
- changeZoomKey = new NamedHotkey(yaml.Value, Game.Settings.Keys);
+ changeZoomKey = new HotkeyReference(yaml.Value, Game.Settings.Keys);
var editorViewport = widget.Get("MAP_EDITOR");
diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs
index dcfb5aab90..872d84a29f 100644
--- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs
+++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs
@@ -38,9 +38,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
MiniYaml yaml;
var ks = Game.Settings.Keys;
string[] keyNames = Enum.GetNames(typeof(ObserverStatsPanel));
- var statsHotkeys = new NamedHotkey[keyNames.Length];
+ var statsHotkeys = new HotkeyReference[keyNames.Length];
for (var i = 0; i < keyNames.Length; i++)
- statsHotkeys[i] = logicArgs.TryGetValue("Statistics" + keyNames[i] + "Key", out yaml) ? new NamedHotkey(yaml.Value, ks) : new NamedHotkey();
+ statsHotkeys[i] = logicArgs.TryGetValue("Statistics" + keyNames[i] + "Key", out yaml) ? new HotkeyReference(yaml.Value, ks) : new HotkeyReference();
// System buttons
var options = widget.GetOrNull("OPTIONS_BUTTON");
diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverShroudSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverShroudSelectorLogic.cs
index c0a7be9e44..de557ce63c 100644
--- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverShroudSelectorLogic.cs
+++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverShroudSelectorLogic.cs
@@ -26,8 +26,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly IOrderedEnumerable> teams;
readonly bool limitViews;
- readonly NamedHotkey combinedViewKey = new NamedHotkey();
- readonly NamedHotkey worldViewKey = new NamedHotkey();
+ readonly HotkeyReference combinedViewKey = new HotkeyReference();
+ readonly HotkeyReference worldViewKey = new HotkeyReference();
CameraOption selected;
@@ -67,10 +67,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
MiniYaml yaml;
var ks = Game.Settings.Keys;
if (logicArgs.TryGetValue("CombinedViewKey", out yaml))
- combinedViewKey = new NamedHotkey(yaml.Value, ks);
+ combinedViewKey = new HotkeyReference(yaml.Value, ks);
if (logicArgs.TryGetValue("WorldViewKey", out yaml))
- worldViewKey = new NamedHotkey(yaml.Value, ks);
+ worldViewKey = new HotkeyReference(yaml.Value, ks);
limitViews = world.Map.Visibility.HasFlag(MapVisibility.MissionSelector);
diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs
index 91565042c6..efc9fb330a 100644
--- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs
+++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs
@@ -52,9 +52,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
MiniYaml yaml;
var ks = Game.Settings.Keys;
string[] keyNames = Enum.GetNames(typeof(ObserverStatsPanel));
- var statsHotkeys = new NamedHotkey[keyNames.Length];
+ var statsHotkeys = new HotkeyReference[keyNames.Length];
for (var i = 0; i < keyNames.Length; i++)
- statsHotkeys[i] = logicArgs.TryGetValue("Statistics" + keyNames[i] + "Key", out yaml) ? new NamedHotkey(yaml.Value, ks) : new NamedHotkey();
+ statsHotkeys[i] = logicArgs.TryGetValue("Statistics" + keyNames[i] + "Key", out yaml) ? new HotkeyReference(yaml.Value, ks) : new HotkeyReference();
players = world.Players.Where(p => !p.NonCombatant);
diff --git a/OpenRA.Mods.Common/Widgets/Logic/MusicHotkeyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MusicHotkeyLogic.cs
index f1c4a80455..bd0432b5af 100644
--- a/OpenRA.Mods.Common/Widgets/Logic/MusicHotkeyLogic.cs
+++ b/OpenRA.Mods.Common/Widgets/Logic/MusicHotkeyLogic.cs
@@ -29,21 +29,21 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var ks = Game.Settings.Keys;
MiniYaml yaml;
- var stopKey = new NamedHotkey();
+ var stopKey = new HotkeyReference();
if (logicArgs.TryGetValue("StopMusicKey", out yaml))
- stopKey = new NamedHotkey(yaml.Value, ks);
+ stopKey = new HotkeyReference(yaml.Value, ks);
- var pauseKey = new NamedHotkey();
+ var pauseKey = new HotkeyReference();
if (logicArgs.TryGetValue("PauseMusicKey", out yaml))
- pauseKey = new NamedHotkey(yaml.Value, ks);
+ pauseKey = new HotkeyReference(yaml.Value, ks);
- var prevKey = new NamedHotkey();
+ var prevKey = new HotkeyReference();
if (logicArgs.TryGetValue("PrevMusicKey", out yaml))
- prevKey = new NamedHotkey(yaml.Value, ks);
+ prevKey = new HotkeyReference(yaml.Value, ks);
- var nextKey = new NamedHotkey();
+ var nextKey = new HotkeyReference();
if (logicArgs.TryGetValue("NextMusicKey", out yaml))
- nextKey = new NamedHotkey(yaml.Value, ks);
+ nextKey = new HotkeyReference(yaml.Value, ks);
var keyhandler = widget.Get("GLOBAL_KEYHANDLER");
keyhandler.AddHandler(e =>
diff --git a/OpenRA.Mods.Common/Widgets/Logic/SingleHotkeyBaseLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/SingleHotkeyBaseLogic.cs
index d00f2b96d7..4534d648c0 100644
--- a/OpenRA.Mods.Common/Widgets/Logic/SingleHotkeyBaseLogic.cs
+++ b/OpenRA.Mods.Common/Widgets/Logic/SingleHotkeyBaseLogic.cs
@@ -22,9 +22,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var ks = Game.Settings.Keys;
MiniYaml yaml;
- var namedKey = new NamedHotkey();
+ var namedKey = new HotkeyReference();
if (logicArgs.TryGetValue(argName, out yaml))
- namedKey = new NamedHotkey(yaml.Value, ks);
+ namedKey = new HotkeyReference(yaml.Value, ks);
var keyhandler = widget.Get(parentName);
keyhandler.AddHandler(e =>
diff --git a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs
index cd865e7b1e..9797a9b5ca 100644
--- a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs
+++ b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Widgets
{
public ActorInfo Actor;
public string Name;
- public NamedHotkey Hotkey;
+ public HotkeyReference Hotkey;
public Sprite Sprite;
public PaletteReference Palette;
public PaletteReference IconClockPalette;
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Widgets
Lazy tooltipContainer;
ProductionQueue currentQueue;
- NamedHotkey[] hotkeys;
+ HotkeyReference[] hotkeys;
public ProductionQueue CurrentQueue
{
@@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Widgets
base.Initialize(args);
hotkeys = Exts.MakeArray(HotkeyCount,
- i => new NamedHotkey(HotkeyPrefix + (i + 1).ToString("D2"), Game.Settings.Keys));
+ i => new HotkeyReference(HotkeyPrefix + (i + 1).ToString("D2"), Game.Settings.Keys));
}
public void ScrollDown()
diff --git a/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs
index 8cdda60074..9d8fd92a21 100644
--- a/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs
+++ b/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs
@@ -69,8 +69,8 @@ namespace OpenRA.Mods.Common.Widgets
public readonly int TabWidth = 30;
public readonly int ArrowWidth = 20;
- public readonly NamedHotkey PreviousProductionTabKey = new NamedHotkey();
- public readonly NamedHotkey NextProductionTabKey = new NamedHotkey();
+ public readonly HotkeyReference PreviousProductionTabKey = new HotkeyReference();
+ public readonly HotkeyReference NextProductionTabKey = new HotkeyReference();
public readonly Dictionary Groups;
diff --git a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs
index 53f071efe9..0b4aee34ca 100644
--- a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs
+++ b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Widgets
public SupportPowerIcon TooltipIcon { get; private set; }
Lazy tooltipContainer;
- NamedHotkey[] hotkeys;
+ HotkeyReference[] hotkeys;
Rectangle eventBounds;
public override Rectangle EventBounds { get { return eventBounds; } }
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Widgets
base.Initialize(args);
hotkeys = Exts.MakeArray(HotkeyCount,
- i => new NamedHotkey(HotkeyPrefix + (i + 1).ToString("D2"), Game.Settings.Keys));
+ i => new HotkeyReference(HotkeyPrefix + (i + 1).ToString("D2"), Game.Settings.Keys));
}
public class SupportPowerIcon
@@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Widgets
public Sprite Sprite;
public PaletteReference Palette;
public PaletteReference IconClockPalette;
- public NamedHotkey Hotkey;
+ public HotkeyReference Hotkey;
}
public void RefreshIcons()
diff --git a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs
index 07ebc8bc72..6ed52c003b 100644
--- a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs
+++ b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs
@@ -26,15 +26,15 @@ namespace OpenRA.Mods.Common.Widgets
{
readonly ResourceLayer resourceLayer;
- public readonly NamedHotkey ScrollUpKey = new NamedHotkey();
- public readonly NamedHotkey ScrollDownKey = new NamedHotkey();
- public readonly NamedHotkey ScrollLeftKey = new NamedHotkey();
- public readonly NamedHotkey ScrollRightKey = new NamedHotkey();
+ public readonly HotkeyReference ScrollUpKey = new HotkeyReference();
+ public readonly HotkeyReference ScrollDownKey = new HotkeyReference();
+ public readonly HotkeyReference ScrollLeftKey = new HotkeyReference();
+ public readonly HotkeyReference ScrollRightKey = new HotkeyReference();
- public readonly NamedHotkey JumpToTopEdgeKey = new NamedHotkey();
- public readonly NamedHotkey JumpToBottomEdgeKey = new NamedHotkey();
- public readonly NamedHotkey JumpToLeftEdgeKey = new NamedHotkey();
- public readonly NamedHotkey JumpToRightEdgeKey = new NamedHotkey();
+ public readonly HotkeyReference JumpToTopEdgeKey = new HotkeyReference();
+ public readonly HotkeyReference JumpToBottomEdgeKey = new HotkeyReference();
+ public readonly HotkeyReference JumpToLeftEdgeKey = new HotkeyReference();
+ public readonly HotkeyReference JumpToRightEdgeKey = new HotkeyReference();
// Note: LinterHotkeyNames assumes that these are disabled by default
public readonly string BookmarkSaveKeyPrefix = null;
@@ -92,8 +92,8 @@ namespace OpenRA.Mods.Common.Widgets
World world;
WorldRenderer worldRenderer;
- NamedHotkey[] saveBookmarkHotkeys;
- NamedHotkey[] restoreBookmarkHotkeys;
+ HotkeyReference[] saveBookmarkHotkeys;
+ HotkeyReference[] restoreBookmarkHotkeys;
WPos?[] bookmarkPositions;
[CustomLintableHotkeyNames]
@@ -147,10 +147,10 @@ namespace OpenRA.Mods.Common.Widgets
base.Initialize(args);
saveBookmarkHotkeys = Exts.MakeArray(BookmarkKeyCount,
- i => new NamedHotkey(BookmarkSaveKeyPrefix + (i + 1).ToString("D2"), Game.Settings.Keys));
+ i => new HotkeyReference(BookmarkSaveKeyPrefix + (i + 1).ToString("D2"), Game.Settings.Keys));
restoreBookmarkHotkeys = Exts.MakeArray(BookmarkKeyCount,
- i => new NamedHotkey(BookmarkRestoreKeyPrefix + (i + 1).ToString("D2"), Game.Settings.Keys));
+ i => new HotkeyReference(BookmarkRestoreKeyPrefix + (i + 1).ToString("D2"), Game.Settings.Keys));
bookmarkPositions = new WPos?[BookmarkKeyCount];
}
@@ -427,7 +427,7 @@ namespace OpenRA.Mods.Common.Widgets
{
var key = Hotkey.FromKeyInput(e);
- Func handleMapScrollKey = (hotkey, scrollDirection) =>
+ Func handleMapScrollKey = (hotkey, scrollDirection) =>
{
var isHotkey = false;
var keyValue = hotkey.GetValue();
diff --git a/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs
index 17923e6d20..7193eda947 100644
--- a/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs
+++ b/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs
@@ -23,8 +23,8 @@ namespace OpenRA.Mods.Common.Widgets
{
public class WorldInteractionControllerWidget : Widget
{
- public readonly NamedHotkey SelectAllKey = new NamedHotkey();
- public readonly NamedHotkey SelectSameTypeKey = new NamedHotkey();
+ public readonly HotkeyReference SelectAllKey = new HotkeyReference();
+ public readonly HotkeyReference SelectSameTypeKey = new HotkeyReference();
protected readonly World World;
readonly WorldRenderer worldRenderer;