Disable menu temporarily on receiving a voucher

pull/175/head
Flashfyre 2024-04-17 15:56:29 -04:00
parent 7155174d3c
commit d210e3878e
3 changed files with 10 additions and 2 deletions

View File

@ -132,6 +132,8 @@ export default class BattleScene extends SceneBase {
public enableTouchControls: boolean = false; public enableTouchControls: boolean = false;
public enableVibration: boolean = false; public enableVibration: boolean = false;
public disableMenu: boolean = false;
public gameData: GameData; public gameData: GameData;
public sessionSlotId: integer; public sessionSlotId: integer;
@ -733,6 +735,8 @@ export default class BattleScene extends SceneBase {
this.setSeed(SEED_OVERRIDE || Utils.randomString(24)); this.setSeed(SEED_OVERRIDE || Utils.randomString(24));
console.log('Seed:', this.seed); console.log('Seed:', this.seed);
this.disableMenu = false;
this.score = 0; this.score = 0;
this.money = 0; this.money = 0;
@ -1234,6 +1238,8 @@ export default class BattleScene extends SceneBase {
inputSuccess = this.ui.processInput(Button.CANCEL); inputSuccess = this.ui.processInput(Button.CANCEL);
this.setLastProcessedMovementTime(Button.CANCEL); this.setLastProcessedMovementTime(Button.CANCEL);
} else if (this.buttonJustPressed(Button.MENU)) { } else if (this.buttonJustPressed(Button.MENU)) {
if (this.disableMenu)
return;
switch (this.ui?.getMode()) { switch (this.ui?.getMode()) {
case Mode.MESSAGE: case Mode.MESSAGE:
if (!(this.ui.getHandler() as MessageUiHandler).pendingPrompt) if (!(this.ui.getHandler() as MessageUiHandler).pendingPrompt)

View File

@ -670,8 +670,8 @@ export default class PokemonSpecies extends PokemonSpeciesForm {
const legendary = this.legendary; const legendary = this.legendary;
const mythical = this.mythical; const mythical = this.mythical;
return species => { return species => {
return pokemonEvolutions.hasOwnProperty(species.speciesId) === hasEvolution return (pseudoLegendary || legendary || mythical || (!pokemonEvolutions.hasOwnProperty(species.speciesId) === hasEvolution
&& pokemonPrevolutions.hasOwnProperty(species.speciesId) === hasPrevolution && pokemonPrevolutions.hasOwnProperty(species.speciesId) === hasPrevolution))
&& species.pseudoLegendary === pseudoLegendary && species.pseudoLegendary === pseudoLegendary
&& species.legendary === legendary && species.legendary === legendary
&& species.mythical === mythical && species.mythical === mythical

View File

@ -742,6 +742,7 @@ export class EncounterPhase extends BattlePhase {
this.scene.ui.setMode(Mode.MESSAGE).then(() => { this.scene.ui.setMode(Mode.MESSAGE).then(() => {
if (!this.loaded) { if (!this.loaded) {
this.scene.gameData.saveSystem().then(success => { this.scene.gameData.saveSystem().then(success => {
this.scene.disableMenu = false;
if (!success) if (!success)
return this.scene.reset(true); return this.scene.reset(true);
this.scene.gameData.saveSession(this.scene, true).then(() => this.doEncounter()); this.scene.gameData.saveSession(this.scene, true).then(() => this.doEncounter());
@ -3304,6 +3305,7 @@ export class ModifierRewardPhase extends BattlePhase {
doReward(): Promise<void> { doReward(): Promise<void> {
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
this.scene.disableMenu = true;
const newModifier = this.modifierType.newModifier(); const newModifier = this.modifierType.newModifier();
this.scene.addModifier(newModifier).then(() => { this.scene.addModifier(newModifier).then(() => {
this.scene.playSound('item_fanfare'); this.scene.playSound('item_fanfare');