Merge pull request #11370 from pchote/fix-game-start-events
Fix shellmap UI disappearing prematurely when starting a mission or replay.
This commit is contained in:
@@ -47,6 +47,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
this.modData = modData;
|
||||
this.onStart = onStart;
|
||||
Game.BeforeGameStart += OnGameStart;
|
||||
|
||||
playerList = panel.Get<ScrollPanelWidget>("PLAYER_LIST");
|
||||
playerHeader = playerList.Get<ScrollItemWidget>("HEADER");
|
||||
@@ -668,16 +669,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
void WatchReplay()
|
||||
{
|
||||
Action startReplay = () =>
|
||||
if (selectedReplay != null && ReplayUtils.PromptConfirmReplayCompatibility(selectedReplay))
|
||||
{
|
||||
cancelLoadingReplays = true;
|
||||
Game.JoinReplay(selectedReplay.FilePath);
|
||||
Ui.CloseWindow();
|
||||
onStart();
|
||||
};
|
||||
|
||||
if (selectedReplay != null && ReplayUtils.PromptConfirmReplayCompatibility(selectedReplay))
|
||||
startReplay();
|
||||
}
|
||||
}
|
||||
|
||||
void AddReplay(ReplayMetadata replay, ScrollItemWidget template)
|
||||
@@ -701,6 +697,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
replayList.AddChild(item);
|
||||
}
|
||||
|
||||
void OnGameStart()
|
||||
{
|
||||
Ui.CloseWindow();
|
||||
onStart();
|
||||
}
|
||||
|
||||
bool disposed;
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && !disposed)
|
||||
{
|
||||
disposed = true;
|
||||
Game.BeforeGameStart -= OnGameStart;
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
class ReplayState
|
||||
{
|
||||
public bool Visible;
|
||||
|
||||
Reference in New Issue
Block a user