mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-07 16:09:27 +02:00
[UI/UX] Added "Hide Username" Setting (#6105)
* [UI/UX] Added "Hide Username" Setting * Mask tid with asterisk instead of hiding completely --------- Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
This commit is contained in:
parent
0ef1a34030
commit
08d7216424
@ -236,6 +236,7 @@ export class BattleScene extends SceneBase {
|
||||
public enableTouchControls = false;
|
||||
public enableVibration = false;
|
||||
public showBgmBar = true;
|
||||
public hideUsername = false;
|
||||
/** Determines the selected battle style. */
|
||||
public battleStyle: BattleStyle = BattleStyle.SWITCH;
|
||||
/**
|
||||
|
@ -171,6 +171,7 @@ export const SettingKeys = {
|
||||
UI_Volume: "UI_SOUND_EFFECTS",
|
||||
Battle_Music: "BATTLE_MUSIC",
|
||||
Show_BGM_Bar: "SHOW_BGM_BAR",
|
||||
Hide_Username: "HIDE_USERNAME",
|
||||
Move_Touch_Controls: "MOVE_TOUCH_CONTROLS",
|
||||
Shop_Overlay_Opacity: "SHOP_OVERLAY_OPACITY",
|
||||
};
|
||||
@ -625,6 +626,13 @@ export const Setting: Array<Setting> = [
|
||||
default: 1,
|
||||
type: SettingType.DISPLAY,
|
||||
},
|
||||
{
|
||||
key: SettingKeys.Hide_Username,
|
||||
label: i18next.t("settings:hideUsername"),
|
||||
options: OFF_ON,
|
||||
default: 0,
|
||||
type: SettingType.DISPLAY,
|
||||
},
|
||||
{
|
||||
key: SettingKeys.Master_Volume,
|
||||
label: i18next.t("settings:masterVolume"),
|
||||
@ -792,6 +800,9 @@ export function setSetting(setting: string, value: number): boolean {
|
||||
case SettingKeys.Show_BGM_Bar:
|
||||
globalScene.showBgmBar = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Hide_Username:
|
||||
globalScene.hideUsername = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Candy_Upgrade_Notification:
|
||||
if (globalScene.candyUpgradeNotification === value) {
|
||||
break;
|
||||
|
@ -803,24 +803,34 @@ export class SummaryUiHandler extends UiHandler {
|
||||
case Page.PROFILE: {
|
||||
const profileContainer = globalScene.add.container(0, -pageBg.height);
|
||||
pageContainer.add(profileContainer);
|
||||
const otColor =
|
||||
globalScene.gameData.gender === PlayerGender.FEMALE ? TextStyle.SUMMARY_PINK : TextStyle.SUMMARY_BLUE;
|
||||
const usernameReplacement =
|
||||
globalScene.gameData.gender === PlayerGender.FEMALE
|
||||
? i18next.t("trainerNames:player_f")
|
||||
: i18next.t("trainerNames:player_m");
|
||||
|
||||
// TODO: should add field for original trainer name to Pokemon object, to support gift/traded Pokemon from MEs
|
||||
const trainerText = addBBCodeTextObject(
|
||||
7,
|
||||
12,
|
||||
`${i18next.t("pokemonSummary:ot")}/${getBBCodeFrag(loggedInUser?.username || i18next.t("pokemonSummary:unknown"), globalScene.gameData.gender === PlayerGender.FEMALE ? TextStyle.SUMMARY_PINK : TextStyle.SUMMARY_BLUE)}`,
|
||||
`${i18next.t("pokemonSummary:ot")}/${getBBCodeFrag(
|
||||
!globalScene.hideUsername
|
||||
? loggedInUser?.username || i18next.t("pokemonSummary:unknown")
|
||||
: usernameReplacement,
|
||||
otColor,
|
||||
)}`,
|
||||
TextStyle.SUMMARY_ALT,
|
||||
);
|
||||
trainerText.setOrigin(0, 0);
|
||||
).setOrigin(0);
|
||||
profileContainer.add(trainerText);
|
||||
|
||||
const idToDisplay = globalScene.hideUsername ? "*****" : globalScene.gameData.trainerId.toString();
|
||||
const trainerIdText = addTextObject(
|
||||
141,
|
||||
12,
|
||||
`${i18next.t("pokemonSummary:idNo")}${globalScene.gameData.trainerId.toString()}`,
|
||||
`${i18next.t("pokemonSummary:idNo")}${idToDisplay}`,
|
||||
TextStyle.SUMMARY_ALT,
|
||||
);
|
||||
trainerIdText.setOrigin(0, 0);
|
||||
).setOrigin(0);
|
||||
profileContainer.add(trainerIdText);
|
||||
|
||||
const typeLabel = addTextObject(7, 28, `${i18next.t("pokemonSummary:type")}/`, TextStyle.WINDOW_ALT);
|
||||
|
Loading…
Reference in New Issue
Block a user