cleanup and doc

This commit is contained in:
MokaStitcher 2024-09-23 18:54:59 +02:00
parent 4d6095b1f7
commit 53f2625168
2 changed files with 18 additions and 2 deletions

View File

@ -120,6 +120,9 @@ export default class EggListUiHandler extends MessageUiHandler {
return true;
}
/**
* Create the grid of egg icons to display
*/
private initEggIcons() {
this.eggIcons = [];
for (let i = 0; i < Math.min(this.ROWS * this.COLUMNS, this.scene.gameData.eggs.length); i++) {
@ -133,6 +136,9 @@ export default class EggListUiHandler extends MessageUiHandler {
}
}
/**
* Show the grid of egg icons
*/
private updateEggIcons() {
const indexOffset = this.scrollGridHandler.getItemOffset();
const eggsToShow = Math.min(this.eggIcons.length, this.scene.gameData.eggs.length - indexOffset);
@ -151,6 +157,10 @@ export default class EggListUiHandler extends MessageUiHandler {
});
}
/**
* Update the information panel with the information of the given egg
* @param index which egg in the list to display the info for
*/
private setEggDetails(index: number): void {
const egg = this.scene.gameData.eggs[index];
this.eggSprite.setFrame(`egg_${egg.getKey()}`);

View File

@ -3,7 +3,7 @@ import { Mode } from "./ui";
import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler";
import MessageUiHandler from "./message-ui-handler";
import { getEggTierForSpecies } from "../data/egg";
import {Button} from "#enums/buttons";
import { Button } from "#enums/buttons";
import PokemonHatchInfoContainer from "./pokemon-hatch-info-container";
import { EggSummaryPhase } from "#app/phases/egg-summary-phase";
import { EggHatchData } from "#app/data/egg-hatch-data";
@ -29,6 +29,7 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
private summaryContainer: Phaser.GameObjects.Container;
/** container for the each pokemon sprites and icons */
private pokemonIconsContainer: Phaser.GameObjects.Container;
/** list of the containers added to pokemonIconsContainer for easier access */
private pokemonContainers: HatchedPokemonContainer[];
/** hatch info container that displays the current pokemon / hatch (main element on left hand side) */
@ -101,6 +102,8 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
this.cursor = -1;
this.scrollGridHandler.reset();
this.summaryContainer.setVisible(false);
this.pokemonIconsContainer.removeAll(true);
this.pokemonContainers = [];
this.eggHatchBg.setVisible(false);
this.getUi().hideTooltip();
@ -167,7 +170,10 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
return true;
}
updatePokemonIcons(): void {
/**
* Show the grid of Pokemon icons
*/
private updatePokemonIcons(): void {
const itemOffset = this.scrollGridHandler.getItemOffset();
const eggsToShow = Math.min(numRows * numCols, this.eggHatchData.length - itemOffset);