Beispiel #1
0
        /// <summary>
        /// 加载多语言配置
        /// </summary>
        /// <param name="completed"></param>
        public static void Load(System.Action completed = null)
        {
            if (string.IsNullOrEmpty(_lanCode))
            {
                _lanCode = Language.current;
            }
            // var request = Resources.LoadAsync<TextAsset>("lc_cn_ERROR");
            // request.completed += (async) =>
            // {
            //     TextAsset textAsset = request.asset as TextAsset;
            //     Parse(textAsset.text);
            //     if (completed != null) completed();
            // };
            var path    = "Assets/AssetBundles/Localization/lc_zh_LOGIN.json";
            var request = AssetsManger.LoadAssetAsync(path, typeof(TextAsset));

            request.completed = (re) =>
            {
                if (string.IsNullOrEmpty(request.error))
                {
                    TextAsset textAsset = re.asset as TextAsset;
                    Parse(textAsset.text);
                }
                else
                {
                    Log.Error(string.Format("Load Localization error:{0}", request.error));
                }
                re.Release();
                if (completed != null)
                {
                    completed();
                }
                if (OnLocalize != null)
                {
                    OnLocalize.Invoke();
                }
            };
        }
Beispiel #2
0
 public void Load()
 {
     request = AssetsManger.LoadAssetAsync(url, type);
 }
Beispiel #3
0
 public void Load()
 {
     request            = AssetsManger.LoadAssetAsync(url, typeof(GameObject));
     request.completed += OnAssetLoaded;
 }