Ejemplo n.º 1
0
        public IEnumerator LoadAssetBundle(string sceneName, string abName, ABLoadCompleted onLoadCompleted = null)
        {
            if (string.IsNullOrEmpty(sceneName) || string.IsNullOrEmpty(abName))
            {
                Debug.LogError(GetType() + "/LoadAssetBundle()/sceneName or abName is null, please check it!");
                yield return(null);
            }

            yield return(WaitUntilMainifestLoad());

            if (!ABManifestLoader.GetInstance().HasAssetBundle(abName))
            {
                yield break;
            }

            if (!container.ContainsKey(sceneName))
            {
                container.Add(sceneName, new MultiABLoader(abName, manifest, onLoadCompleted));
            }

            var loader = container[sceneName];

            if (loader == null)
            {
                Debug.LogError(GetType() + "/LoadAssetBundle()/MultiABLoader is null, please check it!");
            }
            yield return(loader.LoadAssetBundle(abName));
        }
Ejemplo n.º 2
0
 public MultiABLoader(string abName, AssetBundleManifest manifest, ABLoadCompleted onLoadCompleted = null)
 {
     loaderContainer      = new Dictionary <string, ABLoader>();
     relationContainer    = new Dictionary <string, ABRelation>();
     this.manifest        = manifest;
     this.onLoadCompleted = onLoadCompleted;
 }
Ejemplo n.º 3
0
 public ABLoader(string abName, Hash128 abHash = new Hash128(), ABLoadStart onLoadStart = null, ABLoadUpdate onLoadUpdate = null, ABLoadCompleted onLoadCompleted = null)
 {
     assetLoader          = null;
     this.abName          = abName;
     this.abHash          = abHash;
     this.onLoadStart     = onLoadStart;
     this.onLoadUpdate    = onLoadUpdate;
     this.onLoadCompleted = onLoadCompleted;
     abDownLoadPath       = PathsUtility.GetWWWPath() + "/" + this.abName;
 }
Ejemplo n.º 4
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();
     }
 }