diff --git a/OpenRA.Mods.RA/Widgets/Logic/MissionBrowserLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/MissionBrowserLogic.cs index 50ddbdee52..2d15e169c4 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/MissionBrowserLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/MissionBrowserLogic.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; +using System.Threading; using OpenRA.FileSystem; using OpenRA.Graphics; using OpenRA.Network; @@ -107,7 +108,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (allMaps.Any()) SelectMap(allMaps.First()); - widget.Get("STARTGAME_BUTTON").OnClick = StartMission; + var startButton = widget.Get("STARTGAME_BUTTON"); + startButton.OnClick = StartMission; + startButton.IsDisabled = () => selectedMapPreview.RuleStatus != MapRuleStatus.Cached; widget.Get("BACK_BUTTON").OnClick = () => { @@ -145,6 +148,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic StopVideo(); selectedMapPreview = Game.modData.MapCache[map.Uid]; + + // Cache the rules on a background thread to avoid jank + new Thread(selectedMapPreview.CacheRules).Start(); + var video = selectedMapPreview.Map.PreviewVideo; var videoVisible = video != null; var videoDisabled = !(videoVisible && GlobalFileSystem.Exists(video)); @@ -187,6 +194,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic { StopVideo(); + if (selectedMapPreview.RuleStatus != MapRuleStatus.Cached) + return; + OrderManager om = null; Action lobbyReady = null;