Remove Game.AfterGameStart

This commit is contained in:
Paul Chote
2011-05-30 20:57:30 +12:00
parent 2ebb2ae921
commit b487476ea9
3 changed files with 7 additions and 5 deletions

View File

@@ -205,7 +205,6 @@ namespace OpenRA
LobbyInfoChanged(); LobbyInfoChanged();
} }
public static event Action<World> AfterGameStart = _ => {};
public static event Action BeforeGameStart = () => {}; public static event Action BeforeGameStart = () => {};
internal static void StartGame(string mapUID) internal static void StartGame(string mapUID)
{ {
@@ -223,7 +222,6 @@ namespace OpenRA
orderManager.LastTickTime = Environment.TickCount; orderManager.LastTickTime = Environment.TickCount;
orderManager.StartGame(); orderManager.StartGame();
worldRenderer.RefreshPalette(); worldRenderer.RefreshPalette();
AfterGameStart( orderManager.world );
} }
public static bool IsHost public static bool IsHost
@@ -275,7 +273,6 @@ namespace OpenRA
AddChatLine = (a,b,c) => {}; AddChatLine = (a,b,c) => {};
ConnectionStateChanged = om => {}; ConnectionStateChanged = om => {};
BeforeGameStart = () => {}; BeforeGameStart = () => {};
AfterGameStart = w => {};
Widget.ResetAll(); Widget.ResetAll();
worldRenderer = null; worldRenderer = null;

View File

@@ -47,6 +47,7 @@ namespace OpenRA.Mods.RA
public class LoadWidgetAtGameStartInfo : ITraitInfo public class LoadWidgetAtGameStartInfo : ITraitInfo
{ {
public readonly string Widget = null; public readonly string Widget = null;
public readonly bool ClearRootWidget = true;
public object Create(ActorInitializer init) { return new LoadWidgetAtGameStart(this); } public object Create(ActorInitializer init) { return new LoadWidgetAtGameStart(this); }
} }
@@ -60,6 +61,10 @@ namespace OpenRA.Mods.RA
public void WorldLoaded(World world) public void WorldLoaded(World world)
{ {
// Clear any existing widget state
if (Info.ClearRootWidget)
Widget.ResetAll();
Game.LoadWidget(world, Info.Widget, Widget.RootWidget, new WidgetArgs()); Game.LoadWidget(world, Info.Widget, Widget.RootWidget, new WidgetArgs());
} }
} }

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
return true; return true;
}; };
Game.AfterGameStart += _ => validPlayers = world.players.Values.Where(a => a != world.LocalPlayer && !a.NonCombatant).Count(); validPlayers = world.players.Values.Where(a => a != world.LocalPlayer && !a.NonCombatant).Count();
diplomacy.IsVisible = () => (validPlayers > 0); diplomacy.IsVisible = () => (validPlayers > 0);
} }