mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 15:32:18 +02:00
time logging and optimisation
This commit is contained in:
parent
5718886a2a
commit
ab5f252f16
@ -36,9 +36,11 @@ export class EggLapsePhase extends Phase {
|
|||||||
// show prompt for skip
|
// show prompt for skip
|
||||||
this.scene.ui.showText(i18next.t("battle:eggSkipPrompt"), 0);
|
this.scene.ui.showText(i18next.t("battle:eggSkipPrompt"), 0);
|
||||||
this.scene.ui.setModeWithoutClear(Mode.CONFIRM, () => {
|
this.scene.ui.setModeWithoutClear(Mode.CONFIRM, () => {
|
||||||
|
console.time("hatch eggs");
|
||||||
for (const egg of eggsToHatch) {
|
for (const egg of eggsToHatch) {
|
||||||
this.hatchEggSilently(egg);
|
this.hatchEggSilently(egg);
|
||||||
}
|
}
|
||||||
|
console.timeEnd("hatch eggs");
|
||||||
|
|
||||||
this.scene.unshiftPhase(new EggSummaryPhase(this.scene, this.eggHatchData));
|
this.scene.unshiftPhase(new EggSummaryPhase(this.scene, this.eggHatchData));
|
||||||
this.end();
|
this.end();
|
||||||
@ -62,9 +64,6 @@ export class EggLapsePhase extends Phase {
|
|||||||
}
|
}
|
||||||
this.end();
|
this.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
console.log(this.eggHatchData);
|
|
||||||
} else {
|
} else {
|
||||||
this.end();
|
this.end();
|
||||||
}
|
}
|
||||||
@ -88,7 +87,6 @@ export class EggLapsePhase extends Phase {
|
|||||||
if (pokemon.fusionSpecies) {
|
if (pokemon.fusionSpecies) {
|
||||||
pokemon.clearFusionSpecies();
|
pokemon.clearFusionSpecies();
|
||||||
}
|
}
|
||||||
console.log(pokemon);
|
|
||||||
|
|
||||||
pokemon.loadAssets().then(() => {
|
pokemon.loadAssets().then(() => {
|
||||||
|
|
||||||
|
@ -21,11 +21,12 @@ export class EggSummaryPhase extends Phase {
|
|||||||
|
|
||||||
start() {
|
start() {
|
||||||
super.start();
|
super.start();
|
||||||
|
console.time("update egg dex");
|
||||||
|
|
||||||
const updateNextPokemon = (i: integer) => {
|
const updateNextPokemon = (i: integer) => {
|
||||||
console.log(i);
|
|
||||||
if (i >= this.eggHatchData.length) {
|
if (i >= this.eggHatchData.length) {
|
||||||
console.log("displayed all pokemon");
|
console.timeEnd("update egg dex");
|
||||||
|
|
||||||
this.scene.ui.setModeForceTransition(Mode.EGG_HATCH_SUMMARY, this.eggHatchData).then(() => {
|
this.scene.ui.setModeForceTransition(Mode.EGG_HATCH_SUMMARY, this.eggHatchData).then(() => {
|
||||||
this.scene.fadeOutBgm(undefined, false);
|
this.scene.fadeOutBgm(undefined, false);
|
||||||
this.eggHatchHandler = this.scene.ui.getHandler() as EggHatchSceneHandler;
|
this.eggHatchHandler = this.scene.ui.getHandler() as EggHatchSceneHandler;
|
||||||
@ -35,7 +36,6 @@ export class EggSummaryPhase extends Phase {
|
|||||||
} else {
|
} else {
|
||||||
this.eggHatchData[i].setDex();
|
this.eggHatchData[i].setDex();
|
||||||
this.eggHatchData[i].updatePokemon().then(() => {
|
this.eggHatchData[i].updatePokemon().then(() => {
|
||||||
console.log("updating next pokemon");
|
|
||||||
if (i < this.eggHatchData.length) {
|
if (i < this.eggHatchData.length) {
|
||||||
updateNextPokemon(i + 1);
|
updateNextPokemon(i + 1);
|
||||||
}
|
}
|
||||||
|
@ -1618,12 +1618,10 @@ export class GameData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const checkPrevolution = () => {
|
const checkPrevolution = () => {
|
||||||
console.log("checking prevolution");
|
|
||||||
if (hasPrevolution) {
|
if (hasPrevolution) {
|
||||||
const prevolutionSpecies = pokemonPrevolutions[species.speciesId];
|
const prevolutionSpecies = pokemonPrevolutions[species.speciesId];
|
||||||
this.setPokemonSpeciesCaught(pokemon, getPokemonSpecies(prevolutionSpecies), incrementCount, fromEgg, showMessage).then(() => resolve());
|
this.setPokemonSpeciesCaught(pokemon, getPokemonSpecies(prevolutionSpecies), incrementCount, fromEgg, showMessage).then(() => resolve());
|
||||||
} else {
|
} else {
|
||||||
console.log("resolving");
|
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -140,6 +140,7 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
|
|||||||
this.eggHatchBg.setVisible(true);
|
this.eggHatchBg.setVisible(true);
|
||||||
|
|
||||||
this.infoContainer.hideDisplayPokemon();
|
this.infoContainer.hideDisplayPokemon();
|
||||||
|
console.time("display icons");
|
||||||
|
|
||||||
this.eggHatchData.forEach( (value: EggHatchData, i: number) => {
|
this.eggHatchData.forEach( (value: EggHatchData, i: number) => {
|
||||||
const x = (i % 11) * 18;
|
const x = (i % 11) * 18;
|
||||||
@ -213,6 +214,8 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
|
|||||||
em.setVisible(value.eggMoveUnlocked);
|
em.setVisible(value.eggMoveUnlocked);
|
||||||
this.pokemonIconsContainer.add(em);
|
this.pokemonIconsContainer.add(em);
|
||||||
});
|
});
|
||||||
|
console.timeEnd("display icons");
|
||||||
|
|
||||||
this.setCursor(0);
|
this.setCursor(0);
|
||||||
|
|
||||||
// TODO nice animation reveal for all eggs hatching at once
|
// TODO nice animation reveal for all eggs hatching at once
|
||||||
@ -226,7 +229,6 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
let success = false;
|
let success = false;
|
||||||
const error = false;
|
const error = false;
|
||||||
console.log("egg handler button " + button);
|
|
||||||
if (button === Button.CANCEL) {
|
if (button === Button.CANCEL) {
|
||||||
const phase = this.scene.getCurrentPhase();
|
const phase = this.scene.getCurrentPhase();
|
||||||
if (phase instanceof EggSummaryPhase) {
|
if (phase instanceof EggSummaryPhase) {
|
||||||
|
@ -134,6 +134,7 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer {
|
|||||||
* Display a given pokemon sprite with animations
|
* Display a given pokemon sprite with animations
|
||||||
*/
|
*/
|
||||||
displayPokemon(pokemon: PlayerPokemon) {
|
displayPokemon(pokemon: PlayerPokemon) {
|
||||||
|
console.time("display pokemon" + pokemon.name);
|
||||||
console.log("displaying pokemon", pokemon.name);
|
console.log("displaying pokemon", pokemon.name);
|
||||||
const species = pokemon.species;
|
const species = pokemon.species;
|
||||||
const female = pokemon.gender === Gender.FEMALE;
|
const female = pokemon.gender === Gender.FEMALE;
|
||||||
@ -146,6 +147,7 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer {
|
|||||||
species.loadAssets(this.scene, female, formIndex, shiny, variant, true).then(() => {
|
species.loadAssets(this.scene, female, formIndex, shiny, variant, true).then(() => {
|
||||||
if (assetLoadCancelled.value) {
|
if (assetLoadCancelled.value) {
|
||||||
console.log("interrupted");
|
console.log("interrupted");
|
||||||
|
console.timeEnd("display pokemon" + pokemon.name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.assetLoadCancelled = null;
|
this.assetLoadCancelled = null;
|
||||||
@ -157,6 +159,7 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer {
|
|||||||
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));
|
||||||
|
console.timeEnd("display pokemon" + pokemon.name);
|
||||||
// this.pokemonSprite.setVisible(!this.statsMode);
|
// this.pokemonSprite.setVisible(!this.statsMode);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -167,7 +170,7 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer {
|
|||||||
* @param hatchInfo The EggHatchData of the pokemon / new hatch to show
|
* @param hatchInfo The EggHatchData of the pokemon / new hatch to show
|
||||||
*/
|
*/
|
||||||
showHatchInfo(hatchInfo: EggHatchData) {
|
showHatchInfo(hatchInfo: EggHatchData) {
|
||||||
console.log("showing hatch info", hatchInfo.pokemon.name);
|
console.time("show hatch info" + hatchInfo.pokemon.name);
|
||||||
this.pokemonEggMovesContainer.setVisible(true);
|
this.pokemonEggMovesContainer.setVisible(true);
|
||||||
|
|
||||||
const pokemon = hatchInfo.pokemon;
|
const pokemon = hatchInfo.pokemon;
|
||||||
@ -208,6 +211,7 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer {
|
|||||||
} else {
|
} else {
|
||||||
this.pokemonHatchedIcon.setFrame(getEggTierForSpecies(species));
|
this.pokemonHatchedIcon.setFrame(getEggTierForSpecies(species));
|
||||||
}
|
}
|
||||||
|
console.timeEnd("show hatch info" + hatchInfo.pokemon.name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user