Menu automatically adjusts width for option width

This commit is contained in:
Flashfyre 2024-04-25 21:20:07 -04:00 committed by Samuel H
parent e3ef65523a
commit 13b1ad698e
5 changed files with 6158 additions and 7 deletions

1244
src/locales/de/ability.ts Normal file

File diff suppressed because it is too large Load Diff

3812
src/locales/de/move.ts Normal file

File diff suppressed because it is too large Load Diff

1086
src/locales/de/pokemon.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@ -14,10 +14,12 @@ import { menuUiHandler as deMenuUiHandler } from '../locales/de/menu-ui-handler.
import { move as enMove } from '../locales/en/move';
import { move as esMove } from '../locales/es/move';
import { move as frMove } from '../locales/fr/move';
import { move as deMove } from '../locales/de/move';
import { ability as enAbility } from '../locales/en/ability';
import { ability as esAbility } from '../locales/es/ability';
import { ability as frAbility } from '../locales/fr/ability';
import { ability as deAbility } from '../locales/de/ability';
import { pokeball as enPokeball } from '../locales/en/pokeball';
import { pokeball as esPokeball } from '../locales/es/pokeball';
@ -27,6 +29,7 @@ import { pokeball as dePokeball } from '../locales/de/pokeball';
import { pokemon as enPokemon } from '../locales/en/pokemon';
import { pokemon as esPokemon } from '../locales/es/pokemon';
import { pokemon as frPokemon } from '../locales/fr/pokemon';
import { pokemon as dePokemon } from '../locales/de/pokemon';
import { pokemonStat as enPokemonStat } from '../locales/en/pokemon-stat';
import { pokemonStat as esPokemonStat } from '../locales/es/pokemon-stat';
@ -140,7 +143,10 @@ export function initI18n(): void {
de: {
menu: deMenu,
menuUiHandler: deMenuUiHandler,
move: deMove,
ability: deAbility,
pokeball: dePokeball,
pokemon: dePokemon,
pokemonStat: dePokemonStat,
commandUiHandler: deCommandUiHandler,
}

View File

@ -58,14 +58,20 @@ export default class MenuUiHandler extends MessageUiHandler {
this.menuContainer.setInteractive(new Phaser.Geom.Rectangle(0, 0, this.scene.game.canvas.width / 6, this.scene.game.canvas.height / 6), Phaser.Geom.Rectangle.Contains);
this.menuBg = addWindow(this.scene, (this.scene.game.canvas.width / 6) - 100, 0, 98, (this.scene.game.canvas.height / 6) - 2);
const menuMessageText = addTextObject(this.scene, 8, 8, '', TextStyle.WINDOW, { maxLines: 2 });
menuMessageText.setWordWrapWidth(1224);
menuMessageText.setOrigin(0, 0);
this.optionSelectText = addTextObject(this.scene, 0, 0, this.menuOptions.map(o => `${i18next.t(`menuUiHandler:${MenuOptions[o]}`)}`).join('\n'), TextStyle.WINDOW, { maxLines: this.menuOptions.length });
this.optionSelectText.setLineSpacing(12);
this.menuBg = addWindow(this.scene, (this.scene.game.canvas.width / 6) - (this.optionSelectText.displayWidth + 25), 0, this.optionSelectText.displayWidth + 23, (this.scene.game.canvas.height / 6) - 2);
this.menuBg.setOrigin(0, 0);
this.optionSelectText.setPositionRelative(this.menuBg, 14, 6);
this.menuContainer.add(this.menuBg);
this.optionSelectText = addTextObject(this.scene, 0, 0, this.menuOptions.map(o => `${i18next.t(`menuUiHandler:${MenuOptions[o]}`)}`).join('\n'), TextStyle.WINDOW, { maxLines: this.menuOptions.length });
this.optionSelectText.setPositionRelative(this.menuBg, 14, 6);
this.optionSelectText.setLineSpacing(12);
this.menuContainer.add(this.optionSelectText);
ui.add(this.menuContainer);
@ -78,9 +84,6 @@ export default class MenuUiHandler extends MessageUiHandler {
menuMessageBox.setOrigin(0, 0);
this.menuMessageBoxContainer.add(menuMessageBox);
const menuMessageText = addTextObject(this.scene, 8, 8, '', TextStyle.WINDOW, { maxLines: 2 });
menuMessageText.setWordWrapWidth(1224);
menuMessageText.setOrigin(0, 0);
this.menuMessageBoxContainer.add(menuMessageText);
this.message = menuMessageText;