mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-25 08:49:32 +02:00
[Enhancement] Add username to title screen + add possibility to hide it
This commit is contained in:
parent
69cac23421
commit
7d915dba98
@ -150,6 +150,7 @@ export default class BattleScene extends SceneBase {
|
||||
public enableTutorials: boolean = import.meta.env.VITE_BYPASS_TUTORIAL === "1";
|
||||
public enableMoveInfo: boolean = true;
|
||||
public enableRetries: boolean = false;
|
||||
public enableHideUsername: boolean = false;
|
||||
public hideIvs: boolean = false;
|
||||
/**
|
||||
* Determines the condition for a notification should be shown for Candy Upgrades
|
||||
|
@ -107,5 +107,6 @@
|
||||
"rewards": "Rewards",
|
||||
"reroll": "Reroll",
|
||||
"shop": "Shop",
|
||||
"checkTeam": "Check Team"
|
||||
"checkTeam": "Check Team",
|
||||
"hiddenUsername": "Hidden Username"
|
||||
}
|
||||
|
@ -107,5 +107,6 @@
|
||||
"rewards": "Obj. gratuits",
|
||||
"reroll": "Relance",
|
||||
"shop": "Boutique",
|
||||
"checkTeam": "Équipe"
|
||||
"checkTeam": "Équipe",
|
||||
"hiddenUsername": "Pseudo caché"
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ export class TitlePhase extends Phase {
|
||||
console.error(err);
|
||||
this.showOptions();
|
||||
});
|
||||
|
||||
this.scene.events.emit("sessionUpdate");
|
||||
}
|
||||
|
||||
showOptions(): void {
|
||||
|
@ -160,7 +160,8 @@ export const SettingKeys = {
|
||||
Music_Preference: "MUSIC_PREFERENCE",
|
||||
Show_BGM_Bar: "SHOW_BGM_BAR",
|
||||
Move_Touch_Controls: "MOVE_TOUCH_CONTROLS",
|
||||
Shop_Overlay_Opacity: "SHOP_OVERLAY_OPACITY"
|
||||
Shop_Overlay_Opacity: "SHOP_OVERLAY_OPACITY",
|
||||
Hide_Username: "HIDE_USERNAME"
|
||||
};
|
||||
|
||||
/**
|
||||
@ -666,6 +667,14 @@ export const Setting: Array<Setting> = [
|
||||
default: 7,
|
||||
type: SettingType.DISPLAY,
|
||||
requireReload: false
|
||||
},
|
||||
{
|
||||
key: SettingKeys.Hide_Username,
|
||||
label: i18next.t("settings:hiddenUsername"),
|
||||
options: OFF_ON,
|
||||
default: 0,
|
||||
type: SettingType.GENERAL,
|
||||
requireReload: false
|
||||
}
|
||||
];
|
||||
|
||||
@ -757,6 +766,10 @@ export function setSetting(scene: BattleScene, setting: string, value: integer):
|
||||
case SettingKeys.Show_BGM_Bar:
|
||||
scene.showBgmBar = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Hide_Username:
|
||||
scene.enableHideUsername = Setting[index].options[value].value === "On";
|
||||
scene.events.emit("sessionUpdate");
|
||||
break;
|
||||
case SettingKeys.Candy_Upgrade_Notification:
|
||||
if (scene.candyUpgradeNotification === value) {
|
||||
break;
|
||||
|
@ -6,6 +6,7 @@ import { TextStyle, addTextObject, getTextStyleOptions } from "./text";
|
||||
import { getSplashMessages } from "../data/splash-messages";
|
||||
import i18next from "i18next";
|
||||
import { TimedEventDisplay } from "#app/timed-event-manager";
|
||||
import {loggedInUser} from "#app/account";
|
||||
|
||||
export default class TitleUiHandler extends OptionSelectUiHandler {
|
||||
/** If the stats can not be retrieved, use this fallback value */
|
||||
@ -15,6 +16,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
|
||||
private playerCountLabel: Phaser.GameObjects.Text;
|
||||
private splashMessage: string;
|
||||
private splashMessageText: Phaser.GameObjects.Text;
|
||||
private usernameText: Phaser.GameObjects.Text;
|
||||
private eventDisplay: TimedEventDisplay;
|
||||
|
||||
private titleStatsTimer: NodeJS.Timeout | null;
|
||||
@ -43,18 +45,35 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
|
||||
this.titleContainer.add(this.eventDisplay);
|
||||
}
|
||||
|
||||
this.usernameText = addTextObject(
|
||||
this.scene,
|
||||
(this.scene.game.canvas.width / 6) - 2,
|
||||
(this.scene.game.canvas.height / 7) - 576 * getTextStyleOptions(TextStyle.WINDOW, this.scene.uiTheme).scale,
|
||||
loggedInUser?.username || "Guest",
|
||||
TextStyle.PARTY_RED,
|
||||
{fontSize: "54px"}
|
||||
);
|
||||
this.usernameText.setOrigin(1, 0);
|
||||
this.titleContainer.add(this.usernameText);
|
||||
|
||||
this.scene.events.on("sessionUpdate", () => {
|
||||
this.scene.enableHideUsername
|
||||
? this.usernameText.setText("")
|
||||
: this.usernameText.setText(loggedInUser?.username || "Guest");
|
||||
});
|
||||
|
||||
this.playerCountLabel = addTextObject(
|
||||
this.scene,
|
||||
(this.scene.game.canvas.width / 6) - 2,
|
||||
(this.scene.game.canvas.height / 6) - 13 - 576 * getTextStyleOptions(TextStyle.WINDOW, this.scene.uiTheme).scale,
|
||||
`? ${i18next.t("menu:playersOnline")}`,
|
||||
TextStyle.MESSAGE,
|
||||
{ fontSize: "54px" }
|
||||
{fontSize: "54px"}
|
||||
);
|
||||
this.playerCountLabel.setOrigin(1, 0);
|
||||
this.titleContainer.add(this.playerCountLabel);
|
||||
|
||||
this.splashMessageText = addTextObject(this.scene, logo.x + 64, logo.y + logo.displayHeight - 8, "", TextStyle.MONEY, { fontSize: "54px" });
|
||||
this.splashMessageText = addTextObject(this.scene, logo.x + 64, logo.y + logo.displayHeight - 8, "", TextStyle.MONEY, {fontSize: "54px"});
|
||||
this.splashMessageText.setOrigin(0.5, 0.5);
|
||||
this.splashMessageText.setAngle(-20);
|
||||
this.titleContainer.add(this.splashMessageText);
|
||||
|
Loading…
Reference in New Issue
Block a user