Beispiel #1
0
        public IEnumerator LoadAssetBundle(string abName)
        {
            Debug.Log("Start load:" + abName);
            //已经加载过直接返回, 执行回调
            if (dicLoadCache.ContainsKey(abName))
            {
                CompleteLoadAB(abName);
                //yield return dicLoadCache[abName].LoadAssetBundle();
            }
            else
            {
                SingleAssetBundleLoader loader = new SingleAssetBundleLoader(abName, CompleteLoadAB);
                dicLoadCache.Add(abName, loader);
                //获取依赖关系
                string[] strDependeceArray = AssetBundleManifestLoader.GetInstance().GetDependce(abName);
                foreach (string item_depend in strDependeceArray)
                {
                    loader.Relation.AddDependence(item_depend);
                    //加载依赖项
                    yield return(LoadDepend(item_depend, loader));
                }

                yield return(loader.LoadAssetBundle());
            }
        }
 private void OnLoadComplete(string abName)
 {
     loader.DisposeAll();
     loader1 = new SingleAssetBundleLoader(abName, OnLoadComplete1);
     StartCoroutine(loader1.LoadAssetBundle());
 }
 void Start()
 {
     loader = new SingleAssetBundleLoader(abName, OnLoadComplete);
     StartCoroutine(loader.LoadAssetBundle());
 }