Add Save and Quit option to replace Return to Title

This commit is contained in:
Flashfyre 2024-05-15 11:42:18 -04:00
parent 38e3022d06
commit ac2e78129e
9 changed files with 23 additions and 17 deletions

View File

@ -9,7 +9,7 @@ export const menuUiHandler: SimpleTranslationEntries = {
"EGG_GACHA": "Eier-Gacha",
"MANAGE_DATA": "Daten verwalten",
"COMMUNITY": "Community",
"RETURN_TO_TITLE": "Zurück zum Titelbildschirm",
"SAVE_AND_QUIT": "Save and Quit",
"LOG_OUT": "Ausloggen",
"slot": "Slot {{slotNumber}}",
"importSession": "Sitzung importieren",

View File

@ -9,7 +9,7 @@ export const menuUiHandler: SimpleTranslationEntries = {
"EGG_GACHA": "Egg Gacha",
"MANAGE_DATA": "Manage Data",
"COMMUNITY": "Community",
"RETURN_TO_TITLE": "Return To Title",
"SAVE_AND_QUIT": "Save and Quit",
"LOG_OUT": "Log Out",
"slot": "Slot {{slotNumber}}",
"importSession": "Import Session",

View File

@ -9,7 +9,7 @@ export const menuUiHandler: SimpleTranslationEntries = {
"EGG_GACHA": "Gacha de Huevos",
"MANAGE_DATA": "Gestionar Datos",
"COMMUNITY": "Comunidad",
"RETURN_TO_TITLE": "Volver al Título",
"SAVE_AND_QUIT": "Save and Quit",
"LOG_OUT": "Cerrar Sesión",
"slot": "Ranura {{slotNumber}}",
"importSession": "Importar Sesión",

View File

@ -9,7 +9,7 @@ export const menuUiHandler: SimpleTranslationEntries = {
"EGG_GACHA": "Gacha-Œufs",
"MANAGE_DATA": "Mes données",
"COMMUNITY": "Communauté",
"RETURN_TO_TITLE": "Écran titre",
"SAVE_AND_QUIT": "Save and Quit",
"LOG_OUT": "Déconnexion",
"slot": "Emplacement {{slotNumber}}",
"importSession": "Importer session",

View File

@ -9,7 +9,7 @@ export const menuUiHandler: SimpleTranslationEntries = {
"EGG_GACHA": "Gacha Uova",
"MANAGE_DATA": "Gestisci Dati",
"COMMUNITY": "Community",
"RETURN_TO_TITLE": "Ritorna al Titolo",
"SAVE_AND_QUIT": "Save and Quit",
"LOG_OUT": "Disconnettiti",
"slot": "Slot {{slotNumber}}",
"importSession": "Importa Sessione",

View File

@ -9,7 +9,7 @@ export const menuUiHandler: SimpleTranslationEntries = {
"EGG_GACHA": "Gacha de Ovos",
"MANAGE_DATA": "Gerenciar Dados",
"COMMUNITY": "Comunidade",
"RETURN_TO_TITLE": "Voltar ao Início",
"SAVE_AND_QUIT": "Save and Quit",
"LOG_OUT": "Logout",
"slot": "Slot {{slotNumber}}",
"importSession": "Importar Sessão",

View File

@ -9,7 +9,7 @@ export const menuUiHandler: SimpleTranslationEntries = {
"EGG_GACHA": "扭蛋机",
"MANAGE_DATA": "管理数据",
"COMMUNITY": "社区",
"RETURN_TO_TITLE": "返回标题画面",
"SAVE_AND_QUIT": "Save and Quit",
"LOG_OUT": "登出",
"slot": "存档位 {{slotNumber}}",
"importSession": "导入存档",

View File

@ -358,12 +358,15 @@ export class GameData {
if (cachedSystemData.timestamp > systemData.timestamp) {
console.debug('Use cached system');
systemData = cachedSystemData;
systemDataStr = cachedSystemDataStr;
} else
this.clearLocalData();
}
console.debug(systemData);
localStorage.setItem(`data_${loggedInUser.username}`, encrypt(systemDataStr, bypassLogin));
/*const versions = [ this.scene.game.config.gameVersion, data.gameVersion || '0.0.0' ];
if (versions[0] !== versions[1]) {
@ -876,7 +879,7 @@ export class GameData {
}) as SessionSaveData;
}
saveAll(scene: BattleScene, skipVerification: boolean = false, sync: boolean = false, useCachedSession: boolean = false): Promise<boolean> {
saveAll(scene: BattleScene, skipVerification: boolean = false, sync: boolean = false, useCachedSession: boolean = false, useCachedSystem: boolean = false): Promise<boolean> {
return new Promise<boolean>(resolve => {
Utils.executeIf(!skipVerification, updateUserInfo).then(success => {
if (success !== null && !success)
@ -886,7 +889,7 @@ export class GameData {
const sessionData = useCachedSession ? this.parseSessionData(decrypt(localStorage.getItem(`sessionData${scene.sessionSlotId ? scene.sessionSlotId : ''}_${loggedInUser.username}`), bypassLogin)) : this.getSessionSaveData(scene);
const maxIntAttrValue = Math.pow(2, 31);
const systemData = this.getSystemSaveData();
const systemData = useCachedSystem ? this.parseSystemData(decrypt(localStorage.getItem(`data_${loggedInUser.username}`), bypassLogin)) : this.getSystemSaveData();
const request = {
system: systemData,

View File

@ -20,7 +20,7 @@ export enum MenuOptions {
EGG_GACHA,
MANAGE_DATA,
COMMUNITY,
RETURN_TO_TITLE,
SAVE_AND_QUIT,
LOG_OUT
}
@ -297,15 +297,18 @@ export default class MenuUiHandler extends MessageUiHandler {
ui.setOverlayMode(Mode.MENU_OPTION_SELECT, this.communityConfig);
success = true;
break;
case MenuOptions.RETURN_TO_TITLE:
case MenuOptions.SAVE_AND_QUIT:
if (this.scene.currentBattle) {
success = true;
ui.showText(i18next.t("menuUiHandler:losingProgressionWarning"), null, () => {
ui.setOverlayMode(Mode.CONFIRM, () => this.scene.reset(true), () => {
ui.revertMode();
ui.showText(null, 0);
}, false, -98);
});
if (this.scene.currentBattle.turn > 1) {
ui.showText(i18next.t("menuUiHandler:losingProgressionWarning"), null, () => {
ui.setOverlayMode(Mode.CONFIRM, () => this.scene.gameData.saveAll(this.scene, true, true, true, true).then(() => this.scene.reset(true)), () => {
ui.revertMode();
ui.showText(null, 0);
}, false, -98);
});
} else
this.scene.gameData.saveAll(this.scene, true, true, true, true).then(() => this.scene.reset(true));
} else
error = true;
break;