private void Awake() { if (Instance == null) { Instance = this; } if (Instance != this) { Destroy(gameObject); return; } anim = GetComponent <Animator>(); defaultZoom = mainCamera.orthographicSize; screenWidth = Screen.width; screenHeight = Screen.height; mainCamera = Camera.main; QualitySettings.vSyncCount = 0; LocalizedStringManager.Init(); LocalizedStringManager.ParseTranslations(); string currentCultureName = Localizer.GetCurrentCultureInfo().Name; Debug.LogFormat("Current culture: {0}", currentCultureName); LocalizedTextRegistry.Clear(); bool isFirstLoad = IsFirstLoad(); Options.Load(); if (isFirstLoad) { Options.currentCulture = CultureInfo.GetCultureInfo(currentCultureName); } Debug.LogFormat("Loading culture {0}", Options.currentCulture.Name); if (Options.currentCulture == null) { Debug.Log("Setting current culture!"); if (!LocalizedStringManager.availableCultures.Contains(currentCultureName)) { Debug.LogFormat("Culture {0} is not supported, defaulting to en-US"); Options.currentCulture = CultureInfo.GetCultureInfo("en-US"); } } LocalizedStringManager.SetCulture(Options.currentCulture.Name); Options.ApplyGraphics(); Options.Save(); OnGameReady += () => canPause = true; }
public void OnLangDropdownChanged(int choice) { Options.currentCulture = CultureInfo.GetCultureInfo(LocalizedStringManager.availableCultures[choice]); Options.SaveLanguage(); Options.ApplyLanguage(); LocalizedTextRegistry.UpdateAll(); }
private void Awake() { text = GetComponent <TMP_Text>(); LocalizedTextRegistry.Register(this); if (setOnAwake) { SetText(textID); } }
private void OnDestroy() { LocalizedTextRegistry.Unregister(this); }