refactor : 重构网络下载模块

This commit is contained in:
何冠峰
2026-01-07 10:23:11 +08:00
parent 454afc9ba6
commit ee67a55c0f
20 changed files with 215 additions and 95 deletions
@@ -12,7 +12,7 @@ namespace YooAsset
/// </remarks>
internal sealed class UnityWebRequestBackend : IDownloadBackend
{
private readonly UnityWebRequestDelegate _webRequestCreator;
private readonly UnityWebRequestCreator _webRequestCreator;
/// <summary>
/// 后端名称
@@ -36,7 +36,7 @@ namespace YooAsset
/// 自定义 UnityWebRequest 创建委托(可选)。
/// 如果为 null,则使用默认的 UnityWebRequest 构造方式。
/// </param>
public UnityWebRequestBackend(UnityWebRequestDelegate webRequestCreator)
public UnityWebRequestBackend(UnityWebRequestCreator webRequestCreator)
{
_webRequestCreator = webRequestCreator;
}
@@ -0,0 +1,10 @@
using UnityEngine.Networking;
using UnityEngine;
namespace YooAsset
{
/// <summary>
/// 自定义下载器的请求委托
/// </summary>
public delegate UnityWebRequest UnityWebRequestCreator(string url);
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0fa3e6346decc4d4db3b03e6ae93e57a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: