Use BeforeGameStart to remove mission browser UI on game start.
This commit is contained in:
@@ -197,7 +197,7 @@ namespace OpenRA
|
||||
CreateAndStartLocalServer(lobbyInfo.GlobalSettings.Map, orders);
|
||||
}
|
||||
|
||||
public static void CreateAndStartLocalServer(string mapUID, IEnumerable<Order> setupOrders, Action onStart = null)
|
||||
public static void CreateAndStartLocalServer(string mapUID, IEnumerable<Order> setupOrders)
|
||||
{
|
||||
OrderManager om = null;
|
||||
|
||||
@@ -207,10 +207,8 @@ namespace OpenRA
|
||||
LobbyInfoChanged -= lobbyReady;
|
||||
foreach (var o in setupOrders)
|
||||
om.IssueOrder(o);
|
||||
|
||||
if (onStart != null)
|
||||
onStart();
|
||||
};
|
||||
|
||||
LobbyInfoChanged += lobbyReady;
|
||||
|
||||
om = JoinServer(IPAddress.Loopback.ToString(), CreateLocalServer(mapUID), "");
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user