more detailed loading logs

This commit is contained in:
James Diefenbach 2024-08-31 17:22:47 +10:00
parent 2535f0ab67
commit 46f39b57bc
2 changed files with 8 additions and 0 deletions

View File

@ -458,6 +458,7 @@ export abstract class PokemonSpeciesForm {
loadAssets(scene: BattleScene, female: boolean, formIndex?: integer, shiny?: boolean, variant?: Variant, startLoad?: boolean): Promise<void> { loadAssets(scene: BattleScene, female: boolean, formIndex?: integer, shiny?: boolean, variant?: Variant, startLoad?: boolean): Promise<void> {
return new Promise(resolve => { return new Promise(resolve => {
console.time("fetching assets " + this.speciesId);
const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant); const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant);
scene.loadPokemonAtlas(spriteKey, this.getSpriteAtlasPath(female, formIndex, shiny, variant)); scene.loadPokemonAtlas(spriteKey, this.getSpriteAtlasPath(female, formIndex, shiny, variant));
scene.load.audio(`cry/${this.getCryKey(formIndex)}`, `audio/cry/${this.getCryKey(formIndex)}.m4a`); scene.load.audio(`cry/${this.getCryKey(formIndex)}`, `audio/cry/${this.getCryKey(formIndex)}.m4a`);
@ -498,6 +499,8 @@ export abstract class PokemonSpeciesForm {
populateVariantColors(spriteKey).then(() => resolve()); populateVariantColors(spriteKey).then(() => resolve());
return; return;
} }
console.timeEnd("fetching assets " + this.speciesId);
resolve(); resolve();
}); });
if (startLoad) { if (startLoad) {

View File

@ -362,7 +362,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
loadAssets(ignoreOverride: boolean = true): Promise<void> { loadAssets(ignoreOverride: boolean = true): Promise<void> {
return new Promise(resolve => { return new Promise(resolve => {
console.time("total asset loading for " + this.name + (this.shiny ? "" : "shiny"));
const moveIds = this.getMoveset().map(m => m!.getMove().id); // TODO: is this bang correct? const moveIds = this.getMoveset().map(m => m!.getMove().id); // TODO: is this bang correct?
console.time("loading moves " + this.name);
Promise.allSettled(moveIds.map(m => initMoveAnim(this.scene, m))) Promise.allSettled(moveIds.map(m => initMoveAnim(this.scene, m)))
.then(() => { .then(() => {
loadMoveAnimAssets(this.scene, moveIds); loadMoveAnimAssets(this.scene, moveIds);
@ -392,10 +394,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
this.playAnim(); this.playAnim();
const updateFusionPaletteAndResolve = () => { const updateFusionPaletteAndResolve = () => {
console.time("fusion loading " + this.name);
this.updateFusionPalette(); this.updateFusionPalette();
if (this.summonData?.speciesForm) { if (this.summonData?.speciesForm) {
this.updateFusionPalette(true); this.updateFusionPalette(true);
} }
console.timeEnd("fusion loading " + this.name);
console.timeEnd("total asset loading for " + this.name + (this.shiny ? "" : "shiny"));
resolve(); resolve();
}; };
if (this.shiny) { if (this.shiny) {