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:
Noam
2018-08-27 00:28:25 +03:00
committed by abcdefg30
parent 399e451ada
commit 4e7a35b50f
3 changed files with 12 additions and 3 deletions

View File

@@ -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)