fix missing variant icon fallback

This commit is contained in:
James Diefenbach 2024-09-01 09:43:40 +10:00
parent 547bc145c1
commit a9cf25b2ab
2 changed files with 14 additions and 9 deletions

View File

@ -42,13 +42,13 @@ export class EggLapsePhase extends Phase {
for (const egg of eggsToHatch) {
this.hatchEggSilently(egg);
}
this.showSummary();
}, () => {
for (const egg of eggsToHatch) {
this.scene.unshiftPhase(new EggHatchPhase(this.scene, this, egg, eggsToHatchCount));
eggsToHatchCount--;
}
this.showSummary();
}
);
}, 100, true);
@ -79,7 +79,6 @@ export class EggLapsePhase extends Phase {
*/
hatchEggSilently(egg: Egg) {
const eggIndex = this.scene.gameData.eggs.findIndex(e => e.id === egg.id);
const eggsRemaining = this.scene.gameData.eggs.length;
if (eggIndex === -1) {
return this.end();
}
@ -91,15 +90,12 @@ export class EggLapsePhase extends Phase {
pokemon.clearFusionSpecies();
}
console.time("loading assets " + pokemon.name + " " + eggsRemaining);
// pokemon.loadAssets().then(() => {
this.loadsWaiting--;
console.log(this.loadsWaiting);
console.timeEnd("loading assets " + pokemon.name + " " + eggsRemaining);
if (this.loadsWaiting === 0) {
console.timeEnd("hatch eggs");
this.showSummary();
}
if (pokemon.species.subLegendary) {

View File

@ -185,13 +185,22 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
bg.setTint(0xdfffaf);
break;
}
const species = displayPokemon.species;
const female = displayPokemon.gender === Gender.FEMALE;
const formIndex = displayPokemon.formIndex;
const variant = displayPokemon.variant;
const isShiny = displayPokemon.shiny;
const icon = this.scene.add.sprite(x-2, y+2, displayPokemon.species.getIconAtlasKey(displayPokemon.formIndex, displayPokemon.shiny, displayPokemon.variant));
// const icon = this.scene.add.sprite(x - 2, y + 2, "egg_icons");
const icon = this.scene.add.sprite(x-2, y+2, species.getIconAtlasKey(formIndex, isShiny, variant));
icon.setScale(0.5);
icon.setOrigin(0, 0);
icon.setFrame(displayPokemon.species.getIconId(displayPokemon.gender === Gender.FEMALE, displayPokemon.formIndex, displayPokemon.shiny, displayPokemon.variant));
// icon.setFrame(egg.getKey());
icon.setFrame(species.getIconId(female, formIndex, isShiny, variant));
if (icon.frame.name !== species.getIconId(female, formIndex, isShiny, variant)) {
console.log(`${species.name}'s variant icon does not exist. Replacing with default.`);
icon.setTexture(species.getIconAtlasKey(formIndex, false, variant));
icon.setFrame(species.getIconId(female, formIndex, false, variant));
}
this.pokemonIconSpritesContainer.add(icon);
this.iconAnimHandler.addOrUpdate(icon, PokemonIconAnimMode.NONE);