made OpenWindow and CloseWindow static
This commit is contained in:
@@ -310,8 +310,8 @@ namespace OpenRA
|
||||
LobbyInfo.GlobalSettings.Mods = Settings.Game.Mods;
|
||||
JoinLocal();
|
||||
StartGame(shellmap);
|
||||
|
||||
Widget.RootWidget.CloseWindow();
|
||||
|
||||
Widget.CloseWindow();
|
||||
Widget.OpenWindow("MAINMENU_BG");
|
||||
}
|
||||
|
||||
|
||||
@@ -40,20 +40,20 @@ namespace OpenRA.Widgets.Delegates
|
||||
|
||||
Game.ConnectionStateChanged += () =>
|
||||
{
|
||||
r.CloseWindow();
|
||||
Widget.CloseWindow();
|
||||
switch( Game.orderManager.Connection.ConnectionState )
|
||||
{
|
||||
case ConnectionState.PreConnecting:
|
||||
r.OpenWindow("MAINMENU_BG");
|
||||
Widget.OpenWindow("MAINMENU_BG");
|
||||
break;
|
||||
case ConnectionState.Connecting:
|
||||
r.OpenWindow("CONNECTING_BG");
|
||||
Widget.OpenWindow("CONNECTING_BG");
|
||||
break;
|
||||
case ConnectionState.NotConnected:
|
||||
r.OpenWindow("CONNECTION_FAILED_BG");
|
||||
Widget.OpenWindow("CONNECTION_FAILED_BG");
|
||||
break;
|
||||
case ConnectionState.Connected:
|
||||
r.OpenWindow("SERVER_LOBBY");
|
||||
Widget.OpenWindow("SERVER_LOBBY");
|
||||
|
||||
var lobby = r.GetWidget("SERVER_LOBBY");
|
||||
lobby.GetWidget<ChatDisplayWidget>("CHAT_DISPLAY").ClearChat();
|
||||
|
||||
@@ -22,17 +22,17 @@ namespace OpenRA.Widgets.Delegates
|
||||
var r = Widget.RootWidget;
|
||||
var cs = r.GetWidget("CREATESERVER_BG");
|
||||
r.GetWidget("MAINMENU_BUTTON_CREATE").OnMouseUp = mi => {
|
||||
r.OpenWindow("CREATESERVER_BG");
|
||||
Widget.OpenWindow("CREATESERVER_BG");
|
||||
return true;
|
||||
};
|
||||
|
||||
cs.GetWidget("BUTTON_CANCEL").OnMouseUp = mi => {
|
||||
r.CloseWindow();
|
||||
Widget.CloseWindow();
|
||||
return true;
|
||||
};
|
||||
|
||||
cs.GetWidget("BUTTON_START").OnMouseUp = mi => {
|
||||
r.OpenWindow("SERVER_LOBBY");
|
||||
Widget.OpenWindow("SERVER_LOBBY");
|
||||
|
||||
var map = Game.modData.AvailableMaps.FirstOrDefault(m => m.Value.Selectable).Key;
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
mapButton.OnMouseUp = mi =>
|
||||
{
|
||||
r.GetWidget("MAP_CHOOSER").SpecialOneArg(MapUid);
|
||||
r.OpenWindow("MAP_CHOOSER");
|
||||
Widget.OpenWindow("MAP_CHOOSER");
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,13 +33,13 @@ namespace OpenRA.Widgets.Delegates
|
||||
bg.GetWidget("BUTTON_OK").OnMouseUp = mi =>
|
||||
{
|
||||
Game.IssueOrder(Order.Command("map " + Map.Uid));
|
||||
r.CloseWindow();
|
||||
Widget.CloseWindow();
|
||||
return true;
|
||||
};
|
||||
|
||||
bg.GetWidget("BUTTON_CANCEL").OnMouseUp = mi =>
|
||||
{
|
||||
r.CloseWindow();
|
||||
Widget.CloseWindow();
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ namespace OpenRA.Widgets.Delegates
|
||||
|
||||
bg.GetWidget("BUTTON_CLOSE").OnMouseUp = mi => {
|
||||
Game.Settings.Save();
|
||||
Widget.RootWidget.CloseWindow();
|
||||
Widget.CloseWindow();
|
||||
return true;
|
||||
};
|
||||
|
||||
Widget.RootWidget.GetWidget("MAINMENU_BUTTON_MUSIC").OnMouseUp = mi => {
|
||||
Widget.RootWidget.OpenWindow("MUSIC_MENU");
|
||||
Widget.OpenWindow("MUSIC_MENU");
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
|
||||
r.GetWidget("MAINMENU_BUTTON_JOIN").OnMouseUp = mi =>
|
||||
{
|
||||
r.OpenWindow("JOINSERVER_BG");
|
||||
Widget.OpenWindow("JOINSERVER_BG");
|
||||
|
||||
r.GetWidget("JOINSERVER_PROGRESS_TITLE").Visible = true;
|
||||
r.GetWidget<LabelWidget>("JOINSERVER_PROGRESS_TITLE").Text = "Fetching game list...";
|
||||
@@ -83,16 +83,16 @@ namespace OpenRA.Widgets.Delegates
|
||||
|
||||
bg.GetWidget("CANCEL_BUTTON").OnMouseUp = mi =>
|
||||
{
|
||||
r.CloseWindow();
|
||||
Widget.CloseWindow();
|
||||
return true;
|
||||
};
|
||||
|
||||
bg.GetWidget("DIRECTCONNECT_BUTTON").OnMouseUp = mi =>
|
||||
{
|
||||
r.CloseWindow();
|
||||
Widget.CloseWindow();
|
||||
|
||||
dc.GetWidget<TextFieldWidget>("SERVER_ADDRESS").Text = Game.Settings.Player.LastServer;
|
||||
r.OpenWindow("DIRECTCONNECT_BG");
|
||||
Widget.OpenWindow("DIRECTCONNECT_BG");
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
return false;
|
||||
}
|
||||
|
||||
r.CloseWindow();
|
||||
Widget.CloseWindow();
|
||||
Game.JoinServer(currentServer.Address.Split(':')[0], int.Parse(currentServer.Address.Split(':')[1]));
|
||||
return true;
|
||||
};
|
||||
@@ -136,14 +136,14 @@ namespace OpenRA.Widgets.Delegates
|
||||
Game.Settings.Player.LastServer = address;
|
||||
Game.Settings.Save();
|
||||
|
||||
r.CloseWindow();
|
||||
Widget.CloseWindow();
|
||||
Game.JoinServer(cpts[0], int.Parse(cpts[1]));
|
||||
return true;
|
||||
};
|
||||
|
||||
dc.GetWidget("CANCEL_BUTTON").OnMouseUp = mi =>
|
||||
{
|
||||
r.CloseWindow();
|
||||
Widget.CloseWindow();
|
||||
return r.GetWidget("MAINMENU_BUTTON_JOIN").OnMouseUp(mi);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -150,13 +150,13 @@ namespace OpenRA.Widgets.Delegates
|
||||
|
||||
bg.GetWidget("BUTTON_CLOSE").OnMouseUp = mi => {
|
||||
Game.Settings.Save();
|
||||
Widget.RootWidget.CloseWindow();
|
||||
Widget.CloseWindow();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Menu Buttons
|
||||
Widget.RootWidget.GetWidget("MAINMENU_BUTTON_SETTINGS").OnMouseUp = mi => {
|
||||
Widget.RootWidget.OpenWindow("SETTINGS_MENU");
|
||||
Widget.OpenWindow("SETTINGS_MENU");
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -44,13 +44,13 @@ namespace OpenRA.Widgets.Delegates
|
||||
|
||||
bg.GetWidget("BUTTON_CLOSE").OnMouseUp = mi => {
|
||||
player.Stop();
|
||||
Widget.RootWidget.CloseWindow();
|
||||
Widget.CloseWindow();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Menu Buttons
|
||||
Widget.RootWidget.GetWidget("MAINMENU_BUTTON_VIDEOPLAYER").OnMouseUp = mi => {
|
||||
Widget.RootWidget.OpenWindow("VIDEOPLAYER_MENU");
|
||||
Widget.OpenWindow("VIDEOPLAYER_MENU");
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -322,14 +322,14 @@ namespace OpenRA.Widgets
|
||||
return (widget != null)? (T) widget : null;
|
||||
}
|
||||
|
||||
public void CloseWindow()
|
||||
public static void CloseWindow()
|
||||
{
|
||||
RootWidget.GetWidget(WindowList.Pop()).Visible = false;
|
||||
if (WindowList.Count > 0)
|
||||
RootWidget.GetWidget(WindowList.Peek()).Visible = true;
|
||||
}
|
||||
|
||||
public Widget OpenWindow(string id)
|
||||
public static Widget OpenWindow(string id)
|
||||
{
|
||||
if (WindowList.Count > 0)
|
||||
RootWidget.GetWidget(WindowList.Peek()).Visible = false;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public static void PlayFullscreenFMVThen(World w, string movie, Action then)
|
||||
{
|
||||
var playerRoot = Widget.RootWidget.OpenWindow("FMVPLAYER");
|
||||
var playerRoot = Widget.OpenWindow("FMVPLAYER");
|
||||
var player = playerRoot.GetWidget<VqaPlayerWidget>("PLAYER");
|
||||
w.DisableTick = true;
|
||||
player.Load(movie);
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.RA
|
||||
if (music)
|
||||
Sound.PlayMusic();
|
||||
|
||||
Widget.RootWidget.CloseWindow();
|
||||
Widget.CloseWindow();
|
||||
w.DisableTick = false;
|
||||
then();
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
var gameRoot = r.GetWidget("INGAME_ROOT");
|
||||
var optionsBG = gameRoot.GetWidget("INGAME_OPTIONS_BG");
|
||||
|
||||
Game.BeforeGameStart += () => r.OpenWindow("INGAME_ROOT");
|
||||
Game.BeforeGameStart += () => Widget.OpenWindow("INGAME_ROOT");
|
||||
Game.AfterGameStart += () => gameRoot.GetWidget<RadarBinWidget>("INGAME_RADAR_BIN").SetWorld(Game.world);
|
||||
|
||||
r.GetWidget("INGAME_OPTIONS_BUTTON").OnMouseUp = mi => {
|
||||
@@ -36,12 +36,12 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
};
|
||||
|
||||
optionsBG.GetWidget("SETTINGS").OnMouseUp = mi => {
|
||||
r.OpenWindow("SETTINGS_MENU");
|
||||
Widget.OpenWindow("SETTINGS_MENU");
|
||||
return true;
|
||||
};
|
||||
|
||||
optionsBG.GetWidget("MUSIC").OnMouseUp = mi => {
|
||||
r.OpenWindow("MUSIC_MENU");
|
||||
Widget.OpenWindow("MUSIC_MENU");
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user