public void Init(IHotUpdatePath pather, IOriginAssetBundleUtil originConstData, IAssetConstUtil assetConstUtil) { // Debug.Log(assetConstUtil.GetType().FullName); Assert.IsNotNull(assetConstUtil); Assert.IsNotNull(assetConstUtil.NameToPath); this._assetConstUtil = assetConstUtil; }
/// <summary> /// 同步添加依赖 /// </summary> /// <param name="_bundleName"></param> void AddBundleWithDependencies(string _bundleName, IOriginAssetBundleUtil originAssetBundleUtil) { //如果已经加载过,就无需在加载 if (HeldedBundles.ContainsKey(_bundleName)) { return; } //获取依赖 var dependences = manifestReader.GetBundleDependencies(_bundleName); //如果没有依赖,直接加载自己,然后返回 if (null == dependences) { loadLoaderTool.LoadFile(originAssetBundleUtil.NameToPath[_bundleName]); return; } //如果有依赖,逐个添加依赖 foreach (var dependence in dependences) { //添加依赖,保证已经加载这个依赖 AddBundleWithDependencies(dependence, originAssetBundleUtil); //添加一次依赖 HeldedBundles[dependence].useTime++; } //如果有依赖,添加完依赖后,最后添加自己,这样,无论有没有以来,最后都会连自己都添加了 loadLoaderTool.LoadFile(originAssetBundleUtil.NameToPath[_bundleName]); }
internal AssetBundleLoaderTool(Action <AssetBundle> onLoadEveryComplete, AssetBundleDownLoader version, IHotUpdatePath updatePath, IOriginAssetBundleUtil originAssetBundleUtil) { this.pather = updatePath; this.onLoadEveryComplete = onLoadEveryComplete; this.version = version; this._originAssetBundleUtil = originAssetBundleUtil; }
public static void Init(IResourceLoader resourceLoader, IHotUpdatePath pather, IOriginAssetBundleUtil originConstData, IAssetConstUtil assetConstUtil) { Assert.IsNotNull(resourceLoader); _resourceLoader = resourceLoader; // Debug.Log("初始化"); _resourceLoader.Init(pather, originConstData, assetConstUtil); }
public void Init(IHotUpdatePath pather, IOriginAssetBundleUtil originConstData, IAssetConstUtil assetConstUtil) { if (null == pather) { return; } if (null == originConstData) { return; } this.originBundleConst = originConstData; this.pather = pather; assetBundleLoader = new AssetBundleLoader(); MainLoop.Instance.StartCoroutine(assetBundleLoader.StartBundleManager(pather, originConstData)); }
/// <summary> /// 开启整个工作流程 /// </summary> /// <returns></returns> internal IEnumerator StartBundleManager(IHotUpdatePath pather, IOriginAssetBundleUtil originAssetBundleUtil = null) { this._originAssetBundleUtil = originAssetBundleUtil; manifestReader = new ManifestReader(pather); yield return(manifestReader.LoadManifest()); if (!string.IsNullOrEmpty(pather.WebServeMainManifest)) { assetBundleDownLoader = new AssetBundleDownLoader(pather); } loadLoaderTool = new AssetBundleLoaderTool(OnAddAssetBundle, assetBundleDownLoader, pather, originAssetBundleUtil); if (!string.IsNullOrEmpty(pather.WebServeMainManifest)) { yield return(assetBundleDownLoader.CheckVersionAndUpdate()); } }