string IBundleServices.GetAssetBundleLoadPath(string manifestPath) { // 尝试获取变体资源清单路径 manifestPath = _variantCollector.TryGetVariantManifestPath(manifestPath); // 从流文件夹内加载所有文件 return(AssetPathHelper.MakeStreamingLoadPath(manifestPath)); }
string IBundleServices.GetAssetBundleLoadPath(string manifestPath) { PatchManifest patchManifest; if (_patcher.WebPatchManifest != null) { patchManifest = _patcher.WebPatchManifest; } else { patchManifest = _patcher.SandboxPatchManifest; } // 尝试获取变体资源清单路径 manifestPath = _variantCollector.TryGetVariantManifestPath(manifestPath); // 注意:可能从APP内加载,也可能从沙盒内加载 PatchElement element; if (patchManifest.Elements.TryGetValue(manifestPath, out element)) { // 先查询APP内的资源 PatchElement appElement; if (_patcher.AppPatchManifest.Elements.TryGetValue(manifestPath, out appElement)) { if (appElement.MD5 == element.MD5) { return(AssetPathHelper.MakeStreamingLoadPath(manifestPath)); } } // 如果APP里不存在或者MD5不匹配,则从沙盒里加载 return(AssetPathHelper.MakePersistentLoadPath(manifestPath)); } else { PatchHelper.Log(ELogLevel.Warning, $"Not found element in patch manifest : {manifestPath}"); return(AssetPathHelper.MakeStreamingLoadPath(manifestPath)); } }
private string GetVariantManifestPath(PatchManifest patchManifest, string manifestPath) { if (_variantCollector == null) { return(manifestPath); } if (patchManifest.Elements.TryGetValue(manifestPath, out PatchElement element)) { // 如果是变体资源 string variant = element.GetFirstVariant(); if (string.IsNullOrEmpty(variant) == false) { manifestPath = _variantCollector.TryGetVariantManifestPath(manifestPath, variant); } return(manifestPath); } else { MotionLog.Warning($"Not found element in patch manifest : {manifestPath}"); return(manifestPath); } }
string IBundleServices.GetAssetBundleLoadPath(string manifestPath) { if (_patchManifest.Elements.TryGetValue(manifestPath, out PatchElement element)) { // 如果是变体资源 if (_variantCollector != null) { string variant = element.GetFirstVariant(); if (string.IsNullOrEmpty(variant) == false) { manifestPath = _variantCollector.TryGetVariantManifestPath(manifestPath, variant); } } // 直接从沙盒里加载 return(AssetPathHelper.MakeStreamingLoadPath(manifestPath)); } else { MotionLog.Warning($"Not found element in patch manifest : {manifestPath}"); return(AssetPathHelper.MakeStreamingLoadPath(manifestPath)); } }