Display the selector in all menus. Fix information leakage from previous mod.
This commit is contained in:
@@ -102,7 +102,6 @@ namespace OpenRA
|
||||
|
||||
static object syncroot = new object();
|
||||
static Action tickActions = () => {};
|
||||
|
||||
public static void RunAfterTick(Action a) { lock(syncroot) tickActions += a; }
|
||||
static void Tick( OrderManager orderManager, Viewport viewPort )
|
||||
{
|
||||
@@ -251,9 +250,19 @@ namespace OpenRA
|
||||
|
||||
public static void InitializeWithMods(string[] mods)
|
||||
{
|
||||
// Clear static state if we have switched mods
|
||||
LobbyInfoChanged = () => {};
|
||||
AddChatLine = (a,b,c) => {};
|
||||
worldRenderer = null;
|
||||
if (server != null)
|
||||
server.Shutdown();
|
||||
if (orderManager != null)
|
||||
orderManager.Dispose();
|
||||
|
||||
// Discard any invalid mods
|
||||
var mm = mods.Where( m => Mod.AllMods.ContainsKey( m ) ).ToArray();
|
||||
Console.WriteLine("Loading mods: {0}",string.Join(",",mm));
|
||||
|
||||
|
||||
modData = new ModData( mm );
|
||||
modData.LoadInitialAssets();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -72,28 +72,29 @@ Background@MAINMENU_BG:
|
||||
Height:25
|
||||
Text:Video Player
|
||||
Bold:True
|
||||
Background@QUICKMODSWITCHER_BG:
|
||||
Background: dialog4
|
||||
X:(WINDOW_RIGHT - PARENT_LEFT - WIDTH - 10)
|
||||
Y:10 - PARENT_TOP
|
||||
Width:205
|
||||
Height:35
|
||||
Children:
|
||||
Label@TITLE:
|
||||
X:8
|
||||
Y:3
|
||||
Width:PARENT_RIGHT
|
||||
Height:25
|
||||
Text:Mod:
|
||||
Align:Left
|
||||
Bold:True
|
||||
DropDownButton@QUICKMODSWITCHER:
|
||||
Id:QUICKMODSWITCHER
|
||||
Text:Team
|
||||
Width:150
|
||||
Height:25
|
||||
X:50
|
||||
Y:5
|
||||
Background@QUICKMODSWITCHER:
|
||||
Id:QUICKMODSWITCHER
|
||||
Background: dialog4
|
||||
X:(WINDOW_RIGHT - PARENT_LEFT - WIDTH - 10)
|
||||
Y:10 - PARENT_TOP
|
||||
Width:205
|
||||
Height:35
|
||||
Children:
|
||||
Label@TITLE:
|
||||
X:8
|
||||
Y:3
|
||||
Width:PARENT_RIGHT
|
||||
Height:25
|
||||
Text:Mod:
|
||||
Align:Left
|
||||
Bold:True
|
||||
DropDownButton@SWITCHER:
|
||||
Id:SWITCHER
|
||||
Text:Team
|
||||
Width:150
|
||||
Height:25
|
||||
X:50
|
||||
Y:5
|
||||
Background@PERF_BG:
|
||||
Id:PERF_BG
|
||||
Background:dialog4
|
||||
|
||||
@@ -73,28 +73,29 @@ Background@MAINMENU_BG:
|
||||
Height:25
|
||||
Text:Video Player
|
||||
Bold:True
|
||||
Background@QUICKMODSWITCHER_BG:
|
||||
Background: dialog4
|
||||
X:(WINDOW_RIGHT - PARENT_LEFT - WIDTH - 10)
|
||||
Y:10 - PARENT_TOP
|
||||
Width:205
|
||||
Height:35
|
||||
Children:
|
||||
Label@TITLE:
|
||||
X:8
|
||||
Y:3
|
||||
Width:PARENT_RIGHT
|
||||
Height:25
|
||||
Text:Mod:
|
||||
Align:Left
|
||||
Bold:True
|
||||
DropDownButton@QUICKMODSWITCHER:
|
||||
Id:QUICKMODSWITCHER
|
||||
Text:Team
|
||||
Width:150
|
||||
Height:25
|
||||
X:50
|
||||
Y:5
|
||||
Background@QUICKMODSWITCHER:
|
||||
Id:QUICKMODSWITCHER
|
||||
Background: dialog4
|
||||
X:(WINDOW_RIGHT - PARENT_LEFT - WIDTH - 10)
|
||||
Y:10 - PARENT_TOP
|
||||
Width:205
|
||||
Height:35
|
||||
Children:
|
||||
Label@TITLE:
|
||||
X:8
|
||||
Y:3
|
||||
Width:PARENT_RIGHT
|
||||
Height:25
|
||||
Text:Mod:
|
||||
Align:Left
|
||||
Bold:True
|
||||
DropDownButton@SWITCHER:
|
||||
Id:SWITCHER
|
||||
Text:Team
|
||||
Width:150
|
||||
Height:25
|
||||
X:50
|
||||
Y:5
|
||||
Background@PERF_BG:
|
||||
ClickThrough:true
|
||||
Id:PERF_BG
|
||||
|
||||
Reference in New Issue
Block a user