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

@@ -26,9 +26,34 @@ namespace Hallucinate.UI
_healthBar = root.Q<ProgressBar>("HealthBar");
_staminaBar = root.Q<ProgressBar>("StaminaBar");
if (LocalizationManager.Instance != null)
{
LocalizationManager.Instance.OnLanguageChanged += ApplyLocalization;
ApplyLocalization();
}
_lastActionTime = Time.time;
}
private void OnDestroy()
{
if (LocalizationManager.Instance != null)
{
LocalizationManager.Instance.OnLanguageChanged -= ApplyLocalization;
}
}
private void ApplyLocalization()
{
if (LocalizationManager.Instance == null) return;
root.Query<Label>().ForEach(l => {
if (l.text == "HEALTH") l.text = LocalizationManager.Instance.GetLocalizedString("HUD_HEALTH");
if (l.text == "STAMINA") l.text = LocalizationManager.Instance.GetLocalizedString("HUD_STAMINA");
if (l.text == "MINIMAP") l.text = LocalizationManager.Instance.GetLocalizedString("HUD_MINIMAP");
});
}
public void UpdateHUD(float health, float stamina)
{
_healthBar.value = health;
@@ -38,8 +63,11 @@ namespace Hallucinate.UI
public void UpdateStats(int ping, int fps)
{
root.Q<Label>("PingLabel").text = $"PING: {ping}ms";
root.Q<Label>("FPSLabel").text = $"FPS: {fps}";
string pingPrefix = LocalizationManager.Instance != null ? LocalizationManager.Instance.GetLocalizedString("HUD_PING_PREFIX") : "PING: ";
string fpsPrefix = LocalizationManager.Instance != null ? LocalizationManager.Instance.GetLocalizedString("HUD_FPS_PREFIX") : "FPS: ";
root.Q<Label>("PingLabel").text = $"{pingPrefix}{ping}ms";
root.Q<Label>("FPSLabel").text = $"{fpsPrefix}{fps}";
}
public void WakeUpHUD()