Beispiel #1
0
        /// <summary>
        /// 加载StreamingAssets物体(可更新)
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static WWW LoadStreamingAsset(string path)
        {
            var localizationPath = Localization.ConvertAssetPath(path);
            WWW result           = UResources.LoadStreamingAsset(localizationPath);

            if (!string.IsNullOrEmpty(result.error))
            {
                result = UResources.LoadStreamingAsset(path);
            }
            return(result);
        }
Beispiel #2
0
        public static void InitLanguage()
        {
            //预置语言
            var www = UResources.LoadStreamingAsset("language.txt");

            if (string.IsNullOrEmpty(www.error))
            {
                var txt = www.text;
                txt      = txt.Replace("-", "_");           //避免把_写成了-
                Language = (LanguageEnum)Enum.Parse(typeof(LanguageEnum), txt);
                Debug.Log("使用StreamingAsset中的语言:" + www.text + " => " + Language);
            }
            else
            {
                var systemLanguage = Application.systemLanguage;
                switch (systemLanguage)
                {
                case SystemLanguage.Chinese:
                case SystemLanguage.ChineseSimplified:
                    Language = LanguageEnum.zh_CN;
                    break;

                case SystemLanguage.ChineseTraditional:
                    Language = LanguageEnum.zh_TW;
                    break;

                case SystemLanguage.English:
                    Language = LanguageEnum.en_US;
                    break;

                case SystemLanguage.French:
                    Language = LanguageEnum.fr_FR;
                    break;
                }
                Debug.Log("没有找到StreamingAsset中的语言,使用系统语言:" + systemLanguage + " => " + Language);
            }
        }