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