mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-18 14:22:19 +02:00
Setting up filteredFormIndices
This commit is contained in:
parent
2e2f61ff5d
commit
a2c4f7eaf4
@ -257,7 +257,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
private menuDescriptions: string[];
|
private menuDescriptions: string[];
|
||||||
private isFormGender: boolean;
|
private isFormGender: boolean;
|
||||||
private filteredIndices: Species[] | null = null;
|
private filteredIndices: Species[] | null = null;
|
||||||
private filteredFormIndices: number[] | null = null;
|
private filteredFormIndices: (number | null)[] | null = null;
|
||||||
|
private filteredIndex: number;
|
||||||
|
|
||||||
private availableVariants: number;
|
private availableVariants: number;
|
||||||
private unlockedVariants: boolean[];
|
private unlockedVariants: boolean[];
|
||||||
@ -699,9 +700,21 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
this.starterAttributes = this.initStarterPrefs();
|
this.starterAttributes = this.initStarterPrefs();
|
||||||
|
|
||||||
console.log(this.filteredIndices);
|
console.log(this.filteredIndices);
|
||||||
|
console.log(this.filteredFormIndices);
|
||||||
console.log(this.savedStarterAttributes);
|
console.log(this.savedStarterAttributes);
|
||||||
console.log(this.starterAttributes);
|
console.log(this.starterAttributes);
|
||||||
|
|
||||||
|
if (this.filteredIndices) {
|
||||||
|
this.filteredIndex = this.filteredIndices.findIndex(id => id === this.species.speciesId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.filteredFormIndices) {
|
||||||
|
const newForm = this.filteredFormIndices[this.filteredIndex];
|
||||||
|
if (!isNullOrUndefined(newForm)) {
|
||||||
|
this.starterAttributes.form = newForm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.menuOptions = Utils.getEnumKeys(MenuOptions).map(m => Number.parseInt(MenuOptions[m]) as MenuOptions);
|
this.menuOptions = Utils.getEnumKeys(MenuOptions).map(m => Number.parseInt(MenuOptions[m]) as MenuOptions);
|
||||||
|
|
||||||
this.menuContainer.setVisible(true);
|
this.menuContainer.setVisible(true);
|
||||||
@ -984,7 +997,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
const caughtAttr = this.isCaught();
|
const caughtAttr = this.isCaught();
|
||||||
|
|
||||||
// no preferences or Pokemon wasn't caught, return empty attribute
|
// no preferences or Pokemon wasn't caught, return empty attribute
|
||||||
if (!starterAttributes || !caughtAttr) {
|
if (!starterAttributes || !this.isSeen()) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1681,11 +1694,15 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
this.savedStarterAttributes.form = newFormIndex;
|
this.savedStarterAttributes.form = newFormIndex;
|
||||||
this.moveInfoOverlay.clear();
|
this.moveInfoOverlay.clear();
|
||||||
this.clearText();
|
this.clearText();
|
||||||
|
if (this.filteredFormIndices) {
|
||||||
|
this.filteredFormIndices[this.filteredIndex] = null;
|
||||||
|
}
|
||||||
ui.setMode(
|
ui.setMode(
|
||||||
Mode.POKEDEX_PAGE,
|
Mode.POKEDEX_PAGE,
|
||||||
newSpecies,
|
newSpecies,
|
||||||
this.savedStarterAttributes,
|
this.savedStarterAttributes,
|
||||||
this.filteredIndices,
|
this.filteredIndices,
|
||||||
|
this.filteredFormIndices,
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@ -2062,6 +2079,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
newSpecies,
|
newSpecies,
|
||||||
this.savedStarterAttributes,
|
this.savedStarterAttributes,
|
||||||
this.filteredIndices,
|
this.filteredIndices,
|
||||||
|
this.filteredFormIndices,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
this.blockInput = false;
|
this.blockInput = false;
|
||||||
@ -2096,6 +2114,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
newSpecies,
|
newSpecies,
|
||||||
this.savedStarterAttributes,
|
this.savedStarterAttributes,
|
||||||
this.filteredIndices,
|
this.filteredIndices,
|
||||||
|
this.filteredFormIndices,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -220,6 +220,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
|||||||
private showFormTrayLabel: Phaser.GameObjects.Text;
|
private showFormTrayLabel: Phaser.GameObjects.Text;
|
||||||
private canShowFormTray: boolean;
|
private canShowFormTray: boolean;
|
||||||
private filteredIndices: Species[];
|
private filteredIndices: Species[];
|
||||||
|
private filteredFormIndices: Species[];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(Mode.POKEDEX);
|
super(Mode.POKEDEX);
|
||||||
@ -1029,7 +1030,13 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
|||||||
} else if (this.showingTray) {
|
} else if (this.showingTray) {
|
||||||
if (button === Button.ACTION) {
|
if (button === Button.ACTION) {
|
||||||
const formIndex = this.trayForms[this.trayCursor].formIndex;
|
const formIndex = this.trayForms[this.trayCursor].formIndex;
|
||||||
ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, { form: formIndex }, this.filteredIndices);
|
ui.setOverlayMode(
|
||||||
|
Mode.POKEDEX_PAGE,
|
||||||
|
this.lastSpecies,
|
||||||
|
{ form: formIndex },
|
||||||
|
this.filteredIndices,
|
||||||
|
this.filteredFormIndices,
|
||||||
|
);
|
||||||
success = true;
|
success = true;
|
||||||
} else {
|
} else {
|
||||||
const numberOfForms = this.trayContainers.length;
|
const numberOfForms = this.trayContainers.length;
|
||||||
@ -1079,7 +1086,13 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
|||||||
} else {
|
} else {
|
||||||
if (button === Button.ACTION) {
|
if (button === Button.ACTION) {
|
||||||
const formIndex = this.pokemonContainers[this.cursor]?.formIndex;
|
const formIndex = this.pokemonContainers[this.cursor]?.formIndex;
|
||||||
ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, { form: formIndex }, this.filteredIndices);
|
ui.setOverlayMode(
|
||||||
|
Mode.POKEDEX_PAGE,
|
||||||
|
this.lastSpecies,
|
||||||
|
{ form: formIndex },
|
||||||
|
this.filteredIndices,
|
||||||
|
this.filteredFormIndices,
|
||||||
|
);
|
||||||
success = true;
|
success = true;
|
||||||
} else {
|
} else {
|
||||||
switch (button) {
|
switch (button) {
|
||||||
@ -1589,6 +1602,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.filteredIndices = this.filteredPokemonData.map(c => c.species.speciesId);
|
this.filteredIndices = this.filteredPokemonData.map(c => c.species.speciesId);
|
||||||
|
this.filteredFormIndices = this.filteredPokemonData.map(c => c.formIndex);
|
||||||
|
|
||||||
this.updateScroll();
|
this.updateScroll();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user