Make Game.LoadWidget / Widget.LoadWidget consistent.
This commit is contained in:
@@ -114,14 +114,14 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load a widget with world, orderManager, worldRenderer args, without adding it to the widget tree
|
// Load a widget with world, orderManager, worldRenderer args, without adding it to the widget tree
|
||||||
public static Widget LoadWidget(World world, string widget, WidgetArgs args)
|
public static Widget LoadWidget(World world, string id, Widget parent, WidgetArgs args)
|
||||||
{
|
{
|
||||||
return Game.modData.WidgetLoader.LoadWidget(new WidgetArgs(args)
|
return Game.modData.WidgetLoader.LoadWidget(new WidgetArgs(args)
|
||||||
{
|
{
|
||||||
{ "world", world },
|
{ "world", world },
|
||||||
{ "orderManager", orderManager },
|
{ "orderManager", orderManager },
|
||||||
{ "worldRenderer", worldRenderer },
|
{ "worldRenderer", worldRenderer },
|
||||||
}, null, widget);
|
}, parent, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ActionQueue afterTickActions = new ActionQueue();
|
static ActionQueue afterTickActions = new ActionQueue();
|
||||||
|
|||||||
@@ -334,9 +334,9 @@ namespace OpenRA.Widgets
|
|||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Widget LoadWidget(string id, WidgetArgs args)
|
public static Widget LoadWidget(string id, Widget parent, WidgetArgs args)
|
||||||
{
|
{
|
||||||
return Game.modData.WidgetLoader.LoadWidget(args, rootWidget, id);
|
return Game.modData.WidgetLoader.LoadWidget(args, parent, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DoTick()
|
public static void DoTick()
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
{ "continueLoading", () => TestAndContinue() },
|
{ "continueLoading", () => TestAndContinue() },
|
||||||
{ "installData", Info }
|
{ "installData", Info }
|
||||||
};
|
};
|
||||||
Widget.LoadWidget(Info["InstallerBackgroundWidget"], args);
|
Widget.LoadWidget(Info["InstallerBackgroundWidget"], Widget.RootWidget, args);
|
||||||
Widget.OpenWindow(Info["InstallerMenuWidget"], args);
|
Widget.OpenWindow(Info["InstallerMenuWidget"], args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -59,7 +59,10 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
ingameRoot.GetWidget<CncMenuButtonWidget>("OPTIONS_BUTTON").OnClick = () =>
|
ingameRoot.GetWidget<CncMenuButtonWidget>("OPTIONS_BUTTON").OnClick = () =>
|
||||||
{
|
{
|
||||||
ingameRoot.IsVisible = () => false;
|
ingameRoot.IsVisible = () => false;
|
||||||
Widget.LoadWidget("INGAME_MENU", new WidgetArgs() {{ "world", world }, { "onExit", () => ingameRoot.IsVisible = () => true }});
|
Game.LoadWidget(world, "INGAME_MENU", Widget.RootWidget, new WidgetArgs()
|
||||||
|
{
|
||||||
|
{ "onExit", () => ingameRoot.IsVisible = () => true }
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var postgameBG = ingameRoot.GetWidget("POSTGAME_BG");
|
var postgameBG = ingameRoot.GetWidget("POSTGAME_BG");
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
CurrentColorPreview = c;
|
CurrentColorPreview = c;
|
||||||
};
|
};
|
||||||
|
|
||||||
var colorChooser = Game.LoadWidget(orderManager.world, "COLOR_CHOOSER", new WidgetArgs()
|
var colorChooser = Game.LoadWidget(orderManager.world, "COLOR_CHOOSER", null, new WidgetArgs()
|
||||||
{
|
{
|
||||||
{ "onSelect", onSelect },
|
{ "onSelect", onSelect },
|
||||||
{ "onChange", onChange },
|
{ "onChange", onChange },
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public void WorldLoaded(World world)
|
public void WorldLoaded(World world)
|
||||||
{
|
{
|
||||||
Widget.RootWidget.AddChild(Game.LoadWidget(world, Info.Widget, new WidgetArgs()));
|
Game.LoadWidget(world, Info.Widget, Widget.RootWidget, new WidgetArgs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
|||||||
switch (orderManager.Connection.ConnectionState)
|
switch (orderManager.Connection.ConnectionState)
|
||||||
{
|
{
|
||||||
case ConnectionState.PreConnecting:
|
case ConnectionState.PreConnecting:
|
||||||
Widget.LoadWidget("MAINMENU_BG", new WidgetArgs());
|
Widget.LoadWidget("MAINMENU_BG", Widget.RootWidget, new WidgetArgs());
|
||||||
break;
|
break;
|
||||||
case ConnectionState.Connecting:
|
case ConnectionState.Connecting:
|
||||||
Widget.OpenWindow("CONNECTING_BG",
|
Widget.OpenWindow("CONNECTING_BG",
|
||||||
|
|||||||
Reference in New Issue
Block a user