代码重构

This commit is contained in:
何冠峰
2026-05-07 10:42:34 +08:00
parent 67745c899a
commit e14022f803
34 changed files with 29 additions and 3388 deletions

View File

@@ -1,3 +1,4 @@
using System.Collections.Generic;
using UnityEngine;
namespace YooAsset
@@ -20,6 +21,7 @@ namespace YooAsset
private readonly SandboxFileSystem _fileSystem;
private readonly FSDownloadBundleOptions _options;
private readonly DownloadRetryController _downloadRetryController;
private IReadOnlyList<string> _candidateUrls;
private DownloadFileBaseOperation _downloadFileOp;
private ESteps _steps = ESteps.None;
@@ -172,8 +174,10 @@ namespace YooAsset
/// </summary>
private string GetRequestUrl(string fileName)
{
var urls = _fileSystem.RemoteService.GetRemoteUrls(fileName);
return _fileSystem.DownloadUrlPolicy.SelectUrl(urls);
if (_candidateUrls == null)
_candidateUrls = _fileSystem.RemoteService.GetRemoteUrls(fileName);
return _fileSystem.DownloadUrlPolicy.SelectUrl(_candidateUrls);
}
}
}

View File

@@ -31,9 +31,9 @@ namespace YooAsset
#region
/// <summary>
/// 自定义参数:是否禁用 Unity 内置网络缓存
/// 自定义参数:禁用 Unity 内置网络缓存
/// </summary>
public bool DisableUnityWebCache { get; private set; } = false;
public bool DisableUnityWebCache { get; private set; } = true;
/// <summary>
/// 自定义参数:下载看门狗超时时间(秒)

View File

@@ -31,7 +31,7 @@ namespace YooAsset
public UnityWebRequestCreator WebRequestCreator { get; private set; }
/// <summary>
/// 自定义参数禁用Unity网络缓存
/// 自定义参数:禁用 Unity 内置网络缓存
/// </summary>
public bool DisableUnityWebCache { get; private set; } = false;

View File

@@ -42,7 +42,7 @@ namespace YooAsset
public UnityWebRequestCreator WebRequestCreator { get; private set; }
/// <summary>
/// 自定义参数禁用Unity网络缓存
/// 自定义参数:禁用 Unity 内置网络缓存
/// </summary>
public bool DisableUnityWebCache { get; private set; } = false;