Update Setting

This commit is contained in:
2026-05-01 17:57:07 +07:00
parent bcb2c329c5
commit 9c784e77f8
26 changed files with 954 additions and 3233 deletions

View File

@@ -49,11 +49,41 @@ namespace Hallucinate.UI
root.Q<Button>("ProfileBtn").clicked += async () => await uiManager.Push<ProfileController>();
root.Q<Button>("ExitBtn").clicked += () => Application.Quit();
// Đăng ký Localization
if (LocalizationManager.Instance != null)
{
LocalizationManager.Instance.OnLanguageChanged += ApplyLocalization;
}
ApplyLocalization();
ResetLogoPosition();
StartPulse();
_lastInteractionTime = Time.time;
}
private void ApplyLocalization()
{
if (LocalizationManager.Instance == null) return;
var joinBtn = root.Q<Button>("JoinBtn");
if (joinBtn != null) joinBtn.text = LocalizationManager.Instance.GetLocalizedString("MENU_JOIN");
var createBtn = root.Q<Button>("CreateBtn");
if (createBtn != null) createBtn.text = LocalizationManager.Instance.GetLocalizedString("MENU_CREATE");
var settingsBtn = root.Q<Button>("SettingsBtn");
if (settingsBtn != null) settingsBtn.text = LocalizationManager.Instance.GetLocalizedString("MENU_SETTINGS");
var profileBtn = root.Q<Button>("ProfileBtn");
if (profileBtn != null) profileBtn.text = LocalizationManager.Instance.GetLocalizedString("MENU_PROFILE");
var exitBtn = root.Q<Button>("ExitBtn");
if (exitBtn != null) exitBtn.text = LocalizationManager.Instance.GetLocalizedString("MENU_EXIT");
var playLabel = _logo.Q<Label>();
if (playLabel != null) playLabel.text = LocalizationManager.Instance.GetLocalizedString("MENU_PLAY");
}
private void OnScreenResize(GeometryChangedEvent evt)
{
// Khi màn hình thay đổi kích thước, nếu đang ở Ribbon thì cập nhật theo LogoSpace
@@ -252,5 +282,13 @@ namespace Hallucinate.UI
cycleMode: CycleMode.Yoyo,
ease: Ease.InOutSine);
}
private void OnDestroy()
{
if (LocalizationManager.Instance != null)
{
LocalizationManager.Instance.OnLanguageChanged -= ApplyLocalization;
}
}
}
}