mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-24 07:23:24 +02:00
Made TitlePhase.loadSession
private
This commit is contained in:
parent
ba489231f9
commit
64d1ff7946
@ -169,7 +169,7 @@ export class TitlePhase extends Phase {
|
||||
}
|
||||
|
||||
// TODO: Make callers actually wait for the damn save slot to load
|
||||
async loadSaveSlot(slotId: number): Promise<void> {
|
||||
private async loadSaveSlot(slotId: number): Promise<void> {
|
||||
globalScene.sessionSlotId = slotId > -1 || !loggedInUser ? slotId : loggedInUser.lastSessionSlot;
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.resetModeChain();
|
||||
|
@ -416,7 +416,7 @@ export class GameManager {
|
||||
* Checks if the current phase matches the target phase.
|
||||
* @param phaseTarget - The target phase.
|
||||
* @returns Whether the current phase matches the target phase
|
||||
* @deprecated - Use phaseString
|
||||
* @deprecated - Use `PhaseString` instead
|
||||
*/
|
||||
isCurrentPhase(phaseTarget: PhaseClass): boolean;
|
||||
isCurrentPhase(phaseTarget: PhaseString | PhaseClass): boolean {
|
||||
@ -425,12 +425,12 @@ export class GameManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current mode matches the target mode.
|
||||
* Check if the current `UiMode` matches the target mode.
|
||||
* @param mode - The target {@linkcode UiMode} to check.
|
||||
* @returns Whether the current mode matches the target mode.
|
||||
*/
|
||||
isCurrentMode(mode: UiMode) {
|
||||
return this.scene.ui?.getMode() === mode;
|
||||
isCurrentMode(mode: UiMode): boolean {
|
||||
return this.scene.ui.getMode() === mode;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -448,10 +448,10 @@ export class GameManager {
|
||||
|
||||
/**
|
||||
* Imports game data from a file.
|
||||
* @param path - The path to the data file.
|
||||
* @param path - The path to the data file
|
||||
* @returns A promise that resolves with a tuple containing a boolean indicating success and an integer status code.
|
||||
*/
|
||||
async importData(path): Promise<[boolean, number]> {
|
||||
async importData(path: string): Promise<[boolean, number]> {
|
||||
const saveKey = "x0i2O7WRiANTqPmZ";
|
||||
const dataRaw = fs.readFileSync(path, { encoding: "utf8", flag: "r" });
|
||||
let dataStr = AES.decrypt(dataRaw, saveKey).toString(enc.Utf8);
|
||||
|
@ -18,11 +18,9 @@ export class ReloadHelper extends GameManagerHelper {
|
||||
super(game);
|
||||
|
||||
// Whenever the game saves the session, save it to the reloadHelper instead
|
||||
vi.spyOn(game.scene.gameData, "saveAll").mockImplementation(() => {
|
||||
return new Promise<boolean>((resolve, _reject) => {
|
||||
this.sessionData = game.scene.gameData.getSessionSaveData();
|
||||
resolve(true);
|
||||
});
|
||||
vi.spyOn(game.scene.gameData, "saveAll").mockImplementation(async () => {
|
||||
this.sessionData = game.scene.gameData.getSessionSaveData();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@ -52,7 +50,7 @@ export class ReloadHelper extends GameManagerHelper {
|
||||
);
|
||||
this.game.scene.modifiers = [];
|
||||
}
|
||||
await titlePhase.loadSaveSlot(-1); // Load the desired session data
|
||||
await titlePhase["loadSaveSlot"](-1); // Load the desired session data
|
||||
|
||||
// Run through prompts for switching Pokemon, copied from classicModeHelper.ts
|
||||
if (this.game.scene.battleStyle === BattleStyle.SWITCH) {
|
||||
|
Loading…
Reference in New Issue
Block a user