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", "EGG_GACHA": "Eier-Gacha",
"MANAGE_DATA": "Daten verwalten", "MANAGE_DATA": "Daten verwalten",
"COMMUNITY": "Community", "COMMUNITY": "Community",
"RETURN_TO_TITLE": "Zurück zum Titelbildschirm", "SAVE_AND_QUIT": "Save and Quit",
"LOG_OUT": "Ausloggen", "LOG_OUT": "Ausloggen",
"slot": "Slot {{slotNumber}}", "slot": "Slot {{slotNumber}}",
"importSession": "Sitzung importieren", "importSession": "Sitzung importieren",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -358,12 +358,15 @@ export class GameData {
if (cachedSystemData.timestamp > systemData.timestamp) { if (cachedSystemData.timestamp > systemData.timestamp) {
console.debug('Use cached system'); console.debug('Use cached system');
systemData = cachedSystemData; systemData = cachedSystemData;
systemDataStr = cachedSystemDataStr;
} else } else
this.clearLocalData(); this.clearLocalData();
} }
console.debug(systemData); console.debug(systemData);
localStorage.setItem(`data_${loggedInUser.username}`, encrypt(systemDataStr, bypassLogin));
/*const versions = [ this.scene.game.config.gameVersion, data.gameVersion || '0.0.0' ]; /*const versions = [ this.scene.game.config.gameVersion, data.gameVersion || '0.0.0' ];
if (versions[0] !== versions[1]) { if (versions[0] !== versions[1]) {
@ -876,7 +879,7 @@ export class GameData {
}) as SessionSaveData; }) 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 => { return new Promise<boolean>(resolve => {
Utils.executeIf(!skipVerification, updateUserInfo).then(success => { Utils.executeIf(!skipVerification, updateUserInfo).then(success => {
if (success !== null && !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 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 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 = { const request = {
system: systemData, system: systemData,

View File

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