Missed a couple of static bits.
This commit is contained in:
@@ -33,9 +33,8 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
// Must be set only once on game start
|
// Must be set only once on game start
|
||||||
// TODO: This is stupid
|
// TODO: This is stupid
|
||||||
static bool staticSetup;
|
static bool staticSetup;
|
||||||
|
enum StaticCrap { LobbyInfo, BeforeGameStart, AddChatLine }
|
||||||
|
static void StaticCrapChanged(StaticCrap type, Color a, string b, string c)
|
||||||
public static void GameStartingStub()
|
|
||||||
{
|
{
|
||||||
var panel = Widget.RootWidget.GetWidget("SERVER_LOBBY");
|
var panel = Widget.RootWidget.GetWidget("SERVER_LOBBY");
|
||||||
|
|
||||||
@@ -47,22 +46,19 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
if (lobbyLogic == null)
|
if (lobbyLogic == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lobbyLogic.onGameStart();
|
switch (type)
|
||||||
}
|
|
||||||
|
|
||||||
public static void UpdateCurrentMapStub()
|
|
||||||
{
|
{
|
||||||
var panel = Widget.RootWidget.GetWidget("SERVER_LOBBY");
|
case StaticCrap.LobbyInfo:
|
||||||
|
|
||||||
// The panel may not be open anymore
|
|
||||||
if (panel == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var lobbyLogic = panel.DelegateObject as CncLobbyLogic;
|
|
||||||
if (lobbyLogic == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
lobbyLogic.UpdateCurrentMap();
|
lobbyLogic.UpdateCurrentMap();
|
||||||
|
lobbyLogic.UpdatePlayerList();
|
||||||
|
break;
|
||||||
|
case StaticCrap.BeforeGameStart:
|
||||||
|
lobbyLogic.onGameStart();
|
||||||
|
break;
|
||||||
|
case StaticCrap.AddChatLine:
|
||||||
|
panel.GetWidget<ChatDisplayWidget>("CHAT_DISPLAY").AddLine(a,b,c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly Action onGameStart;
|
readonly Action onGameStart;
|
||||||
@@ -82,12 +78,12 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
if (!staticSetup)
|
if (!staticSetup)
|
||||||
{
|
{
|
||||||
staticSetup = true;
|
staticSetup = true;
|
||||||
Game.LobbyInfoChanged += UpdateCurrentMapStub;
|
Game.LobbyInfoChanged += () => StaticCrapChanged(StaticCrap.LobbyInfo, Color.Beige, null, null);
|
||||||
Game.BeforeGameStart += GameStartingStub;
|
Game.BeforeGameStart += () => StaticCrapChanged(StaticCrap.BeforeGameStart, Color.PapayaWhip, null, null);
|
||||||
|
Game.AddChatLine += (a,b,c) => StaticCrapChanged(StaticCrap.AddChatLine, a, b, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateCurrentMap();
|
UpdateCurrentMap();
|
||||||
|
|
||||||
CurrentColorPreview = Game.Settings.Player.ColorRamp;
|
CurrentColorPreview = Game.Settings.Player.ColorRamp;
|
||||||
|
|
||||||
Players = lobby.GetWidget<ScrollPanelWidget>("PLAYERS");
|
Players = lobby.GetWidget<ScrollPanelWidget>("PLAYERS");
|
||||||
@@ -182,9 +178,6 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
|
|
||||||
// Todo: Only show if the map requirements are met for player slots
|
// Todo: Only show if the map requirements are met for player slots
|
||||||
startGameButton.IsVisible = () => Game.IsHost;
|
startGameButton.IsVisible = () => Game.IsHost;
|
||||||
Game.LobbyInfoChanged += UpdatePlayerList;
|
|
||||||
|
|
||||||
Game.AddChatLine += lobby.GetWidget<ChatDisplayWidget>("CHAT_DISPLAY").AddLine;
|
|
||||||
|
|
||||||
bool teamChat = false;
|
bool teamChat = false;
|
||||||
var chatLabel = lobby.GetWidget<LabelWidget>("LABEL_CHATTYPE");
|
var chatLabel = lobby.GetWidget<LabelWidget>("LABEL_CHATTYPE");
|
||||||
|
|||||||
Reference in New Issue
Block a user