From f4ea4c5daa27886947bba80d3f00ebf319379c1e Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 13 May 2011 09:41:21 +1200 Subject: [PATCH] Add a WidgetArgs type to work around gmcs not understanding lambda -> Action -> object. --- OpenRA.Game/Game.cs | 10 ++-- OpenRA.Game/Widgets/Widget.cs | 17 +++++-- OpenRA.Game/Widgets/WidgetLoader.cs | 6 +-- OpenRA.Mods.Cnc/CncLoadScreen.cs | 4 +- OpenRA.Mods.Cnc/Widgets/CncConnectionLogic.cs | 6 +-- .../Widgets/CncIngameChromeLogic.cs | 19 ++++---- OpenRA.Mods.Cnc/Widgets/CncInstallLogic.cs | 10 ++-- OpenRA.Mods.Cnc/Widgets/CncLobbyLogic.cs | 18 +++---- OpenRA.Mods.Cnc/Widgets/CncMenuLogic.cs | 48 +++++++++---------- .../Widgets/CncMusicPlayerLogic.cs | 2 +- .../Widgets/CncServerCreationLogic.cs | 4 +- OpenRA.Mods.RA/NullLoadScreen.cs | 2 +- OpenRA.Mods.RA/OpenWidgetAtGameStart.cs | 2 +- OpenRA.Mods.RA/RALoadScreen.cs | 2 +- .../Widgets/Delegates/GameInitDelegate.cs | 6 +-- .../Widgets/Delegates/LobbyDelegate.cs | 4 +- .../Delegates/MainMenuButtonsDelegate.cs | 4 +- 17 files changed, 85 insertions(+), 79 deletions(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index f01dddc972..e86d16fe1a 100755 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -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{{ "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 args) + public static Widget OpenWindow(string widget, WidgetArgs args) { - return Widget.OpenWindow(widget, new Dictionary(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 args) + public static Widget LoadWidget(World world, string widget, WidgetArgs args) { - return Widget.LoadWidget(widget, new Dictionary(args) + return Widget.LoadWidget(widget, new WidgetArgs(args) { { "world", world }, { "orderManager", orderManager }, diff --git a/OpenRA.Game/Widgets/Widget.cs b/OpenRA.Game/Widgets/Widget.cs index 367a75c1a3..7ad9801a7f 100644 --- a/OpenRA.Game/Widgets/Widget.cs +++ b/OpenRA.Game/Widgets/Widget.cs @@ -121,7 +121,7 @@ namespace OpenRA.Widgets height); } - public void PostInit(Dictionary args) + public void PostInit(WidgetArgs args) { if (Delegate == null) return; @@ -322,10 +322,10 @@ namespace OpenRA.Widgets public static Widget OpenWindow(string id) { - return OpenWindow(id, new Dictionary()); + return OpenWindow(id, new WidgetArgs()); } - public static Widget OpenWindow(string id, Dictionary args) + public static Widget OpenWindow(string id, WidgetArgs args) { var window = Game.modData.WidgetLoader.LoadWidget(args, rootWidget, id); if (WindowList.Count > 0) @@ -334,7 +334,7 @@ namespace OpenRA.Widgets return window; } - public static Widget LoadWidget(string id, Dictionary args) + public static Widget LoadWidget(string id, WidgetArgs args) { return Game.modData.WidgetLoader.LoadWidget(args, rootWidget, id); } @@ -378,7 +378,14 @@ namespace OpenRA.Widgets public override string GetCursor(int2 pos) { return null; } public override Widget Clone() { return new ContainerWidget(this); } } - + + public class WidgetArgs : Dictionary + { + public WidgetArgs() : base() { } + public WidgetArgs(Dictionary args) : base(args) { } + public void Add(string key, Action val) { base.Add(key, val); } + } + public interface IWidgetDelegate { } // TODO: This can die once ra init is sane diff --git a/OpenRA.Game/Widgets/WidgetLoader.cs b/OpenRA.Game/Widgets/WidgetLoader.cs index 190362aa85..696ab684d6 100644 --- a/OpenRA.Game/Widgets/WidgetLoader.cs +++ b/OpenRA.Game/Widgets/WidgetLoader.cs @@ -32,7 +32,7 @@ namespace OpenRA } } - public Widget LoadWidget( Dictionary args, Widget parent, string w ) + public Widget LoadWidget( WidgetArgs args, Widget parent, string w ) { MiniYamlNode ret; if (!widgets.TryGetValue(w, out ret)) @@ -41,7 +41,7 @@ namespace OpenRA return LoadWidget( args, parent, ret ); } - public Widget LoadWidget( Dictionary args, Widget parent, MiniYamlNode node) + public Widget LoadWidget( WidgetArgs args, Widget parent, MiniYamlNode node) { var widget = NewWidget(node.Key, args); @@ -63,7 +63,7 @@ namespace OpenRA return widget; } - Widget NewWidget(string widgetType, Dictionary args) + Widget NewWidget(string widgetType, WidgetArgs args) { widgetType = widgetType.Split('@')[0]; return Game.modData.ObjectCreator.CreateObject(widgetType + "Widget", args); diff --git a/OpenRA.Mods.Cnc/CncLoadScreen.cs b/OpenRA.Mods.Cnc/CncLoadScreen.cs index c0198c6875..d62477e8ea 100644 --- a/OpenRA.Mods.Cnc/CncLoadScreen.cs +++ b/OpenRA.Mods.Cnc/CncLoadScreen.cs @@ -85,9 +85,9 @@ namespace OpenRA.Mods.Cnc Widget.RootWidget.RemoveChildren(); if (!FileSystem.Exists(Info["TestFile"])) { - var args = new Dictionary() + var args = new WidgetArgs() { - { "continueLoading", (Action)(() => TestAndContinue()) }, + { "continueLoading", () => TestAndContinue() }, { "installData", Info } }; Widget.LoadWidget(Info["InstallerBackgroundWidget"], args); diff --git a/OpenRA.Mods.Cnc/Widgets/CncConnectionLogic.cs b/OpenRA.Mods.Cnc/Widgets/CncConnectionLogic.cs index b53ccb6713..d038eea444 100644 --- a/OpenRA.Mods.Cnc/Widgets/CncConnectionLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/CncConnectionLogic.cs @@ -46,7 +46,7 @@ namespace OpenRA.Mods.Cnc.Widgets { // Show connection failed dialog Widget.CloseWindow(); - Widget.OpenWindow("CONNECTIONFAILED_PANEL", new Dictionary() + Widget.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs() { { "onAbort", onAbort }, { "onRetry", onRetry }, @@ -85,13 +85,13 @@ namespace OpenRA.Mods.Cnc.Widgets public static void Connect(string host, int port, Action onConnect, Action onAbort) { Game.JoinServer(host, port); - Widget.OpenWindow("CONNECTING_PANEL", new Dictionary() + Widget.OpenWindow("CONNECTING_PANEL", new WidgetArgs() { { "host", host }, { "port", port }, { "onConnect", onConnect }, { "onAbort", onAbort }, - { "onRetry", new Action(() => Connect(host, port, onConnect, onAbort)) } + { "onRetry", () => Connect(host, port, onConnect, onAbort) } }); } } diff --git a/OpenRA.Mods.Cnc/Widgets/CncIngameChromeLogic.cs b/OpenRA.Mods.Cnc/Widgets/CncIngameChromeLogic.cs index d9e001655a..a1ecc39293 100755 --- a/OpenRA.Mods.Cnc/Widgets/CncIngameChromeLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/CncIngameChromeLogic.cs @@ -59,8 +59,7 @@ namespace OpenRA.Mods.Cnc.Widgets ingameRoot.GetWidget("OPTIONS_BUTTON").OnClick = () => { ingameRoot.IsVisible = () => false; - var onExit = new Action(() => {ingameRoot.IsVisible = () => true;}); - Widget.LoadWidget("INGAME_MENU", new Dictionary() {{ "world", world }, { "onExit", onExit }}); + Widget.LoadWidget("INGAME_MENU", new WidgetArgs() {{ "world", world }, { "onExit", () => ingameRoot.IsVisible = () => true }}); }; var postgameBG = ingameRoot.GetWidget("POSTGAME_BG"); @@ -93,19 +92,19 @@ namespace OpenRA.Mods.Cnc.Widgets bool hideButtons = false; menu.GetWidget("MENU_BUTTONS").IsVisible = () => !hideButtons; - var onQuit = (Action)(() => + Action onQuit = () => { Game.DisconnectOnly(); Widget.RootWidget.RemoveChildren(); Game.LoadShellMap(); - }); + }; - var doNothing = (Action)(() => {}); + Action doNothing = () => {}; menu.GetWidget("QUIT_BUTTON").OnClick = () => PromptConfirmAction("Quit", "Are you sure you want to quit?", onQuit, doNothing); - var onSurrender = (Action)(() => world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false))); + Action onSurrender = () => world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false)); var surrenderButton = menu.GetWidget("SURRENDER_BUTTON"); surrenderButton.IsDisabled = () => (world.LocalPlayer == null || world.LocalPlayer.WinState != WinState.Undefined); surrenderButton.OnClick = () => @@ -114,18 +113,18 @@ namespace OpenRA.Mods.Cnc.Widgets menu.GetWidget("MUSIC_BUTTON").OnClick = () => { hideButtons = true; - Widget.OpenWindow("MUSIC_PANEL", new Dictionary() + Widget.OpenWindow("MUSIC_PANEL", new WidgetArgs() { - { "onExit", new Action(() => hideButtons = false) }, + { "onExit", () => hideButtons = false }, }); }; menu.GetWidget("PREFERENCES_BUTTON").OnClick = () => { hideButtons = true; - Widget.OpenWindow("SETTINGS_PANEL", new Dictionary() + Widget.OpenWindow("SETTINGS_PANEL", new WidgetArgs() { - { "onExit", new Action(() => hideButtons = false) }, + { "onExit", () => hideButtons = false }, }); }; diff --git a/OpenRA.Mods.Cnc/Widgets/CncInstallLogic.cs b/OpenRA.Mods.Cnc/Widgets/CncInstallLogic.cs index 5178ca1a6a..d75f2de97b 100755 --- a/OpenRA.Mods.Cnc/Widgets/CncInstallLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/CncInstallLogic.cs @@ -29,9 +29,9 @@ namespace OpenRA.Mods.Cnc.Widgets [ObjectCreator.Param] Action continueLoading) { var panel = widget.GetWidget("INSTALL_PANEL"); - var args = new Dictionary() + var args = new WidgetArgs() { - { "continueLoading", new Action(() => { Widget.CloseWindow(); continueLoading(); }) }, + { "continueLoading", () => { Widget.CloseWindow(); continueLoading(); } }, { "installData", installData } }; @@ -46,11 +46,11 @@ namespace OpenRA.Mods.Cnc.Widgets // TODO: panel.GetWidget("MODS_BUTTON").OnClick = () => { - Widget.OpenWindow("MODS_PANEL", new Dictionary() + Widget.OpenWindow("MODS_PANEL", new WidgetArgs() { - { "onExit", new Action(() => {}) }, + { "onExit", () => {} }, // Close this panel - { "onSwitch", new Action(Widget.CloseWindow) }, + { "onSwitch", Widget.CloseWindow }, }); }; } diff --git a/OpenRA.Mods.Cnc/Widgets/CncLobbyLogic.cs b/OpenRA.Mods.Cnc/Widgets/CncLobbyLogic.cs index 47145a3b88..8161b8cace 100755 --- a/OpenRA.Mods.Cnc/Widgets/CncLobbyLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/CncLobbyLogic.cs @@ -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() + 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() + 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 + 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() { {"worldRenderer", worldRenderer} }, null, "COLOR_CHOOSER" ); + var colorChooser = Game.modData.WidgetLoader.LoadWidget( new WidgetArgs() { {"worldRenderer", worldRenderer} }, null, "COLOR_CHOOSER" ); var hueSlider = colorChooser.GetWidget("HUE_SLIDER"); hueSlider.SetOffset(orderManager.LocalClient.ColorRamp.H / 255f); diff --git a/OpenRA.Mods.Cnc/Widgets/CncMenuLogic.cs b/OpenRA.Mods.Cnc/Widgets/CncMenuLogic.cs index c13092e223..5117f81e85 100755 --- a/OpenRA.Mods.Cnc/Widgets/CncMenuLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/CncMenuLogic.cs @@ -50,10 +50,10 @@ namespace OpenRA.Mods.Cnc.Widgets mainMenu.GetWidget("REPLAYS_BUTTON").OnClick = () => { Menu = MenuType.None; - Widget.OpenWindow("REPLAYBROWSER_PANEL", new Dictionary() + Widget.OpenWindow("REPLAYBROWSER_PANEL", new WidgetArgs() { - { "onExit", new Action(() => Menu = MenuType.Main) }, - { "onStart", new Action(RemoveShellmapUI) } + { "onExit", () => Menu = MenuType.Main }, + { "onStart", RemoveShellmapUI } }); }; @@ -68,30 +68,30 @@ namespace OpenRA.Mods.Cnc.Widgets multiplayerMenu.GetWidget("JOIN_BUTTON").OnClick = () => { Menu = MenuType.None; - Widget.OpenWindow("SERVERBROWSER_PANEL", new Dictionary() + Widget.OpenWindow("SERVERBROWSER_PANEL", new WidgetArgs() { - { "onExit", new Action(() => Menu = MenuType.Multiplayer) }, - { "openLobby", new Action(() => OpenLobbyPanel(MenuType.Multiplayer)) } + { "onExit", () => Menu = MenuType.Multiplayer }, + { "openLobby", () => OpenLobbyPanel(MenuType.Multiplayer) } }); }; multiplayerMenu.GetWidget("CREATE_BUTTON").OnClick = () => { Menu = MenuType.None; - Widget.OpenWindow("CREATESERVER_PANEL", new Dictionary() + Widget.OpenWindow("CREATESERVER_PANEL", new WidgetArgs() { - { "onExit", new Action(() => Menu = MenuType.Multiplayer) }, - { "openLobby", new Action(() => OpenLobbyPanel(MenuType.Multiplayer)) } + { "onExit", () => Menu = MenuType.Multiplayer }, + { "openLobby", () => OpenLobbyPanel(MenuType.Multiplayer) } }); }; multiplayerMenu.GetWidget("DIRECTCONNECT_BUTTON").OnClick = () => { Menu = MenuType.None; - Widget.OpenWindow("DIRECTCONNECT_PANEL", new Dictionary() + Widget.OpenWindow("DIRECTCONNECT_PANEL", new WidgetArgs() { - { "onExit", new Action(() => Menu = MenuType.Multiplayer) }, - { "openLobby", new Action(() => OpenLobbyPanel(MenuType.Multiplayer)) } + { "onExit", () => Menu = MenuType.Multiplayer }, + { "openLobby", () => OpenLobbyPanel(MenuType.Multiplayer) } }); }; @@ -102,28 +102,28 @@ namespace OpenRA.Mods.Cnc.Widgets settingsMenu.GetWidget("MODS_BUTTON").OnClick = () => { Menu = MenuType.None; - Widget.OpenWindow("MODS_PANEL", new Dictionary() + Widget.OpenWindow("MODS_PANEL", new WidgetArgs() { - { "onExit", new Action(() => Menu = MenuType.Settings) }, - { "onSwitch", new Action(RemoveShellmapUI) } + { "onExit", () => Menu = MenuType.Settings }, + { "onSwitch", RemoveShellmapUI } }); }; settingsMenu.GetWidget("MUSIC_BUTTON").OnClick = () => { Menu = MenuType.None; - Widget.OpenWindow("MUSIC_PANEL", new Dictionary() + Widget.OpenWindow("MUSIC_PANEL", new WidgetArgs() { - { "onExit", new Action(() => Menu = MenuType.Settings) }, + { "onExit", () => Menu = MenuType.Settings }, }); }; settingsMenu.GetWidget("PREFERENCES_BUTTON").OnClick = () => { Menu = MenuType.None; - Widget.OpenWindow("SETTINGS_PANEL", new Dictionary() + Widget.OpenWindow("SETTINGS_PANEL", new WidgetArgs() { - { "onExit", new Action(() => Menu = MenuType.Settings) }, + { "onExit", () => Menu = MenuType.Settings }, }); }; settingsMenu.GetWidget("BACK_BUTTON").OnClick = () => Menu = MenuType.Main; @@ -138,10 +138,10 @@ namespace OpenRA.Mods.Cnc.Widgets void OpenLobbyPanel(MenuType menu) { Menu = MenuType.None; - Game.OpenWindow("SERVER_LOBBY", new Dictionary() + Game.OpenWindow("SERVER_LOBBY", new WidgetArgs() { - { "onExit", new Action(() => { Game.DisconnectOnly(); Menu = menu; }) }, - { "onStart", new Action(RemoveShellmapUI) } + { "onExit", () => { Game.DisconnectOnly(); Menu = menu; } }, + { "onStart", RemoveShellmapUI } }); } @@ -152,8 +152,8 @@ namespace OpenRA.Mods.Cnc.Widgets Game.CreateLocalServer(map); CncConnectingLogic.Connect(IPAddress.Loopback.ToString(), Game.Settings.Server.LoopbackPort, - new Action(() => OpenLobbyPanel(MenuType.Main)), - new Action(() => { Game.CloseServer(); Menu = MenuType.Main; })); + () => OpenLobbyPanel(MenuType.Main), + () => { Game.CloseServer(); Menu = MenuType.Main; }); } } } diff --git a/OpenRA.Mods.Cnc/Widgets/CncMusicPlayerLogic.cs b/OpenRA.Mods.Cnc/Widgets/CncMusicPlayerLogic.cs index 595fa39681..67d9a1b760 100644 --- a/OpenRA.Mods.Cnc/Widgets/CncMusicPlayerLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/CncMusicPlayerLogic.cs @@ -59,7 +59,7 @@ namespace OpenRA.Mods.Cnc.Widgets var installButton = panel.GetWidget("INSTALL_BUTTON"); installButton.OnClick = () => - Widget.OpenWindow("INSTALL_MUSIC_PANEL", new Dictionary() {{ "afterInstall", afterInstall }}); + Widget.OpenWindow("INSTALL_MUSIC_PANEL", new WidgetArgs() {{ "afterInstall", afterInstall }}); installButton.IsVisible = () => music.Length < 2; // Hack around ra shipping (only) hellmarch by default panel.GetWidget("NO_MUSIC_LABEL").IsVisible = noMusic; diff --git a/OpenRA.Mods.Cnc/Widgets/CncServerCreationLogic.cs b/OpenRA.Mods.Cnc/Widgets/CncServerCreationLogic.cs index f3e4cb1d46..163cd3820e 100644 --- a/OpenRA.Mods.Cnc/Widgets/CncServerCreationLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/CncServerCreationLogic.cs @@ -38,10 +38,10 @@ namespace OpenRA.Mods.Cnc.Widgets panel.GetWidget("MAP_BUTTON").OnClick = () => { - Widget.OpenWindow( "MAPCHOOSER_PANEL", new Dictionary + Widget.OpenWindow( "MAPCHOOSER_PANEL", new WidgetArgs() { { "initialMap", map.Uid }, - { "onExit", new Action(() => {}) }, + { "onExit", () => {} }, { "onSelect", new Action(m => map = m) } }); }; diff --git a/OpenRA.Mods.RA/NullLoadScreen.cs b/OpenRA.Mods.RA/NullLoadScreen.cs index 957b53731a..59d02a1d73 100644 --- a/OpenRA.Mods.RA/NullLoadScreen.cs +++ b/OpenRA.Mods.RA/NullLoadScreen.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA public void StartGame() { Widget.RootWidget.RemoveChildren(); - Game.modData.WidgetLoader.LoadWidget( new Dictionary(), Widget.RootWidget, "INIT_SETUP" ); + Game.modData.WidgetLoader.LoadWidget( new WidgetArgs(), Widget.RootWidget, "INIT_SETUP" ); } } } diff --git a/OpenRA.Mods.RA/OpenWidgetAtGameStart.cs b/OpenRA.Mods.RA/OpenWidgetAtGameStart.cs index b3c1dd46c9..7b1edc088f 100644 --- a/OpenRA.Mods.RA/OpenWidgetAtGameStart.cs +++ b/OpenRA.Mods.RA/OpenWidgetAtGameStart.cs @@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA public void WorldLoaded(World world) { - Game.LoadWidget(world, Info.Widget, new Dictionary()); + Game.LoadWidget(world, Info.Widget, new WidgetArgs()); } } } \ No newline at end of file diff --git a/OpenRA.Mods.RA/RALoadScreen.cs b/OpenRA.Mods.RA/RALoadScreen.cs index 4cf2ae6111..dc23a32351 100644 --- a/OpenRA.Mods.RA/RALoadScreen.cs +++ b/OpenRA.Mods.RA/RALoadScreen.cs @@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA public void StartGame() { Widget.RootWidget.RemoveChildren(); - Game.modData.WidgetLoader.LoadWidget( new Dictionary(), Widget.RootWidget, "INIT_SETUP" ); + Game.modData.WidgetLoader.LoadWidget( new WidgetArgs(), Widget.RootWidget, "INIT_SETUP" ); } } } diff --git a/OpenRA.Mods.RA/Widgets/Delegates/GameInitDelegate.cs b/OpenRA.Mods.RA/Widgets/Delegates/GameInitDelegate.cs index 9a0b3442c1..1b95fba0ca 100755 --- a/OpenRA.Mods.RA/Widgets/Delegates/GameInitDelegate.cs +++ b/OpenRA.Mods.RA/Widgets/Delegates/GameInitDelegate.cs @@ -42,15 +42,15 @@ namespace OpenRA.Mods.RA.Widgets.Delegates switch (orderManager.Connection.ConnectionState) { case ConnectionState.PreConnecting: - Widget.LoadWidget("MAINMENU_BG", new Dictionary()); + Widget.LoadWidget("MAINMENU_BG", new WidgetArgs()); break; case ConnectionState.Connecting: Widget.OpenWindow("CONNECTING_BG", - new Dictionary { { "host", orderManager.Host }, { "port", orderManager.Port } }); + new WidgetArgs() { { "host", orderManager.Host }, { "port", orderManager.Port } }); break; case ConnectionState.NotConnected: Widget.OpenWindow("CONNECTION_FAILED_BG", - new Dictionary { { "orderManager", orderManager } }); + new WidgetArgs() { { "orderManager", orderManager } }); break; case ConnectionState.Connected: var lobby = Game.OpenWindow(orderManager.world, "SERVER_LOBBY"); diff --git a/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs b/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs index 77671e031e..ca3e59b9ae 100755 --- a/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs +++ b/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs @@ -92,7 +92,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates var mapButton = lobby.GetWidget("CHANGEMAP_BUTTON"); mapButton.OnMouseUp = mi => { - Widget.OpenWindow( "MAP_CHOOSER", new Dictionary { { "orderManager", orderManager }, { "mapName", MapUid } } ); + Widget.OpenWindow( "MAP_CHOOSER", new WidgetArgs() { { "orderManager", orderManager }, { "mapName", MapUid } } ); return true; }; @@ -281,7 +281,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates if (Map.Players[s.MapPlayer].LockColor) return false; - var colorChooser = Game.modData.WidgetLoader.LoadWidget( new Dictionary() { {"worldRenderer", worldRenderer} }, null, "COLOR_CHOOSER" ); + var colorChooser = Game.modData.WidgetLoader.LoadWidget( new WidgetArgs() { {"worldRenderer", worldRenderer} }, null, "COLOR_CHOOSER" ); var hueSlider = colorChooser.GetWidget("HUE_SLIDER"); hueSlider.SetOffset(orderManager.LocalClient.ColorRamp.H / 255f); diff --git a/OpenRA.Mods.RA/Widgets/Delegates/MainMenuButtonsDelegate.cs b/OpenRA.Mods.RA/Widgets/Delegates/MainMenuButtonsDelegate.cs index 2e488282c1..d4eaadf13e 100755 --- a/OpenRA.Mods.RA/Widgets/Delegates/MainMenuButtonsDelegate.cs +++ b/OpenRA.Mods.RA/Widgets/Delegates/MainMenuButtonsDelegate.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates [ObjectCreator.UseCtor] public MainMenuButtonsDelegate([ObjectCreator.Param] Widget widget) { - Game.modData.WidgetLoader.LoadWidget( new Dictionary(), Widget.RootWidget, "PERF_BG" ); + Game.modData.WidgetLoader.LoadWidget( new WidgetArgs(), Widget.RootWidget, "PERF_BG" ); widget.GetWidget("MAINMENU_BUTTON_JOIN").OnMouseUp = mi => { Widget.OpenWindow("JOINSERVER_BG"); return true; }; widget.GetWidget("MAINMENU_BUTTON_CREATE").OnMouseUp = mi => { Widget.OpenWindow("CREATESERVER_BG"); return true; }; widget.GetWidget("MAINMENU_BUTTON_SETTINGS").OnMouseUp = mi => { Widget.OpenWindow("SETTINGS_MENU"); return true; }; @@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates public static void DisplayModSelector() { - var selector = Game.modData.WidgetLoader.LoadWidget( new Dictionary(), Widget.RootWidget, "QUICKMODSWITCHER" ); + var selector = Game.modData.WidgetLoader.LoadWidget( new WidgetArgs(), Widget.RootWidget, "QUICKMODSWITCHER" ); var switcher = selector.GetWidget("SWITCHER"); switcher.OnMouseDown = _ => ShowModsDropDown(switcher); switcher.GetText = ActiveModTitle;