diff --git a/src/phases/egg-lapse-phase.ts b/src/phases/egg-lapse-phase.ts index 568b6225278..166d9b4be38 100644 --- a/src/phases/egg-lapse-phase.ts +++ b/src/phases/egg-lapse-phase.ts @@ -54,13 +54,12 @@ export class EggLapsePhase extends Phase { ); }, 100, true); } else { + // regular hatches, no summary this.scene.queueMessage(i18next.t("battle:eggHatching")); for (const egg of eggsToHatch) { this.scene.unshiftPhase(new EggHatchPhase(this.scene, this, egg, eggsToHatchCount)); eggsToHatchCount--; } - - this.scene.unshiftPhase(new EggSummaryPhase(this.scene, this.eggHatchData)); this.end(); } diff --git a/src/ui/egg-summary-ui-handler.ts b/src/ui/egg-summary-ui-handler.ts index 8cab9c87fc3..f4ccc2ff6e0 100644 --- a/src/ui/egg-summary-ui-handler.ts +++ b/src/ui/egg-summary-ui-handler.ts @@ -212,12 +212,12 @@ export default class EggSummaryUiHandler extends MessageUiHandler { em.setScale(0.5); em.setVisible(value.eggMoveUnlocked); this.pokemonIconsContainer.add(em); - if (i === 0) { - this.infoContainer.displayPokemon(displayPokemon); - } }); this.setCursor(0); + // TODO nice animation reveal for all eggs hatching at once + this.scene.playSoundWithoutBgm("evolution_fanfare"); + return true; } @@ -278,6 +278,7 @@ export default class EggSummaryUiHandler extends MessageUiHandler { const lastCursor = this.cursor; changed = super.setCursor(cursor); + this.infoContainer.interruptDisplay(); if (changed) { this.cursorObj.setPosition(114 + 18 * (cursor % 11), 10 + 18 * Math.floor(cursor / 11)); diff --git a/src/ui/pokemon-hatch-info-container.ts b/src/ui/pokemon-hatch-info-container.ts index c42cf0ce9df..0788674f943 100644 --- a/src/ui/pokemon-hatch-info-container.ts +++ b/src/ui/pokemon-hatch-info-container.ts @@ -14,6 +14,7 @@ import { starterColors } from "../battle-scene"; import { argbFromRgba } from "@material/material-color-utilities"; import { EggHatchData } from "#app/data/egg-hatch-data.js"; import { PlayerPokemon } from "#app/field/pokemon.js"; +import { getPokemonSpeciesForm } from "#app/data/pokemon-species.js"; /** * Class for the hatch info summary of each pokemon @@ -32,6 +33,7 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer { private pokemonCandyIcon: Phaser.GameObjects.Sprite; private pokemonCandyOverlayIcon: Phaser.GameObjects.Sprite; private pokemonCandyCountText: Phaser.GameObjects.Text; + private assetLoadCancelled: Utils.BooleanHolder | null; constructor(scene: BattleScene, listContainer : Phaser.GameObjects.Container, x: number = 115, y: number = 9,) { super(scene, x, y); @@ -121,6 +123,13 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer { this.currentPokemonSprite.setVisible(false); } + interruptDisplay() { + if (this.assetLoadCancelled) { + this.assetLoadCancelled.value = true; + this.assetLoadCancelled = null; + } + } + /** * Display a given pokemon sprite with animations */ @@ -131,14 +140,19 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer { const formIndex = pokemon.formIndex; const shiny = pokemon.shiny; const variant = pokemon.variant; + const assetLoadCancelled = new Utils.BooleanHolder(false); + this.assetLoadCancelled = assetLoadCancelled; + species.loadAssets(this.scene, female, formIndex, shiny, variant, true).then(() => { - // if (assetLoadCancelled.value) { - // return; - // } - // this.assetLoadCancelled = null; + if (assetLoadCancelled.value) { + console.log("interrupted"); + return; + } + this.assetLoadCancelled = null; // this.speciesLoaded.set(species.speciesId, true); // redundant setVisible(true) but makes sure sprite is only visible after being rendered (no substitute visible) this.currentPokemonSprite.setVisible(true); + getPokemonSpeciesForm(species.speciesId, pokemon.formIndex).cry(this.scene); this.currentPokemonSprite.play(species.getSpriteKey(female, formIndex, shiny, variant)); this.currentPokemonSprite.setPipelineData("shiny", shiny); this.currentPokemonSprite.setPipelineData("variant", variant);