From aa3a0499855bbaa94ac1bc4111c1e495339e67cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E5=86=A0=E5=B3=B0?= Date: Thu, 26 Dec 2024 14:57:37 +0800 Subject: [PATCH] fix #414 --- .../DefaultBuildinFileSystem.cs | 17 +++++++++++++++-- .../Operation/DBFSInitializeOperation.cs | 10 +++++++++- .../internal/LoadBuildinCatalogFileOperation.cs | 2 +- .../FileSystem/FileSystemParametersDefine.cs | 1 + 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs index 8b4fb9a1..0bcd0aae 100644 --- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs @@ -63,6 +63,11 @@ namespace YooAsset /// public bool AppendFileExtension { private set; get; } = false; + /// + /// 自定义参数:禁用Catalog目录查询文件 + /// + public bool DisableCatalogFile { private set; get; } = false; + /// /// 自定义参数:解密方法类 /// @@ -138,6 +143,10 @@ namespace YooAsset { AppendFileExtension = (bool)value; } + else if (name == FileSystemParametersDefine.DISABLE_CATALOG_FILE) + { + DisableCatalogFile = (bool)value; + } else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES) { DecryptionServices = (IDecryptionServices)value; @@ -172,10 +181,14 @@ namespace YooAsset public virtual bool Belong(PackageBundle bundle) { + if (DisableCatalogFile) + return true; return _wrappers.ContainsKey(bundle.BundleGUID); } public virtual bool Exists(PackageBundle bundle) { + if (DisableCatalogFile) + return true; return _wrappers.ContainsKey(bundle.BundleGUID); } public virtual bool NeedDownload(PackageBundle bundle) @@ -304,9 +317,9 @@ namespace YooAsset } /// - /// 记录文件信息 + /// 记录内置文件信息 /// - public bool RecordFile(string bundleGUID, FileWrapper wrapper) + public bool RecordBuildinFile(string bundleGUID, FileWrapper wrapper) { if (_wrappers.ContainsKey(bundleGUID)) { diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSInitializeOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSInitializeOperation.cs index 0cdbfdb3..aa680f1b 100644 --- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSInitializeOperation.cs +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSInitializeOperation.cs @@ -48,7 +48,15 @@ namespace YooAsset if (_initUnpackFIleSystemOp.Status == EOperationStatus.Succeed) { - _steps = ESteps.LoadCatalogFile; + if (_fileSystem.DisableCatalogFile) + { + _steps = ESteps.Done; + Status = EOperationStatus.Succeed; + } + else + { + _steps = ESteps.LoadCatalogFile; + } } else { diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs index 427dca8a..4cbae771 100644 --- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs @@ -51,7 +51,7 @@ namespace YooAsset foreach (var wrapper in catalog.Wrappers) { var fileWrapper = new DefaultBuildinFileSystem.FileWrapper(wrapper.FileName); - _fileSystem.RecordFile(wrapper.BundleGUID, fileWrapper); + _fileSystem.RecordBuildinFile(wrapper.BundleGUID, fileWrapper); } YooLogger.Log($"Package '{_fileSystem.PackageName}' buildin catalog files count : {catalog.Wrappers.Count}"); diff --git a/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs b/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs index e4a9795a..5f864a2c 100644 --- a/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs +++ b/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs @@ -7,6 +7,7 @@ namespace YooAsset public const string REMOTE_SERVICES = "REMOTE_SERVICES"; public const string DECRYPTION_SERVICES = "DECRYPTION_SERVICES"; public const string APPEND_FILE_EXTENSION = "APPEND_FILE_EXTENSION"; + public const string DISABLE_CATALOG_FILE = "DISABLE_CATALOG_FILE"; public const string DISABLE_UNITY_WEB_CACHE = "DISABLE_UNITY_WEB_CACHE"; public const string DOWNLOAD_MAX_CONCURRENCY = "DOWNLOAD_MAX_CONCURRENCY"; public const string DOWNLOAD_MAX_REQUEST_PER_FRAME = "DOWNLOAD_MAX_REQUEST_PER_FRAME";