Migrate hotkey consumers to HotkeyManager.
This commit is contained in:
@@ -275,7 +275,7 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
else if (fieldType == typeof(HotkeyReference))
|
else if (fieldType == typeof(HotkeyReference))
|
||||||
{
|
{
|
||||||
return new HotkeyReference(value, Game.Settings.Keys);
|
return Game.ModData.Hotkeys[value];
|
||||||
}
|
}
|
||||||
else if (fieldType == typeof(WDist))
|
else if (fieldType == typeof(WDist))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,20 +32,6 @@ namespace OpenRA
|
|||||||
this.getValue = getValue;
|
this.getValue = getValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HotkeyReference(string name, KeySettings settings)
|
|
||||||
{
|
|
||||||
// Try parsing the value as a reference to a named hotkey
|
|
||||||
getValue = settings.GetHotkeyReference(name);
|
|
||||||
|
|
||||||
if (getValue == null)
|
|
||||||
{
|
|
||||||
// Try parsing the value as a normal (static) hotkey
|
|
||||||
var staticKey = Hotkey.Invalid;
|
|
||||||
Hotkey.TryParse(name, out staticKey);
|
|
||||||
getValue = () => staticKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Hotkey GetValue()
|
public Hotkey GetValue()
|
||||||
{
|
{
|
||||||
return getValue();
|
return getValue();
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
public class MapEditorLogic : ChromeLogic
|
public class MapEditorLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public MapEditorLogic(Widget widget, World world, WorldRenderer worldRenderer, Dictionary<string, MiniYaml> logicArgs)
|
public MapEditorLogic(Widget widget, ModData modData, World world, WorldRenderer worldRenderer, Dictionary<string, MiniYaml> logicArgs)
|
||||||
{
|
{
|
||||||
MiniYaml yaml;
|
MiniYaml yaml;
|
||||||
var changeZoomKey = new HotkeyReference();
|
var changeZoomKey = new HotkeyReference();
|
||||||
if (logicArgs.TryGetValue("ChangeZoomKey", out yaml))
|
if (logicArgs.TryGetValue("ChangeZoomKey", out yaml))
|
||||||
changeZoomKey = new HotkeyReference(yaml.Value, Game.Settings.Keys);
|
changeZoomKey = modData.Hotkeys[yaml.Value];
|
||||||
|
|
||||||
var editorViewport = widget.Get<EditorViewportControllerWidget>("MAP_EDITOR");
|
var editorViewport = widget.Get<EditorViewportControllerWidget>("MAP_EDITOR");
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
|||||||
readonly World world;
|
readonly World world;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public CycleBasesHotkeyLogic(Widget widget, WorldRenderer worldRenderer, World world, Dictionary<string, MiniYaml> logicArgs)
|
public CycleBasesHotkeyLogic(Widget widget, ModData modData, WorldRenderer worldRenderer, World world, Dictionary<string, MiniYaml> logicArgs)
|
||||||
: base(widget, "CycleBasesKey", "WORLD_KEYHANDLER", logicArgs)
|
: base(widget, modData, "CycleBasesKey", "WORLD_KEYHANDLER", logicArgs)
|
||||||
{
|
{
|
||||||
viewport = worldRenderer.Viewport;
|
viewport = worldRenderer.Viewport;
|
||||||
selection = world.Selection;
|
selection = world.Selection;
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
|||||||
readonly World world;
|
readonly World world;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public CycleProductionActorsHotkeyLogic(Widget widget, WorldRenderer worldRenderer, World world, Dictionary<string, MiniYaml> logicArgs)
|
public CycleProductionActorsHotkeyLogic(Widget widget, ModData modData, WorldRenderer worldRenderer, World world, Dictionary<string, MiniYaml> logicArgs)
|
||||||
: base(widget, "CycleProductionActorsKey", "WORLD_KEYHANDLER", logicArgs)
|
: base(widget, modData, "CycleProductionActorsKey", "WORLD_KEYHANDLER", logicArgs)
|
||||||
{
|
{
|
||||||
viewport = worldRenderer.Viewport;
|
viewport = worldRenderer.Viewport;
|
||||||
selection = world.Selection;
|
selection = world.Selection;
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
|||||||
StatusBarsType[] options = { StatusBarsType.Standard, StatusBarsType.DamageShow, StatusBarsType.AlwaysShow };
|
StatusBarsType[] options = { StatusBarsType.Standard, StatusBarsType.DamageShow, StatusBarsType.AlwaysShow };
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public CycleStatusBarsHotkeyLogic(Widget widget, Dictionary<string, MiniYaml> logicArgs)
|
public CycleStatusBarsHotkeyLogic(Widget widget, ModData modData, Dictionary<string, MiniYaml> logicArgs)
|
||||||
: base(widget, "CycleStatusBarsKey", "WORLD_KEYHANDLER", logicArgs) { }
|
: base(widget, modData, "CycleStatusBarsKey", "WORLD_KEYHANDLER", logicArgs) { }
|
||||||
|
|
||||||
protected override bool OnHotkeyActivated(KeyInput e)
|
protected override bool OnHotkeyActivated(KeyInput e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
|||||||
readonly RadarPings radarPings;
|
readonly RadarPings radarPings;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public JumpToLastEventHotkeyLogic(Widget widget, WorldRenderer worldRenderer, World world, Dictionary<string, MiniYaml> logicArgs)
|
public JumpToLastEventHotkeyLogic(Widget widget, ModData modData, WorldRenderer worldRenderer, World world, Dictionary<string, MiniYaml> logicArgs)
|
||||||
: base(widget, "JumpToLastEventKey", "WORLD_KEYHANDLER", logicArgs)
|
: base(widget, modData, "JumpToLastEventKey", "WORLD_KEYHANDLER", logicArgs)
|
||||||
{
|
{
|
||||||
viewport = worldRenderer.Viewport;
|
viewport = worldRenderer.Viewport;
|
||||||
radarPings = world.WorldActor.TraitOrDefault<RadarPings>();
|
radarPings = world.WorldActor.TraitOrDefault<RadarPings>();
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
|||||||
readonly Selection selection;
|
readonly Selection selection;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public JumpToSelectedActorsHotkeyLogic(Widget widget, WorldRenderer worldRenderer, World world, Dictionary<string, MiniYaml> logicArgs)
|
public JumpToSelectedActorsHotkeyLogic(Widget widget, ModData modData, WorldRenderer worldRenderer, World world, Dictionary<string, MiniYaml> logicArgs)
|
||||||
: base(widget, "JumpToSelectedActorsKey", "WORLD_KEYHANDLER", logicArgs)
|
: base(widget, modData, "JumpToSelectedActorsKey", "WORLD_KEYHANDLER", logicArgs)
|
||||||
{
|
{
|
||||||
viewport = worldRenderer.Viewport;
|
viewport = worldRenderer.Viewport;
|
||||||
selection = world.Selection;
|
selection = world.Selection;
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
|||||||
readonly World world;
|
readonly World world;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public PauseHotkeyLogic(Widget widget, World world, Dictionary<string, MiniYaml> logicArgs)
|
public PauseHotkeyLogic(Widget widget, ModData modData, World world, Dictionary<string, MiniYaml> logicArgs)
|
||||||
: base(widget, "PauseKey", "WORLD_KEYHANDLER", logicArgs)
|
: base(widget, modData, "PauseKey", "WORLD_KEYHANDLER", logicArgs)
|
||||||
{
|
{
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
|||||||
readonly Viewport viewport;
|
readonly Viewport viewport;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public TogglePixelDoubleHotkeyLogic(Widget widget, WorldRenderer worldRenderer, Dictionary<string, MiniYaml> logicArgs)
|
public TogglePixelDoubleHotkeyLogic(Widget widget, ModData modData, WorldRenderer worldRenderer, Dictionary<string, MiniYaml> logicArgs)
|
||||||
: base(widget, "TogglePixelDoubleKey", "WORLD_KEYHANDLER", logicArgs)
|
: base(widget, modData, "TogglePixelDoubleKey", "WORLD_KEYHANDLER", logicArgs)
|
||||||
{
|
{
|
||||||
viewport = worldRenderer.Viewport;
|
viewport = worldRenderer.Viewport;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
|||||||
public class TogglePlayerStanceColorHotkeyLogic : SingleHotkeyBaseLogic
|
public class TogglePlayerStanceColorHotkeyLogic : SingleHotkeyBaseLogic
|
||||||
{
|
{
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public TogglePlayerStanceColorHotkeyLogic(Widget widget, Dictionary<string, MiniYaml> logicArgs)
|
public TogglePlayerStanceColorHotkeyLogic(Widget widget, ModData modData, Dictionary<string, MiniYaml> logicArgs)
|
||||||
: base(widget, "TogglePlayerStanceColorKey", "WORLD_KEYHANDLER", logicArgs) { }
|
: base(widget, modData, "TogglePlayerStanceColorKey", "WORLD_KEYHANDLER", logicArgs) { }
|
||||||
|
|
||||||
protected override bool OnHotkeyActivated(KeyInput e)
|
protected override bool OnHotkeyActivated(KeyInput e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Widget currentWidget;
|
Widget currentWidget;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[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;
|
this.world = world;
|
||||||
|
|
||||||
@@ -36,11 +36,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
menuRoot = Ui.Root.Get("MENU_ROOT");
|
menuRoot = Ui.Root.Get("MENU_ROOT");
|
||||||
|
|
||||||
MiniYaml yaml;
|
MiniYaml yaml;
|
||||||
var ks = Game.Settings.Keys;
|
|
||||||
string[] keyNames = Enum.GetNames(typeof(ObserverStatsPanel));
|
string[] keyNames = Enum.GetNames(typeof(ObserverStatsPanel));
|
||||||
var statsHotkeys = new HotkeyReference[keyNames.Length];
|
var statsHotkeys = new HotkeyReference[keyNames.Length];
|
||||||
for (var i = 0; i < keyNames.Length; i++)
|
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
|
// System buttons
|
||||||
var options = widget.GetOrNull<MenuButtonWidget>("OPTIONS_BUTTON");
|
var options = widget.GetOrNull<MenuButtonWidget>("OPTIONS_BUTTON");
|
||||||
|
|||||||
@@ -62,15 +62,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ObserverShroudSelectorLogic(Widget widget, World world, Dictionary<string, MiniYaml> logicArgs)
|
public ObserverShroudSelectorLogic(Widget widget, ModData modData, World world, Dictionary<string, MiniYaml> logicArgs)
|
||||||
{
|
{
|
||||||
MiniYaml yaml;
|
MiniYaml yaml;
|
||||||
var ks = Game.Settings.Keys;
|
|
||||||
if (logicArgs.TryGetValue("CombinedViewKey", out yaml))
|
if (logicArgs.TryGetValue("CombinedViewKey", out yaml))
|
||||||
combinedViewKey = new HotkeyReference(yaml.Value, ks);
|
combinedViewKey = modData.Hotkeys[yaml.Value];
|
||||||
|
|
||||||
if (logicArgs.TryGetValue("WorldViewKey", out yaml))
|
if (logicArgs.TryGetValue("WorldViewKey", out yaml))
|
||||||
worldViewKey = new HotkeyReference(yaml.Value, ks);
|
worldViewKey = modData.Hotkeys[yaml.Value];
|
||||||
|
|
||||||
limitViews = world.Map.Visibility.HasFlag(MapVisibility.MissionSelector);
|
limitViews = world.Map.Visibility.HasFlag(MapVisibility.MissionSelector);
|
||||||
|
|
||||||
|
|||||||
@@ -44,17 +44,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly WorldRenderer worldRenderer;
|
readonly WorldRenderer worldRenderer;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ObserverStatsLogic(World world, WorldRenderer worldRenderer, Widget widget, Action onExit, ObserverStatsPanel activePanel, Dictionary<string, MiniYaml> logicArgs)
|
public ObserverStatsLogic(World world, ModData modData, WorldRenderer worldRenderer, Widget widget,
|
||||||
|
Action onExit, ObserverStatsPanel activePanel, Dictionary<string, MiniYaml> logicArgs)
|
||||||
{
|
{
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.worldRenderer = worldRenderer;
|
this.worldRenderer = worldRenderer;
|
||||||
|
|
||||||
MiniYaml yaml;
|
MiniYaml yaml;
|
||||||
var ks = Game.Settings.Keys;
|
|
||||||
string[] keyNames = Enum.GetNames(typeof(ObserverStatsPanel));
|
string[] keyNames = Enum.GetNames(typeof(ObserverStatsPanel));
|
||||||
var statsHotkeys = new HotkeyReference[keyNames.Length];
|
var statsHotkeys = new HotkeyReference[keyNames.Length];
|
||||||
for (var i = 0; i < keyNames.Length; i++)
|
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();
|
||||||
|
|
||||||
players = world.Players.Where(p => !p.NonCombatant);
|
players = world.Players.Where(p => !p.NonCombatant);
|
||||||
|
|
||||||
|
|||||||
@@ -22,28 +22,26 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly MusicPlaylist musicPlaylist;
|
readonly MusicPlaylist musicPlaylist;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public MusicHotkeyLogic(Widget widget, World world, Dictionary<string, MiniYaml> logicArgs)
|
public MusicHotkeyLogic(Widget widget, ModData modData, World world, Dictionary<string, MiniYaml> logicArgs)
|
||||||
{
|
{
|
||||||
musicPlaylist = world.WorldActor.Trait<MusicPlaylist>();
|
musicPlaylist = world.WorldActor.Trait<MusicPlaylist>();
|
||||||
|
|
||||||
var ks = Game.Settings.Keys;
|
|
||||||
MiniYaml yaml;
|
MiniYaml yaml;
|
||||||
|
|
||||||
var stopKey = new HotkeyReference();
|
var stopKey = new HotkeyReference();
|
||||||
if (logicArgs.TryGetValue("StopMusicKey", out yaml))
|
if (logicArgs.TryGetValue("StopMusicKey", out yaml))
|
||||||
stopKey = new HotkeyReference(yaml.Value, ks);
|
stopKey = modData.Hotkeys[yaml.Value];
|
||||||
|
|
||||||
var pauseKey = new HotkeyReference();
|
var pauseKey = new HotkeyReference();
|
||||||
if (logicArgs.TryGetValue("PauseMusicKey", out yaml))
|
if (logicArgs.TryGetValue("PauseMusicKey", out yaml))
|
||||||
pauseKey = new HotkeyReference(yaml.Value, ks);
|
pauseKey = modData.Hotkeys[yaml.Value];
|
||||||
|
|
||||||
var prevKey = new HotkeyReference();
|
var prevKey = new HotkeyReference();
|
||||||
if (logicArgs.TryGetValue("PrevMusicKey", out yaml))
|
if (logicArgs.TryGetValue("PrevMusicKey", out yaml))
|
||||||
prevKey = new HotkeyReference(yaml.Value, ks);
|
prevKey = modData.Hotkeys[yaml.Value];
|
||||||
|
|
||||||
var nextKey = new HotkeyReference();
|
var nextKey = new HotkeyReference();
|
||||||
if (logicArgs.TryGetValue("NextMusicKey", out yaml))
|
if (logicArgs.TryGetValue("NextMusicKey", out yaml))
|
||||||
nextKey = new HotkeyReference(yaml.Value, ks);
|
nextKey = modData.Hotkeys[yaml.Value];
|
||||||
|
|
||||||
var keyhandler = widget.Get<LogicKeyListenerWidget>("GLOBAL_KEYHANDLER");
|
var keyhandler = widget.Get<LogicKeyListenerWidget>("GLOBAL_KEYHANDLER");
|
||||||
keyhandler.AddHandler(e =>
|
keyhandler.AddHandler(e =>
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
public class MuteHotkeyLogic : SingleHotkeyBaseLogic
|
public class MuteHotkeyLogic : SingleHotkeyBaseLogic
|
||||||
{
|
{
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public MuteHotkeyLogic(Widget widget, Dictionary<string, MiniYaml> logicArgs)
|
public MuteHotkeyLogic(Widget widget, ModData modData, Dictionary<string, MiniYaml> logicArgs)
|
||||||
: base(widget, "MuteAudioKey", "GLOBAL_KEYHANDLER", logicArgs) { }
|
: base(widget, modData, "MuteAudioKey", "GLOBAL_KEYHANDLER", logicArgs) { }
|
||||||
|
|
||||||
protected override bool OnHotkeyActivated(KeyInput e)
|
protected override bool OnHotkeyActivated(KeyInput e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
public class ScreenshotHotkeyLogic : SingleHotkeyBaseLogic
|
public class ScreenshotHotkeyLogic : SingleHotkeyBaseLogic
|
||||||
{
|
{
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ScreenshotHotkeyLogic(Widget widget, Dictionary<string, MiniYaml> logicArgs)
|
public ScreenshotHotkeyLogic(Widget widget, ModData modData, Dictionary<string, MiniYaml> logicArgs)
|
||||||
: base(widget, "TakeScreenshotKey", "GLOBAL_KEYHANDLER", logicArgs) { }
|
: base(widget, modData, "TakeScreenshotKey", "GLOBAL_KEYHANDLER", logicArgs) { }
|
||||||
|
|
||||||
protected override bool OnHotkeyActivated(KeyInput e)
|
protected override bool OnHotkeyActivated(KeyInput e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,14 +17,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public abstract class SingleHotkeyBaseLogic : ChromeLogic
|
public abstract class SingleHotkeyBaseLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
protected SingleHotkeyBaseLogic(Widget widget, string argName, string parentName, Dictionary<string, MiniYaml> logicArgs)
|
protected SingleHotkeyBaseLogic(Widget widget, ModData modData, string argName, string parentName, Dictionary<string, MiniYaml> logicArgs)
|
||||||
{
|
{
|
||||||
var ks = Game.Settings.Keys;
|
|
||||||
MiniYaml yaml;
|
MiniYaml yaml;
|
||||||
|
|
||||||
var namedKey = new HotkeyReference();
|
var namedKey = new HotkeyReference();
|
||||||
if (logicArgs.TryGetValue(argName, out yaml))
|
if (logicArgs.TryGetValue(argName, out yaml))
|
||||||
namedKey = new HotkeyReference(yaml.Value, ks);
|
namedKey = modData.Hotkeys[yaml.Value];
|
||||||
|
|
||||||
var keyhandler = widget.Get<LogicKeyListenerWidget>(parentName);
|
var keyhandler = widget.Get<LogicKeyListenerWidget>(parentName);
|
||||||
keyhandler.AddHandler(e =>
|
keyhandler.AddHandler(e =>
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public ProductionIcon TooltipIcon { get; private set; }
|
public ProductionIcon TooltipIcon { get; private set; }
|
||||||
public Func<ProductionIcon> GetTooltipIcon;
|
public Func<ProductionIcon> GetTooltipIcon;
|
||||||
public readonly World World;
|
public readonly World World;
|
||||||
|
readonly ModData modData;
|
||||||
readonly OrderManager orderManager;
|
readonly OrderManager orderManager;
|
||||||
|
|
||||||
public int MinimumRows = 4;
|
public int MinimumRows = 4;
|
||||||
@@ -127,8 +128,9 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ProductionPaletteWidget(OrderManager orderManager, World world, WorldRenderer worldRenderer)
|
public ProductionPaletteWidget(ModData modData, OrderManager orderManager, World world, WorldRenderer worldRenderer)
|
||||||
{
|
{
|
||||||
|
this.modData = modData;
|
||||||
this.orderManager = orderManager;
|
this.orderManager = orderManager;
|
||||||
World = world;
|
World = world;
|
||||||
this.worldRenderer = worldRenderer;
|
this.worldRenderer = worldRenderer;
|
||||||
@@ -146,7 +148,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
base.Initialize(args);
|
base.Initialize(args);
|
||||||
|
|
||||||
hotkeys = Exts.MakeArray(HotkeyCount,
|
hotkeys = Exts.MakeArray(HotkeyCount,
|
||||||
i => new HotkeyReference(HotkeyPrefix + (i + 1).ToString("D2"), Game.Settings.Keys));
|
i => modData.Hotkeys[HotkeyPrefix + (i + 1).ToString("D2")]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ScrollDown()
|
public void ScrollDown()
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public int IconCount { get; private set; }
|
public int IconCount { get; private set; }
|
||||||
public event Action<int, int> OnIconCountChanged = (a, b) => { };
|
public event Action<int, int> OnIconCountChanged = (a, b) => { };
|
||||||
|
|
||||||
|
readonly ModData modData;
|
||||||
readonly WorldRenderer worldRenderer;
|
readonly WorldRenderer worldRenderer;
|
||||||
readonly SupportPowerManager spm;
|
readonly SupportPowerManager spm;
|
||||||
|
|
||||||
@@ -82,8 +83,9 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public SupportPowersWidget(World world, WorldRenderer worldRenderer)
|
public SupportPowersWidget(ModData modData, World world, WorldRenderer worldRenderer)
|
||||||
{
|
{
|
||||||
|
this.modData = modData;
|
||||||
this.worldRenderer = worldRenderer;
|
this.worldRenderer = worldRenderer;
|
||||||
spm = world.LocalPlayer.PlayerActor.Trait<SupportPowerManager>();
|
spm = world.LocalPlayer.PlayerActor.Trait<SupportPowerManager>();
|
||||||
tooltipContainer = Exts.Lazy(() =>
|
tooltipContainer = Exts.Lazy(() =>
|
||||||
@@ -98,7 +100,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
base.Initialize(args);
|
base.Initialize(args);
|
||||||
|
|
||||||
hotkeys = Exts.MakeArray(HotkeyCount,
|
hotkeys = Exts.MakeArray(HotkeyCount,
|
||||||
i => new HotkeyReference(HotkeyPrefix + (i + 1).ToString("D2"), Game.Settings.Keys));
|
i => modData.Hotkeys[HotkeyPrefix + (i + 1).ToString("D2")]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SupportPowerIcon
|
public class SupportPowerIcon
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
public class ViewportControllerWidget : Widget
|
public class ViewportControllerWidget : Widget
|
||||||
{
|
{
|
||||||
|
readonly ModData modData;
|
||||||
readonly ResourceLayer resourceLayer;
|
readonly ResourceLayer resourceLayer;
|
||||||
|
|
||||||
public readonly HotkeyReference ScrollUpKey = new HotkeyReference();
|
public readonly HotkeyReference ScrollUpKey = new HotkeyReference();
|
||||||
@@ -132,8 +133,9 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ViewportControllerWidget(World world, WorldRenderer worldRenderer)
|
public ViewportControllerWidget(ModData modData, World world, WorldRenderer worldRenderer)
|
||||||
{
|
{
|
||||||
|
this.modData = modData;
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.worldRenderer = worldRenderer;
|
this.worldRenderer = worldRenderer;
|
||||||
tooltipContainer = Exts.Lazy(() =>
|
tooltipContainer = Exts.Lazy(() =>
|
||||||
@@ -147,10 +149,10 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
base.Initialize(args);
|
base.Initialize(args);
|
||||||
|
|
||||||
saveBookmarkHotkeys = Exts.MakeArray(BookmarkKeyCount,
|
saveBookmarkHotkeys = Exts.MakeArray(BookmarkKeyCount,
|
||||||
i => new HotkeyReference(BookmarkSaveKeyPrefix + (i + 1).ToString("D2"), Game.Settings.Keys));
|
i => modData.Hotkeys[BookmarkSaveKeyPrefix + (i + 1).ToString("D2")]);
|
||||||
|
|
||||||
restoreBookmarkHotkeys = Exts.MakeArray(BookmarkKeyCount,
|
restoreBookmarkHotkeys = Exts.MakeArray(BookmarkKeyCount,
|
||||||
i => new HotkeyReference(BookmarkRestoreKeyPrefix + (i + 1).ToString("D2"), Game.Settings.Keys));
|
i => modData.Hotkeys[BookmarkRestoreKeyPrefix + (i + 1).ToString("D2")]);
|
||||||
|
|
||||||
bookmarkPositions = new WPos?[BookmarkKeyCount];
|
bookmarkPositions = new WPos?[BookmarkKeyCount];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user