Ejemplo n.º 1
0
        public override bool LoadSync()
        {
            if (!CheckLoadAble())
            {
                return(false);
            }

            resState = eResState.kLoading;

            //TimeDebugger timer = ResMgr.S.timeDebugger;

            string url = ProjectPathConfig.AssetBundleName2Url(m_Name);

            //timer.Begin("LoadSync AssetBundle:" + m_Name);
            AssetBundle bundle = AssetBundle.LoadFromFile(url);

            //timer.End();

            m_UnloadFlag = true;

            if (bundle == null)
            {
                Log.e("Failed Load AssetBundle:" + m_Name);
                OnResLoadFaild();
                return(false);
            }

            assetBundle = bundle;
            resState    = eResState.kReady;
            ++s_ActiveCount;
            //Log.i(string.Format("Load AssetBundle Success.ID:{0}, Name:{1}", bundle.GetInstanceID(), bundle.name));

            //timer.Dump(-1);
            return(true);
        }
Ejemplo n.º 2
0
        public override IEnumerator StartIEnumeratorTask(Action finishCallback)
        {
            //开启的时候已经结束了
            if (refCount <= 0)
            {
                OnResLoadFaild();
                finishCallback();
                yield break;
            }

            string url = ProjectPathConfig.AssetBundleName2Url(m_Name);

            AssetBundleCreateRequest abcR = AssetBundle.LoadFromFileAsync(url);

            m_AssetBundleCreateRequest = abcR;
            yield return(abcR);

            m_AssetBundleCreateRequest = null;

            if (!abcR.isDone)
            {
                Log.e("AssetBundleCreateRequest Not Done! Path:" + m_Name);
                OnResLoadFaild();
                finishCallback();
                yield break;
            }

            assetBundle = abcR.assetBundle;

            resState = eResState.kReady;
            ++s_ActiveCount;

            finishCallback();
        }