예제 #1
0
        /// <summary>
        /// 重加载同一种语言
        /// </summary>
        public void ReLoad()
        {
            ULanguageInfo oldLanguage = Language;

            Language = Languages[Languages.Count - 1];
            Language = oldLanguage;
        }
예제 #2
0
 /// <summary>
 /// 判断该语言是否已配置
 /// </summary>
 /// <param name="language">需要判断的语言</param>
 /// <returns>true该语言已配置</returns>
 public bool HasLanguage(ULanguageInfo language)
 {
     foreach (var systemLanguage in Languages)
     {
         if (systemLanguage.Equals(language))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #3
0
        private void LoadAllLanguages(XmlNodeList _nodeList)
        {
            var d = ULanguageInfo.zhCn;

            Languages.Clear();
            foreach (XmlNode node in _nodeList)
            {
                var language = new ULanguageInfo(GetNameAttribute(node));

                Languages.Add(language);
                //是否是默认语言
                if (GetDefaultAttribute(node))
                {
                    d = language;
                }
            }
            Language = d;
        }
예제 #4
0
        private void Load_LocalizationCSVConfig(string _strConfigPath)
        {
            ScpReader LocalizationConfigReader = new ScpReader(_strConfigPath, true, 2);

            var d = ULanguageInfo.zhCn;

            Languages.Clear();
            for (int i = 0; i < LocalizationConfigReader.GetRecordCount(); ++i)
            {
                int    id         = LocalizationConfigReader.GetInt(i, (int)ELocalizationConfig.ELC_ID, -1);
                string strABBName = LocalizationConfigReader.GetString(i, (int)ELocalizationConfig.ELC_ABB, string.Empty);

                if (id != -1 && id < 1000)
                {
                    var language = new ULanguageInfo(strABBName);

                    Languages.Add(language);
                    //是否是默认语言
                    if (LocalizationConfigReader.GetInt(i, (int)ELocalizationConfig.ELC_DEF, 0) == 1)
                    {
                        d = language;
                    }
                }
                else if (id != -1 && id >= 1000)
                {
                    if (!LanguagesCSVFiles.Contains(strABBName))
                    {
                        LanguagesCSVFiles.Add(strABBName);
                    }
                    else
                    {
                        Trace.LogWarning("本地化文件配置里有重复文件名:" + strABBName);
                    }
                }
            }
            Language = d;
        }