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