Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        // 言語切り替え時に呼ばれる
        void ChangeLanguage()
        {
            if (!string.IsNullOrEmpty(LanguageKeyOfParam))
            {
                Param.SetParameterString(LanguageKeyOfParam, LanguageManagerBase.Instance.CurrentLanguage);
            }

            this.Page.OnChangeLanguage();
            OnChangeLanguage.Invoke(this);
            //ローカライズ時に呼びだす(今のところボイスファイルの変更が必要な時のみ)
            ForEachCommand((x) => x.OnChangeLanguage(this));
        }
Exemplo n.º 3
0
    // ---------------------------------------------------------------------

    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();
            }
        }
    }
Exemplo n.º 4
0
        void SetLanguage(string langName, IDictionary <string, string> values)
        {
            if (_currentLanguage.Name == langName)
            {
                return;
            }
            _currentLanguage.Update(values);
            _currentLanguage.Name = langName;
            OnChangeLanguage.SafeInvoke(_currentLanguage);
#if HOURAI_EVENTS
            _eventManager.Publish(new LanguageChanged {
                NewLanguage = _currentLanguage
            });
#endif
            log.Info("Set language to {0}", Language.GetName(langName));
        }
Exemplo n.º 5
0
 /// <summary>
 /// 言語切り替え時に呼ばれる
 /// </summary>
 void ChangeLanguage()
 {
     this.Page.OnChangeLanguage();
     OnChangeLanguage.Invoke(this);
 }