Generalise and combine cancel/confirm prompts.

This commit is contained in:
Paul Chote
2016-06-16 18:21:55 +01:00
parent bc03c199f5
commit 3ac42e1643
9 changed files with 94 additions and 146 deletions

View File

@@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
};
}
ConfirmationDialogs.PromptConfirmAction(
ConfirmationDialogs.ButtonPrompt(
title: "Leave Mission",
text: "Leave this game and return to the menu?",
onConfirm: onQuit,
@@ -132,7 +132,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
exitEditorButton.OnClick = () =>
{
hideMenu = true;
ConfirmationDialogs.PromptConfirmAction(
ConfirmationDialogs.ButtonPrompt(
title: "Exit Map Editor",
text: "Exit and lose all unsaved changes?",
onConfirm: onQuit,
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
surrenderButton.OnClick = () =>
{
hideMenu = true;
ConfirmationDialogs.PromptConfirmAction(
ConfirmationDialogs.ButtonPrompt(
title: "Surrender",
text: "Are you sure you want to surrender?",
onConfirm: onSurrender,

View File

@@ -328,7 +328,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
void DeleteOneMap(string map, Action<string> after)
{
ConfirmationDialogs.PromptConfirmAction(
ConfirmationDialogs.ButtonPrompt(
title: "Delete map",
text: "Delete the map '{0}'?".F(modData.MapCache[map].Title),
onConfirm: () =>
@@ -343,7 +343,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
void DeleteAllMaps(string[] maps, Action<string> after)
{
ConfirmationDialogs.PromptConfirmAction(
ConfirmationDialogs.ButtonPrompt(
title: "Delete maps",
text: "Delete all maps on this page?",
onConfirm: () =>

View File

@@ -409,7 +409,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Action<ReplayMetadata, Action> onDeleteReplay = (r, after) =>
{
ConfirmationDialogs.PromptConfirmAction(
ConfirmationDialogs.ButtonPrompt(
title: "Delete selected replay?",
text: "Delete replay '{0}'?".F(Path.GetFileNameWithoutExtension(r.FilePath)),
onConfirm: () =>
@@ -450,7 +450,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return;
}
ConfirmationDialogs.PromptConfirmAction(
ConfirmationDialogs.ButtonPrompt(
title: "Delete all selected replays?",
text: "Delete {0} replays?".F(list.Count),
onConfirm: () =>

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var error = "It was recorded with an " + type;
error += string.IsNullOrEmpty(name) ? "." : ":\n{0}".F(name);
ConfirmationDialogs.CancelPrompt("Incompatible Replay", error, onCancel);
ConfirmationDialogs.ButtonPrompt("Incompatible Replay", error, onCancel: onCancel);
return false;
}

View File

@@ -128,14 +128,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
catch (System.Net.Sockets.SocketException e)
{
var err_msg = "Could not listen on port {0}.".F(Game.Settings.Server.ListenPort);
var message = "Could not listen on port {0}.".F(Game.Settings.Server.ListenPort);
if (e.ErrorCode == 10048) { // AddressAlreadyInUse (WSAEADDRINUSE)
err_msg += "\n\nCheck if the port is already being used.";
message += "\nCheck if the port is already being used.";
} else {
err_msg += "\n\nError is: \"{0}\" ({1})".F(e.Message, e.ErrorCode);
message += "\nError is: \"{0}\" ({1})".F(e.Message, e.ErrorCode);
}
ConfirmationDialogs.CancelPrompt("Server Creation Failed", err_msg, cancelText: "OK");
ConfirmationDialogs.ButtonPrompt("Server Creation Failed", message, onCancel: () => { }, cancelText: "Back");
return;
}

View File

@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
OriginalGraphicsRenderer != current.Graphics.Renderer ||
OriginalGraphicsWindowedSize != current.Graphics.WindowedSize ||
OriginalGraphicsFullscreenSize != current.Graphics.FullscreenSize)
ConfirmationDialogs.PromptConfirmAction(
ConfirmationDialogs.ButtonPrompt(
title: "Restart Now?",
text: "Some changes will not be applied until\nthe game is restarted. Restart now?",
onConfirm: Game.Restart,