Updated the observer ui
This commit is contained in:
@@ -12,13 +12,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Lint;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
[ChromeLogicArgsHotkeys("StatisticsBasicKey", "StatisticsEconomyKey", "StatisticsProductionKey", "StatisticsCombatKey", "StatisticsGraphKey", "StatisticsArmyGraphKey")]
|
||||
public class MenuButtonsChromeLogic : ChromeLogic
|
||||
{
|
||||
readonly World world;
|
||||
@@ -38,10 +36,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
menuRoot = Ui.Root.Get("MENU_ROOT");
|
||||
|
||||
MiniYaml yaml;
|
||||
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) ? modData.Hotkeys[yaml.Value] : new HotkeyReference();
|
||||
|
||||
// System buttons
|
||||
var options = widget.GetOrNull<MenuButtonWidget>("OPTIONS_BUTTON");
|
||||
@@ -91,35 +85,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
});
|
||||
}
|
||||
|
||||
var stats = widget.GetOrNull<MenuButtonWidget>("OBSERVER_STATS_BUTTON");
|
||||
if (stats != null)
|
||||
{
|
||||
stats.IsDisabled = () => disableSystemButtons || world.Map.Visibility.HasFlag(MapVisibility.MissionSelector);
|
||||
stats.OnClick = () => OpenMenuPanel(stats, new WidgetArgs() { { "activePanel", ObserverStatsPanel.Basic } });
|
||||
}
|
||||
|
||||
var keyListener = widget.GetOrNull<LogicKeyListenerWidget>("OBSERVER_KEY_LISTENER");
|
||||
if (keyListener != null)
|
||||
{
|
||||
keyListener.AddHandler(e =>
|
||||
{
|
||||
if (e.Event == KeyInputEvent.Down && !e.IsRepeat)
|
||||
{
|
||||
for (var i = 0; i < statsHotkeys.Length; i++)
|
||||
{
|
||||
if (statsHotkeys[i].IsActivatedBy(e))
|
||||
{
|
||||
Game.Sound.PlayNotification(modData.DefaultRules, null, "Sounds", clickSound, null);
|
||||
OpenMenuPanel(stats, new WidgetArgs() { { "activePanel", i } });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (logicArgs.TryGetValue("ClickSound", out yaml))
|
||||
clickSound = yaml.Value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user