Dynamically resizing ability box, showing ability description on first hover. Removed debug logs.
This commit is contained in:
parent
bb2aea40b9
commit
25e23decd4
|
@ -1690,8 +1690,6 @@ export function initPokemonPrevolutions(): void {
|
|||
pokemonPrevolutions[ev.speciesId] = parseInt(pk) as Species;
|
||||
}
|
||||
});
|
||||
console.log("Prevo", pokemonPrevolutions[Species.IVYSAUR]);
|
||||
console.log("Prevo", pokemonPrevolutions[Species.VENUSAUR]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -116,10 +116,6 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
|
|||
).join("\n"),
|
||||
TextStyle.WINDOW, { maxLines: options.length, lineSpacing: 12 }
|
||||
);
|
||||
console.log(options.map(o => o.item
|
||||
? `[color=${o.color || "white"}] ${o.label}[/color]`
|
||||
: `[color=${o.color || "white"}]${o.label}[/color]`
|
||||
).join("\n"));
|
||||
this.optionSelectText.setOrigin(0, 0);
|
||||
this.optionSelectText.setName("text-option-select");
|
||||
this.optionSelectContainer.add(this.optionSelectText);
|
||||
|
@ -199,8 +195,6 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
|
|||
|
||||
let playSound = true;
|
||||
|
||||
console.log(button);
|
||||
|
||||
if (button === Button.ACTION || button === Button.CANCEL) {
|
||||
if (this.blockInput) {
|
||||
ui.playError();
|
||||
|
@ -209,29 +203,22 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
|
|||
|
||||
success = true;
|
||||
if (button === Button.CANCEL) {
|
||||
console.log("Pressed CANCEL");
|
||||
if (this.config?.maxOptions && this.config.options.length > this.config.maxOptions) {
|
||||
this.scrollCursor = (this.config.options.length - this.config.maxOptions) + 1;
|
||||
this.cursor = unskippedIndices.length - 1;
|
||||
console.log("A", this.scrollCursor, this.cursor);
|
||||
} else if (!this.config?.noCancel) {
|
||||
this.setCursor(unskippedIndices.length - 1);
|
||||
console.log("B", this.scrollCursor, this.cursor);
|
||||
} else {
|
||||
console.log("C", this.scrollCursor, this.cursor);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const option = this.config?.options[unskippedIndices[this.cursor] + (this.scrollCursor - (this.scrollCursor ? 1 : 0))];
|
||||
console.log("CD", option);
|
||||
if (option?.handler()) {
|
||||
if (!option.keepOpen) {
|
||||
console.log("D", this.scrollCursor, this.cursor);
|
||||
this.clear();
|
||||
}
|
||||
playSound = !option.overrideSound;
|
||||
} else {
|
||||
console.log("E", this.scrollCursor, this.cursor);
|
||||
ui.playError();
|
||||
}
|
||||
} else if (button === Button.SUBMIT && ui.getMode() === Mode.AUTO_COMPLETE) {
|
||||
|
|
|
@ -7,9 +7,6 @@ import i18next from "i18next";
|
|||
export interface PokedexInfoOverlaySettings {
|
||||
delayVisibility?: boolean; // if true, showing the overlay will only set it to active and populate the fields and the handler using this field has to manually call setVisible later.
|
||||
scale?:number; // scale the box? A scale of 0.5 is recommended
|
||||
top?: boolean; // should the effect box be on top?
|
||||
right?: boolean; // should the effect box be on the right?
|
||||
onSide?: boolean; // should the effect be on the side? ignores top argument if true
|
||||
//location and width of the component; unaffected by scaling
|
||||
x?: number;
|
||||
y?: number;
|
||||
|
@ -20,9 +17,7 @@ export interface PokedexInfoOverlaySettings {
|
|||
hideBg?: boolean;
|
||||
}
|
||||
|
||||
const EFF_HEIGHT = 36;
|
||||
const EFF_WIDTH = 82;
|
||||
const DESC_HEIGHT = 36;
|
||||
const DESC_HEIGHT = 48;
|
||||
const BORDER = 8;
|
||||
const GLOBAL_SCALE = 6;
|
||||
|
||||
|
@ -36,47 +31,50 @@ export default class PokedexInfoOverlay extends Phaser.GameObjects.Container imp
|
|||
|
||||
private options: PokedexInfoOverlaySettings;
|
||||
|
||||
private textMaskRect: Phaser.GameObjects.Graphics;
|
||||
|
||||
private maskPointOriginX: number;
|
||||
private maskPointOriginY: number;
|
||||
public scale: number;
|
||||
public width: number;
|
||||
|
||||
constructor(scene: BattleScene, options?: PokedexInfoOverlaySettings) {
|
||||
if (options?.onSide) {
|
||||
options.top = false;
|
||||
}
|
||||
super(scene, options?.x, options?.y);
|
||||
const scale = options?.scale || 1; // set up the scale
|
||||
this.setScale(scale);
|
||||
this.scale = options?.scale || 1; // set up the scale
|
||||
this.setScale(this.scale);
|
||||
this.options = options || {};
|
||||
|
||||
// prepare the description box
|
||||
const width = (options?.width || PokedexInfoOverlay.getWidth(scale, scene)) / scale; // divide by scale as we always want this to be half a window wide
|
||||
this.descBg = addWindow(scene, (options?.onSide && !options?.right ? EFF_WIDTH : 0), options?.top ? EFF_HEIGHT : 0, width - (options?.onSide ? EFF_WIDTH : 0), DESC_HEIGHT);
|
||||
this.width = (options?.width || PokedexInfoOverlay.getWidth(this.scale, scene)) / this.scale; // divide by scale as we always want this to be half a window wide
|
||||
this.descBg = addWindow(scene, 0, 0, this.width, DESC_HEIGHT);
|
||||
this.descBg.setOrigin(0, 0);
|
||||
this.add(this.descBg);
|
||||
|
||||
// set up the description; wordWrap uses true pixels, unaffected by any scaling, while other values are affected
|
||||
this.desc = addTextObject(scene, (options?.onSide && !options?.right ? EFF_WIDTH : 0) + BORDER, (options?.top ? EFF_HEIGHT : 0) + BORDER - 2, "", TextStyle.BATTLE_INFO, { wordWrap: { width: (width - (BORDER - 2) * 2 - (options?.onSide ? EFF_WIDTH : 0)) * GLOBAL_SCALE }});
|
||||
this.desc = addTextObject(scene, BORDER, BORDER - 2, "", TextStyle.BATTLE_INFO, { wordWrap: { width: (this.width - (BORDER - 2) * 2) * GLOBAL_SCALE }});
|
||||
this.desc.setLineSpacing(i18next.resolvedLanguage === "ja" ? 25 : 5);
|
||||
|
||||
// limit the text rendering, required for scrolling later on
|
||||
const maskPointOrigin = {
|
||||
x: (options?.x || 0),
|
||||
y: (options?.y || 0),
|
||||
};
|
||||
if (maskPointOrigin.x < 0) {
|
||||
maskPointOrigin.x += this.scene.game.canvas.width / GLOBAL_SCALE;
|
||||
this.maskPointOriginX = options?.x || 0;
|
||||
this.maskPointOriginY = options?.y || 0;
|
||||
|
||||
if (this.maskPointOriginX < 0) {
|
||||
this.maskPointOriginX += this.scene.game.canvas.width / GLOBAL_SCALE;
|
||||
}
|
||||
if (maskPointOrigin.y < 0) {
|
||||
maskPointOrigin.y += this.scene.game.canvas.height / GLOBAL_SCALE;
|
||||
if (this.maskPointOriginY < 0) {
|
||||
this.maskPointOriginY += this.scene.game.canvas.height / GLOBAL_SCALE;
|
||||
}
|
||||
|
||||
const moveDescriptionTextMaskRect = this.scene.make.graphics();
|
||||
moveDescriptionTextMaskRect.fillStyle(0xFF0000);
|
||||
moveDescriptionTextMaskRect.fillRect(
|
||||
maskPointOrigin.x + ((options?.onSide && !options?.right ? EFF_WIDTH : 0) + BORDER) * scale, maskPointOrigin.y + ((options?.top ? EFF_HEIGHT : 0) + BORDER - 2) * scale,
|
||||
width - ((options?.onSide ? EFF_WIDTH : 0) - BORDER * 2) * scale, (DESC_HEIGHT - (BORDER - 2) * 2) * scale);
|
||||
moveDescriptionTextMaskRect.setScale(6);
|
||||
const moveDescriptionTextMask = this.createGeometryMask(moveDescriptionTextMaskRect);
|
||||
this.textMaskRect = this.scene.make.graphics();
|
||||
this.textMaskRect.fillStyle(0xFF0000);
|
||||
this.textMaskRect.fillRect(
|
||||
this.maskPointOriginX + BORDER * this.scale, this.maskPointOriginY + (BORDER - 2) * this.scale,
|
||||
this.width - (BORDER * 2) * this.scale, (DESC_HEIGHT - (BORDER - 2) * 2) * this.scale);
|
||||
this.textMaskRect.setScale(6);
|
||||
const textMask = this.createGeometryMask(this.textMaskRect);
|
||||
|
||||
this.add(this.desc);
|
||||
this.desc.setMask(moveDescriptionTextMask);
|
||||
this.desc.setMask(textMask);
|
||||
|
||||
if (options?.hideBg) {
|
||||
this.descBg.setVisible(false);
|
||||
|
@ -98,20 +96,37 @@ export default class PokedexInfoOverlay extends Phaser.GameObjects.Container imp
|
|||
if (this.descScroll) {
|
||||
this.descScroll.remove();
|
||||
this.descScroll = null;
|
||||
this.desc.y = (this.options?.top ? EFF_HEIGHT : 0) + BORDER - 2;
|
||||
this.desc.y = BORDER - 2;
|
||||
}
|
||||
|
||||
// determine if we need to add new scrolling effects
|
||||
const moveDescriptionLineCount = Math.floor(this.desc.displayHeight * (96 / 72) / 14.83);
|
||||
if (moveDescriptionLineCount > 3) {
|
||||
const lineCount = Math.floor(this.desc.displayHeight * (96 / 72) / 14.83);
|
||||
|
||||
const newHeight = lineCount >= 3 ? 48 : (lineCount === 2 ? 36 : 24);
|
||||
this.textMaskRect.clear();
|
||||
this.textMaskRect.fillStyle(0xFF0000);
|
||||
this.textMaskRect.fillRect(
|
||||
this.maskPointOriginX + BORDER * this.scale,
|
||||
this.maskPointOriginY + (BORDER - 2) * this.scale + (48 - newHeight),
|
||||
this.width - (BORDER * 2) * this.scale,
|
||||
(newHeight - (BORDER - 2) * 2) * this.scale
|
||||
);
|
||||
const updatedMask = this.createGeometryMask(this.textMaskRect);
|
||||
this.desc.setMask(updatedMask);
|
||||
|
||||
this.descBg.setSize(this.descBg.width, newHeight);
|
||||
this.descBg.setY(48 - newHeight);
|
||||
this.desc.setY(BORDER - 2 + (48 - newHeight));
|
||||
|
||||
if (lineCount > 3) {
|
||||
// generate scrolling effects
|
||||
this.descScroll = this.scene.tweens.add({
|
||||
targets: this.desc,
|
||||
delay: Utils.fixedInt(2000),
|
||||
loop: -1,
|
||||
hold: Utils.fixedInt(2000),
|
||||
duration: Utils.fixedInt((moveDescriptionLineCount - 3) * 2000),
|
||||
y: `-=${14.83 * (72 / 96) * (moveDescriptionLineCount - 3)}`
|
||||
duration: Utils.fixedInt((lineCount - 3) * 2000),
|
||||
y: `-=${14.83 * (72 / 96) * (lineCount - 3)}`
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -153,6 +168,6 @@ export default class PokedexInfoOverlay extends Phaser.GameObjects.Container imp
|
|||
|
||||
// height of this element
|
||||
static getHeight(scale:number, onSide?: boolean):number {
|
||||
return (onSide ? Math.max(EFF_HEIGHT, DESC_HEIGHT) : (EFF_HEIGHT + DESC_HEIGHT)) * scale;
|
||||
return DESC_HEIGHT * scale;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -205,7 +205,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
private evolutions: SpeciesFormEvolution[];
|
||||
private battleForms: PokemonForm[];
|
||||
private prevolution: SpeciesFormEvolution;
|
||||
private baseForm: PokemonForm;
|
||||
|
||||
private speciesStarterDexEntry: DexEntry | null;
|
||||
private canCycleShiny: boolean;
|
||||
|
@ -488,7 +487,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
this.optionSelectText.displayWidth + 19 + 24 * this.scale,
|
||||
(this.scene.game.canvas.height / 6) - 2
|
||||
);
|
||||
console.log("Logging sizes", this.optionSelectText.displayWidth + 25, this.scene.game.canvas.width / 6);
|
||||
this.menuBg.setOrigin(0, 0);
|
||||
|
||||
this.optionSelectText.setPositionRelative(this.menuBg, 10 + 24 * this.scale, 6);
|
||||
|
@ -514,7 +512,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
|
||||
this.infoOverlay = new PokedexInfoOverlay(this.scene, {
|
||||
scale: overlayScale,
|
||||
top: true,
|
||||
x: 1,
|
||||
y: this.scene.game.canvas.height / 6 - PokedexInfoOverlay.getHeight(overlayScale) - 29,
|
||||
});
|
||||
|
@ -529,21 +526,14 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
|
||||
show(args: any[]): boolean {
|
||||
|
||||
console.log("POKEDEX PAGE calling show");
|
||||
|
||||
if (args.length >= 1 && args[0] === "refresh") {
|
||||
console.log("this.lastSpecies", this.lastSpecies);
|
||||
console.log("this.lastFormIndex", this.lastFormIndex);
|
||||
return false;
|
||||
} else {
|
||||
console.log("Calling", args[0], args[1] ?? 0);
|
||||
this.lastSpecies = args[0];
|
||||
this.lastFormIndex = args[1] ?? 0;
|
||||
this.starterAttributes = args[2] ?? { shiny:false, female:true, variant:0, form:0 };
|
||||
this.starterSetup();
|
||||
console.log("this.lastSpecies", this.lastSpecies);
|
||||
console.log("this.lastFormIndex", this.lastFormIndex);
|
||||
console.log("A this.starterAttributes", this.starterAttributes);
|
||||
}
|
||||
|
||||
this.moveInfoOverlay.clear(); // clear this when removing a menu; the cancel button doesn't seem to trigger this automatically on controllers
|
||||
|
@ -551,23 +541,17 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
|
||||
super.show(args);
|
||||
|
||||
console.log("B this.starterAttributes", this.starterAttributes);
|
||||
|
||||
this.starterSelectContainer.setVisible(true);
|
||||
this.getUi().bringToTop(this.starterSelectContainer);
|
||||
|
||||
this.starterAttributes = this.initStarterPrefs();
|
||||
|
||||
console.log("C this.starterAttributes", this.starterAttributes);
|
||||
|
||||
this.menuOptions = Utils.getEnumKeys(MenuOptions).map(m => parseInt(MenuOptions[m]) as MenuOptions);
|
||||
|
||||
this.menuContainer.setVisible(true);
|
||||
|
||||
this.setCursor(0);
|
||||
|
||||
console.log("D this.starterAttributes", this.starterAttributes);
|
||||
|
||||
this.setSpecies(this.lastSpecies);
|
||||
this.updateInstructions();
|
||||
|
||||
|
@ -582,8 +566,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
|
||||
const allEvolutions = pokemonEvolutions.hasOwnProperty(species.speciesId) ? pokemonEvolutions[species.speciesId] : [];
|
||||
|
||||
console.log(species.speciesId, Species[species.speciesId], formIndex);
|
||||
|
||||
if (species.forms.length > 0) {
|
||||
const form = species.forms[formIndex];
|
||||
|
||||
|
@ -635,15 +617,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
|
||||
this.prevolution = null;
|
||||
const preSpecies = pokemonPrevolutions.hasOwnProperty(this.lastSpecies.speciesId) ? allSpecies.find(sp => sp.speciesId === pokemonPrevolutions[this.lastSpecies.speciesId]) : null;
|
||||
console.log("Prespecies", preSpecies?.name);
|
||||
if (preSpecies) {
|
||||
const preEvolutions = pokemonEvolutions.hasOwnProperty(preSpecies.speciesId) ? pokemonEvolutions[preSpecies.speciesId] : [];
|
||||
console.log(preEvolutions);
|
||||
if (species.forms.length > 0) {
|
||||
console.log("A");
|
||||
this.prevolution = preEvolutions.filter(e => (e.evoFormKey === species.forms[formIndex].formKey || e.evoFormKey === null))[0];
|
||||
} else {
|
||||
console.log("B");
|
||||
this.prevolution = preEvolutions[0];
|
||||
}
|
||||
|
||||
|
@ -948,9 +926,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
this.toggleStatsMode(false);
|
||||
success = true;
|
||||
} else {
|
||||
console.log(this.getUi().getModeChain());
|
||||
this.getUi().revertMode();
|
||||
console.log(this.getUi().getModeChain());
|
||||
success = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -962,14 +938,11 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
|
||||
if (button === Button.ACTION) {
|
||||
|
||||
console.log("Cursor", this.cursor);
|
||||
|
||||
switch (this.cursor) {
|
||||
|
||||
case MenuOptions.BASE_STATS:
|
||||
|
||||
this.blockInput = true;
|
||||
console.log("level moves", MenuOptions.LEVEL_MOVES);
|
||||
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.showText(i18next.t("pokedexUiHandler:baseStats"), null, () => {
|
||||
|
@ -1017,13 +990,10 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
case MenuOptions.LEVEL_MOVES:
|
||||
|
||||
this.blockInput = true;
|
||||
console.log("level moves", MenuOptions.LEVEL_MOVES);
|
||||
|
||||
ui.setMode(Mode.POKEDEX_PAGE, "refresh").then(() => {
|
||||
ui.showText(i18next.t("pokedexUiHandler:movesLearntOnLevelUp"), null, () => {
|
||||
|
||||
console.log(this.levelMoves);
|
||||
console.log(this.levelMoves[0]);
|
||||
this.moveInfoOverlay.show(allMoves[this.levelMoves[0][1]]);
|
||||
|
||||
ui.setModeWithoutClear(Mode.OPTION_SELECT, {
|
||||
|
@ -1054,7 +1024,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
maxOptions: 8,
|
||||
yOffset: 19
|
||||
});
|
||||
console.log("We did the thing");
|
||||
this.blockInput = false;
|
||||
});
|
||||
});
|
||||
|
@ -1175,6 +1144,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
|
||||
ui.showText(i18next.t("pokedexUiHandler:showAbilities"), null, () => {
|
||||
|
||||
this.infoOverlay.show(allAbilities[this.ability1].description);
|
||||
|
||||
const options: any[] = [];
|
||||
|
||||
if (this.ability1) {
|
||||
|
@ -1301,7 +1272,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
|
||||
ui.showText(i18next.t("pokedexUiHandler:evolutionsAndForms"), null, () => {
|
||||
|
||||
if (!this.prevolution && !this.baseForm && !this.evolutions && !this.battleForms) {
|
||||
if (!this.prevolution && !this.evolutions && !this.battleForms) {
|
||||
this.blockInput = false;
|
||||
return true;
|
||||
}
|
||||
|
@ -1314,7 +1285,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
});
|
||||
|
||||
const pre = this.prevolution;
|
||||
console.log("Prevolution", pre);
|
||||
options.push({
|
||||
label: i18next.t(`pokemon:${Species[pokemonPrevolutions[pre.speciesId]].toUpperCase()}`),
|
||||
color: "#ccbe00",
|
||||
|
@ -1346,36 +1316,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
skip: true,
|
||||
handler: () => false
|
||||
});
|
||||
|
||||
} else if (this.baseForm) {
|
||||
options.push({
|
||||
label: i18next.t("pokedexUiHandler:baseForm") + ":",
|
||||
skip: true,
|
||||
handler: () => false
|
||||
});
|
||||
const bf = this.baseForm;
|
||||
const formText = capitalizeString(bf.formKey, "-", false, false);
|
||||
const speciesName = capitalizeString(this.getStarterSpecies(this.lastSpecies).name, "_", true, false);
|
||||
const label = Object.values(SpeciesFormKey).includes(bf.formKey as SpeciesFormKey) ?
|
||||
i18next.t(`battlePokemonForm:${bf.formKey}`, { pokemonName:this.lastSpecies.name }) : (
|
||||
this.lastSpecies.speciesId === Species.ARCEUS ?
|
||||
i18next.t(`pokemonInfo:Type.${formText?.toUpperCase()}`) :
|
||||
formText ? i18next.t(`pokemonForm:${speciesName}${formText}`) : ""
|
||||
);
|
||||
options.push({
|
||||
label: label,
|
||||
color: "#ccbe00",
|
||||
handler: () => {
|
||||
const newSpecies = this.lastSpecies;
|
||||
const newFormIndex = bf.formIndex;
|
||||
this.starterAttributes.form = newFormIndex;
|
||||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
console.log("Pressing form", newSpecies, newFormIndex);
|
||||
ui.setMode(Mode.POKEDEX_PAGE, newSpecies, newFormIndex, this.starterAttributes);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.evolutions.length > 0) {
|
||||
|
@ -1385,8 +1325,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
handler: () => false
|
||||
});
|
||||
this.evolutions.map(evo => {
|
||||
console.log(evo);
|
||||
console.log(Species[evo.speciesId]);
|
||||
options.push({
|
||||
label: i18next.t(`pokemon:${Species[evo.speciesId].toUpperCase()}`),
|
||||
color: "#ccbe00",
|
||||
|
@ -1448,7 +1386,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
this.starterAttributes.form = newFormIndex;
|
||||
this.moveInfoOverlay.clear();
|
||||
this.clearText();
|
||||
console.log("Pressing form", newSpecies, newFormIndex);
|
||||
ui.setMode(Mode.POKEDEX_PAGE, newSpecies, newFormIndex, this.starterAttributes);
|
||||
return true;
|
||||
}
|
||||
|
@ -1690,7 +1627,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
const props = this.scene.gameData.getSpeciesDexAttrProps(this.lastSpecies, this.getCurrentDexProps(this.lastSpecies.speciesId));
|
||||
switch (button) {
|
||||
case Button.CYCLE_SHINY:
|
||||
console.log("Pressing Button.CYCLE_SHINY");
|
||||
if (this.canCycleShiny) {
|
||||
starterAttributes.shiny = starterAttributes.shiny !== undefined ? !starterAttributes.shiny : false;
|
||||
|
||||
|
@ -1705,7 +1641,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
this.pokemonShinyIcon.setFrame(getVariantIcon(newVariant));
|
||||
this.pokemonShinyIcon.setTint(tint);
|
||||
this.pokemonShinyIcon.setVisible(true);
|
||||
console.log(starterAttributes.shiny, starterAttributes.variant);
|
||||
} else {
|
||||
this.setSpeciesDetails(this.lastSpecies, { shiny: false, variant: 0 });
|
||||
this.pokemonShinyIcon.setVisible(false);
|
||||
|
@ -1714,7 +1649,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
}
|
||||
break;
|
||||
case Button.V:
|
||||
console.log("before", starterAttributes.shiny, starterAttributes.variant);
|
||||
if (this.canCycleVariant) {
|
||||
let newVariant = props.variant;
|
||||
do {
|
||||
|
@ -1739,7 +1673,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
const tint = getVariantTint(newVariant as Variant);
|
||||
this.pokemonShinyIcon.setFrame(getVariantIcon(newVariant as Variant));
|
||||
this.pokemonShinyIcon.setTint(tint);
|
||||
console.log("after", starterAttributes.shiny, starterAttributes.variant);
|
||||
success = true;
|
||||
}
|
||||
break;
|
||||
|
@ -2136,8 +2069,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
const forSeen: boolean = options.forSeen ?? false;
|
||||
const oldProps = species ? this.starterAttributes : null;
|
||||
|
||||
console.log("A new beginning", shiny, formIndex, female, variant);
|
||||
|
||||
// We will only update the sprite if there is a change to form, shiny/variant
|
||||
// or gender for species with gender sprite differences
|
||||
const shouldUpdateSprite = (species?.genderDiffs && !isNullOrUndefined(female))
|
||||
|
@ -2196,7 +2127,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
|
||||
if (shiny === undefined || shiny !== props.shiny) {
|
||||
shiny = props.shiny;
|
||||
console.log("Uh oh shiny:", shiny);
|
||||
}
|
||||
if (formIndex === undefined || formIndex !== props.form) {
|
||||
formIndex = props.form;
|
||||
|
@ -2218,23 +2148,18 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||
const assetLoadCancelled = new BooleanHolder(false);
|
||||
this.assetLoadCancelled = assetLoadCancelled;
|
||||
|
||||
console.log("Updating sprite?", shouldUpdateSprite);
|
||||
if (shouldUpdateSprite) {
|
||||
species.loadAssets(this.scene, female!, formIndex, shiny, variant, true).then(() => { // TODO: is this bang correct?
|
||||
if (assetLoadCancelled.value) {
|
||||
return;
|
||||
}
|
||||
console.log("Updating sprite...");
|
||||
this.assetLoadCancelled = null;
|
||||
this.speciesLoaded.set(species.speciesId, true);
|
||||
this.pokemonSprite.play(species.getSpriteKey(female!, formIndex, shiny, variant)); // TODO: is this bang correct?
|
||||
console.log(female, formIndex, shiny, variant); // TODO: is this bang correct?
|
||||
console.log(species.getSpriteKey(female!, formIndex, shiny, variant));
|
||||
this.pokemonSprite.setPipelineData("shiny", shiny);
|
||||
this.pokemonSprite.setPipelineData("variant", variant);
|
||||
this.pokemonSprite.setPipelineData("spriteKey", species.getSpriteKey(female!, formIndex, shiny, variant)); // TODO: is this bang correct?
|
||||
this.pokemonSprite.setVisible(!this.statsMode);
|
||||
console.log("Was it updated?");
|
||||
});
|
||||
} else {
|
||||
this.pokemonSprite.setVisible(!this.statsMode);
|
||||
|
|
Loading…
Reference in New Issue