update download system

remove timeout
This commit is contained in:
何冠峰
2025-07-17 20:59:15 +08:00
parent dd6fab46f9
commit b3622167da
43 changed files with 321 additions and 210 deletions
@@ -8,11 +8,6 @@ namespace YooAsset
/// </summary>
public readonly int FailedTryAgain;
/// <summary>
/// 超时时间
/// </summary>
public readonly int Timeout;
/// <summary>
/// 主资源地址
/// </summary>
@@ -28,10 +23,9 @@ namespace YooAsset
/// </summary>
public string ImportFilePath { set; get; }
public DownloadFileOptions(int failedTryAgain, int timeout)
public DownloadFileOptions(int failedTryAgain)
{
FailedTryAgain = failedTryAgain;
Timeout = timeout;
}
/// <summary>
@@ -2,7 +2,7 @@
namespace YooAsset
{
internal abstract class DownloadAssetBundleOperation : AsyncOperationBase
internal abstract class LoadWebAssetBundleOperation : AsyncOperationBase
{
/// <summary>
/// AssetBundle对象
@@ -2,7 +2,7 @@
namespace YooAsset
{
internal class DownloadEncryptAssetBundleOperation : DownloadAssetBundleOperation
internal class LoadWebEncryptAssetBundleOperation : LoadWebAssetBundleOperation
{
protected enum ESteps
{
@@ -16,7 +16,6 @@ namespace YooAsset
private UnityWebDataRequestOperation _unityWebDataRequestOp;
private readonly PackageBundle _bundle;
private readonly DownloadFileOptions _options;
private readonly bool _checkTimeout;
private readonly IWebDecryptionServices _decryptionServices;
protected int _requestCount = 0;
@@ -24,11 +23,10 @@ namespace YooAsset
protected int _failedTryAgain;
private ESteps _steps = ESteps.None;
internal DownloadEncryptAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options, bool checkTimeout, IWebDecryptionServices decryptionServices)
internal LoadWebEncryptAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options, IWebDecryptionServices decryptionServices)
{
_bundle = bundle;
_options = options;
_checkTimeout = checkTimeout;
_decryptionServices = decryptionServices;
}
internal override void InternalStart()
@@ -53,10 +51,8 @@ namespace YooAsset
}
string url = GetRequestURL();
_unityWebDataRequestOp = new UnityWebDataRequestOperation(url, _options.Timeout);
_unityWebDataRequestOp = new UnityWebDataRequestOperation(url, 0);
_unityWebDataRequestOp.StartOperation();
if (_checkTimeout == false)
_unityWebDataRequestOp.DontCheckTimeout();
_steps = ESteps.CheckRequest;
}
@@ -2,7 +2,7 @@
namespace YooAsset
{
internal class DownloadNormalAssetBundleOperation : DownloadAssetBundleOperation
internal class LoadWebNormalAssetBundleOperation : LoadWebAssetBundleOperation
{
protected enum ESteps
{
@@ -13,18 +13,18 @@ namespace YooAsset
Done,
}
private UnityAssetBundleRequestOperation _unityAssetBundleRequestOp;
private readonly PackageBundle _bundle;
private readonly DownloadFileOptions _options;
private readonly bool _disableUnityWebCache;
private UnityAssetBundleRequestOperation _unityAssetBundleRequestOp;
protected int _requestCount = 0;
protected float _tryAgainTimer;
protected int _failedTryAgain;
private ESteps _steps = ESteps.None;
internal DownloadNormalAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options, bool disableUnityWebCache)
internal LoadWebNormalAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options, bool disableUnityWebCache)
{
_bundle = bundle;
_options = options;
@@ -43,7 +43,7 @@ namespace YooAsset
if (_steps == ESteps.CreateRequest)
{
string url = GetRequestURL();
_unityAssetBundleRequestOp = new UnityAssetBundleRequestOperation(_bundle, _disableUnityWebCache, url, _options.Timeout);
_unityAssetBundleRequestOp = new UnityAssetBundleRequestOperation(_bundle, _disableUnityWebCache, url);
_unityAssetBundleRequestOp.StartOperation();
_steps = ESteps.CheckRequest;
}