add NoAvailableMaps exception.
modify ChooseInitialMap to throw NoAvailalbeMaps exception if no maps were loaded. implement Utilities.TryWithPrompt - safe execution of a provided action with ability to prompt user on error.
This commit is contained in:
@@ -122,7 +122,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
missionsButton.Disabled = !hasCampaign && !hasMissions;
|
||||
|
||||
singleplayerMenu.Get<ButtonWidget>("SKIRMISH_BUTTON").OnClick = StartSkirmishGame;
|
||||
var hasMaps = modData.MapCache.Any(p => p.Visibility.HasFlag(MapVisibility.Lobby));
|
||||
var skirmishButton = singleplayerMenu.Get<ButtonWidget>("SKIRMISH_BUTTON");
|
||||
skirmishButton.OnClick = StartSkirmishGame;
|
||||
skirmishButton.Disabled = !hasMaps;
|
||||
|
||||
singleplayerMenu.Get<ButtonWidget>("BACK_BUTTON").OnClick = () => SwitchMenu(MenuType.Main);
|
||||
|
||||
@@ -200,6 +203,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
});
|
||||
};
|
||||
|
||||
loadMapButton.Disabled = !hasMaps;
|
||||
|
||||
mapEditorMenu.Get<ButtonWidget>("BACK_BUTTON").OnClick = () => SwitchMenu(MenuType.Extras);
|
||||
|
||||
var newsBG = widget.GetOrNull("NEWS_BG");
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
@@ -55,6 +56,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
});
|
||||
};
|
||||
|
||||
var hasMaps = modData.MapCache.Any(p => !p.Visibility.HasFlag(MapVisibility.Shellmap));
|
||||
createServerButton.Disabled = !hasMaps;
|
||||
|
||||
widget.Get<ButtonWidget>("BACK_BUTTON").OnClick = () => { Ui.CloseWindow(); onExit(); };
|
||||
|
||||
if (directConnectHost != null)
|
||||
|
||||
Reference in New Issue
Block a user