From 150b46a0a74ba6efc58dc13d92fe737e5389b244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E5=86=A0=E5=B3=B0?= Date: Fri, 27 Jun 2025 17:42:57 +0800 Subject: [PATCH] update file system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增ICopyLocalFileServices服务类 --- .../DefaultBuildinFileSystem.cs | 8 +- .../DefaultCacheFileSystem.cs | 6 +- .../Operation/DCFSLoadBundleOperation.cs | 8 - .../internal/DownloadCenterOperation.cs | 43 ++-- .../internal/DownloadLocalFileOperation.cs | 221 ++++++++++++++++++ .../DownloadLocalFileOperation.cs.meta | 11 + .../internal/DownloadNormalFileOperation.cs | 73 +----- .../internal/DownloadResumeFileOperation.cs | 74 +----- .../FileSystem/FileSystemParametersDefine.cs | 2 +- .../Interface/CopyBuildinFileServices.cs | 11 - .../Services/ICopyLocalFileServices.cs | 29 +++ .../ICopyLocalFileServices.cs.meta} | 0 12 files changed, 308 insertions(+), 178 deletions(-) create mode 100644 Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadLocalFileOperation.cs create mode 100644 Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadLocalFileOperation.cs.meta delete mode 100644 Assets/YooAsset/Runtime/FileSystem/Interface/CopyBuildinFileServices.cs create mode 100644 Assets/YooAsset/Runtime/Services/ICopyLocalFileServices.cs rename Assets/YooAsset/Runtime/{FileSystem/Interface/CopyBuildinFileServices.cs.meta => Services/ICopyLocalFileServices.cs.meta} (100%) diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs index 01a3002d..3f833112 100644 --- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs @@ -97,7 +97,7 @@ namespace YooAsset /// /// 自定义参数:拷贝内置文件服务类 /// - public ICopyBuildinBundleServices CopyBuildinBundleServices { private set; get; } + public ICopyLocalFileServices CopyLocalFileServices { private set; get; } #endregion @@ -188,9 +188,9 @@ namespace YooAsset { ManifestServices = (IManifestServices)value; } - else if (name == FileSystemParametersDefine.COPY_BUILDIN_BUNDLE_SERVICES) + else if (name == FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES) { - CopyBuildinBundleServices = (ICopyBuildinBundleServices)value; + CopyLocalFileServices = (ICopyLocalFileServices)value; } else { @@ -214,7 +214,7 @@ namespace YooAsset _unpackFileSystem.SetParameter(FileSystemParametersDefine.INSTALL_CLEAR_MODE, InstallClearMode); _unpackFileSystem.SetParameter(FileSystemParametersDefine.APPEND_FILE_EXTENSION, AppendFileExtension); _unpackFileSystem.SetParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, DecryptionServices); - _unpackFileSystem.SetParameter(FileSystemParametersDefine.COPY_BUILDIN_BUNDLE_SERVICES, CopyBuildinBundleServices); + _unpackFileSystem.SetParameter(FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES, CopyLocalFileServices); _unpackFileSystem.OnCreate(packageName, null); } public virtual void OnDestroy() diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs index a4022cc9..7fb63b83 100644 --- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs @@ -108,7 +108,7 @@ namespace YooAsset /// /// 自定义参数:拷贝内置文件服务类 /// - public ICopyBuildinBundleServices CopyBuildinBundleServices { private set; get; } + public ICopyLocalFileServices CopyLocalFileServices { private set; get; } #endregion @@ -235,9 +235,9 @@ namespace YooAsset { ManifestServices = (IManifestServices)value; } - else if (name == FileSystemParametersDefine.COPY_BUILDIN_BUNDLE_SERVICES) + else if (name == FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES) { - CopyBuildinBundleServices = (ICopyBuildinBundleServices)value; + CopyLocalFileServices = (ICopyLocalFileServices)value; } else { diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs index 70d81d62..d53dd208 100644 --- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs @@ -228,10 +228,6 @@ namespace YooAsset { if (ExecuteWhileDone()) { - //TODO 拷贝本地文件失败也会触发该错误! - if (_downloadFileOp != null && _downloadFileOp.Status == EOperationStatus.Failed) - YooLogger.Error($"Try load bundle {_bundle.BundleName} from remote !"); - _steps = ESteps.Done; break; } @@ -361,10 +357,6 @@ namespace YooAsset { if (ExecuteWhileDone()) { - //TODO 拷贝本地文件失败也会触发该错误! - if (_downloadFileOp != null && _downloadFileOp.Status == EOperationStatus.Failed) - YooLogger.Error($"Try load bundle {_bundle.BundleName} from remote !"); - _steps = ESteps.Done; break; } diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadCenterOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadCenterOperation.cs index 047414f0..6db35cde 100644 --- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadCenterOperation.cs +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadCenterOperation.cs @@ -82,33 +82,40 @@ namespace YooAsset return oldDownloader; } - // 设置请求URL - if (string.IsNullOrEmpty(options.ImportFilePath)) - { - options.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(bundle.FileName); - options.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(bundle.FileName); - } - else - { - // 注意:把本地文件路径指定为远端下载地址 - options.MainURL = DownloadSystemHelper.ConvertToWWWPath(options.ImportFilePath); - options.FallbackURL = options.MainURL; - } - // 创建新的下载器 DefaultDownloadFileOperation newDownloader; - if (bundle.FileSize >= _fileSystem.ResumeDownloadMinimumSize) + if (string.IsNullOrEmpty(options.ImportFilePath)) { - newDownloader = new DownloadResumeFileOperation(_fileSystem, bundle, options); - AddChildOperation(newDownloader); - _downloaders.Add(bundle.BundleGUID, newDownloader); + // 远端下载地址 + options.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(bundle.FileName); + options.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(bundle.FileName); + + // 创建新的下载器 + if (bundle.FileSize >= _fileSystem.ResumeDownloadMinimumSize) + { + newDownloader = new DownloadResumeFileOperation(_fileSystem, bundle, options); + AddChildOperation(newDownloader); + _downloaders.Add(bundle.BundleGUID, newDownloader); + } + else + { + newDownloader = new DownloadNormalFileOperation(_fileSystem, bundle, options); + AddChildOperation(newDownloader); + _downloaders.Add(bundle.BundleGUID, newDownloader); + } } else { - newDownloader = new DownloadNormalFileOperation(_fileSystem, bundle, options); + // 注意:把本地文件路径指定为可下载地址 + options.MainURL = DownloadSystemHelper.ConvertToWWWPath(options.ImportFilePath); + options.FallbackURL = options.MainURL; + + // 创建新的下载器 + newDownloader = new DownloadLocalFileOperation(_fileSystem, bundle, options); AddChildOperation(newDownloader); _downloaders.Add(bundle.BundleGUID, newDownloader); } + return newDownloader; } diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadLocalFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadLocalFileOperation.cs new file mode 100644 index 00000000..2c42c89d --- /dev/null +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadLocalFileOperation.cs @@ -0,0 +1,221 @@ +using System.IO; +using UnityEngine; +using UnityEngine.Networking; + +namespace YooAsset +{ + internal class DownloadLocalFileOperation : DefaultDownloadFileOperation + { + private readonly DefaultCacheFileSystem _fileSystem; + private VerifyTempFileOperation _verifyOperation; + private string _tempFilePath; + private ESteps _steps = ESteps.None; + + internal DownloadLocalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options) + { + _fileSystem = fileSystem; + } + internal override void InternalStart() + { + _tempFilePath = _fileSystem.GetTempFilePath(Bundle); + _steps = ESteps.CheckExists; + } + internal override void InternalUpdate() + { + if (_steps == ESteps.None || _steps == ESteps.Done) + return; + + // 检测文件是否存在 + if (_steps == ESteps.CheckExists) + { + if (_fileSystem.Exists(Bundle)) + { + _steps = ESteps.Done; + Status = EOperationStatus.Succeed; + } + else + { + if (_fileSystem.CopyLocalFileServices != null) + _steps = ESteps.CopyBuildinBundle; + else + _steps = ESteps.CreateRequest; + } + } + + // 创建下载器 + if (_steps == ESteps.CreateRequest) + { + FileUtility.CreateFileDirectory(_tempFilePath); + + // 删除临时文件 + if (File.Exists(_tempFilePath)) + File.Delete(_tempFilePath); + + // 获取请求地址 + _requestURL = GetRequestURL(); + + // 重置请求 + ResetRequestFiled(); + + // 创建下载器 + CreateWebRequest(); + + _steps = ESteps.CheckRequest; + } + + // 检测下载结果 + if (_steps == ESteps.CheckRequest) + { + DownloadProgress = _webRequest.downloadProgress; + DownloadedBytes = (long)_webRequest.downloadedBytes; + Progress = DownloadProgress; + if (_webRequest.isDone == false) + { + CheckRequestTimeout(); + return; + } + + // 检查网络错误 + if (CheckRequestResult()) + _steps = ESteps.VerifyTempFile; + else + _steps = ESteps.TryAgain; + + // 注意:最终释放请求器 + DisposeWebRequest(); + } + + // 拷贝内置文件 + if (_steps == ESteps.CopyBuildinBundle) + { + FileUtility.CreateFileDirectory(_tempFilePath); + + // 删除临时文件 + if (File.Exists(_tempFilePath)) + File.Delete(_tempFilePath); + + // 获取请求地址 + _requestURL = GetRequestURL(); + + try + { + //TODO 团结引擎,在某些机型(红米),拷贝包内文件会小概率失败!需要借助其它方式来拷贝包内文件。 + var localFileInfo = new LocalFileInfo(); + localFileInfo.PackageName = _fileSystem.PackageName; + localFileInfo.BundleName = Bundle.BundleName; + localFileInfo.SourceFileURL = _requestURL; + _fileSystem.CopyLocalFileServices.CopyFile(localFileInfo, _tempFilePath); + if (File.Exists(_tempFilePath)) + { + DownloadProgress = 1f; + DownloadedBytes = Bundle.FileSize; + Progress = DownloadProgress; + _steps = ESteps.VerifyTempFile; + } + else + { + Error = $"Failed copy buildin bundle : {_requestURL}"; + _steps = ESteps.TryAgain; + } + } + catch (System.Exception ex) + { + Error = $"Failed copy buildin bundle : {ex.Message}"; + _steps = ESteps.TryAgain; + } + } + + // 验证下载文件 + if (_steps == ESteps.VerifyTempFile) + { + var element = new TempFileElement(_tempFilePath, Bundle.FileCRC, Bundle.FileSize); + _verifyOperation = new VerifyTempFileOperation(element); + _verifyOperation.StartOperation(); + AddChildOperation(_verifyOperation); + _steps = ESteps.CheckVerifyTempFile; + } + + // 等待验证完成 + if (_steps == ESteps.CheckVerifyTempFile) + { + if (IsWaitForAsyncComplete) + _verifyOperation.WaitForAsyncComplete(); + + _verifyOperation.UpdateOperation(); + if (_verifyOperation.IsDone == false) + return; + + if (_verifyOperation.Status == EOperationStatus.Succeed) + { + if (_fileSystem.WriteCacheBundleFile(Bundle, _tempFilePath)) + { + _steps = ESteps.Done; + Status = EOperationStatus.Succeed; + } + else + { + _steps = ESteps.Done; + Status = EOperationStatus.Failed; + Error = $"{_fileSystem.GetType().FullName} failed to write file !"; + YooLogger.Error(Error); + } + } + else + { + _steps = ESteps.TryAgain; + Error = _verifyOperation.Error; + } + + // 注意:验证完成后直接删除文件 + if (File.Exists(_tempFilePath)) + File.Delete(_tempFilePath); + } + + // 重新尝试下载 + if (_steps == ESteps.TryAgain) + { + //TODO 拷贝本地文件失败后不再尝试! + Status = EOperationStatus.Failed; + _steps = ESteps.Done; + YooLogger.Error(Error); + } + } + internal override void InternalAbort() + { + _steps = ESteps.Done; + DisposeWebRequest(); + } + internal override void InternalWaitForAsyncComplete() + { + while (true) + { + //TODO 等待导入或解压本地文件完毕,该操作会挂起主线程! + InternalUpdate(); + if (IsDone) + break; + + // 短暂休眠避免完全卡死 + System.Threading.Thread.Sleep(1); + } + } + + private void CreateWebRequest() + { + _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL); + DownloadHandlerFile handler = new DownloadHandlerFile(_tempFilePath); + handler.removeFileOnAbort = true; + _webRequest.downloadHandler = handler; + _webRequest.disposeDownloadHandlerOnDispose = true; + _webRequest.SendWebRequest(); + } + private void DisposeWebRequest() + { + if (_webRequest != null) + { + //注意:引擎底层会自动调用Abort方法 + _webRequest.Dispose(); + _webRequest = null; + } + } + } +} \ No newline at end of file diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadLocalFileOperation.cs.meta b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadLocalFileOperation.cs.meta new file mode 100644 index 00000000..6514b3aa --- /dev/null +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadLocalFileOperation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c68640bb1d36552469024324e3357bc2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadNormalFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadNormalFileOperation.cs index 4f20f585..8204017c 100644 --- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadNormalFileOperation.cs +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadNormalFileOperation.cs @@ -8,7 +8,6 @@ namespace YooAsset { private readonly DefaultCacheFileSystem _fileSystem; private VerifyTempFileOperation _verifyOperation; - private bool _isReuqestLocalFile; private string _tempFilePath; private ESteps _steps = ESteps.None; @@ -18,7 +17,6 @@ namespace YooAsset } internal override void InternalStart() { - _isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Options.MainURL); _tempFilePath = _fileSystem.GetTempFilePath(Bundle); _steps = ESteps.CheckExists; } @@ -37,10 +35,7 @@ namespace YooAsset } else { - if (_isReuqestLocalFile && _fileSystem.CopyBuildinBundleServices != null) - _steps = ESteps.CopyBuildinBundle; - else - _steps = ESteps.CreateRequest; + _steps = ESteps.CreateRequest; } } @@ -87,42 +82,6 @@ namespace YooAsset DisposeWebRequest(); } - // 拷贝内置文件 - if (_steps == ESteps.CopyBuildinBundle) - { - FileUtility.CreateFileDirectory(_tempFilePath); - - // 删除临时文件 - if (File.Exists(_tempFilePath)) - File.Delete(_tempFilePath); - - // 获取请求地址 - _requestURL = GetRequestURL(); - - try - { - //TODO 团结引擎,在某些机型(红米),拷贝包内文件会小概率失败!需要借助其它方式来拷贝包内文件。 - _fileSystem.CopyBuildinBundleServices.CopyBuildinFile(_requestURL, _tempFilePath); - if (File.Exists(_tempFilePath)) - { - DownloadProgress = 1f; - DownloadedBytes = Bundle.FileSize; - Progress = DownloadProgress; - _steps = ESteps.VerifyTempFile; - } - else - { - Error = $"Failed copy buildin bundle : {_requestURL}"; - _steps = ESteps.TryAgain; - } - } - catch (System.Exception ex) - { - Error = $"Failed copy buildin bundle : {ex.Message}"; - _steps = ESteps.TryAgain; - } - } - // 验证下载文件 if (_steps == ESteps.VerifyTempFile) { @@ -172,15 +131,6 @@ namespace YooAsset // 重新尝试下载 if (_steps == ESteps.TryAgain) { - //TODO 拷贝本地文件失败后不再尝试! - if (_isReuqestLocalFile) - { - Status = EOperationStatus.Failed; - _steps = ESteps.Done; - YooLogger.Error(Error); - return; - } - if (FailedTryAgain <= 0) { Status = EOperationStatus.Failed; @@ -207,23 +157,14 @@ namespace YooAsset { while (true) { - //TODO 如果是导入或解压本地文件,执行等待完毕,该操作会挂起主线程! - if (_isReuqestLocalFile) + if (ExecuteWhileDone()) { - InternalUpdate(); - if (IsDone) - break; + //TODO 同步加载失败 + if (Status == EOperationStatus.Failed) + YooLogger.Error($"Try load bundle {Bundle.BundleName} from remote !"); - // 短暂休眠避免完全卡死 - System.Threading.Thread.Sleep(1); - } - else - { - if (ExecuteWhileDone()) - { - _steps = ESteps.Done; - break; - } + _steps = ESteps.Done; + break; } } } diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadResumeFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadResumeFileOperation.cs index 09c00f45..c6ef2ba0 100644 --- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadResumeFileOperation.cs +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadResumeFileOperation.cs @@ -9,19 +9,16 @@ namespace YooAsset private readonly DefaultCacheFileSystem _fileSystem; private DownloadHandlerFileRange _downloadHandle; private VerifyTempFileOperation _verifyOperation; - private bool _isReuqestLocalFile; private long _fileOriginLength = 0; private string _tempFilePath; private ESteps _steps = ESteps.None; - internal DownloadResumeFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options) { _fileSystem = fileSystem; } internal override void InternalStart() { - _isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Options.MainURL); _tempFilePath = _fileSystem.GetTempFilePath(Bundle); _steps = ESteps.CheckExists; } @@ -40,10 +37,7 @@ namespace YooAsset } else { - if (_isReuqestLocalFile && _fileSystem.CopyBuildinBundleServices != null) - _steps = ESteps.CopyBuildinBundle; - else - _steps = ESteps.CreateRequest; + _steps = ESteps.CreateRequest; } } @@ -107,42 +101,6 @@ namespace YooAsset DisposeWebRequest(); } - // 拷贝内置文件 - if (_steps == ESteps.CopyBuildinBundle) - { - FileUtility.CreateFileDirectory(_tempFilePath); - - // 删除临时文件(不支持断点续传) - if (File.Exists(_tempFilePath)) - File.Delete(_tempFilePath); - - // 获取请求地址 - _requestURL = GetRequestURL(); - - try - { - //TODO 团结引擎,在某些机型(红米),拷贝包内文件会小概率失败!需要借助其它方式来拷贝包内文件。 - _fileSystem.CopyBuildinBundleServices.CopyBuildinFile(_requestURL, _tempFilePath); - if (File.Exists(_tempFilePath)) - { - DownloadProgress = 1f; - DownloadedBytes = Bundle.FileSize; - Progress = DownloadProgress; - _steps = ESteps.VerifyTempFile; - } - else - { - Error = $"Failed copy buildin bundle : {_requestURL}"; - _steps = ESteps.TryAgain; - } - } - catch (System.Exception ex) - { - Error = $"Failed copy buildin bundle : {ex.Message}"; - _steps = ESteps.TryAgain; - } - } - // 验证下载文件 if (_steps == ESteps.VerifyTempFile) { @@ -191,15 +149,6 @@ namespace YooAsset // 重新尝试下载 if (_steps == ESteps.TryAgain) { - //TODO 拷贝本地文件失败后不再尝试! - if (_isReuqestLocalFile) - { - Status = EOperationStatus.Failed; - _steps = ESteps.Done; - YooLogger.Error(Error); - return; - } - if (FailedTryAgain <= 0) { Status = EOperationStatus.Failed; @@ -226,23 +175,14 @@ namespace YooAsset { while (true) { - //TODO 如果是导入或解压本地文件,执行等待完毕,该操作会挂起主线程! - if (_isReuqestLocalFile) + if (ExecuteWhileDone()) { - InternalUpdate(); - if (IsDone) - break; + //TODO 同步加载失败 + if (Status == EOperationStatus.Failed) + YooLogger.Error($"Try load bundle {Bundle.BundleName} from remote !"); - // 短暂休眠避免完全卡死 - System.Threading.Thread.Sleep(1); - } - else - { - if (ExecuteWhileDone()) - { - _steps = ESteps.Done; - break; - } + _steps = ESteps.Done; + break; } } } diff --git a/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs b/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs index 84d42cf7..d9fc543b 100644 --- a/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs +++ b/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs @@ -19,6 +19,6 @@ namespace YooAsset public const string ASYNC_SIMULATE_MAX_FRAME = "ASYNC_SIMULATE_MAX_FRAME"; public const string COPY_BUILDIN_PACKAGE_MANIFEST = "COPY_BUILDIN_PACKAGE_MANIFEST"; public const string COPY_BUILDIN_PACKAGE_MANIFEST_DEST_ROOT = "COPY_BUILDIN_PACKAGE_MANIFEST_DEST_ROOT"; - public const string COPY_BUILDIN_BUNDLE_SERVICES = "COPY_BUILDIN_BUNDLE_SERVICES"; + public const string COPY_LOCAL_FILE_SERVICES = "COPY_LOCAL_FILE_SERVICES"; } } \ No newline at end of file diff --git a/Assets/YooAsset/Runtime/FileSystem/Interface/CopyBuildinFileServices.cs b/Assets/YooAsset/Runtime/FileSystem/Interface/CopyBuildinFileServices.cs deleted file mode 100644 index 2501f549..00000000 --- a/Assets/YooAsset/Runtime/FileSystem/Interface/CopyBuildinFileServices.cs +++ /dev/null @@ -1,11 +0,0 @@ - -namespace YooAsset -{ - /// - /// 拷贝内置文件服务类 - /// - public interface ICopyBuildinBundleServices - { - void CopyBuildinFile(string buildinFileURL, string destFilePath); - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Runtime/Services/ICopyLocalFileServices.cs b/Assets/YooAsset/Runtime/Services/ICopyLocalFileServices.cs new file mode 100644 index 00000000..5a128704 --- /dev/null +++ b/Assets/YooAsset/Runtime/Services/ICopyLocalFileServices.cs @@ -0,0 +1,29 @@ + +namespace YooAsset +{ + public struct LocalFileInfo + { + /// + /// 包裹名称 + /// + public string PackageName; + + /// + /// 资源包名称 + /// + public string BundleName; + + /// + /// 源文件请求地址 + /// + public string SourceFileURL; + } + + /// + /// 本地文件拷贝服务类 + /// + public interface ICopyLocalFileServices + { + void CopyFile(LocalFileInfo sourceFileInfo, string destFilePath); + } +} \ No newline at end of file diff --git a/Assets/YooAsset/Runtime/FileSystem/Interface/CopyBuildinFileServices.cs.meta b/Assets/YooAsset/Runtime/Services/ICopyLocalFileServices.cs.meta similarity index 100% rename from Assets/YooAsset/Runtime/FileSystem/Interface/CopyBuildinFileServices.cs.meta rename to Assets/YooAsset/Runtime/Services/ICopyLocalFileServices.cs.meta