private void LoadDepends(bool immediately, Action <bool> loadSelf) { if (depLoaderList == null) { depLoaderList = ListPool <ABLoader> .Get(); depObjectList = ListPool <ABObject> .Get(); for (int i = 0; i < abData.dependencies.Length; i++) { uint hash = abData.dependencies[i]; ABObject abObject = _loadContext.FindABObjectCache(hash); if (abObject != null) { abObject.ResetLifeTime(); depObjectList.Add(abObject); } else { ABLoader loader = GetLoader(hash, _loadContext); depLoaderList.Add(loader); } } } ABLoader depLoader; int loadDepCount = loadingDepCount = depLoaderList.Count; if (loadDepCount == 0) { loadSelf(immediately); } else { for (int i = 0; i < loadDepCount; i++) { depLoader = depLoaderList[i]; if (depLoader.isComplete) { continue; } depLoader.Load(immediately, (abObject) => { loadingDepCount--; if (loadingDepCount == 0 && state != ABLoadState.LoadingDep) { loadSelf(immediately); } }); } } }
/// <summary> /// 创建ABObject /// </summary> /// <returns></returns> private ABObject CreateABObject() { ABObject abObject = new ABObject(abName, abData, bundle); abObject.isReady = true; abObject.ResetLifeTime(); for (int i = 0; i < depObjectList.Count; i++) { abObject.AddDependency(depObjectList[i]); } for (int i = 0; i < depLoaderList.Count; i++) { abObject.AddDependency(depLoaderList[i].abObject); } return(abObject); }