1
0
forked from 0ad/0ad

Add an extra button to skip the summary page when quitting.

Allows devs (and players) to skip the summary page when they don't need
them.

Patch by: @Schweini
Differential revision: https://code.wildfiregames.com/D3958
Reviewed by: @Langbart
Fixes: #4300
Comments by: @nwtour, @Stan
This was SVN commit r25978.
This commit is contained in:
Freagarach 2021-10-28 06:31:16 +00:00
parent 137ec9f3d4
commit 3ab25cbd95
6 changed files with 42 additions and 13 deletions

View File

@ -9,7 +9,7 @@ class NetworkStatusOverlay
this.netStatus = Engine.GetGUIObjectByName("netStatus");
this.loadingClientsText = Engine.GetGUIObjectByName("loadingClientsText");
Engine.GetGUIObjectByName("disconnectedExitButton").onPress = endGame;
Engine.GetGUIObjectByName("disconnectedExitButton").onPress = () => { endGame(true); };
registerNetworkStatusChangeHandler(this.onNetStatusMessage.bind(this));
registerClientsLoadingHandler(this.onClientsLoadingMessage.bind(this));

View File

@ -6,15 +6,25 @@ QuitConfirmation.prototype.Title =
translate("Confirmation");
QuitConfirmation.prototype.Caption =
translate("Are you sure you want to quit?");
translate("The game has finished, what do you want to do?");
QuitConfirmation.prototype.Buttons =
[
{
"caption": translate("No")
// Translation: Shown in the Dialog that shows up when the game finishes
"caption": translate("Stay")
},
{
"caption": translate("Yes"),
"onPress": endGame
// Translation: Shown in the Dialog that shows up when the game finishes
"caption": translate("Quit and View Summary"),
"onPress": () => { endGame(true); }
},
{
// Translation: Shown in the Dialog that shows up when the game finishes
"caption": translate("Quit"),
"onPress": () => { endGame(false); }
}
];
QuitConfirmation.prototype.Width = 600;
QuitConfirmation.prototype.Height = 200;

View File

@ -65,7 +65,7 @@ ReturnQuestion.prototype.Caption = translate("Do you want to resign or will you
ReturnQuestion.prototype.Buttons = [
{
"caption": translate("I will return"),
"onPress": endGame
"onPress": () => { endGame(false); }
},
{
"caption": translate("I resign"),

View File

@ -14,15 +14,25 @@ QuitConfirmationReplay.prototype.Title =
translateWithContext("replayFinished", "Confirmation");
QuitConfirmationReplay.prototype.Caption =
translateWithContext("replayFinished", "The replay has finished. Do you want to quit?");
translateWithContext("replayFinished", "The replay has finished. What do you want to do?");
QuitConfirmationReplay.prototype.Buttons =
[
{
"caption": translateWithContext("replayFinished", "No")
// Translation: Shown in the Dialog that shows up when a replay finishes
"caption": translate("Stay")
},
{
"caption": translateWithContext("replayFinished", "Yes"),
"onPress": endGame
// Translation: Shown in the Dialog that shows up when a replay finishes
"caption": translate("Quit and View Summary"),
"onPress": () => { endGame(true); }
},
{
// Translation: Shown in the Dialog that shows up when a replay finishes
"caption": translate("Quit"),
"onPress": () => { endGame(false); }
}
];
QuitConfirmationReplay.prototype.Width = 600;
QuitConfirmationReplay.prototype.Height = 200;

View File

@ -409,7 +409,7 @@ function updateTutorial(notification)
{
Engine.GetGUIObjectByName("tutorialWarning").caption = translate("Click to quit this tutorial.");
Engine.GetGUIObjectByName("tutorialReady").caption = translate("Quit");
Engine.GetGUIObjectByName("tutorialReady").onPress = endGame;
Engine.GetGUIObjectByName("tutorialReady").onPress = () => { endGame(true); };
}
else
Engine.GetGUIObjectByName("tutorialWarning").caption = translate("Click when ready.");

View File

@ -513,7 +513,7 @@ function closeOpenDialogs()
g_TradeDialog.close();
}
function endGame()
function endGame(showSummary)
{
// Before ending the game
let replayDirectory = Engine.GetCurrentReplayDirectory();
@ -554,7 +554,16 @@ function endGame()
summaryData.nextPage = menu;
}
Engine.SwitchGuiPage("page_summary.xml", summaryData);
if (showSummary)
Engine.SwitchGuiPage("page_summary.xml", summaryData);
else if (g_InitAttributes.campaignData)
Engine.SwitchGuiPage(summaryData.nextPage, summaryData.campaignData);
else if (Engine.HasXmppClient())
Engine.SwitchGuiPage("page_lobby.xml", { "dialog": false });
else if (g_IsReplay)
Engine.SwitchGuiPage("page_replaymenu.xml");
else
Engine.SwitchGuiPage("page_pregame.xml");
}
// Return some data that we'll use when hotloading this file after changes