diff --git a/Assets/YooAsset/Runtime/PatchSystem/Operations/CheckPackageContentsOperation.cs b/Assets/YooAsset/Runtime/PatchSystem/Operations/CheckPackageContentsOperation.cs index 922d6aa..06076c7 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/Operations/CheckPackageContentsOperation.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/Operations/CheckPackageContentsOperation.cs @@ -71,7 +71,7 @@ namespace YooAsset if (_steps == ESteps.CheckLoadedManifest) { - if (_impl.LocalPatchManifest == null) + if (_impl.ActivePatchManifest == null) { _steps = ESteps.Done; Status = EOperationStatus.Failed; @@ -88,7 +88,7 @@ namespace YooAsset #if UNITY_WEBGL _verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices); #else - _verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices); + _verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.ActivePatchManifest, _impl.QueryServices); #endif OperationSystem.StartOperation(_verifyOperation); diff --git a/Assets/YooAsset/Runtime/PatchSystem/Operations/InitializationOperation.cs b/Assets/YooAsset/Runtime/PatchSystem/Operations/InitializationOperation.cs index e461712..f5e3b70 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/Operations/InitializationOperation.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/Operations/InitializationOperation.cs @@ -70,7 +70,7 @@ namespace YooAsset { var manifest = _deserializer.Manifest; InitializedPackageVersion = manifest.PackageVersion; - _impl.SetSimulatePatchManifest(manifest); + _impl.SetActivePatchManifest(manifest); _steps = ESteps.Done; Status = EOperationStatus.Succeed; } @@ -160,7 +160,7 @@ namespace YooAsset else { InitializedPackageVersion = manifest.PackageVersion; - _impl.SetAppPatchManifest(manifest); + _impl.SetActivePatchManifest(manifest); _steps = ESteps.StartVerifyOperation; } } @@ -170,7 +170,7 @@ namespace YooAsset #if UNITY_WEBGL _verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.AppPatchManifest, null); #else - _verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.AppPatchManifest, null); + _verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.ActivePatchManifest, null); #endif OperationSystem.StartOperation(_verifyOperation); @@ -263,7 +263,7 @@ namespace YooAsset if (manifest != null) { InitializedPackageVersion = manifest.PackageVersion; - _impl.SetLocalPatchManifest(manifest); + _impl.SetActivePatchManifest(manifest); _steps = ESteps.StartVerifyOperation; } else @@ -332,7 +332,7 @@ namespace YooAsset else { InitializedPackageVersion = manifest.PackageVersion; - _impl.SetLocalPatchManifest(manifest); + _impl.SetActivePatchManifest(manifest); _steps = ESteps.StartVerifyOperation; } } @@ -342,7 +342,7 @@ namespace YooAsset #if UNITY_WEBGL _verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices); #else - _verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices); + _verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.ActivePatchManifest, _impl.QueryServices); #endif OperationSystem.StartOperation(_verifyOperation); diff --git a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageManifestOperation.cs b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageManifestOperation.cs index bf30b4f..02e038b 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageManifestOperation.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageManifestOperation.cs @@ -191,7 +191,7 @@ namespace YooAsset { if (_deserializer.Status == EOperationStatus.Succeed) { - _impl.SetLocalPatchManifest(_deserializer.Manifest); + _impl.SetActivePatchManifest(_deserializer.Manifest); FoundNewManifest = true; _steps = ESteps.StartVerifyOperation; } @@ -209,7 +209,7 @@ namespace YooAsset #if UNITY_WEBGL _verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices); #else - _verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices); + _verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.ActivePatchManifest, _impl.QueryServices); #endif OperationSystem.StartOperation(_verifyOperation); diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs index fcdb5ee..42fe55a 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs @@ -6,7 +6,7 @@ namespace YooAsset { internal class EditorSimulateModeImpl : IBundleServices { - private PatchManifest _simulatePatchManifest; + public PatchManifest ActivePatchManifest { private set; get; } private bool _locationToLower; /// @@ -25,15 +25,15 @@ namespace YooAsset /// public string GetPackageVersion() { - if (_simulatePatchManifest == null) + if (ActivePatchManifest == null) return string.Empty; - return _simulatePatchManifest.PackageVersion; + return ActivePatchManifest.PackageVersion; } - internal void SetSimulatePatchManifest(PatchManifest patchManifest) + internal void SetActivePatchManifest(PatchManifest patchManifest) { - _simulatePatchManifest = patchManifest; - _simulatePatchManifest.InitAssetPathMapping(_locationToLower); + ActivePatchManifest = patchManifest; + ActivePatchManifest.InitAssetPathMapping(_locationToLower); } #region IBundleServices接口 @@ -43,7 +43,7 @@ namespace YooAsset throw new Exception("Should never get here !"); // 注意:如果补丁清单里未找到资源包会抛出异常! - var patchBundle = _simulatePatchManifest.GetMainPatchBundle(assetInfo.AssetPath); + var patchBundle = ActivePatchManifest.GetMainPatchBundle(assetInfo.AssetPath); BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromEditor, assetInfo.AssetPath); return bundleInfo; } @@ -53,34 +53,34 @@ namespace YooAsset } AssetInfo[] IBundleServices.GetAssetInfos(string[] tags) { - return _simulatePatchManifest.GetAssetsInfoByTags(tags); + return ActivePatchManifest.GetAssetsInfoByTags(tags); } PatchAsset IBundleServices.TryGetPatchAsset(string assetPath) { - if (_simulatePatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset)) + if (ActivePatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset)) return patchAsset; else return null; } string IBundleServices.MappingToAssetPath(string location) { - return _simulatePatchManifest.MappingToAssetPath(location); + return ActivePatchManifest.MappingToAssetPath(location); } string IBundleServices.TryMappingToAssetPath(string location) { - return _simulatePatchManifest.TryMappingToAssetPath(location); + return ActivePatchManifest.TryMappingToAssetPath(location); } string IBundleServices.GetPackageName() { - return _simulatePatchManifest.PackageName; + return ActivePatchManifest.PackageName; } bool IBundleServices.IsIncludeBundleFile(string fileName) { - return _simulatePatchManifest.IsIncludeBundleFile(fileName); + return ActivePatchManifest.IsIncludeBundleFile(fileName); } bool IBundleServices.IsServicesValid() { - return _simulatePatchManifest != null; + return ActivePatchManifest != null; } #endregion } diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs index fc88644..8724731 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs @@ -8,7 +8,7 @@ namespace YooAsset internal class HostPlayModeImpl : IBundleServices { // 补丁清单 - internal PatchManifest LocalPatchManifest { private set; get; } + public PatchManifest ActivePatchManifest { private set; get; } // 参数相关 private bool _locationToLower; @@ -36,9 +36,9 @@ namespace YooAsset /// public string GetPackageVersion() { - if (LocalPatchManifest == null) + if (ActivePatchManifest == null) return string.Empty; - return LocalPatchManifest.PackageVersion; + return ActivePatchManifest.PackageVersion; } /// @@ -86,7 +86,7 @@ namespace YooAsset /// public PatchDownloaderOperation CreatePatchDownloaderByAll(int fileLoadingMaxNumber, int failedTryAgain, int timeout) { - YooLogger.Log($"Create patch downloader : {LocalPatchManifest.PackageName} {LocalPatchManifest.PackageVersion}"); + YooLogger.Log($"Create patch downloader : {ActivePatchManifest.PackageName} {ActivePatchManifest.PackageVersion}"); List downloadList = GetDownloadListByAll(); var operation = new PatchDownloaderOperation(downloadList, fileLoadingMaxNumber, failedTryAgain, timeout); return operation; @@ -94,7 +94,7 @@ namespace YooAsset private List GetDownloadListByAll() { List downloadList = new List(1000); - foreach (var patchBundle in LocalPatchManifest.BundleList) + foreach (var patchBundle in ActivePatchManifest.BundleList) { // 忽略缓存文件 if (CacheSystem.IsCached(patchBundle)) @@ -115,7 +115,7 @@ namespace YooAsset /// public PatchDownloaderOperation CreatePatchDownloaderByTags(string[] tags, int fileLoadingMaxNumber, int failedTryAgain, int timeout) { - YooLogger.Log($"Create patch downloader : {LocalPatchManifest.PackageName} {LocalPatchManifest.PackageVersion}"); + YooLogger.Log($"Create patch downloader : {ActivePatchManifest.PackageName} {ActivePatchManifest.PackageVersion}"); List downloadList = GetDownloadListByTags(tags); var operation = new PatchDownloaderOperation(downloadList, fileLoadingMaxNumber, failedTryAgain, timeout); return operation; @@ -123,7 +123,7 @@ namespace YooAsset private List GetDownloadListByTags(string[] tags) { List downloadList = new List(1000); - foreach (var patchBundle in LocalPatchManifest.BundleList) + foreach (var patchBundle in ActivePatchManifest.BundleList) { // 忽略缓存文件 if (CacheSystem.IsCached(patchBundle)) @@ -156,7 +156,7 @@ namespace YooAsset /// public PatchDownloaderOperation CreatePatchDownloaderByPaths(AssetInfo[] assetInfos, int fileLoadingMaxNumber, int failedTryAgain, int timeout) { - YooLogger.Log($"Create patch downloader : {LocalPatchManifest.PackageName} {LocalPatchManifest.PackageVersion}"); + YooLogger.Log($"Create patch downloader : {ActivePatchManifest.PackageName} {ActivePatchManifest.PackageVersion}"); List downloadList = GetDownloadListByPaths(assetInfos); var operation = new PatchDownloaderOperation(downloadList, fileLoadingMaxNumber, failedTryAgain, timeout); return operation; @@ -174,12 +174,12 @@ namespace YooAsset } // 注意:如果补丁清单里未找到资源包会抛出异常! - PatchBundle mainBundle = LocalPatchManifest.GetMainPatchBundle(assetInfo.AssetPath); + PatchBundle mainBundle = ActivePatchManifest.GetMainPatchBundle(assetInfo.AssetPath); if (checkList.Contains(mainBundle) == false) checkList.Add(mainBundle); // 注意:如果补丁清单里未找到资源包会抛出异常! - PatchBundle[] dependBundles = LocalPatchManifest.GetAllDependencies(assetInfo.AssetPath); + PatchBundle[] dependBundles = ActivePatchManifest.GetAllDependencies(assetInfo.AssetPath); foreach (var dependBundle in dependBundles) { if (checkList.Contains(dependBundle) == false) @@ -209,7 +209,7 @@ namespace YooAsset /// public PatchUnpackerOperation CreatePatchUnpackerByTags(string[] tags, int fileUpackingMaxNumber, int failedTryAgain, int timeout) { - YooLogger.Log($"Create patch unpacker : {LocalPatchManifest.PackageName} {LocalPatchManifest.PackageVersion}"); + YooLogger.Log($"Create patch unpacker : {ActivePatchManifest.PackageName} {ActivePatchManifest.PackageVersion}"); List unpcakList = GetUnpackListByTags(tags); var operation = new PatchUnpackerOperation(unpcakList, fileUpackingMaxNumber, failedTryAgain, timeout); return operation; @@ -217,7 +217,7 @@ namespace YooAsset private List GetUnpackListByTags(string[] tags) { List downloadList = new List(1000); - foreach (var patchBundle in LocalPatchManifest.BundleList) + foreach (var patchBundle in ActivePatchManifest.BundleList) { // 忽略缓存文件 if (CacheSystem.IsCached(patchBundle)) @@ -241,7 +241,7 @@ namespace YooAsset /// public PatchUnpackerOperation CreatePatchUnpackerByAll(int fileUpackingMaxNumber, int failedTryAgain, int timeout) { - YooLogger.Log($"Create patch unpacker : {LocalPatchManifest.PackageName} {LocalPatchManifest.PackageVersion}"); + YooLogger.Log($"Create patch unpacker : {ActivePatchManifest.PackageName} {ActivePatchManifest.PackageVersion}"); List unpcakList = GetUnpackListByAll(); var operation = new PatchUnpackerOperation(unpcakList, fileUpackingMaxNumber, failedTryAgain, timeout); return operation; @@ -249,7 +249,7 @@ namespace YooAsset private List GetUnpackListByAll() { List downloadList = new List(1000); - foreach (var patchBundle in LocalPatchManifest.BundleList) + foreach (var patchBundle in ActivePatchManifest.BundleList) { // 忽略缓存文件 if (CacheSystem.IsCached(patchBundle)) @@ -312,10 +312,10 @@ namespace YooAsset return bundleInfo; } - internal void SetLocalPatchManifest(PatchManifest patchManifest) + internal void SetActivePatchManifest(PatchManifest patchManifest) { - LocalPatchManifest = patchManifest; - LocalPatchManifest.InitAssetPathMapping(_locationToLower); + ActivePatchManifest = patchManifest; + ActivePatchManifest.InitAssetPathMapping(_locationToLower); } internal bool IsBuildinPatchBundle(PatchBundle patchBundle) { @@ -351,7 +351,7 @@ namespace YooAsset throw new Exception("Should never get here !"); // 注意:如果补丁清单里未找到资源包会抛出异常! - var patchBundle = LocalPatchManifest.GetMainPatchBundle(assetInfo.AssetPath); + var patchBundle = ActivePatchManifest.GetMainPatchBundle(assetInfo.AssetPath); return CreateBundleInfo(patchBundle); } BundleInfo[] IBundleServices.GetAllDependBundleInfos(AssetInfo assetInfo) @@ -360,7 +360,7 @@ namespace YooAsset throw new Exception("Should never get here !"); // 注意:如果补丁清单里未找到资源包会抛出异常! - var depends = LocalPatchManifest.GetAllDependencies(assetInfo.AssetPath); + var depends = ActivePatchManifest.GetAllDependencies(assetInfo.AssetPath); List result = new List(depends.Length); foreach (var patchBundle in depends) { @@ -371,34 +371,34 @@ namespace YooAsset } AssetInfo[] IBundleServices.GetAssetInfos(string[] tags) { - return LocalPatchManifest.GetAssetsInfoByTags(tags); + return ActivePatchManifest.GetAssetsInfoByTags(tags); } PatchAsset IBundleServices.TryGetPatchAsset(string assetPath) { - if (LocalPatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset)) + if (ActivePatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset)) return patchAsset; else return null; } string IBundleServices.MappingToAssetPath(string location) { - return LocalPatchManifest.MappingToAssetPath(location); + return ActivePatchManifest.MappingToAssetPath(location); } string IBundleServices.TryMappingToAssetPath(string location) { - return LocalPatchManifest.TryMappingToAssetPath(location); + return ActivePatchManifest.TryMappingToAssetPath(location); } string IBundleServices.GetPackageName() { - return LocalPatchManifest.PackageName; + return ActivePatchManifest.PackageName; } bool IBundleServices.IsIncludeBundleFile(string fileName) { - return LocalPatchManifest.IsIncludeBundleFile(fileName); + return ActivePatchManifest.IsIncludeBundleFile(fileName); } bool IBundleServices.IsServicesValid() { - return LocalPatchManifest != null; + return ActivePatchManifest != null; } #endregion } diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs index 9b4feb1..2d16fe3 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs @@ -7,7 +7,7 @@ namespace YooAsset { internal class OfflinePlayModeImpl : IBundleServices { - public PatchManifest AppPatchManifest { private set; get; } + public PatchManifest ActivePatchManifest { private set; get; } private bool _locationToLower; /// @@ -26,15 +26,15 @@ namespace YooAsset /// public string GetPackageVersion() { - if (AppPatchManifest == null) + if (ActivePatchManifest == null) return string.Empty; - return AppPatchManifest.PackageVersion; + return ActivePatchManifest.PackageVersion; } - internal void SetAppPatchManifest(PatchManifest patchManifest) + internal void SetActivePatchManifest(PatchManifest patchManifest) { - AppPatchManifest = patchManifest; - AppPatchManifest.InitAssetPathMapping(_locationToLower); + ActivePatchManifest = patchManifest; + ActivePatchManifest.InitAssetPathMapping(_locationToLower); } #region IBundleServices接口 @@ -62,7 +62,7 @@ namespace YooAsset throw new Exception("Should never get here !"); // 注意:如果补丁清单里未找到资源包会抛出异常! - var patchBundle = AppPatchManifest.GetMainPatchBundle(assetInfo.AssetPath); + var patchBundle = ActivePatchManifest.GetMainPatchBundle(assetInfo.AssetPath); return CreateBundleInfo(patchBundle); } BundleInfo[] IBundleServices.GetAllDependBundleInfos(AssetInfo assetInfo) @@ -71,7 +71,7 @@ namespace YooAsset throw new Exception("Should never get here !"); // 注意:如果补丁清单里未找到资源包会抛出异常! - var depends = AppPatchManifest.GetAllDependencies(assetInfo.AssetPath); + var depends = ActivePatchManifest.GetAllDependencies(assetInfo.AssetPath); List result = new List(depends.Length); foreach (var patchBundle in depends) { @@ -82,34 +82,34 @@ namespace YooAsset } AssetInfo[] IBundleServices.GetAssetInfos(string[] tags) { - return AppPatchManifest.GetAssetsInfoByTags(tags); + return ActivePatchManifest.GetAssetsInfoByTags(tags); } PatchAsset IBundleServices.TryGetPatchAsset(string assetPath) { - if (AppPatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset)) + if (ActivePatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset)) return patchAsset; else return null; } string IBundleServices.MappingToAssetPath(string location) { - return AppPatchManifest.MappingToAssetPath(location); + return ActivePatchManifest.MappingToAssetPath(location); } string IBundleServices.TryMappingToAssetPath(string location) { - return AppPatchManifest.TryMappingToAssetPath(location); + return ActivePatchManifest.TryMappingToAssetPath(location); } string IBundleServices.GetPackageName() { - return AppPatchManifest.PackageName; + return ActivePatchManifest.PackageName; } bool IBundleServices.IsIncludeBundleFile(string fileName) { - return AppPatchManifest.IsIncludeBundleFile(fileName); + return ActivePatchManifest.IsIncludeBundleFile(fileName); } bool IBundleServices.IsServicesValid() { - return AppPatchManifest != null; + return ActivePatchManifest != null; } #endregion }