Use BeforeGameStart to remove mission browser UI on game start.

This commit is contained in:
Paul Chote
2016-05-28 18:13:09 +01:00
parent 773eb25917
commit 485e695585
2 changed files with 23 additions and 6 deletions

View File

@@ -55,6 +55,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
this.modData = modData;
this.onStart = onStart;
Game.BeforeGameStart += OnGameStart;
missionList = widget.Get<ScrollPanelWidget>("MISSION_LIST");
@@ -151,6 +152,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic
};
}
void OnGameStart()
{
Ui.CloseWindow();
onStart();
}
bool disposed;
protected override void Dispose(bool disposing)
{
if (disposing && !disposed)
{
disposed = true;
Game.BeforeGameStart -= OnGameStart;
}
base.Dispose(disposing);
}
void CreateMissionGroup(string title, IEnumerable<MapPreview> previews)
{
var header = ScrollItemWidget.Setup(headerTemplate, () => true, () => { });
@@ -344,11 +363,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
PlayVideo(fsPlayer, missionData.StartVideo, PlayingVideo.GameStart, () =>
{
StopVideo(fsPlayer);
Game.CreateAndStartLocalServer(selectedMap.Uid, orders, onStart);
Game.CreateAndStartLocalServer(selectedMap.Uid, orders);
});
}
else
Game.CreateAndStartLocalServer(selectedMap.Uid, orders, onStart);
Game.CreateAndStartLocalServer(selectedMap.Uid, orders);
}
class DropDownOption