Disable missions that define bogus rules. Fixes #6818.
This commit is contained in:
@@ -13,6 +13,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Threading;
|
||||||
using OpenRA.FileSystem;
|
using OpenRA.FileSystem;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Network;
|
using OpenRA.Network;
|
||||||
@@ -107,7 +108,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
if (allMaps.Any())
|
if (allMaps.Any())
|
||||||
SelectMap(allMaps.First());
|
SelectMap(allMaps.First());
|
||||||
|
|
||||||
widget.Get<ButtonWidget>("STARTGAME_BUTTON").OnClick = StartMission;
|
var startButton = widget.Get<ButtonWidget>("STARTGAME_BUTTON");
|
||||||
|
startButton.OnClick = StartMission;
|
||||||
|
startButton.IsDisabled = () => selectedMapPreview.RuleStatus != MapRuleStatus.Cached;
|
||||||
|
|
||||||
widget.Get<ButtonWidget>("BACK_BUTTON").OnClick = () =>
|
widget.Get<ButtonWidget>("BACK_BUTTON").OnClick = () =>
|
||||||
{
|
{
|
||||||
@@ -145,6 +148,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
StopVideo();
|
StopVideo();
|
||||||
|
|
||||||
selectedMapPreview = Game.modData.MapCache[map.Uid];
|
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 video = selectedMapPreview.Map.PreviewVideo;
|
||||||
var videoVisible = video != null;
|
var videoVisible = video != null;
|
||||||
var videoDisabled = !(videoVisible && GlobalFileSystem.Exists(video));
|
var videoDisabled = !(videoVisible && GlobalFileSystem.Exists(video));
|
||||||
@@ -187,6 +194,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
{
|
{
|
||||||
StopVideo();
|
StopVideo();
|
||||||
|
|
||||||
|
if (selectedMapPreview.RuleStatus != MapRuleStatus.Cached)
|
||||||
|
return;
|
||||||
|
|
||||||
OrderManager om = null;
|
OrderManager om = null;
|
||||||
|
|
||||||
Action lobbyReady = null;
|
Action lobbyReady = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user