changed loading to be on demand from cursor nav

This commit is contained in:
James Diefenbach 2024-08-31 17:41:32 +10:00
parent 46f39b57bc
commit 547bc145c1
2 changed files with 31 additions and 28 deletions

View File

@ -92,29 +92,29 @@ export class EggLapsePhase extends Phase {
} }
console.time("loading assets " + pokemon.name + " " + eggsRemaining); console.time("loading assets " + pokemon.name + " " + eggsRemaining);
pokemon.loadAssets().then(() => { // pokemon.loadAssets().then(() => {
this.loadsWaiting--; this.loadsWaiting--;
console.log(this.loadsWaiting); console.log(this.loadsWaiting);
console.timeEnd("loading assets " + pokemon.name + " " + eggsRemaining); console.timeEnd("loading assets " + pokemon.name + " " + eggsRemaining);
if (this.loadsWaiting === 0) { if (this.loadsWaiting === 0) {
console.timeEnd("hatch eggs"); console.timeEnd("hatch eggs");
this.showSummary(); this.showSummary();
} }
if (pokemon.species.subLegendary) { if (pokemon.species.subLegendary) {
this.scene.validateAchv(achvs.HATCH_SUB_LEGENDARY); this.scene.validateAchv(achvs.HATCH_SUB_LEGENDARY);
} }
if (pokemon.species.legendary) { if (pokemon.species.legendary) {
this.scene.validateAchv(achvs.HATCH_LEGENDARY); this.scene.validateAchv(achvs.HATCH_LEGENDARY);
} }
if (pokemon.species.mythical) { if (pokemon.species.mythical) {
this.scene.validateAchv(achvs.HATCH_MYTHICAL); this.scene.validateAchv(achvs.HATCH_MYTHICAL);
} }
if (pokemon.isShiny()) { if (pokemon.isShiny()) {
this.scene.validateAchv(achvs.HATCH_SHINY); this.scene.validateAchv(achvs.HATCH_SHINY);
} }
}); // });
} }

View File

@ -128,14 +128,17 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer {
const formIndex = pokemon.formIndex; const formIndex = pokemon.formIndex;
const shiny = pokemon.shiny; const shiny = pokemon.shiny;
const variant = pokemon.variant; const variant = pokemon.variant;
this.currentPokemonSprite.setVisible(false);
species.loadAssets(this.scene, female, formIndex, shiny, variant, true).then(() => {
getPokemonSpeciesForm(species.speciesId, pokemon.formIndex).cry(this.scene); getPokemonSpeciesForm(species.speciesId, pokemon.formIndex).cry(this.scene);
this.currentPokemonSprite.play(species.getSpriteKey(female, formIndex, shiny, variant)); this.currentPokemonSprite.play(species.getSpriteKey(female, formIndex, shiny, variant));
this.currentPokemonSprite.setPipelineData("shiny", shiny); this.currentPokemonSprite.setPipelineData("shiny", shiny);
this.currentPokemonSprite.setPipelineData("variant", variant); this.currentPokemonSprite.setPipelineData("variant", variant);
this.currentPokemonSprite.setPipelineData("spriteKey", species.getSpriteKey(female, formIndex, shiny, variant)); this.currentPokemonSprite.setPipelineData("spriteKey", species.getSpriteKey(female, formIndex, shiny, variant));
this.currentPokemonSprite.setVisible(true); this.currentPokemonSprite.setVisible(true);
console.timeEnd("display pokemon" + pokemon.name); console.timeEnd("display pokemon" + pokemon.name);
});
} }
/** /**