[UI/UX] Truncate overlapping name in starter select (#6828)

* Add name truncation

* Update src/ui/handlers/starter-select-ui-handler.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* remove unnecessary length check

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
Fabi 2025-12-09 02:45:44 +01:00 committed by GitHub
parent 3d23a2b28a
commit 15f668e1b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,6 +70,7 @@ import {
padInt,
randIntRange,
rgbHexToRgba,
truncateString,
} from "#utils/common";
import type { StarterPreferences } from "#utils/data";
import { deepCopy, loadStarterPreferences, saveStarterPreferences } from "#utils/data";
@ -2167,6 +2168,7 @@ export class StarterSelectUiHandler extends MessageUiHandler {
} else {
this.pokemonNameText.setText(this.lastSpecies.name);
}
this.truncateName();
ui.setMode(UiMode.STARTER_SELECT);
},
() => {
@ -3554,6 +3556,7 @@ export class StarterSelectUiHandler extends MessageUiHandler {
} else {
this.pokemonNameText.setText(species.name);
}
this.truncateName();
if (this.speciesStarterDexEntry?.caughtAttr) {
const colorScheme = starterColors[species.speciesId];
@ -4674,4 +4677,12 @@ export class StarterSelectUiHandler extends MessageUiHandler {
this.starterPreferences = {};
this.originalStarterPreferences = {};
}
/**
* Truncate the Pokémon name so it won't overlap into the starters.
*/
private truncateName() {
const name = this.pokemonNameText.text;
this.pokemonNameText.setText(truncateString(name, 15));
}
}