Use BeforeGameStart to remove replay browser UI on game start.
This commit is contained in:
@@ -44,6 +44,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
panel = widget;
|
panel = widget;
|
||||||
|
|
||||||
this.onStart = onStart;
|
this.onStart = onStart;
|
||||||
|
Game.BeforeGameStart += OnGameStart;
|
||||||
|
|
||||||
playerList = panel.Get<ScrollPanelWidget>("PLAYER_LIST");
|
playerList = panel.Get<ScrollPanelWidget>("PLAYER_LIST");
|
||||||
playerHeader = playerList.Get<ScrollItemWidget>("HEADER");
|
playerHeader = playerList.Get<ScrollItemWidget>("HEADER");
|
||||||
@@ -664,16 +665,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
void WatchReplay()
|
void WatchReplay()
|
||||||
{
|
{
|
||||||
Action startReplay = () =>
|
if (selectedReplay != null && ReplayUtils.PromptConfirmReplayCompatibility(selectedReplay))
|
||||||
{
|
{
|
||||||
cancelLoadingReplays = true;
|
cancelLoadingReplays = true;
|
||||||
Game.JoinReplay(selectedReplay.FilePath);
|
Game.JoinReplay(selectedReplay.FilePath);
|
||||||
Ui.CloseWindow();
|
}
|
||||||
onStart();
|
|
||||||
};
|
|
||||||
|
|
||||||
if (selectedReplay != null && ReplayUtils.PromptConfirmReplayCompatibility(selectedReplay))
|
|
||||||
startReplay();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddReplay(ReplayMetadata replay, ScrollItemWidget template)
|
void AddReplay(ReplayMetadata replay, ScrollItemWidget template)
|
||||||
@@ -697,6 +693,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
replayList.AddChild(item);
|
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
|
class ReplayState
|
||||||
{
|
{
|
||||||
public bool Visible;
|
public bool Visible;
|
||||||
|
|||||||
Reference in New Issue
Block a user