-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfix.patch
More file actions
84 lines (78 loc) · 2.63 KB
/
fix.patch
File metadata and controls
84 lines (78 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
diff --git a/OpenRA.Mods.CA/Widgets/Logic/Ingame/ProductionTabsLogicCA.cs b/OpenRA.Mods.CA/Widgets/Logic/Ingame/ProductionTabsLogicCA.cs
index 2ed4c5f2..00000000 100644
--- a/OpenRA.Mods.CA/Widgets/Logic/Ingame/ProductionTabsLogicCA.cs
+++ b/OpenRA.Mods.CA/Widgets/Logic/Ingame/ProductionTabsLogicCA.cs
@@ -10,6 +10,7 @@
using System;
using System.Linq;
+using OpenRA;
using OpenRA.Mods.Common.Widgets;
using OpenRA.Widgets;
@@ -17,6 +18,9 @@ namespace OpenRA.Mods.CA.Widgets.Logic
{
public class ProductionTabsLogicCA : ChromeLogic
{
+ const string PromotionGroupName = "Promotion";
+ const string CommanderTreeOverlayId = "COMMANDER_TREE_OVERLAY";
+
readonly ProductionTabsCAWidget tabs;
readonly World world;
@@ -25,6 +29,29 @@ namespace OpenRA.Mods.CA.Widgets.Logic
{
if (button == null)
return;
+
+ if (string.Equals(button.ProductionGroup, PromotionGroupName, StringComparison.OrdinalIgnoreCase))
+ {
+ button.IsDisabled = () => false;
+
+ button.OnMouseDown = mi =>
+ {
+ if (mi.Button == MouseButton.Left)
+ OpenCommanderTree();
+ };
+ button.OnMouseUp = _ => { };
+ button.OnClick = () => { };
+ button.OnKeyPress = e =>
+ {
+ if (e.Event != KeyInputEvent.Down)
+ return;
+
+ OpenCommanderTree();
+ };
+ button.IsHighlighted = () => Ui.CurrentWindow() != null && Ui.CurrentWindow().Id == CommanderTreeOverlayId;
+
+ var chromeName = button.ProductionGroup.ToLowerInvariant();
+ var icon = button.Get<ImageWidget>("ICON");
+ icon.GetImageName = () => tabs.Groups[button.ProductionGroup].Alert ? chromeName + "-alert" : chromeName;
+
+ return;
+ }
Action<bool> selectTab = reverse =>
{
@@ -40,7 +67,7 @@ namespace OpenRA.Mods.CA.Widgets.Logic
button.IsHighlighted = () => tabs.QueueGroup == button.ProductionGroup;
var chromeName = button.ProductionGroup.ToLowerInvariant();
- var icon = button.Get<ImageWidget>("ICON");
- icon.GetImageName = () => button.IsDisabled() ? chromeName + "-disabled" :
- tabs.Groups[button.ProductionGroup].Alert ? chromeName + "-alert" : chromeName;
+ var icon = button.Get<ImageWidget>("ICON");
+ icon.GetImageName = () => button.IsDisabled() ? chromeName + "-disabled" :
+ tabs.Groups[button.ProductionGroup].Alert ? chromeName + "-alert" : chromeName;
}
+ void OpenCommanderTree()
+ {
+ var current = Ui.CurrentWindow();
+ if (current != null && current.Id == CommanderTreeOverlayId)
+ {
+ Ui.CloseWindow();
+ return;
+ }
+
+ Ui.OpenWindow(CommanderTreeOverlayId);
+ Ui.ResetTooltips();
+ }
+
[ObjectCreator.UseCtor]
public ProductionTabsLogicCA(Widget widget, World world)
{