Display the selector in all menus. Fix information leakage from previous mod.

This commit is contained in:
Paul Chote
2011-01-21 11:30:50 +13:00
parent 37fc836b46
commit 11aab8705e
5 changed files with 63 additions and 47 deletions

View File

@@ -9,6 +9,7 @@
#endregion
using OpenRA.Traits;
using OpenRA.Widgets;
namespace OpenRA.Mods.RA
{
@@ -30,6 +31,9 @@ namespace OpenRA.Mods.RA
public void WorldLoaded(World world)
{
// Remove all open widgets
Widget.RootWidget.Children.Clear();
if (world.LocalPlayer != null)
Game.OpenWindow(world, Info.Widget);
else if (Info.ObserverWidget != null)

View File

@@ -31,7 +31,8 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
widget.GetWidget("MAINMENU_BUTTON_REPLAY_VIEWER").OnMouseUp = mi => { Widget.OpenWindow("REPLAYBROWSER_BG"); return true; };
widget.GetWidget("MAINMENU_BUTTON_QUIT").OnMouseUp = mi => { Game.Exit(); return true; };
var selector = widget.GetWidget<ButtonWidget>("QUICKMODSWITCHER");
var switcher = Game.modData.WidgetLoader.LoadWidget( new Dictionary<string,object>(), Widget.RootWidget, "QUICKMODSWITCHER" );
var selector = switcher.GetWidget<ButtonWidget>("SWITCHER");
selector.OnMouseDown = _ => ShowModsDropDown(selector);
selector.GetText = ActiveModTitle;
}
@@ -57,7 +58,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
}
dropDownOptions.Add(new Pair<string, Action>( kv.Value.Title,
() => Game.InitializeWithMods( modList.ToArray() ) ));
() => Game.RunAfterTick(() => Game.InitializeWithMods( modList.ToArray() ) )));
}
DropDownButtonWidget.ShowDropDown( selector,