Fixed more warnings; added localization strings in the pokedex scan overlay.
This commit is contained in:
parent
01c29169e1
commit
345f743203
|
@ -7741,9 +7741,9 @@ export function initBiomes() {
|
||||||
: [ TimeOfDay.ALL ];
|
: [ TimeOfDay.ALL ];
|
||||||
|
|
||||||
catchableSpecies[speciesId].push({
|
catchableSpecies[speciesId].push({
|
||||||
biome: biome,
|
biome: biome as Biome,
|
||||||
tier: tier,
|
tier: tier as BiomePoolTier,
|
||||||
tod: timesOfDay
|
tod: timesOfDay as TimeOfDay[]
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const tod of timesOfDay) {
|
for (const tod of timesOfDay) {
|
||||||
|
|
|
@ -68434,23 +68434,24 @@ export const tmSpecies: TmSpecies = {
|
||||||
};
|
};
|
||||||
|
|
||||||
interface SpeciesTmMoves {
|
interface SpeciesTmMoves {
|
||||||
[key: number]: Array<Moves>
|
[key: integer]: Moves[]
|
||||||
}
|
}
|
||||||
|
|
||||||
function flipTmSpecies(tmSpecies: TmSpecies): SpeciesTmMoves {
|
function flipTmSpecies(tmSpecies: TmSpecies): SpeciesTmMoves {
|
||||||
const flipped: SpeciesTmMoves = {};
|
const flipped: SpeciesTmMoves = {};
|
||||||
|
|
||||||
for (const move in tmSpecies) {
|
for (const move in Object.keys(tmSpecies)) {
|
||||||
const speciesList = tmSpecies[move]; // Convert the move key back to a number
|
const moveKey = Number(move);
|
||||||
|
const speciesList = tmSpecies[moveKey];
|
||||||
|
|
||||||
for (const species of speciesList) {
|
for (const species of speciesList) {
|
||||||
if (!flipped[species]) {
|
const speciesKey = Number(species);
|
||||||
flipped[species] = [];
|
if (!flipped[speciesKey]) {
|
||||||
|
flipped[speciesKey] = [];
|
||||||
}
|
}
|
||||||
flipped[species].push(move);
|
flipped[speciesKey].push(moveKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return flipped;
|
return flipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ export class FilterText extends Phaser.GameObjects.Container {
|
||||||
this.menuMessageBoxContainer.setVisible(false);
|
this.menuMessageBoxContainer.setVisible(false);
|
||||||
|
|
||||||
// Full-width window used for testing dialog messages in debug mode
|
// Full-width window used for testing dialog messages in debug mode
|
||||||
this.dialogueMessageBox = addWindow(this.scene, -this.textPadding, 0, this.scene.game.canvas.width / 6 + this.textPadding * 2, 49, false, false, 0, 0, WindowVariant.THIN);
|
this.dialogueMessageBox = addWindow(scene, -this.textPadding, 0, this.scene.game.canvas.width / 6 + this.textPadding * 2, 49, false, false, 0, 0, WindowVariant.THIN);
|
||||||
this.dialogueMessageBox.setOrigin(0, 0);
|
this.dialogueMessageBox.setOrigin(0, 0);
|
||||||
this.menuMessageBoxContainer.add(this.dialogueMessageBox);
|
this.menuMessageBoxContainer.add(this.dialogueMessageBox);
|
||||||
|
|
||||||
|
@ -162,20 +162,6 @@ export class FilterText extends Phaser.GameObjects.Container {
|
||||||
this.lastCursor = cursor;
|
this.lastCursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Switch the message window style and size when we are replaying dialog for debug purposes
|
|
||||||
* In "dialog test mode", the window takes the whole width of the screen and the text
|
|
||||||
* is set up to wrap around the same way as the dialogue during the game
|
|
||||||
* @param isDialogMode whether to use the dialog test
|
|
||||||
*/
|
|
||||||
setDialogTestMode(isDialogMode: boolean) {
|
|
||||||
this.dialogueMessageBox.setVisible(isDialogMode);
|
|
||||||
// If we're testing dialog, we use the same word wrapping as the battle message handler
|
|
||||||
this.message.setWordWrapWidth(isDialogMode ? this.scene.ui.getMessageHandler().wordWrapWidth : this.defaultWordWrapWidth);
|
|
||||||
this.message.setX(isDialogMode ? this.textPadding + 1 : this.textPadding);
|
|
||||||
this.message.setY(isDialogMode ? this.textPadding + 0.4 : this.textPadding);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////From here down changes must be made
|
/////////////////From here down changes must be made
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { FilterTextRow } from "./filter-text";
|
||||||
import { allAbilities } from "#app/data/ability";
|
import { allAbilities } from "#app/data/ability";
|
||||||
import { allMoves } from "#app/data/move";
|
import { allMoves } from "#app/data/move";
|
||||||
import { allSpecies } from "#app/data/pokemon-species";
|
import { allSpecies } from "#app/data/pokemon-species";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
export default class PokedexScanUiHandler extends FormModalUiHandler {
|
export default class PokedexScanUiHandler extends FormModalUiHandler {
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler {
|
||||||
nameKeys: string[];
|
nameKeys: string[];
|
||||||
moveKeys: string[];
|
moveKeys: string[];
|
||||||
abilityKeys: string[];
|
abilityKeys: string[];
|
||||||
|
row: number;
|
||||||
|
|
||||||
constructor(scene, mode) {
|
constructor(scene, mode) {
|
||||||
super(scene, mode);
|
super(scene, mode);
|
||||||
|
@ -31,7 +33,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
getModalTitle(config?: ModalConfig): string {
|
getModalTitle(config?: ModalConfig): string {
|
||||||
return "Choose option";
|
return i18next.t("pokedexUiHandler:scanChooseOption");
|
||||||
}
|
}
|
||||||
|
|
||||||
getWidth(config?: ModalConfig): number {
|
getWidth(config?: ModalConfig): number {
|
||||||
|
@ -43,7 +45,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
getButtonLabels(config?: ModalConfig): string[] {
|
getButtonLabels(config?: ModalConfig): string[] {
|
||||||
return [ "Select", "Cancel" ];
|
return [ i18next.t("pokedexUiHandler:scanSelect"), i18next.t("pokedexUiHandler:scanCancel") ];
|
||||||
}
|
}
|
||||||
|
|
||||||
getReadableErrorMessage(error: string): string {
|
getReadableErrorMessage(error: string): string {
|
||||||
|
@ -56,13 +58,29 @@ export default class PokedexScanUiHandler extends FormModalUiHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
override getInputFieldConfigs(): InputFieldConfig[] {
|
override getInputFieldConfigs(): InputFieldConfig[] {
|
||||||
return [{ label: "Dialogue" }];
|
switch (this.row) {
|
||||||
|
case FilterTextRow.NAME: {
|
||||||
|
return [{ label: i18next.t("pokedexUiHandler:scanLabelName") }];
|
||||||
|
}
|
||||||
|
case FilterTextRow.MOVE_1:
|
||||||
|
case FilterTextRow.MOVE_2: {
|
||||||
|
return [{ label: i18next.t("pokedexUiHandler:scanLabelMove") }];
|
||||||
|
}
|
||||||
|
case FilterTextRow.ABILITY_1:{
|
||||||
|
return [{ label: i18next.t("pokedexUiHandler:scanLabelAbility") }];
|
||||||
|
}
|
||||||
|
case FilterTextRow.ABILITY_2: {
|
||||||
|
return [{ label: i18next.t("pokedexUiHandler:scanLabelPassive") }];
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
return [{ label: "" }];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reduceKeys(row: FilterTextRow): void {
|
reduceKeys(): void {
|
||||||
console.log("Function was called!");
|
switch (this.row) {
|
||||||
console.log(this.keys);
|
|
||||||
switch (row) {
|
|
||||||
case FilterTextRow.NAME: {
|
case FilterTextRow.NAME: {
|
||||||
this.reducedKeys = this.nameKeys;
|
this.reducedKeys = this.nameKeys;
|
||||||
break;
|
break;
|
||||||
|
@ -87,6 +105,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler {
|
||||||
// args[2] is an index of FilterTextRow
|
// args[2] is an index of FilterTextRow
|
||||||
//TODO: This logic is probably way more complex than we need, and actually messes things up for moves and abilities with a space like "Leech Seed"
|
//TODO: This logic is probably way more complex than we need, and actually messes things up for moves and abilities with a space like "Leech Seed"
|
||||||
show(args: any[]): boolean {
|
show(args: any[]): boolean {
|
||||||
|
this.row = args[2];
|
||||||
const ui = this.getUi();
|
const ui = this.getUi();
|
||||||
const hasTitle = !!this.getModalTitle();
|
const hasTitle = !!this.getModalTitle();
|
||||||
this.updateFields(this.getInputFieldConfigs(), hasTitle);
|
this.updateFields(this.getInputFieldConfigs(), hasTitle);
|
||||||
|
@ -94,8 +113,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler {
|
||||||
const input = this.inputs[0];
|
const input = this.inputs[0];
|
||||||
input.setMaxLength(255);
|
input.setMaxLength(255);
|
||||||
|
|
||||||
console.log(args[2]);
|
this.reduceKeys();
|
||||||
this.reduceKeys(args[2]);
|
|
||||||
|
|
||||||
input.on("keydown", (inputObject, evt: KeyboardEvent) => {
|
input.on("keydown", (inputObject, evt: KeyboardEvent) => {
|
||||||
if ([ "escape", "space" ].some((v) => v === evt.key.toLowerCase() || v === evt.code.toLowerCase()) && ui.getMode() === Mode.AUTO_COMPLETE) {
|
if ([ "escape", "space" ].some((v) => v === evt.key.toLowerCase() || v === evt.code.toLowerCase()) && ui.getMode() === Mode.AUTO_COMPLETE) {
|
||||||
|
|
|
@ -311,12 +311,8 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Switch to the dialog test window
|
|
||||||
this.setDialogTestMode(true);
|
|
||||||
ui.showText(String(i18next.t(translatedString, interpolatorOptions)), null, () => this.scene.ui.showText("", 0, () => {
|
ui.showText(String(i18next.t(translatedString, interpolatorOptions)), null, () => this.scene.ui.showText("", 0, () => {
|
||||||
handler.tutorialActive = false;
|
handler.tutorialActive = false;
|
||||||
// Go back to the default message window
|
|
||||||
this.setDialogTestMode(false);
|
|
||||||
}), null, true);
|
}), null, true);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
|
@ -2059,15 +2055,6 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setDialogTestMode(isDialogMode: boolean) {
|
|
||||||
this.menuMessageBox.setVisible(!isDialogMode);
|
|
||||||
this.dialogueMessageBox.setVisible(isDialogMode);
|
|
||||||
// If we're testing dialog, we use the same word wrapping as the battle message handler
|
|
||||||
this.message.setWordWrapWidth(isDialogMode ? this.scene.ui.getMessageHandler().wordWrapWidth : this.defaultWordWrapWidth);
|
|
||||||
this.message.setX(isDialogMode ? this.textPadding + 1 : this.textPadding);
|
|
||||||
this.message.setY(isDialogMode ? this.textPadding + 0.4 : this.textPadding);
|
|
||||||
}
|
|
||||||
|
|
||||||
checkIconId(icon: Phaser.GameObjects.Sprite, species: PokemonSpecies, female: boolean, formIndex: number, shiny: boolean, variant: number) {
|
checkIconId(icon: Phaser.GameObjects.Sprite, species: PokemonSpecies, female: boolean, formIndex: number, shiny: boolean, variant: number) {
|
||||||
if (icon.frame.name !== species.getIconId(female, formIndex, shiny, variant)) {
|
if (icon.frame.name !== species.getIconId(female, formIndex, shiny, variant)) {
|
||||||
console.log(`${species.name}'s icon ${icon.frame.name} does not match getIconId with female: ${female}, formIndex: ${formIndex}, shiny: ${shiny}, variant: ${variant}`);
|
console.log(`${species.name}'s icon ${icon.frame.name} does not match getIconId with female: ${female}, formIndex: ${formIndex}, shiny: ${shiny}, variant: ${variant}`);
|
||||||
|
|
Loading…
Reference in New Issue