コード例 #1
0
        private IEnumerator LoadAssetBundleByRecursive(string abName)
        {
            if (relationContainer == null)
            {
                yield break;
            }
            if (!relationContainer.ContainsKey(abName))
            {
                relationContainer.Add(abName, new ABRelation(abName));
            }
            var relation     = relationContainer[abName];
            var dependencies = ABManifestLoader.GetInstance().GetAllDependencies(abName);

            foreach (var item in dependencies)
            {
                relation.AddDependence(item);
                yield return(LoadReferenceByRecursive(item, abName));
            }

            if (loaderContainer == null)
            {
                yield break;
            }
            if (!loaderContainer.ContainsKey(abName))
            {
                loaderContainer.Add(abName, ABLoaderManager.Create(abName, manifest.GetAssetBundleHash(abName)));
            }
            yield return(loaderContainer[abName].LoadAssetBundle());
        }
コード例 #2
0
        public IEnumerator DownloadAssetBundle()
        {
            yield return(WaitUntilMainifestLoad());

            foreach (var abName in ABManifestLoader.GetInstance().AssetBundleList)
            {
                var sceneName = abName.Substring(0, abName.IndexOf("/"));
                StartCoroutine(LoadAssetBundle(sceneName, abName));
            }
            while (ABLoaderManager.GetDownloadProgress() < 1)
            {
                yield return(null);
            }
            Resources.UnloadUnusedAssets();
            System.GC.Collect();
        }
コード例 #3
0
 public void Dispose()
 {
     try
     {
         foreach (var abName in loaderContainer.Keys)
         {
             ABLoaderManager.Dispose(abName);
         }
     }
     finally
     {
         loaderContainer.Clear();
         loaderContainer = null;
         relationContainer.Clear();
         relationContainer = null;
         onLoadCompleted   = null;
         Resources.UnloadUnusedAssets();
         System.GC.Collect();
     }
 }