public virtual void Load(AssetsCompleteHandler completeHandler, ProgressHandler progressHandler, ErrorHandler errorHandler, bool useWWW = false, bool fromCache = true, bool sync = false) { this.completeHandler = completeHandler; this.progressHandler = progressHandler; this.errorHandler = errorHandler; AssetsProxy assetsProxy = AssetsManager.GetAssetBundle(this.assetBundleName); if (assetsProxy != null) { this.completeHandler?.Invoke(this, assetsProxy); return; } if (Application.isEditor) { fromCache = false; } this._canceled = false; if (!this._isManifest) { string[] dependencies = GAssetBundleManifest.GetAllDependencies(this.assetBundleName); if (dependencies != null && dependencies.Length > 0) { int count = dependencies.Length; List <string> dependenciesNotLoaded = new List <string>(); for (int i = 0; i < count; i++) { dependencies[i] = AssetsManager.RemapVariantName(dependencies[i]); AssetsProxy dAssetsProxy = AssetsManager.GetAssetBundle(dependencies[i]); if (dAssetsProxy == null) { dependenciesNotLoaded.Add(dependencies[i]); } } if (dependenciesNotLoaded.Count == 0) { this.LoadAsset(useWWW, fromCache, sync); } else { SyncTask.Create(this.LoadDependenciesInternal(dependenciesNotLoaded, useWWW, fromCache, sync)); } } else { this.LoadAsset(useWWW, fromCache, sync); } } else { this.LoadAsset(useWWW, fromCache, sync); } }
public void Load(AssetsCompleteHandler completeHandler, ProgressHandler progressHandler, ErrorHandler errorHandler, bool useWWW = false, bool fromCache = true, bool sync = false) { this.completeHandler = completeHandler; this.progressHandler = progressHandler; this.errorHandler = errorHandler; this.Cancel(); this._batch = new LoadBatch(fromCache, sync); this._batch.Add(new AssetsLoader(this._assetBundleName, string.Empty, null, AssetsLoader.CacheType.NoCache)); this._batch.Add(new AssetsLoader(this._assetBundleName + "_res", string.Empty, null, AssetsLoader.CacheType.NoCache)); this._batch.Start(this.OnInternalComplete, this.OnInternalProgress, this.OnInternalError, this.OnInternalSingleComplete); }
public override void Load(AssetsCompleteHandler completeHandler, ProgressHandler progressHandler, ErrorHandler errorHandler, bool useWWW = false, bool fromCache = true, bool sync = false) { this.completeHandler = completeHandler; this.progressHandler = progressHandler; this.errorHandler = errorHandler; this._canceled = false; if (string.IsNullOrEmpty(this.assetBundleName)) { SyncTask.Create(this.LoadSceneAsync(this.assetName, this._loadSceneMode, sync)); } else { if (Application.isEditor) { fromCache = false; } string[] dependencies = GAssetBundleManifest.GetAllDependencies(this.assetBundleName); if (dependencies != null && dependencies.Length > 0) { int count = dependencies.Length; List <string> dependenciesNotLoaded = new List <string>(); for (int i = 0; i < count; i++) { dependencies[i] = AssetsManager.RemapVariantName(dependencies[i]); AssetsProxy dAssetsProxy = AssetsManager.GetAssetBundle(dependencies[i]); if (dAssetsProxy == null) { dependenciesNotLoaded.Add(dependencies[i]); } } if (dependenciesNotLoaded.Count == 0) { this.LoadAsset(useWWW, fromCache, sync); } else { SyncTask.Create(this.LoadDependenciesInternal(dependenciesNotLoaded, useWWW, fromCache, sync)); } } else { this.LoadAsset(useWWW, fromCache, sync); } } }