mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-15 06:15:20 +01:00
[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:
parent
3d23a2b28a
commit
15f668e1b5
@ -70,6 +70,7 @@ import {
|
|||||||
padInt,
|
padInt,
|
||||||
randIntRange,
|
randIntRange,
|
||||||
rgbHexToRgba,
|
rgbHexToRgba,
|
||||||
|
truncateString,
|
||||||
} from "#utils/common";
|
} from "#utils/common";
|
||||||
import type { StarterPreferences } from "#utils/data";
|
import type { StarterPreferences } from "#utils/data";
|
||||||
import { deepCopy, loadStarterPreferences, saveStarterPreferences } from "#utils/data";
|
import { deepCopy, loadStarterPreferences, saveStarterPreferences } from "#utils/data";
|
||||||
@ -2167,6 +2168,7 @@ export class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
} else {
|
} else {
|
||||||
this.pokemonNameText.setText(this.lastSpecies.name);
|
this.pokemonNameText.setText(this.lastSpecies.name);
|
||||||
}
|
}
|
||||||
|
this.truncateName();
|
||||||
ui.setMode(UiMode.STARTER_SELECT);
|
ui.setMode(UiMode.STARTER_SELECT);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
@ -3554,6 +3556,7 @@ export class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
} else {
|
} else {
|
||||||
this.pokemonNameText.setText(species.name);
|
this.pokemonNameText.setText(species.name);
|
||||||
}
|
}
|
||||||
|
this.truncateName();
|
||||||
|
|
||||||
if (this.speciesStarterDexEntry?.caughtAttr) {
|
if (this.speciesStarterDexEntry?.caughtAttr) {
|
||||||
const colorScheme = starterColors[species.speciesId];
|
const colorScheme = starterColors[species.speciesId];
|
||||||
@ -4674,4 +4677,12 @@ export class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
this.starterPreferences = {};
|
this.starterPreferences = {};
|
||||||
this.originalStarterPreferences = {};
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user