split Widget static bits into Ui static class

This commit is contained in:
Chris Forbes
2011-12-13 23:38:59 +13:00
parent 83055f0a17
commit ed429a3b30
60 changed files with 173 additions and 168 deletions

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
panel.GetWidget<ButtonWidget>("GIVE_EXPLORATION_BUTTON").OnClick = () =>
world.IssueOrder(new Order("DevGiveExploration", world.LocalPlayer.PlayerActor, false));
panel.GetWidget<ButtonWidget>("CLOSE_BUTTON").OnClick = () => { Widget.CloseWindow(); onExit(); };
panel.GetWidget<ButtonWidget>("CLOSE_BUTTON").OnClick = () => { Ui.CloseWindow(); onExit(); };
}
public void Order(World world, string order)

View File

@@ -86,12 +86,12 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
{
if (menu != MenuType.None)
{
Widget.CloseWindow();
Ui.CloseWindow();
menu = MenuType.None;
}
ingameRoot.IsVisible = () => false;
Game.LoadWidget(world, "INGAME_MENU", Widget.RootWidget, new WidgetArgs()
Game.LoadWidget(world, "INGAME_MENU", Ui.RootWidget, new WidgetArgs()
{
{ "onExit", () => ingameRoot.IsVisible = () => true }
});
@@ -135,7 +135,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
cheatsButton.OnClick = () =>
{
if (menu != MenuType.None)
Widget.CloseWindow();
Ui.CloseWindow();
menu = MenuType.Cheats;
Game.OpenWindow("CHEATS_PANEL", new WidgetArgs() {{"onExit", () => menu = MenuType.None }});

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
Game.RunAfterDelay(1200 + 40 * mpe.Info.FadeLength, () =>
{
Game.Disconnect();
Widget.ResetAll();
Ui.ResetAll();
Game.LoadShellMap();
});
};
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
menu.GetWidget<ButtonWidget>("MUSIC_BUTTON").OnClick = () =>
{
hideButtons = true;
Widget.OpenWindow("MUSIC_PANEL", new WidgetArgs()
Ui.OpenWindow("MUSIC_PANEL", new WidgetArgs()
{
{ "onExit", () => hideButtons = false },
});
@@ -69,7 +69,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
menu.GetWidget<ButtonWidget>("SETTINGS_BUTTON").OnClick = () =>
{
hideButtons = true;
Widget.OpenWindow("SETTINGS_PANEL", new WidgetArgs()
Ui.OpenWindow("SETTINGS_PANEL", new WidgetArgs()
{
{ "world", world },
{ "onExit", () => hideButtons = false },
@@ -80,8 +80,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
resumeButton.IsDisabled = () => resumeDisabled;
resumeButton.OnClick = () =>
{
Widget.CloseWindow();
Widget.RootWidget.RemoveChild(menu);
Ui.CloseWindow();
Ui.RootWidget.RemoveChild(menu);
world.WorldActor.Trait<CncMenuPaletteEffect>().Fade(CncMenuPaletteEffect.EffectType.None);
onExit();
};

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
statusLabel = panel.GetWidget<LabelWidget>("STATUS_LABEL");
backButton = panel.GetWidget<ButtonWidget>("BACK_BUTTON");
backButton.OnClick = Widget.CloseWindow;
backButton.OnClick = Ui.CloseWindow;
retryButton = panel.GetWidget<ButtonWidget>("RETRY_BUTTON");
retryButton.OnClick = CheckForDisk;
@@ -114,7 +114,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
Game.RunAfterTick(() =>
{
Widget.CloseWindow();
Ui.CloseWindow();
afterInstall();
});
}

View File

@@ -22,15 +22,15 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
var panel = widget.GetWidget("INSTALL_PANEL");
var args = new WidgetArgs()
{
{ "afterInstall", () => { Widget.CloseWindow(); continueLoading(); } },
{ "afterInstall", () => { Ui.CloseWindow(); continueLoading(); } },
{ "installData", installData }
};
panel.GetWidget<ButtonWidget>("DOWNLOAD_BUTTON").OnClick = () =>
Widget.OpenWindow("INSTALL_DOWNLOAD_PANEL", args);
Ui.OpenWindow("INSTALL_DOWNLOAD_PANEL", args);
panel.GetWidget<ButtonWidget>("INSTALL_BUTTON").OnClick = () =>
Widget.OpenWindow("INSTALL_FROMCD_PANEL", new WidgetArgs(args)
Ui.OpenWindow("INSTALL_FROMCD_PANEL", new WidgetArgs(args)
{
{ "filesToCopy", new[] { "CONQUER.MIX", "DESERT.MIX", "SCORES.MIX",
"SOUNDS.MIX", "TEMPERAT.MIX", "WINTER.MIX" } },
@@ -41,11 +41,11 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
panel.GetWidget<ButtonWidget>("MODS_BUTTON").OnClick = () =>
{
Widget.OpenWindow("MODS_PANEL", new WidgetArgs()
Ui.OpenWindow("MODS_PANEL", new WidgetArgs()
{
{ "onExit", () => {} },
// Close this panel
{ "onSwitch", Widget.CloseWindow },
{ "onSwitch", Ui.CloseWindow },
});
};
}

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
mainMenu.GetWidget<ButtonWidget>("MODS_BUTTON").OnClick = () =>
{
Menu = MenuType.None;
Widget.OpenWindow("MODS_PANEL", new WidgetArgs()
Ui.OpenWindow("MODS_PANEL", new WidgetArgs()
{
{ "onExit", () => Menu = MenuType.Main },
{ "onSwitch", RemoveShellmapUI }
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
settingsMenu.GetWidget<ButtonWidget>("REPLAYS_BUTTON").OnClick = () =>
{
Menu = MenuType.None;
Widget.OpenWindow("REPLAYBROWSER_PANEL", new WidgetArgs()
Ui.OpenWindow("REPLAYBROWSER_PANEL", new WidgetArgs()
{
{ "onExit", () => Menu = MenuType.Settings },
{ "onStart", RemoveShellmapUI }
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
settingsMenu.GetWidget<ButtonWidget>("MUSIC_BUTTON").OnClick = () =>
{
Menu = MenuType.None;
Widget.OpenWindow("MUSIC_PANEL", new WidgetArgs()
Ui.OpenWindow("MUSIC_PANEL", new WidgetArgs()
{
{ "onExit", () => Menu = MenuType.Settings },
});
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
settingsMenu.GetWidget<ButtonWidget>("SETTINGS_BUTTON").OnClick = () =>
{
Menu = MenuType.None;
Widget.OpenWindow("SETTINGS_PANEL", new WidgetArgs()
Ui.OpenWindow("SETTINGS_PANEL", new WidgetArgs()
{
{ "world", world },
{ "onExit", () => Menu = MenuType.Settings },
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
void OpenGamePanel(string id)
{
Menu = MenuType.None;
Widget.OpenWindow(id, new WidgetArgs()
Ui.OpenWindow(id, new WidgetArgs()
{
{ "onExit", () => Menu = MenuType.Multiplayer },
{ "openLobby", () => OpenLobbyPanel(MenuType.Multiplayer, false) }

View File

@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
installed = Rules.Music.Where(m => m.Value.Exists).Any();
Func<bool> noMusic = () => !installed;
panel.GetWidget<ButtonWidget>("BACK_BUTTON").OnClick = () => { Widget.CloseWindow(); onExit(); };
panel.GetWidget<ButtonWidget>("BACK_BUTTON").OnClick = () => { Ui.CloseWindow(); onExit(); };
Action afterInstall = () =>
{
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
var installButton = panel.GetWidget<ButtonWidget>("INSTALL_BUTTON");
installButton.OnClick = () =>
Widget.OpenWindow("INSTALL_MUSIC_PANEL", new WidgetArgs() {
Ui.OpenWindow("INSTALL_MUSIC_PANEL", new WidgetArgs() {
{ "afterInstall", afterInstall },
{ "filesToCopy", new [] { "SCORES.MIX" } },
{ "filesToExtract", new [] { "transit.mix" } },

View File

@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
int.TryParse(windowHeight.Text, out y);
graphicsSettings.WindowedSize = new int2(x,y);
Game.Settings.Save();
Widget.CloseWindow();
Ui.CloseWindow();
onExit();
};
}