mirror of https://github.com/tuyoogame/YooAsset
refactor : DownloadParam rename DownloadFileOptions
parent
b843c6b0ed
commit
c0d42e79d8
|
@ -1,30 +0,0 @@
|
|||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class DownloadParam
|
||||
{
|
||||
public readonly int FailedTryAgain;
|
||||
public readonly int Timeout;
|
||||
|
||||
/// <summary>
|
||||
/// 导入的本地文件路径
|
||||
/// </summary>
|
||||
public string ImportFilePath { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 主资源地址
|
||||
/// </summary>
|
||||
public string MainURL { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 备用资源地址
|
||||
/// </summary>
|
||||
public string FallbackURL { set; get; }
|
||||
|
||||
public DownloadParam(int failedTryAgain, int timeout)
|
||||
{
|
||||
FailedTryAgain = failedTryAgain;
|
||||
Timeout = timeout;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 56ea224b45d314e4a86b558404e9b6c8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -113,11 +113,11 @@ namespace YooAsset
|
|||
{
|
||||
return _unpackFileSystem.ClearCacheFilesAsync(manifest, options);
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
|
||||
{
|
||||
// 注意:业务层的解压下载器会依赖内置文件系统的下载方法
|
||||
param.ImportFilePath = GetBuildinFileLoadPath(bundle);
|
||||
return _unpackFileSystem.DownloadFileAsync(bundle, param);
|
||||
options.ImportFilePath = GetBuildinFileLoadPath(bundle);
|
||||
return _unpackFileSystem.DownloadFileAsync(bundle, options);
|
||||
}
|
||||
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
|
||||
{
|
||||
|
|
|
@ -154,9 +154,9 @@ namespace YooAsset
|
|||
return operation;
|
||||
}
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
|
||||
{
|
||||
var downloader = DownloadCenter.DownloadFileAsync(bundle, param);
|
||||
var downloader = DownloadCenter.DownloadFileAsync(bundle, options);
|
||||
downloader.Reference(); //增加下载器的引用计数
|
||||
|
||||
// 注意:将下载器进行包裹,可以避免父类任务终止的时候,连带子任务里的下载器也一起被终止!
|
||||
|
|
|
@ -58,8 +58,8 @@ namespace YooAsset
|
|||
// 注意:边玩边下下载器引用计数没有Release
|
||||
if (_downloadFileOp == null)
|
||||
{
|
||||
DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
|
||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
|
||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
|
||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, options);
|
||||
_downloadFileOp.StartOperation();
|
||||
AddChildOperation(_downloadFileOp);
|
||||
}
|
||||
|
@ -297,8 +297,8 @@ namespace YooAsset
|
|||
// 注意:边玩边下下载器引用计数没有Release
|
||||
if (_downloadFileOp == null)
|
||||
{
|
||||
DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
|
||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
|
||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
|
||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, options);
|
||||
_downloadFileOp.StartOperation();
|
||||
AddChildOperation(_downloadFileOp);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace YooAsset
|
|||
/// <summary>
|
||||
/// 创建下载任务
|
||||
/// </summary>
|
||||
public FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
public FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
|
||||
{
|
||||
// 查询旧的下载器
|
||||
if (_downloaders.TryGetValue(bundle.BundleGUID, out var oldDownloader))
|
||||
|
@ -83,29 +83,29 @@ namespace YooAsset
|
|||
}
|
||||
|
||||
// 设置请求URL
|
||||
if (string.IsNullOrEmpty(param.ImportFilePath))
|
||||
if (string.IsNullOrEmpty(options.ImportFilePath))
|
||||
{
|
||||
param.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
param.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
options.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
options.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 注意:把本地文件路径指定为远端下载地址
|
||||
param.MainURL = DownloadSystemHelper.ConvertToWWWPath(param.ImportFilePath);
|
||||
param.FallbackURL = param.MainURL;
|
||||
options.MainURL = DownloadSystemHelper.ConvertToWWWPath(options.ImportFilePath);
|
||||
options.FallbackURL = options.MainURL;
|
||||
}
|
||||
|
||||
// 创建新的下载器
|
||||
DefaultDownloadFileOperation newDownloader;
|
||||
if (bundle.FileSize >= _fileSystem.ResumeDownloadMinimumSize)
|
||||
{
|
||||
newDownloader = new DownloadResumeFileOperation(_fileSystem, bundle, param);
|
||||
newDownloader = new DownloadResumeFileOperation(_fileSystem, bundle, options);
|
||||
AddChildOperation(newDownloader);
|
||||
_downloaders.Add(bundle.BundleGUID, newDownloader);
|
||||
}
|
||||
else
|
||||
{
|
||||
newDownloader = new DownloadNormalFileOperation(_fileSystem, bundle, param);
|
||||
newDownloader = new DownloadNormalFileOperation(_fileSystem, bundle, options);
|
||||
AddChildOperation(newDownloader);
|
||||
_downloaders.Add(bundle.BundleGUID, newDownloader);
|
||||
}
|
||||
|
|
|
@ -12,13 +12,13 @@ namespace YooAsset
|
|||
private string _tempFilePath;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal DownloadNormalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, DownloadParam param) : base(bundle, param)
|
||||
internal DownloadNormalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Param.MainURL);
|
||||
_isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Options.MainURL);
|
||||
_tempFilePath = _fileSystem.GetTempFilePath(Bundle);
|
||||
_steps = ESteps.CheckExists;
|
||||
}
|
||||
|
|
|
@ -15,13 +15,13 @@ namespace YooAsset
|
|||
private ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
internal DownloadResumeFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, DownloadParam param) : base(bundle, param)
|
||||
internal DownloadResumeFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Param.MainURL);
|
||||
_isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Options.MainURL);
|
||||
_tempFilePath = _fileSystem.GetTempFilePath(Bundle);
|
||||
_steps = ESteps.CheckExists;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace YooAsset
|
|||
var operation = new FSClearCacheFilesCompleteOperation();
|
||||
return operation;
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace YooAsset
|
|||
var operation = new FSClearCacheFilesCompleteOperation();
|
||||
return operation;
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
|
|
@ -34,19 +34,19 @@ namespace YooAsset
|
|||
{
|
||||
if (_downloadAssetBundleOp == null)
|
||||
{
|
||||
DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
|
||||
downloadParam.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName);
|
||||
downloadParam.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
|
||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
|
||||
options.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName);
|
||||
options.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
|
||||
|
||||
if (_bundle.Encrypted)
|
||||
{
|
||||
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, downloadParam);
|
||||
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, options);
|
||||
_downloadAssetBundleOp.StartOperation();
|
||||
AddChildOperation(_downloadAssetBundleOp);
|
||||
}
|
||||
else
|
||||
{
|
||||
_downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, downloadParam);
|
||||
_downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, options);
|
||||
_downloadAssetBundleOp.StartOperation();
|
||||
AddChildOperation(_downloadAssetBundleOp);
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace YooAsset
|
|||
var operation = new FSClearCacheFilesCompleteOperation();
|
||||
return operation;
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
|
|
@ -34,20 +34,20 @@ namespace YooAsset
|
|||
{
|
||||
if (_downloadAssetBundleOp == null)
|
||||
{
|
||||
DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
|
||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
|
||||
string fileLoadPath = _fileSystem.GetWebFileLoadPath(_bundle);
|
||||
downloadParam.MainURL = DownloadSystemHelper.ConvertToWWWPath(fileLoadPath);
|
||||
downloadParam.FallbackURL = downloadParam.MainURL;
|
||||
options.MainURL = DownloadSystemHelper.ConvertToWWWPath(fileLoadPath);
|
||||
options.FallbackURL = options.MainURL;
|
||||
|
||||
if (_bundle.Encrypted)
|
||||
{
|
||||
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, downloadParam);
|
||||
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, options);
|
||||
_downloadAssetBundleOp.StartOperation();
|
||||
AddChildOperation(_downloadAssetBundleOp);
|
||||
}
|
||||
else
|
||||
{
|
||||
_downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, downloadParam);
|
||||
_downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, options);
|
||||
_downloadAssetBundleOp.StartOperation();
|
||||
AddChildOperation(_downloadAssetBundleOp);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace YooAsset
|
|||
/// <summary>
|
||||
/// 下载Bundle文件
|
||||
/// </summary>
|
||||
FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param);
|
||||
FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// 加载Bundle文件
|
||||
|
|
|
@ -1,6 +1,40 @@
|
|||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class DownloadFileOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 失败后重试次数
|
||||
/// </summary>
|
||||
public readonly int FailedTryAgain;
|
||||
|
||||
/// <summary>
|
||||
/// 超时时间
|
||||
/// </summary>
|
||||
public readonly int Timeout;
|
||||
|
||||
/// <summary>
|
||||
/// 主资源地址
|
||||
/// </summary>
|
||||
public string MainURL { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 备用资源地址
|
||||
/// </summary>
|
||||
public string FallbackURL { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 导入的本地文件路径
|
||||
/// </summary>
|
||||
public string ImportFilePath { set; get; }
|
||||
|
||||
public DownloadFileOptions(int failedTryAgain, int timeout)
|
||||
{
|
||||
FailedTryAgain = failedTryAgain;
|
||||
Timeout = timeout;
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract class FSDownloadFileOperation : AsyncOperationBase
|
||||
{
|
||||
public PackageBundle Bundle { private set; get; }
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace YooAsset
|
|||
}
|
||||
|
||||
// 下载参数
|
||||
protected readonly DownloadParam Param;
|
||||
protected readonly DownloadFileOptions Options;
|
||||
|
||||
// 请求相关
|
||||
protected UnityWebRequest _webRequest;
|
||||
|
@ -35,10 +35,10 @@ namespace YooAsset
|
|||
protected int FailedTryAgain;
|
||||
|
||||
|
||||
internal DefaultDownloadFileOperation(PackageBundle bundle, DownloadParam param) : base(bundle)
|
||||
internal DefaultDownloadFileOperation(PackageBundle bundle, DownloadFileOptions options) : base(bundle)
|
||||
{
|
||||
Param = param;
|
||||
FailedTryAgain = param.FailedTryAgain;
|
||||
Options = options;
|
||||
FailedTryAgain = options.FailedTryAgain;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -49,9 +49,9 @@ namespace YooAsset
|
|||
// 轮流返回请求地址
|
||||
_requestCount++;
|
||||
if (_requestCount % 2 == 0)
|
||||
return Param.FallbackURL;
|
||||
return Options.FallbackURL;
|
||||
else
|
||||
return Param.MainURL;
|
||||
return Options.MainURL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -87,7 +87,7 @@ namespace YooAsset
|
|||
}
|
||||
|
||||
float offset = UnityEngine.Time.realtimeSinceStartup - _latestDownloadRealtime;
|
||||
if (offset > Param.Timeout)
|
||||
if (offset > Options.Timeout)
|
||||
{
|
||||
YooLogger.Warning($"Download request timeout : {_requestURL}");
|
||||
if (_webRequest != null)
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace YooAsset
|
|||
{
|
||||
internal abstract class DownloadAssetBundleOperation : DefaultDownloadFileOperation
|
||||
{
|
||||
internal DownloadAssetBundleOperation(PackageBundle bundle, DownloadParam param) : base(bundle, param)
|
||||
internal DownloadAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace YooAsset
|
|||
private DownloadHandlerBuffer _downloadhandler;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal DownloadWebEncryptAssetBundleOperation(bool checkTimeout, IWebDecryptionServices decryptionServices, PackageBundle bundle, DownloadParam param) : base(bundle, param)
|
||||
internal DownloadWebEncryptAssetBundleOperation(bool checkTimeout, IWebDecryptionServices decryptionServices, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
|
||||
{
|
||||
_checkTimeout = checkTimeout;
|
||||
_decryptionServices = decryptionServices;
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace YooAsset
|
|||
private DownloadHandlerAssetBundle _downloadhandler;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal DownloadWebNormalAssetBundleOperation(bool disableUnityWebCache, PackageBundle bundle, DownloadParam param) : base(bundle, param)
|
||||
internal DownloadWebNormalAssetBundleOperation(bool disableUnityWebCache, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
|
||||
{
|
||||
_disableUnityWebCache = disableUnityWebCache;
|
||||
}
|
||||
|
|
|
@ -38,9 +38,9 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public FSDownloadFileOperation CreateDownloader(int failedTryAgain, int timeout)
|
||||
{
|
||||
DownloadParam downloadParam = new DownloadParam(failedTryAgain, timeout);
|
||||
downloadParam.ImportFilePath = _importFilePath;
|
||||
return _fileSystem.DownloadFileAsync(Bundle, downloadParam);
|
||||
DownloadFileOptions options = new DownloadFileOptions(failedTryAgain, timeout);
|
||||
options.ImportFilePath = _importFilePath;
|
||||
return _fileSystem.DownloadFileAsync(Bundle, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -8,7 +8,7 @@ internal class TTFSDownloadFileOperation : DefaultDownloadFileOperation
|
|||
private TiktokFileSystem _fileSystem;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal TTFSDownloadFileOperation(TiktokFileSystem fileSystem, PackageBundle bundle, DownloadParam param) : base(bundle, param)
|
||||
internal TTFSDownloadFileOperation(TiktokFileSystem fileSystem, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
|
|
@ -35,19 +35,19 @@ internal class TTFSLoadBundleOperation : FSLoadBundleOperation
|
|||
{
|
||||
if (_downloadAssetBundleOp == null)
|
||||
{
|
||||
DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
|
||||
downloadParam.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName); ;
|
||||
downloadParam.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
|
||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
|
||||
options.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName); ;
|
||||
options.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
|
||||
|
||||
if (_bundle.Encrypted)
|
||||
{
|
||||
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(false, _fileSystem.DecryptionServices, _bundle, downloadParam);
|
||||
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(false, _fileSystem.DecryptionServices, _bundle, options);
|
||||
_downloadAssetBundleOp.StartOperation();
|
||||
AddChildOperation(_downloadAssetBundleOp);
|
||||
}
|
||||
else
|
||||
{
|
||||
_downloadAssetBundleOp = new DownloadTiktokAssetBundleOperation(_bundle, downloadParam);
|
||||
_downloadAssetBundleOp = new DownloadTiktokAssetBundleOperation(_bundle, options);
|
||||
_downloadAssetBundleOp.StartOperation();
|
||||
AddChildOperation(_downloadAssetBundleOp);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace YooAsset
|
|||
{
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal DownloadTiktokAssetBundleOperation(PackageBundle bundle, DownloadParam param) : base(bundle, param)
|
||||
internal DownloadTiktokAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
|
||||
{
|
||||
}
|
||||
internal override void InternalStart()
|
||||
|
|
|
@ -129,11 +129,11 @@ internal class TiktokFileSystem : IFileSystem
|
|||
var operation = new FSClearCacheFilesCompleteOperation();
|
||||
return operation;
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
|
||||
{
|
||||
param.MainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
param.FallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
var operation = new TTFSDownloadFileOperation(this, bundle, param);
|
||||
options.MainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
options.FallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
var operation = new TTFSDownloadFileOperation(this, bundle, options);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
|
||||
|
|
|
@ -9,7 +9,7 @@ internal class WXFSDownloadFileOperation : DefaultDownloadFileOperation
|
|||
private WechatFileSystem _fileSystem;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal WXFSDownloadFileOperation(WechatFileSystem fileSystem, PackageBundle bundle, DownloadParam param) : base(bundle, param)
|
||||
internal WXFSDownloadFileOperation(WechatFileSystem fileSystem, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
|
|
@ -33,19 +33,19 @@ internal class WXFSLoadBundleOperation : FSLoadBundleOperation
|
|||
{
|
||||
if (_downloadAssetBundleOp == null)
|
||||
{
|
||||
DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
|
||||
downloadParam.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName); ;
|
||||
downloadParam.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
|
||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
|
||||
options.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName); ;
|
||||
options.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
|
||||
|
||||
if (_bundle.Encrypted)
|
||||
{
|
||||
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(false, _fileSystem.DecryptionServices, _bundle, downloadParam);
|
||||
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(false, _fileSystem.DecryptionServices, _bundle, options);
|
||||
_downloadAssetBundleOp.StartOperation();
|
||||
AddChildOperation(_downloadAssetBundleOp);
|
||||
}
|
||||
else
|
||||
{
|
||||
_downloadAssetBundleOp = new DownloadWechatAssetBundleOperation(_bundle, downloadParam);
|
||||
_downloadAssetBundleOp = new DownloadWechatAssetBundleOperation(_bundle, options);
|
||||
_downloadAssetBundleOp.StartOperation();
|
||||
AddChildOperation(_downloadAssetBundleOp);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace YooAsset
|
|||
{
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal DownloadWechatAssetBundleOperation(PackageBundle bundle, DownloadParam param) : base(bundle, param)
|
||||
internal DownloadWechatAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
|
||||
{
|
||||
}
|
||||
internal override void InternalStart()
|
||||
|
|
|
@ -144,11 +144,11 @@ internal class WechatFileSystem : IFileSystem
|
|||
return operation;
|
||||
}
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
|
||||
{
|
||||
param.MainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
param.FallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
var operation = new WXFSDownloadFileOperation(this, bundle, param);
|
||||
options.MainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||
options.FallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||
var operation = new WXFSDownloadFileOperation(this, bundle, options);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
|
||||
|
|
Loading…
Reference in New Issue