public void SetLanguage(SystemLanguage language) { Language = language; _listLocalizationValues.Clear(); TextAsset txtLocalization = Resources.Load <TextAsset>($"Localization/{language}") as TextAsset; if (txtLocalization != null) { DataLocalization dataLocalization = JsonUtility.FromJson <DataLocalization>(txtLocalization.ToString()); foreach (var dataItemLocalization in dataLocalization.Data) { _listLocalizationValues.Add(dataItemLocalization.Key, dataItemLocalization.Value); } } OnChangeLanguage?.Invoke(); var items = FindObjectsOfType <MonoBehaviour>().OfType <ILocalizationItem>(); foreach (var item in items) { item.ChangeLocalization(); } PlayerPrefs.SetInt(_keyLanguage, (int)language); }
// 言語切り替え時に呼ばれる void ChangeLanguage() { if (!string.IsNullOrEmpty(LanguageKeyOfParam)) { Param.SetParameterString(LanguageKeyOfParam, LanguageManagerBase.Instance.CurrentLanguage); } this.Page.OnChangeLanguage(); OnChangeLanguage.Invoke(this); //ローカライズ時に呼びだす(今のところボイスファイルの変更が必要な時のみ) ForEachCommand((x) => x.OnChangeLanguage(this)); }
// --------------------------------------------------------------------- public void ChangeLanguage(Language newLanaguage) { if (newLanaguage != CurrentLanguage) { CurrentLanguage = newLanaguage; Debug.Log("Changing language to: " + CurrentLanguage.ToString()); LoadLocFile(mLanguages[CurrentLanguage].LocFile, ref mLocEntries); if (OnChangeLanguage != null) { OnChangeLanguage.Invoke(); } } }
/// <summary> /// 言語切り替え時に呼ばれる /// </summary> void ChangeLanguage() { this.Page.OnChangeLanguage(); OnChangeLanguage.Invoke(this); }