Show an error prompt if restart mod switch fails.
This commit is contained in:
@@ -75,16 +75,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Action closeAndExit = () => { Ui.CloseWindow(); onExit(); };
|
Action closeAndExit = () => { Ui.CloseWindow(); onExit(); };
|
||||||
if (needsRestart)
|
if (needsRestart)
|
||||||
{
|
{
|
||||||
Action restart = () =>
|
Action noRestart = () => ConfirmationDialogs.ButtonPrompt(
|
||||||
|
title: "Restart Required",
|
||||||
|
text: "Some changes will not be applied until\nthe game is restarted.",
|
||||||
|
onCancel: closeAndExit,
|
||||||
|
cancelText: "Continue");
|
||||||
|
|
||||||
|
if (!Game.ExternalMods.TryGetValue(ExternalMod.MakeKey(Game.ModData.Manifest), out var external))
|
||||||
{
|
{
|
||||||
var external = Game.ExternalMods[ExternalMod.MakeKey(Game.ModData.Manifest)];
|
noRestart();
|
||||||
Game.SwitchToExternalMod(external, null, closeAndExit);
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(
|
||||||
title: "Restart Now?",
|
title: "Restart Now?",
|
||||||
text: "Some changes will not be applied until\nthe game is restarted. Restart now?",
|
text: "Some changes will not be applied until\nthe game is restarted. Restart now?",
|
||||||
onConfirm: restart,
|
onConfirm: () => Game.SwitchToExternalMod(external, null, noRestart),
|
||||||
onCancel: closeAndExit,
|
onCancel: closeAndExit,
|
||||||
confirmText: "Restart Now",
|
confirmText: "Restart Now",
|
||||||
cancelText: "Restart Later");
|
cancelText: "Restart Later");
|
||||||
|
|||||||
Reference in New Issue
Block a user