From dcd44756177053a0a8d70a6ca262e62af31a8244 Mon Sep 17 00:00:00 2001 From: hevinci Date: Sat, 6 Aug 2022 11:23:43 +0800 Subject: [PATCH] Fix #34 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复一个拼写错误 --- .../Handles/AssetOperationHandle.cs | 2 +- .../Handles/SceneOperationHandle.cs | 6 ++-- .../DownloadSystem/PatchCacheVerifier.cs | 4 +-- .../OperationSystem/OperationSystem.cs | 2 +- .../Operations/DownloaderOperation.cs | 2 +- .../Operations/UpdatePackageOperation.cs | 2 +- .../Runtime/PatchSystem/PatchBundle.cs | 11 +++++++ .../PlayMode/EditorSimulateModeImpl.cs | 2 +- .../PatchSystem/PlayMode/HostPlayModeImpl.cs | 18 +++++------ .../PlayMode/OfflinePlayModeImpl.cs | 2 +- Assets/YooAsset/Runtime/YooAssets.cs | 30 +++++++++---------- 11 files changed, 46 insertions(+), 35 deletions(-) diff --git a/Assets/YooAsset/Runtime/AssetSystem/Handles/AssetOperationHandle.cs b/Assets/YooAsset/Runtime/AssetSystem/Handles/AssetOperationHandle.cs index b5f9dc5..20cf027 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Handles/AssetOperationHandle.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Handles/AssetOperationHandle.cs @@ -149,7 +149,7 @@ namespace YooAsset private InstantiateOperation InstantiateAsyncInternal(Vector3 position, Quaternion rotation, Transform parent, bool setPositionRotation) { InstantiateOperation operation = new InstantiateOperation(this, position, rotation, parent, setPositionRotation); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } } diff --git a/Assets/YooAsset/Runtime/AssetSystem/Handles/SceneOperationHandle.cs b/Assets/YooAsset/Runtime/AssetSystem/Handles/SceneOperationHandle.cs index 53d5eca..71fae54 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Handles/SceneOperationHandle.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Handles/SceneOperationHandle.cs @@ -102,7 +102,7 @@ namespace YooAsset { string error = $"{nameof(SceneOperationHandle)} is invalid."; var operation = new UnloadSceneOperation(error); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } @@ -112,7 +112,7 @@ namespace YooAsset string error = $"Cannot unload main scene. Use {nameof(YooAssets.LoadSceneAsync)} method to change the main scene !"; YooLogger.Error(error); var operation = new UnloadSceneOperation(error); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } @@ -121,7 +121,7 @@ namespace YooAsset AssetSystem.UnloadSubScene(Provider); { var operation = new UnloadSceneOperation(sceneObject); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } } diff --git a/Assets/YooAsset/Runtime/DownloadSystem/PatchCacheVerifier.cs b/Assets/YooAsset/Runtime/DownloadSystem/PatchCacheVerifier.cs index 5144acd..2a50218 100644 --- a/Assets/YooAsset/Runtime/DownloadSystem/PatchCacheVerifier.cs +++ b/Assets/YooAsset/Runtime/DownloadSystem/PatchCacheVerifier.cs @@ -55,7 +55,7 @@ namespace YooAsset // 注意:如果是APP资源并且哈希值相同,则不需要下载 if (appPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) { - if (appPatchBundle.IsBuildin && appPatchBundle.FileHash == patchBundle.FileHash) + if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) continue; } @@ -180,7 +180,7 @@ namespace YooAsset // 注意:如果是APP资源并且哈希值相同,则不需要下载 if (appPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) { - if (appPatchBundle.IsBuildin && appPatchBundle.FileHash == patchBundle.FileHash) + if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) continue; } diff --git a/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs b/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs index 6442e46..cf05a69 100644 --- a/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs +++ b/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs @@ -59,7 +59,7 @@ namespace YooAsset /// /// 开始处理异步操作类 /// - public static void StartOperaiton(AsyncOperationBase operationBase) + public static void StartOperation(AsyncOperationBase operationBase) { _operations.Add(operationBase); operationBase.Start(); diff --git a/Assets/YooAsset/Runtime/PatchSystem/Operations/DownloaderOperation.cs b/Assets/YooAsset/Runtime/PatchSystem/Operations/DownloaderOperation.cs index 5b155c5..bbcd688 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/Operations/DownloaderOperation.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/Operations/DownloaderOperation.cs @@ -205,7 +205,7 @@ namespace YooAsset { if (_steps == ESteps.None) { - OperationSystem.StartOperaiton(this); + OperationSystem.StartOperation(this); } } diff --git a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageOperation.cs b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageOperation.cs index 827dff4..d3b3e25 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageOperation.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageOperation.cs @@ -205,7 +205,7 @@ namespace YooAsset // 注意:如果是APP资源并且哈希值相同,则不需要下载 if (_impl.AppPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) { - if (appPatchBundle.IsBuildin && appPatchBundle.FileHash == patchBundle.FileHash) + if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) continue; } diff --git a/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs b/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs index 0efbc15..8b00fd4 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs @@ -160,5 +160,16 @@ namespace YooAsset else return false; } + + /// + /// 检测资源包文件内容是否相同 + /// + public bool Equals(PatchBundle otherBundle) + { + if (FileHash == otherBundle.FileHash) + return true; + + return false; + } } } \ No newline at end of file diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs index cb116d8..0147a7a 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs @@ -16,7 +16,7 @@ namespace YooAsset { _locationToLower = locationToLower; var operation = new EditorSimulateModeInitializationOperation(this, simulatePatchManifestPath); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs index 11a232b..04f56fc 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs @@ -33,7 +33,7 @@ namespace YooAsset _fallbackHostServer = fallbackHostServer; var operation = new HostPlayModeInitializationOperation(this); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } @@ -43,7 +43,7 @@ namespace YooAsset public UpdateStaticVersionOperation UpdateStaticVersionAsync(int timeout) { var operation = new HostPlayModeUpdateStaticVersionOperation(this, timeout); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } @@ -53,7 +53,7 @@ namespace YooAsset public UpdateManifestOperation UpdatePatchManifestAsync(int resourceVersion, int timeout) { var operation = new HostPlayModeUpdateManifestOperation(this, resourceVersion, timeout); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } @@ -63,7 +63,7 @@ namespace YooAsset public UpdateManifestOperation WeaklyUpdatePatchManifestAsync(int resourceVersion) { var operation = new HostPlayModeWeaklyUpdateManifestOperation(this, resourceVersion); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } @@ -73,7 +73,7 @@ namespace YooAsset public UpdatePackageOperation UpdatePackageAsync(int resourceVersion, int timeout) { var operation = new HostPlayModeUpdatePackageOperation(this, resourceVersion, timeout); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } @@ -138,7 +138,7 @@ namespace YooAsset // 注意:如果是APP资源并且哈希值相同,则不需要下载 if (AppPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) { - if (appPatchBundle.IsBuildin && appPatchBundle.FileHash == patchBundle.FileHash) + if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) continue; } @@ -170,7 +170,7 @@ namespace YooAsset // 注意:如果是APP资源并且哈希值相同,则不需要下载 if (AppPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) { - if (appPatchBundle.IsBuildin && appPatchBundle.FileHash == patchBundle.FileHash) + if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) continue; } @@ -240,7 +240,7 @@ namespace YooAsset // 注意:如果是APP资源并且哈希值相同,则不需要下载 if (AppPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) { - if (appPatchBundle.IsBuildin && appPatchBundle.FileHash == patchBundle.FileHash) + if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) continue; } @@ -386,7 +386,7 @@ namespace YooAsset // 查询APP资源 if (AppPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) { - if (appPatchBundle.IsBuildin && appPatchBundle.FileHash == patchBundle.FileHash) + if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) { BundleInfo bundleInfo = new BundleInfo(appPatchBundle, BundleInfo.ELoadMode.LoadFromStreaming); return bundleInfo; diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs index 8a711d6..d5dd47c 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs @@ -16,7 +16,7 @@ namespace YooAsset { _locationToLower = locationToLower; var operation = new OfflinePlayModeInitializationOperation(this); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs index 6d5c3d1..399fcf5 100644 --- a/Assets/YooAsset/Runtime/YooAssets.cs +++ b/Assets/YooAsset/Runtime/YooAssets.cs @@ -261,13 +261,13 @@ namespace YooAsset if (_playMode == EPlayMode.EditorSimulateMode) { var operation = new EditorPlayModeUpdateStaticVersionOperation(); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } else if (_playMode == EPlayMode.OfflinePlayMode) { var operation = new OfflinePlayModeUpdateStaticVersionOperation(); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } else if (_playMode == EPlayMode.HostPlayMode) @@ -291,13 +291,13 @@ namespace YooAsset if (_playMode == EPlayMode.EditorSimulateMode) { var operation = new EditorPlayModeUpdateManifestOperation(); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } else if (_playMode == EPlayMode.OfflinePlayMode) { var operation = new OfflinePlayModeUpdateManifestOperation(); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } else if (_playMode == EPlayMode.HostPlayMode) @@ -321,13 +321,13 @@ namespace YooAsset if (_playMode == EPlayMode.EditorSimulateMode) { var operation = new EditorPlayModeUpdateManifestOperation(); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } else if (_playMode == EPlayMode.OfflinePlayMode) { var operation = new OfflinePlayModeUpdateManifestOperation(); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } else if (_playMode == EPlayMode.HostPlayMode) @@ -344,9 +344,9 @@ namespace YooAsset /// 开启一个异步操作 /// /// 异步操作对象 - public static void StartOperaiton(GameAsyncOperation operation) + public static void StartOperation(GameAsyncOperation operation) { - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); } /// @@ -512,7 +512,7 @@ namespace YooAsset if (assetInfo.IsInvalid) { RawFileOperation operation = new CompletedRawFileOperation(assetInfo.Error, copyPath); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } @@ -522,26 +522,26 @@ namespace YooAsset string error = $"Cannot load asset bundle file using {nameof(GetRawFileAsync)} interfaces !"; YooLogger.Warning(error); RawFileOperation operation = new CompletedRawFileOperation(error, copyPath); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } if (_playMode == EPlayMode.EditorSimulateMode) { RawFileOperation operation = new EditorPlayModeRawFileOperation(bundleInfo, copyPath); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } else if (_playMode == EPlayMode.OfflinePlayMode) { RawFileOperation operation = new OfflinePlayModeRawFileOperation(bundleInfo, copyPath); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } else if (_playMode == EPlayMode.HostPlayMode) { RawFileOperation operation = new HostPlayModeRawFileOperation(bundleInfo, copyPath); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } else @@ -959,13 +959,13 @@ namespace YooAsset if (_playMode == EPlayMode.EditorSimulateMode) { var operation = new EditorPlayModeUpdatePackageOperation(); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } else if (_playMode == EPlayMode.OfflinePlayMode) { var operation = new OfflinePlayModeUpdatePackageOperation(); - OperationSystem.StartOperaiton(operation); + OperationSystem.StartOperation(operation); return operation; } else if (_playMode == EPlayMode.HostPlayMode)