Use the same mechanism for loading ingame and shellmap ui.
This commit is contained in:
@@ -112,6 +112,16 @@ namespace OpenRA
|
|||||||
{ "worldRenderer", worldRenderer },
|
{ "worldRenderer", worldRenderer },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Widget LoadWidget(World world, string widget, Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
return Widget.LoadWidget(widget, new Dictionary<string,object>(args)
|
||||||
|
{
|
||||||
|
{ "world", world },
|
||||||
|
{ "orderManager", orderManager },
|
||||||
|
{ "worldRenderer", worldRenderer },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
static ActionQueue afterTickActions = new ActionQueue();
|
static ActionQueue afterTickActions = new ActionQueue();
|
||||||
public static void RunAfterTick(Action a) { afterTickActions.Add(a); }
|
public static void RunAfterTick(Action a) { afterTickActions.Add(a); }
|
||||||
|
|||||||
@@ -91,11 +91,8 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
var onQuit = (Action)(() =>
|
var onQuit = (Action)(() =>
|
||||||
{
|
{
|
||||||
Game.DisconnectOnly();
|
Game.DisconnectOnly();
|
||||||
|
|
||||||
// This is stupid. It should be handled by the shellmap
|
|
||||||
Game.LoadShellMap();
|
|
||||||
Widget.RootWidget.RemoveChildren();
|
Widget.RootWidget.RemoveChildren();
|
||||||
Widget.LoadWidget("MENU_BACKGROUND", new Dictionary<string, object>());
|
Game.LoadShellMap();
|
||||||
});
|
});
|
||||||
|
|
||||||
var doNothing = (Action)(() => {});
|
var doNothing = (Action)(() => {});
|
||||||
|
|||||||
@@ -10,9 +10,11 @@
|
|||||||
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
|
// Legacy crap
|
||||||
public class OpenWidgetAtGameStartInfo : ITraitInfo
|
public class OpenWidgetAtGameStartInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly string Widget = "INGAME_ROOT";
|
public readonly string Widget = "INGAME_ROOT";
|
||||||
@@ -40,4 +42,25 @@ namespace OpenRA.Mods.RA
|
|||||||
Game.OpenWindow(world, Info.ObserverWidget);
|
Game.OpenWindow(world, Info.ObserverWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New version
|
||||||
|
public class LoadWidgetAtGameStartInfo : ITraitInfo
|
||||||
|
{
|
||||||
|
public readonly string Widget = null;
|
||||||
|
public object Create(ActorInitializer init) { return new LoadWidgetAtGameStart(this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LoadWidgetAtGameStart: IWorldLoaded
|
||||||
|
{
|
||||||
|
readonly LoadWidgetAtGameStartInfo Info;
|
||||||
|
public LoadWidgetAtGameStart(LoadWidgetAtGameStartInfo Info)
|
||||||
|
{
|
||||||
|
this.Info = Info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WorldLoaded(World world)
|
||||||
|
{
|
||||||
|
Game.LoadWidget(world, Info.Widget, new Dictionary<string, object>());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -71,11 +71,11 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
|||||||
if (FileSystem.Exists(Info.TestFile))
|
if (FileSystem.Exists(Info.TestFile))
|
||||||
{
|
{
|
||||||
Game.LoadShellMap();
|
Game.LoadShellMap();
|
||||||
Widget.RootWidget.RemoveChildren();
|
if (Info.InstallMode != "cnc")
|
||||||
if (Info.InstallMode == "cnc")
|
{
|
||||||
Widget.LoadWidget("MENU_BACKGROUND", new Dictionary<string, object>());
|
Widget.RootWidget.RemoveChildren();
|
||||||
else
|
|
||||||
Widget.OpenWindow("MAINMENU_BG");
|
Widget.OpenWindow("MAINMENU_BG");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1014,7 +1014,8 @@ Rules:
|
|||||||
-CrateSpawner:
|
-CrateSpawner:
|
||||||
CncShellmapScript:
|
CncShellmapScript:
|
||||||
DesaturatedPaletteEffect:
|
DesaturatedPaletteEffect:
|
||||||
-OpenWidgetAtGameStart:
|
LoadWidgetAtGameStart:
|
||||||
|
Widget:MENU_BACKGROUND
|
||||||
LST:
|
LST:
|
||||||
Mobile:
|
Mobile:
|
||||||
Speed: 3
|
Speed: 3
|
||||||
|
|||||||
@@ -44,9 +44,8 @@ Player:
|
|||||||
SurrenderOnDisconnect:
|
SurrenderOnDisconnect:
|
||||||
|
|
||||||
World:
|
World:
|
||||||
OpenWidgetAtGameStart:
|
LoadWidgetAtGameStart:
|
||||||
Widget: INGAME_ROOT
|
Widget: INGAME_ROOT
|
||||||
ObserverWidget: OBSERVER_ROOT
|
|
||||||
ScreenShaker:
|
ScreenShaker:
|
||||||
NukePaletteEffect:
|
NukePaletteEffect:
|
||||||
CncWaterPaletteRotation:
|
CncWaterPaletteRotation:
|
||||||
|
|||||||
Reference in New Issue
Block a user