2025-05-13 05:02:17 -07:00
|
|
|
class ReturnQuestion extends SessionMessageBox
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
ReturnQuestion.prototype.Title = translate("Confirmation");
|
|
|
|
|
ReturnQuestion.prototype.Caption = translate("Do you want to resign or will you return soon?");
|
|
|
|
|
ReturnQuestion.prototype.Buttons = [
|
|
|
|
|
{
|
|
|
|
|
"caption": translate("I will return"),
|
2026-06-11 12:06:33 -07:00
|
|
|
"onPress": function() { this.closeSession(false); }
|
2025-05-13 05:02:17 -07:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"caption": translate("I resign"),
|
2025-12-30 00:57:37 -08:00
|
|
|
"onPress": () =>
|
|
|
|
|
{
|
2025-05-13 05:02:17 -07:00
|
|
|
Engine.PostNetworkCommand({
|
|
|
|
|
"type": "resign"
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
2019-10-30 04:14:55 -07:00
|
|
|
/**
|
|
|
|
|
* The class that is enabled() will be triggered when the user clicks on the Exit menu button.
|
|
|
|
|
*/
|
|
|
|
|
class QuitConfirmationMenu
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2019-11-23 00:10:36 -08:00
|
|
|
* In single-player mode, replay mode and for observers in multiplayer matches that
|
2019-10-30 04:14:55 -07:00
|
|
|
* aren't the host, exit the match instantly.
|
|
|
|
|
*/
|
|
|
|
|
QuitConfirmationMenu.prototype.Singleplayer = class extends QuitConfirmation
|
|
|
|
|
{
|
|
|
|
|
enabled()
|
|
|
|
|
{
|
|
|
|
|
return !g_IsNetworked || (!g_IsController && g_IsObserver);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* If the current player is the host of a networked match, have the player
|
|
|
|
|
* confirm intent to end the game for the remote players as well.
|
|
|
|
|
*/
|
|
|
|
|
QuitConfirmationMenu.prototype.MultiplayerHost = class extends QuitConfirmation
|
|
|
|
|
{
|
|
|
|
|
enabled()
|
|
|
|
|
{
|
|
|
|
|
return g_IsNetworked && g_IsController;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QuitConfirmationMenu.prototype.MultiplayerHost.prototype.Caption =
|
|
|
|
|
translate("Are you sure you want to quit? Leaving will disconnect all other players.");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Active players that aren't the host will be asked if they want to resign before leaving.
|
|
|
|
|
*/
|
|
|
|
|
QuitConfirmationMenu.prototype.MultiplayerClient = class extends QuitConfirmation
|
|
|
|
|
{
|
|
|
|
|
enabled()
|
|
|
|
|
{
|
|
|
|
|
return g_IsNetworked && !g_IsController && !g_IsObserver;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-13 04:26:48 -08:00
|
|
|
QuitConfirmationMenu.prototype.MultiplayerClient.prototype.Caption =
|
|
|
|
|
translate("Are you sure you want to quit?");
|
|
|
|
|
|
2019-10-30 04:14:55 -07:00
|
|
|
QuitConfirmationMenu.prototype.MultiplayerClient.prototype.Buttons =
|
2025-12-30 00:57:37 -08:00
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"caption": translate("No")
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"caption": translate("Yes"),
|
2026-06-11 12:06:33 -07:00
|
|
|
"onPress": closeSession =>
|
2025-12-30 00:57:37 -08:00
|
|
|
{
|
2026-06-11 12:06:33 -07:00
|
|
|
(new ReturnQuestion()).display(closeSession);
|
2025-12-30 00:57:37 -08:00
|
|
|
}
|
2019-10-30 04:14:55 -07:00
|
|
|
}
|
2025-12-30 00:57:37 -08:00
|
|
|
];
|