mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-08 08:29:37 +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 enableTouchControls = false;
|
||||||
public enableVibration = false;
|
public enableVibration = false;
|
||||||
public showBgmBar = true;
|
public showBgmBar = true;
|
||||||
|
public hideUsername = false;
|
||||||
/** Determines the selected battle style. */
|
/** Determines the selected battle style. */
|
||||||
public battleStyle: BattleStyle = BattleStyle.SWITCH;
|
public battleStyle: BattleStyle = BattleStyle.SWITCH;
|
||||||
/**
|
/**
|
||||||
|
@ -171,6 +171,7 @@ export const SettingKeys = {
|
|||||||
UI_Volume: "UI_SOUND_EFFECTS",
|
UI_Volume: "UI_SOUND_EFFECTS",
|
||||||
Battle_Music: "BATTLE_MUSIC",
|
Battle_Music: "BATTLE_MUSIC",
|
||||||
Show_BGM_Bar: "SHOW_BGM_BAR",
|
Show_BGM_Bar: "SHOW_BGM_BAR",
|
||||||
|
Hide_Username: "HIDE_USERNAME",
|
||||||
Move_Touch_Controls: "MOVE_TOUCH_CONTROLS",
|
Move_Touch_Controls: "MOVE_TOUCH_CONTROLS",
|
||||||
Shop_Overlay_Opacity: "SHOP_OVERLAY_OPACITY",
|
Shop_Overlay_Opacity: "SHOP_OVERLAY_OPACITY",
|
||||||
};
|
};
|
||||||
@ -625,6 +626,13 @@ export const Setting: Array<Setting> = [
|
|||||||
default: 1,
|
default: 1,
|
||||||
type: SettingType.DISPLAY,
|
type: SettingType.DISPLAY,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: SettingKeys.Hide_Username,
|
||||||
|
label: i18next.t("settings:hideUsername"),
|
||||||
|
options: OFF_ON,
|
||||||
|
default: 0,
|
||||||
|
type: SettingType.DISPLAY,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: SettingKeys.Master_Volume,
|
key: SettingKeys.Master_Volume,
|
||||||
label: i18next.t("settings:masterVolume"),
|
label: i18next.t("settings:masterVolume"),
|
||||||
@ -792,6 +800,9 @@ export function setSetting(setting: string, value: number): boolean {
|
|||||||
case SettingKeys.Show_BGM_Bar:
|
case SettingKeys.Show_BGM_Bar:
|
||||||
globalScene.showBgmBar = Setting[index].options[value].value === "On";
|
globalScene.showBgmBar = Setting[index].options[value].value === "On";
|
||||||
break;
|
break;
|
||||||
|
case SettingKeys.Hide_Username:
|
||||||
|
globalScene.hideUsername = Setting[index].options[value].value === "On";
|
||||||
|
break;
|
||||||
case SettingKeys.Candy_Upgrade_Notification:
|
case SettingKeys.Candy_Upgrade_Notification:
|
||||||
if (globalScene.candyUpgradeNotification === value) {
|
if (globalScene.candyUpgradeNotification === value) {
|
||||||
break;
|
break;
|
||||||
|
@ -803,24 +803,34 @@ export class SummaryUiHandler extends UiHandler {
|
|||||||
case Page.PROFILE: {
|
case Page.PROFILE: {
|
||||||
const profileContainer = globalScene.add.container(0, -pageBg.height);
|
const profileContainer = globalScene.add.container(0, -pageBg.height);
|
||||||
pageContainer.add(profileContainer);
|
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
|
// TODO: should add field for original trainer name to Pokemon object, to support gift/traded Pokemon from MEs
|
||||||
const trainerText = addBBCodeTextObject(
|
const trainerText = addBBCodeTextObject(
|
||||||
7,
|
7,
|
||||||
12,
|
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,
|
TextStyle.SUMMARY_ALT,
|
||||||
);
|
).setOrigin(0);
|
||||||
trainerText.setOrigin(0, 0);
|
|
||||||
profileContainer.add(trainerText);
|
profileContainer.add(trainerText);
|
||||||
|
|
||||||
|
const idToDisplay = globalScene.hideUsername ? "*****" : globalScene.gameData.trainerId.toString();
|
||||||
const trainerIdText = addTextObject(
|
const trainerIdText = addTextObject(
|
||||||
141,
|
141,
|
||||||
12,
|
12,
|
||||||
`${i18next.t("pokemonSummary:idNo")}${globalScene.gameData.trainerId.toString()}`,
|
`${i18next.t("pokemonSummary:idNo")}${idToDisplay}`,
|
||||||
TextStyle.SUMMARY_ALT,
|
TextStyle.SUMMARY_ALT,
|
||||||
);
|
).setOrigin(0);
|
||||||
trainerIdText.setOrigin(0, 0);
|
|
||||||
profileContainer.add(trainerIdText);
|
profileContainer.add(trainerIdText);
|
||||||
|
|
||||||
const typeLabel = addTextObject(7, 28, `${i18next.t("pokemonSummary:type")}/`, TextStyle.WINDOW_ALT);
|
const typeLabel = addTextObject(7, 28, `${i18next.t("pokemonSummary:type")}/`, TextStyle.WINDOW_ALT);
|
||||||
|
Loading…
Reference in New Issue
Block a user