Fix observer buttons.
This commit is contained in:
@@ -78,8 +78,16 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var observerWidgets = Game.LoadWidget(world, "OBSERVER_WIDGETS", playerRoot, new WidgetArgs());
|
var observerWidgets = Game.LoadWidget(world, "OBSERVER_WIDGETS", playerRoot, new WidgetArgs());
|
||||||
|
|
||||||
Game.LoadWidget(world, "OBSERVER_STATS", observerWidgets, new WidgetArgs());
|
Widget observerstats = null;
|
||||||
observerWidgets.Get<ButtonWidget>("INGAME_STATS_BUTTON").OnClick = () => gameRoot.Get("OBSERVER_STATS").Visible ^= true;
|
observerstats = Game.LoadWidget(world, "INGAME_OBSERVERSTATS_BG", observerWidgets, new WidgetArgs
|
||||||
|
{
|
||||||
|
{ "transient", false },
|
||||||
|
{ "onExit", () => observerstats.Visible = false }
|
||||||
|
});
|
||||||
|
observerstats.Visible = false;
|
||||||
|
|
||||||
|
var statsButton = observerWidgets.Get<ButtonWidget>("OBSERVER_STATS_BUTTON");
|
||||||
|
statsButton.OnClick = () => observerstats.Visible ^= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum RadarBinState { Closed, BinAnimating, RadarAnimating, Open };
|
enum RadarBinState { Closed, BinAnimating, RadarAnimating, Open };
|
||||||
@@ -90,7 +98,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
|
|||||||
Widget diplomacy = null;
|
Widget diplomacy = null;
|
||||||
diplomacy = Game.LoadWidget(world, "INGAME_DIPLOMACY_BG", playerWidgets, new WidgetArgs
|
diplomacy = Game.LoadWidget(world, "INGAME_DIPLOMACY_BG", playerWidgets, new WidgetArgs
|
||||||
{
|
{
|
||||||
{ "transient", true },
|
{ "transient", false },
|
||||||
{ "onExit", () => diplomacy.Visible = false }
|
{ "onExit", () => diplomacy.Visible = false }
|
||||||
});
|
});
|
||||||
diplomacy.Visible = false;
|
diplomacy.Visible = false;
|
||||||
@@ -104,7 +112,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
|
|||||||
Widget cheats = null;
|
Widget cheats = null;
|
||||||
cheats = Game.LoadWidget(world, "INGAME_DEBUG_BG", playerWidgets, new WidgetArgs
|
cheats = Game.LoadWidget(world, "INGAME_DEBUG_BG", playerWidgets, new WidgetArgs
|
||||||
{
|
{
|
||||||
{ "transient", true },
|
{ "transient", false },
|
||||||
{ "onExit", () => cheats.Visible = false }
|
{ "onExit", () => cheats.Visible = false }
|
||||||
});
|
});
|
||||||
cheats.Visible = false;
|
cheats.Visible = false;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
WorldRenderer worldRenderer;
|
WorldRenderer worldRenderer;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ObserverStatsLogic(World world, WorldRenderer worldRenderer, Widget widget)
|
public ObserverStatsLogic(World world, WorldRenderer worldRenderer, Widget widget, Action onExit, bool transient)
|
||||||
{
|
{
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.worldRenderer = worldRenderer;
|
this.worldRenderer = worldRenderer;
|
||||||
@@ -136,6 +136,21 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
|
|
||||||
ClearStats();
|
ClearStats();
|
||||||
DisplayStats(BasicStats);
|
DisplayStats(BasicStats);
|
||||||
|
|
||||||
|
var close = widget.GetOrNull<ButtonWidget>("CLOSE");
|
||||||
|
if (close != null)
|
||||||
|
{
|
||||||
|
close.OnClick = () =>
|
||||||
|
{
|
||||||
|
if (transient)
|
||||||
|
{
|
||||||
|
Ui.CloseWindow();
|
||||||
|
Ui.Root.RemoveChild(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
onExit();
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearStats()
|
void ClearStats()
|
||||||
|
|||||||
@@ -78,6 +78,13 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
debug.IsDisabled = () => disableSystemButtons;
|
debug.IsDisabled = () => disableSystemButtons;
|
||||||
debug.OnClick = () => OpenMenuPanel(debug);
|
debug.OnClick = () => OpenMenuPanel(debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var stats = widget.GetOrNull<MenuButtonWidget>("OBSERVER_STATS_BUTTON");
|
||||||
|
if (stats != null)
|
||||||
|
{
|
||||||
|
stats.IsDisabled = () => disableSystemButtons;
|
||||||
|
stats.OnClick = () => OpenMenuPanel(stats);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenMenuPanel(MenuButtonWidget button)
|
void OpenMenuPanel(MenuButtonWidget button)
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ Container@INGAME_ROOT:
|
|||||||
|
|
||||||
Container@OBSERVER_WIDGETS:
|
Container@OBSERVER_WIDGETS:
|
||||||
Children:
|
Children:
|
||||||
Button@OPTIONS_BUTTON:
|
MenuButton@OPTIONS_BUTTON:
|
||||||
|
Logic: OrderButtonsChromeLogic
|
||||||
Key: escape
|
Key: escape
|
||||||
X: WINDOW_RIGHT-202
|
X: WINDOW_RIGHT-202
|
||||||
Y: 5
|
Y: 5
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Container@OBSERVER_WIDGETS:
|
Container@OBSERVER_WIDGETS:
|
||||||
Children:
|
Children:
|
||||||
Button@INGAME_STATS_BUTTON:
|
Button@OBSERVER_STATS_BUTTON:
|
||||||
X: 162
|
X: 162
|
||||||
Y: 0
|
Y: 0
|
||||||
Width: 160
|
Width: 160
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
Container@OBSERVER_WIDGETS:
|
Container@OBSERVER_WIDGETS:
|
||||||
|
Logic: OrderButtonsChromeLogic
|
||||||
Children:
|
Children:
|
||||||
Container@GAME_TIMER_BLOCK:
|
Container@GAME_TIMER_BLOCK:
|
||||||
Logic: GameTimerLogic
|
Logic: GameTimerLogic
|
||||||
@@ -19,7 +20,10 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Align: Center
|
Align: Center
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Contrast: true
|
Contrast: true
|
||||||
Button@INGAME_OPTIONS_BUTTON:
|
MenuButton@OPTIONS_BUTTON:
|
||||||
|
MenuContainer: INGAME_OPTIONS_BG
|
||||||
|
HideIngameUI: false
|
||||||
|
Pause: false
|
||||||
X: 0
|
X: 0
|
||||||
Y: 0
|
Y: 0
|
||||||
Width: 160
|
Width: 160
|
||||||
@@ -27,7 +31,10 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Text: Options (ESC)
|
Text: Options (ESC)
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Key: escape
|
Key: escape
|
||||||
Button@INGAME_STATS_BUTTON:
|
MenuButton@OBSERVER_STATS_BUTTON:
|
||||||
|
MenuContainer: INGAME_OBSERVERSTATS_BG
|
||||||
|
HideIngameUI: false
|
||||||
|
Pause: false
|
||||||
X: 162
|
X: 162
|
||||||
Y: 0
|
Y: 0
|
||||||
Width: 160
|
Width: 160
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
Container@OBSERVER_STATS:
|
Background@INGAME_OBSERVERSTATS_BG:
|
||||||
Logic: ObserverStatsLogic
|
Logic: ObserverStatsLogic
|
||||||
X: 25
|
X: 25
|
||||||
Y: 50
|
Y: 50
|
||||||
Width: 950
|
Width: 950
|
||||||
Height: 500
|
Height: 500
|
||||||
Visible: false
|
|
||||||
Children:
|
|
||||||
Background@BACKGROUND:
|
|
||||||
Width: PARENT_RIGHT
|
|
||||||
Height: PARENT_BOTTOM
|
|
||||||
Background: dialog
|
Background: dialog
|
||||||
|
Children:
|
||||||
|
Container@BACKGROUND:
|
||||||
|
Width: PARENT_RIGHT
|
||||||
|
Height: PARENT_BOTTOM - 35
|
||||||
Children:
|
Children:
|
||||||
Label@TITLE:
|
Label@TITLE:
|
||||||
X: 0
|
X: 0
|
||||||
@@ -486,4 +485,11 @@ Container@OBSERVER_STATS:
|
|||||||
YAxisLabel: $
|
YAxisLabel: $
|
||||||
LabelFont: TinyBold
|
LabelFont: TinyBold
|
||||||
AxisFont: Bold
|
AxisFont: Bold
|
||||||
|
Button@CLOSE:
|
||||||
|
X: PARENT_RIGHT - 145
|
||||||
|
Y: PARENT_BOTTOM - 45
|
||||||
|
Width: 120
|
||||||
|
Height: 25
|
||||||
|
Text: Close
|
||||||
|
Key: escape
|
||||||
|
Font: Bold
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ Container@PLAYER_WIDGETS:
|
|||||||
Logic: AddRaceSuffixLogic
|
Logic: AddRaceSuffixLogic
|
||||||
MenuContainer: INGAME_DEBUG_BG
|
MenuContainer: INGAME_DEBUG_BG
|
||||||
HideIngameUI: false
|
HideIngameUI: false
|
||||||
|
Pause: false
|
||||||
Key: f2
|
Key: f2
|
||||||
X: 128
|
X: 128
|
||||||
Width: 28
|
Width: 28
|
||||||
@@ -126,6 +127,7 @@ Container@PLAYER_WIDGETS:
|
|||||||
Logic: AddRaceSuffixLogic
|
Logic: AddRaceSuffixLogic
|
||||||
MenuContainer: INGAME_DIPLOMACY_BG
|
MenuContainer: INGAME_DIPLOMACY_BG
|
||||||
HideIngameUI: false
|
HideIngameUI: false
|
||||||
|
Pause: false
|
||||||
Key: f1
|
Key: f1
|
||||||
X: 160
|
X: 160
|
||||||
Width: 28
|
Width: 28
|
||||||
|
|||||||
Reference in New Issue
Block a user