Example #1
0
        private IEnumerator CoLoadSerializeMaterial()
        {
            var matLoadBridge = KAssetFileLoader.Load(Url);

            while (!matLoadBridge.IsCompleted)
            {
                Progress = matLoadBridge.Progress;
                yield return(null);
            }

            var sMat = matLoadBridge.ResultObject as KSerializeMaterial;

            Debuger.Assert(sMat);

            Desc = sMat.ShaderName;

            Debuger.Assert(Mat == null);
            yield return(KResourceModule.Instance.StartCoroutine(CoGenerateMaterial(Url, sMat)));

            Debuger.Assert(Mat);

            matLoadBridge.Release(); //不需要它了

            if (Application.isEditor)
            {
                KResoourceLoadedAssetDebugger.Create("Material", Url, Mat);
            }
            OnFinish(Mat);
        }
Example #2
0
        protected override void Init(string url, params object[] args)
        {
            base.Init(url, args);

            _assetFileBridge = KAssetFileLoader.Load(url, (isOk, asset) =>
            {
                if (IsReadyDisposed) // 中途释放
                {
                    OnFinish(null);
                    return;
                }
                if (!isOk)
                {
                    OnFinish(null);
                    Log.Error("[InstanceAssetLoader]Error on assetfilebridge loaded... {0}", url);
                    return;
                }

                try
                {
                    InstanceAsset = (GameObject)GameObject.Instantiate(asset as UnityEngine.GameObject);
                }
                catch (Exception e)
                {
                    Log.LogException(e);
                }

                if (Application.isEditor)
                {
                    KResoourceLoadedAssetDebugger.Create("AssetCopy", url, InstanceAsset);
                }

                OnFinish(InstanceAsset);
            });
        }
Example #3
0
        protected override void Init(string url, params object[] args)
        {
            base.Init(url, args);

            Path            = url;
            AssetFileBridge = KAssetFileLoader.Load(Path, OnAssetLoaded);
        }
Example #4
0
 //仅仅是预加载,回调仅告知是否加载成功
 public static KAssetFileLoader Preload(string path, System.Action <bool> callback = null)
 {
     return(KAssetFileLoader.Load(path, (isOk, asset) =>
     {
         if (callback != null)
         {
             callback(isOk);
         }
     }));
 }
Example #5
0
        //仅仅是预加载,回调仅告知是否加载成功
        public static IEnumerator CoPreload(string path, System.Action <bool> callback = null)
        {
            var w = KAssetFileLoader.Load(path, null);

            while (!w.IsCompleted)
            {
                yield return(null);
            }

            if (callback != null)
            {
                callback(!w.IsError); // isOk?
            }
        }
Example #6
0
        protected override void Init(string path, params object[] args)
        {
            var loaderMode = (LoaderMode)args[0];

            base.Init(path, args);
            if (string.IsNullOrEmpty(path))
            {
                Log.Error("StaticAssetLoader 空资源路径!");
            }

            _assetFileLoader = KAssetFileLoader.Load(path, (_isOk, _obj) =>
            {
                OnFinish(_obj);

                if (Application.isEditor)
                {
                    if (TheAsset != null)
                    {
                        KResoourceLoadedAssetDebugger.Create("StaticAsset", path, TheAsset);
                    }
                }
            }, loaderMode);
        }
Example #7
0
        protected override void Init(string url, params object[] args)
        {
            base.Init(url, args);

            AssetFileBridge = KAssetFileLoader.Load(url, (bool isOk, UnityEngine.Object obj) => { OnFinish(obj); });
        }
Example #8
0
        /// <summary>
        /// load asset bundle immediatly
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static KAbstractResourceLoader LoadBundle(string path, KAssetFileLoader.AssetFileBridgeDelegate callback = null)
        {
            var request = KAssetFileLoader.Load(path, callback, LoaderMode.Sync);

            return(request);
        }
Example #9
0
        /// <summary>
        /// Load Async Asset Bundle
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static KAbstractResourceLoader LoadBundleAsync(string path)
        {
            var request = KAssetFileLoader.Load(path);

            return(request);
        }
Example #10
0
        protected override void Init(string url, params object[] args)
        {
            base.Init(url, args);

            _bridge = KAssetFileLoader.Load(Url, (_isOk, _obj) => { OnFinish(_obj); });
        }