update download system
This commit is contained in:
@@ -6,6 +6,11 @@ using UnityEngine.Networking;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 自定义下载器的请求委托
|
||||
/// </summary>
|
||||
public delegate UnityWebRequest DownloadRequestDelegate(string url);
|
||||
|
||||
/// <summary>
|
||||
/// 1. 保证每一时刻资源文件只存在一个下载器
|
||||
/// 2. 保证下载器下载完成后立刻验证并缓存
|
||||
@@ -17,10 +22,15 @@ namespace YooAsset
|
||||
private static readonly List<string> _removeList = new List<string>(100);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 自定义下载器的请求委托
|
||||
/// </summary>
|
||||
public static DownloadRequestDelegate RequestDelegate = null;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义的证书认证实例
|
||||
/// </summary>
|
||||
public static CertificateHandler CertificateHandlerInstance;
|
||||
public static CertificateHandler CertificateHandlerInstance = null;
|
||||
|
||||
/// <summary>
|
||||
/// 启用断点续传功能文件的最小字节数
|
||||
@@ -32,14 +42,6 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public static List<long> ClearFileResponseCodes { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义下载请求
|
||||
/// </summary>
|
||||
/// <param name="requestDelegate"></param>
|
||||
public static void SetRequestDelegate(DownloadRequestDelegate requestDelegate)
|
||||
{
|
||||
DownloadRequestUtil.SetRequestDelegate(requestDelegate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新所有下载器
|
||||
@@ -75,7 +77,11 @@ namespace YooAsset
|
||||
}
|
||||
_downloaderDic.Clear();
|
||||
_removeList.Clear();
|
||||
|
||||
RequestDelegate = null;
|
||||
CertificateHandlerInstance = null;
|
||||
BreakpointResumeFileSize = int.MaxValue;
|
||||
ClearFileResponseCodes.Clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +116,18 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建一个新的网络请求
|
||||
/// </summary>
|
||||
public static UnityWebRequest NewRequest(string requestURL)
|
||||
{
|
||||
if (RequestDelegate != null)
|
||||
return RequestDelegate.Invoke(requestURL);
|
||||
|
||||
var request = new UnityWebRequest(requestURL, UnityWebRequest.kHttpVerbGET);
|
||||
return request;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取下载器的总数
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user