public override bool LoadSync() { if (!CheckLoadAble()) { return(false); } resState = eResState.kLoading; //TimeDebugger timer = ResMgr.Instance.timeDebugger; string url = QFrameworkConfig.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; //Log.i(string.Format("Load AssetBundle Success.ID:{0}, Name:{1}", bundle.GetInstanceID(), bundle.name)); //timer.Dump(-1); return(true); }
public override IEnumerator StartIEnumeratorTask(Action finishCallback) { //开启的时候已经结束了 if (refCount <= 0) { OnResLoadFaild(); finishCallback(); yield break; } string url = QFrameworkConfig.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; finishCallback(); }