mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-22 07:19:28 +02:00
[UI/UX] Save in starter select screen after moveset changes (#6287)
* Save after moveset changes * Saving only when the moveset is actually changed * Removed logs, added docs * Update src/ui/starter-select-ui-handler.ts --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
This commit is contained in:
parent
6bdfb7eb31
commit
d2e9615457
@ -401,6 +401,12 @@ export class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
private starterPreferences: StarterPreferences;
|
private starterPreferences: StarterPreferences;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to check whether any moves were swapped using the reorder menu, to decide
|
||||||
|
* whether a save should be performed or not.
|
||||||
|
*/
|
||||||
|
private hasSwappedMoves = false;
|
||||||
|
|
||||||
protected blockInput = false;
|
protected blockInput = false;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -1957,6 +1963,14 @@ export class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
handler: () => {
|
handler: () => {
|
||||||
this.moveInfoOverlay.clear();
|
this.moveInfoOverlay.clear();
|
||||||
this.clearText();
|
this.clearText();
|
||||||
|
// Only saved if moves were actually swapped
|
||||||
|
if (this.hasSwappedMoves) {
|
||||||
|
globalScene.gameData.saveSystem().then(success => {
|
||||||
|
if (!success) {
|
||||||
|
return globalScene.reset(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
ui.setMode(UiMode.STARTER_SELECT);
|
ui.setMode(UiMode.STARTER_SELECT);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@ -1975,6 +1989,7 @@ export class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
options.push({
|
options.push({
|
||||||
label: i18next.t("starterSelectUiHandler:manageMoves"),
|
label: i18next.t("starterSelectUiHandler:manageMoves"),
|
||||||
handler: () => {
|
handler: () => {
|
||||||
|
this.hasSwappedMoves = false;
|
||||||
showSwapOptions(this.starterMoveset!); // TODO: is this bang correct?
|
showSwapOptions(this.starterMoveset!); // TODO: is this bang correct?
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@ -2724,8 +2739,8 @@ export class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
} else {
|
} else {
|
||||||
starterData.moveset = updatedMoveset;
|
starterData.moveset = updatedMoveset;
|
||||||
}
|
}
|
||||||
|
this.hasSwappedMoves = true;
|
||||||
this.setSpeciesDetails(this.lastSpecies, { forSeen: false });
|
this.setSpeciesDetails(this.lastSpecies, { forSeen: false });
|
||||||
|
|
||||||
this.updateSelectedStarterMoveset(speciesId);
|
this.updateSelectedStarterMoveset(speciesId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user