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()); }
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)); }
public static ABManifestLoader GetInstance() { if (instance == null) { instance = new ABManifestLoader(); } return(instance); }
private IEnumerator WaitUntilMainifestLoad() { while (!ABManifestLoader.GetInstance().IsLoadCompleted) { yield return(null); } manifest = ABManifestLoader.GetInstance().GetABManifest(); if (manifest == null) { Debug.LogError(GetType() + "/LoadAssetBundle()/manifest(field) is null, please make sure manifest file loaded first!"); yield return(null); } }
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(); }
private void Awake() { StartCoroutine(ABManifestLoader.GetInstance().LoadMainifestFile()); }
public override void InstallBindings() { Container.Bind <AssetBundleManager>().FromInstance(AssetBundleManager.GetInstance()).AsSingle(); Container.Bind <ABManifestLoader>().FromInstance(ABManifestLoader.GetInstance()).AsSingle(); }