From d1ab218044fb68882f70fe4334183b06ca0b4943 Mon Sep 17 00:00:00 2001 From: Adrian Date: Thu, 12 Sep 2024 17:11:53 -0400 Subject: [PATCH] Without exceed length with pokemon re-name in start-ui-handler.ts --- src/ui/starter-select-ui-handler.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index f9b40dd96e6..fada9cc4151 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -1583,6 +1583,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler { const name = decodeURIComponent(escape(atob(starterAttributes.nickname))); if (name.length > 0) { this.pokemonNameText.setText(name); + while (this.pokemonNameText.displayWidth > 90) { + const displayName = `${this.pokemonNameText.text.slice(0, this.pokemonNameText.text.endsWith(".") ? -2 : -1).trimEnd()}.`; + this.pokemonNameText.setText(displayName); + } } else { this.pokemonNameText.setText(this.lastSpecies.name); } @@ -2663,6 +2667,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler { if (starterAttributes?.nickname) { const name = decodeURIComponent(escape(atob(starterAttributes.nickname))); this.pokemonNameText.setText(name); + while (this.pokemonNameText.displayWidth > 90) { + const displayName = `${this.pokemonNameText.text.slice(0, this.pokemonNameText.text.endsWith(".") ? -2 : -1).trimEnd()}.`; + this.pokemonNameText.setText(displayName); + } } else { this.pokemonNameText.setText(species.name); }