@@ -416,10 +416,13 @@ namespace OpenRA.Widgets
|
|||||||
}
|
}
|
||||||
|
|
||||||
public virtual void RemoveChild(Widget child)
|
public virtual void RemoveChild(Widget child)
|
||||||
|
{
|
||||||
|
if (child != null)
|
||||||
{
|
{
|
||||||
Children.Remove(child);
|
Children.Remove(child);
|
||||||
child.Removed();
|
child.Removed();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void RemoveChildren()
|
public virtual void RemoveChildren()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
|
|||||||
|
|
||||||
Action ShowLeaveRestartDialog = () =>
|
Action ShowLeaveRestartDialog = () =>
|
||||||
{
|
{
|
||||||
gameRoot.IsVisible = () => false;
|
gameRoot.RemoveChildren();
|
||||||
Game.LoadWidget(world, "LEAVE_RESTART_WIDGET", Ui.Root, new WidgetArgs());
|
Game.LoadWidget(world, "LEAVE_RESTART_WIDGET", Ui.Root, new WidgetArgs());
|
||||||
};
|
};
|
||||||
world.GameOver += ShowLeaveRestartDialog;
|
world.GameOver += ShowLeaveRestartDialog;
|
||||||
|
|||||||
@@ -32,9 +32,8 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
panelName = "LEAVE_RESTART_FULL";
|
panelName = "LEAVE_RESTART_FULL";
|
||||||
|
|
||||||
var dialog = widget.Get<ContainerWidget>(panelName);
|
var dialog = widget.Get<ContainerWidget>(panelName);
|
||||||
var fmvPlayer = Ui.Root.GetOrNull<BackgroundWidget>("FMVPLAYER");
|
|
||||||
dialog.IsVisible = () => true;
|
dialog.IsVisible = () => true;
|
||||||
widget.IsVisible = () => fmvPlayer == null || fmvPlayer != Ui.CurrentWindow();
|
widget.IsVisible = () => Ui.CurrentWindow() == null;
|
||||||
|
|
||||||
var leaveButton = dialog.Get<ButtonWidget>("LEAVE_BUTTON");
|
var leaveButton = dialog.Get<ButtonWidget>("LEAVE_BUTTON");
|
||||||
leaveButton.OnClick = () =>
|
leaveButton.OnClick = () =>
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
|
|
||||||
Action ShowLeaveRestartDialog = () =>
|
Action ShowLeaveRestartDialog = () =>
|
||||||
{
|
{
|
||||||
ingameRoot.IsVisible = () => false;
|
ingameRoot.RemoveChildren();
|
||||||
Game.LoadWidget(world, "LEAVE_RESTART_WIDGET", Ui.Root, new WidgetArgs());
|
Game.LoadWidget(world, "LEAVE_RESTART_WIDGET", Ui.Root, new WidgetArgs());
|
||||||
};
|
};
|
||||||
world.GameOver += ShowLeaveRestartDialog;
|
world.GameOver += ShowLeaveRestartDialog;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
readonly World world;
|
readonly World world;
|
||||||
readonly Widget ingameRoot;
|
readonly Widget ingameRoot;
|
||||||
bool disableSystemButtons;
|
bool disableSystemButtons;
|
||||||
|
Widget currentWidget;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public OrderButtonsChromeLogic(Widget widget, World world)
|
public OrderButtonsChromeLogic(Widget widget, World world)
|
||||||
@@ -28,6 +29,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
this.world = world;
|
this.world = world;
|
||||||
ingameRoot = Ui.Root.Get("INGAME_ROOT");
|
ingameRoot = Ui.Root.Get("INGAME_ROOT");
|
||||||
|
|
||||||
|
Action removeCurrentWidget = () => Ui.Root.RemoveChild(currentWidget);
|
||||||
|
world.GameOver += removeCurrentWidget;
|
||||||
|
|
||||||
// Order Buttons
|
// Order Buttons
|
||||||
var sell = widget.GetOrNull<ButtonWidget>("SELL_BUTTON");
|
var sell = widget.GetOrNull<ButtonWidget>("SELL_BUTTON");
|
||||||
if (sell != null)
|
if (sell != null)
|
||||||
@@ -139,7 +143,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
disableSystemButtons = false;
|
disableSystemButtons = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
Game.LoadWidget(world, button.MenuContainer, Ui.Root, widgetArgs);
|
currentWidget = Game.LoadWidget(world, button.MenuContainer, Ui.Root, widgetArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BindOrderButton<T>(World world, ButtonWidget w, string icon)
|
static void BindOrderButton<T>(World world, ButtonWidget w, string icon)
|
||||||
|
|||||||
Reference in New Issue
Block a user