Remove Game.AfterGameStart
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user