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

@@ -92,22 +92,22 @@ namespace OpenRA.Mods.Cnc.Widgets
// Show connection failed dialog
Widget.CloseWindow();
Action onConnect = new Action(() =>
Action onConnect = () =>
{
Game.OpenWindow("SERVER_LOBBY", new Dictionary<string, object>()
Game.OpenWindow("SERVER_LOBBY", new WidgetArgs()
{
{ "onExit", onExit },
{ "onStart", OnGameStart }
});
});
};
Action onRetry = new Action(() =>
Action onRetry = () =>
{
Widget.CloseWindow();
CncConnectingLogic.Connect(om.Host, om.Port, onConnect, onExit);
});
};
Widget.OpenWindow("CONNECTIONFAILED_PANEL", new Dictionary<string, object>()
Widget.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs()
{
{ "onAbort", onExit },
{ "onRetry", onRetry },
@@ -197,10 +197,10 @@ namespace OpenRA.Mods.Cnc.Widgets
Game.Settings.Save();
});
Widget.OpenWindow( "MAPCHOOSER_PANEL", new Dictionary<string, object>
Widget.OpenWindow( "MAPCHOOSER_PANEL", new WidgetArgs()
{
{ "initialMap", Map.Uid },
{ "onExit", new Action(() => {}) },
{ "onExit", () => {} },
{ "onSelect", onSelect }
});
};
@@ -406,7 +406,7 @@ namespace OpenRA.Mods.Cnc.Widgets
if (Map.Players[s.MapPlayer].LockColor)
return false;
var colorChooser = Game.modData.WidgetLoader.LoadWidget( new Dictionary<string,object>() { {"worldRenderer", worldRenderer} }, null, "COLOR_CHOOSER" );
var colorChooser = Game.modData.WidgetLoader.LoadWidget( new WidgetArgs() { {"worldRenderer", worldRenderer} }, null, "COLOR_CHOOSER" );
var hueSlider = colorChooser.GetWidget<SliderWidget>("HUE_SLIDER");
hueSlider.SetOffset(orderManager.LocalClient.ColorRamp.H / 255f);