Add a WidgetArgs type to work around gmcs not understanding lambda -> Action -> object.

This commit is contained in:
Paul Chote
2011-05-13 09:41:21 +12:00
parent 603379aa96
commit f4ea4c5daa
17 changed files with 85 additions and 79 deletions

View File

@@ -98,14 +98,14 @@ namespace OpenRA
// Hacky workaround for orderManager visibility
public static Widget OpenWindow(World world, string widget)
{
return Widget.OpenWindow(widget, new Dictionary<string,object>{{ "world", world }, { "orderManager", orderManager }, { "worldRenderer", worldRenderer }});
return Widget.OpenWindow(widget, new WidgetArgs() {{ "world", world }, { "orderManager", orderManager }, { "worldRenderer", worldRenderer }});
}
// Who came up with the great idea of making these things
// impossible for the things that want them to access them directly?
public static Widget OpenWindow(string widget, Dictionary<string, object> args)
public static Widget OpenWindow(string widget, WidgetArgs args)
{
return Widget.OpenWindow(widget, new Dictionary<string,object>(args)
return Widget.OpenWindow(widget, new WidgetArgs(args)
{
{ "world", worldRenderer.world },
{ "orderManager", orderManager },
@@ -113,9 +113,9 @@ namespace OpenRA
});
}
public static Widget LoadWidget(World world, string widget, Dictionary<string, object> args)
public static Widget LoadWidget(World world, string widget, WidgetArgs args)
{
return Widget.LoadWidget(widget, new Dictionary<string,object>(args)
return Widget.LoadWidget(widget, new WidgetArgs(args)
{
{ "world", world },
{ "orderManager", orderManager },