Fix end game window conflicting with ingame menu

Fixes #6311
This commit is contained in:
Oliver Brakmann
2014-08-23 14:49:28 +02:00
parent f0fc63b15d
commit 2f4c81b7c9
5 changed files with 13 additions and 7 deletions

View File

@@ -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)