Migrate hotkey consumers to HotkeyManager.

This commit is contained in:
Paul Chote
2017-10-28 09:12:54 +01:00
committed by abcdefg30
parent 35a3df3736
commit 2f79173044
21 changed files with 51 additions and 64 deletions

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Widget currentWidget;
[ObjectCreator.UseCtor]
public MenuButtonsChromeLogic(Widget widget, World world, Dictionary<string, MiniYaml> logicArgs)
public MenuButtonsChromeLogic(Widget widget, ModData modData, World world, Dictionary<string, MiniYaml> logicArgs)
{
this.world = world;
@@ -36,11 +36,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
menuRoot = Ui.Root.Get("MENU_ROOT");
MiniYaml yaml;
var ks = Game.Settings.Keys;
string[] keyNames = Enum.GetNames(typeof(ObserverStatsPanel));
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 HotkeyReference(yaml.Value, ks) : new HotkeyReference();
statsHotkeys[i] = logicArgs.TryGetValue("Statistics" + keyNames[i] + "Key", out yaml) ? modData.Hotkeys[yaml.Value] : new HotkeyReference();
// System buttons
var options = widget.GetOrNull<MenuButtonWidget>("OPTIONS_BUTTON");