[Beta] [Bug] Show correct username in title ui (#6710)

fix title username
This commit is contained in:
Fabi 2025-10-29 22:19:27 +01:00 committed by GitHub
parent ea7a1c9a74
commit bc79a2490b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -47,6 +47,10 @@ export class TitleUiHandler extends OptionSelectUiHandler {
return i18next.t("menu:loggedInAs", { username: displayName });
}
updateUsername() {
this.usernameLabel.setText(this.getUsername());
}
constructor(mode: UiMode = UiMode.TITLE) {
super(mode);
}
@ -167,6 +171,8 @@ export class TitleUiHandler extends OptionSelectUiHandler {
const scaledHeight = globalScene.scaledCanvas.height;
const windowHeight = this.getWindowHeight();
this.updateUsername();
// Moving username and player count to top of the menu
// and sorting it, to display the shorter one on top
const UPPER_LABEL = scaledHeight - 23 - windowHeight;

View File

@ -10,6 +10,7 @@ import { MessageUiHandler } from "#ui/message-ui-handler";
import { NavigationManager, NavigationMenu } from "#ui/navigation-menu";
import { ScrollBar } from "#ui/scroll-bar";
import { addTextObject, getTextColor } from "#ui/text";
import type { TitleUiHandler } from "#ui/title-ui-handler";
import { addWindow } from "#ui/ui-theme";
import i18next from "i18next";
@ -497,6 +498,7 @@ export class AbstractSettingsUiHandler extends MessageUiHandler {
this.setScrollCursor(0);
this.eraseCursor();
this.getUi().bgmBar.toggleBgmBar(globalScene.showBgmBar);
(this.getUi().handlers[UiMode.TITLE] as TitleUiHandler)?.updateUsername();
if (this.reloadRequired) {
this.reloadRequired = false;
globalScene.reset(true, false, true);