update file system

修正2.3.11版本同步加载本地加密文件失败的问题。
This commit is contained in:
何冠峰
2025-07-01 16:40:01 +08:00
parent d401086fd1
commit 97fe3b0681
6 changed files with 32 additions and 22 deletions

View File

@@ -126,7 +126,7 @@ namespace YooAsset
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
{
// 注意:业务层的解压下载器会依赖内置文件系统的下载方法
options.LocalFilePath = GetBuildinFileLoadPath(bundle);
options.ImportFilePath = GetBuildinFileLoadPath(bundle);
return _unpackFileSystem.DownloadFileAsync(bundle, options);
}
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)

View File

@@ -82,15 +82,31 @@ namespace YooAsset
return oldDownloader;
}
// 创建新的下载器
DefaultDownloadFileOperation newDownloader;
if (string.IsNullOrEmpty(options.LocalFilePath))
// 获取下载地址
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;
bool isRequestLocalFile = DownloadSystemHelper.IsRequestLocalFile(options.MainURL);
if (isRequestLocalFile)
{
newDownloader = new DownloadLocalFileOperation(_fileSystem, bundle, options);
AddChildOperation(newDownloader);
_downloaders.Add(bundle.BundleGUID, newDownloader);
}
else
{
if (bundle.FileSize >= _fileSystem.ResumeDownloadMinimumSize)
{
newDownloader = new DownloadResumeFileOperation(_fileSystem, bundle, options);
@@ -104,18 +120,6 @@ namespace YooAsset
_downloaders.Add(bundle.BundleGUID, newDownloader);
}
}
else
{
// 注意:把本地文件路径指定为可下载地址
options.MainURL = DownloadSystemHelper.ConvertToWWWPath(options.LocalFilePath);
options.FallbackURL = options.MainURL;
// 创建新的下载器
newDownloader = new DownloadLocalFileOperation(_fileSystem, bundle, options);
AddChildOperation(newDownloader);
_downloaders.Add(bundle.BundleGUID, newDownloader);
}
return newDownloader;
}

View File

@@ -159,9 +159,12 @@ namespace YooAsset
{
if (ExecuteWhileDone())
{
//TODO 同步加载失败
//TODO 尝试同步加载远端的资源文件失败
if (Status == EOperationStatus.Failed)
{
YooLogger.Error($"Try load bundle {Bundle.BundleName} from remote !");
YooLogger.Error($"The load remote bundle url : {_requestURL}");
}
_steps = ESteps.Done;
break;

View File

@@ -177,9 +177,12 @@ namespace YooAsset
{
if (ExecuteWhileDone())
{
//TODO 同步加载失败
//TODO 尝试同步加载远端的资源文件失败
if (Status == EOperationStatus.Failed)
{
YooLogger.Error($"Try load bundle {Bundle.BundleName} from remote !");
YooLogger.Error($"The load remote bundle url : {_requestURL}");
}
_steps = ESteps.Done;
break;

View File

@@ -26,7 +26,7 @@ namespace YooAsset
/// <summary>
/// 拷贝的本地文件路径
/// </summary>
public string LocalFilePath { set; get; }
public string ImportFilePath { set; get; }
public DownloadFileOptions(int failedTryAgain, int timeout)
{

View File

@@ -39,7 +39,7 @@ namespace YooAsset
public FSDownloadFileOperation CreateDownloader(int failedTryAgain, int timeout)
{
DownloadFileOptions options = new DownloadFileOptions(failedTryAgain, timeout);
options.LocalFilePath = _importFilePath;
options.ImportFilePath = _importFilePath;
return _fileSystem.DownloadFileAsync(Bundle, options);
}