Merge export and rename UIs

The renaming UI is used to rename, export, or delete your game logs
This commit is contained in:
RedstonewolfX 2024-07-12 17:04:34 -04:00
parent d464e46150
commit c39ecd7181
2 changed files with 42 additions and 5 deletions

View File

@ -397,7 +397,16 @@ export function generateEditOption(scene: BattleScene, i: integer, saves: any, p
buttonActions: [
() => {
scene.ui.playSelect();
console.log("Ending UI phase thingy");
phase.callEnd()
},
() => {
scene.ui.playSelect();
downloadLogByID(i)
phase.callEnd()
},
() => {
scene.ui.playSelect();
localStorage.removeItem(logs[i][1])
phase.callEnd()
}
]

View File

@ -417,11 +417,39 @@ export class TitlePhase extends Phase {
//options.push(LoggerTools.generateAddOption(i, this.scene, this))
}
}
options.push({
label: "Delete all",
handler: () => {
for (var i = 0; i < LoggerTools.logs.length; i++) {
if (localStorage.getItem(LoggerTools.logs[i][1]) != null) {
localStorage.removeItem(LoggerTools.logs[i][1])
}
}
this.scene.clearPhaseQueue();
this.scene.pushPhase(new TitlePhase(this.scene));
super.end();
return true;
}
}, {
label: i18next.t("menu:cancel"),
handler: () => {
this.scene.clearPhaseQueue();
this.scene.pushPhase(new TitlePhase(this.scene));
super.end();
return true;
}
});
this.scene.ui.showText("Export or clear game logs.", null, () => this.scene.ui.setOverlayMode(Mode.OPTION_SELECT, { options: options }));
return true;
}
logRenameMenu(): boolean {
const options: OptionSelectItem[] = [];
LoggerTools.getLogs()
for (var i = 0; i < LoggerTools.logs.length; i++) {
if (localStorage.getItem(LoggerTools.logs[i][1]) != null) {
//options.push(LoggerTools.generateOption(i, this.scene, this.logMenu) as OptionSelectItem)
options.push(LoggerTools.generateEditOption(this.scene, i, this.getSaves(), this) as OptionSelectItem)
} else {
options.push(LoggerTools.generateAddOption(i, this.scene, this))
//options.push(LoggerTools.generateAddOption(i, this.scene, this))
}
}
options.push({
@ -446,7 +474,7 @@ export class TitlePhase extends Phase {
return true;
}
});
this.scene.ui.showText("Export or clear game logs.", null, () => this.scene.ui.setOverlayMode(Mode.OPTION_SELECT, { options: options }));
this.scene.ui.showText("Export, rename, or delete logs.", null, () => this.scene.ui.setOverlayMode(Mode.OPTION_SELECT, { options: options }));
return true;
}
@ -563,7 +591,7 @@ export class TitlePhase extends Phase {
}, {
label: "Manage Logs",
handler: () => {
return this.logMenu()
return this.logRenameMenu()
}
})
options.push({