mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-28 19:48:47 +00:00
update download system
remove timeout
This commit is contained in:
@@ -94,4 +94,25 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public long FileSize;
|
public long FileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 导入文件的信息
|
||||||
|
/// </summary>
|
||||||
|
public struct ImportFileInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 本地文件路径
|
||||||
|
/// </summary>
|
||||||
|
public string FilePath;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源包名称
|
||||||
|
/// </summary>
|
||||||
|
public string BundleName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源包GUID
|
||||||
|
/// </summary>
|
||||||
|
public string BundleGUID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public AssetBundle Result { private set; get; }
|
public AssetBundle Result { private set; get; }
|
||||||
|
|
||||||
internal UnityAssetBundleRequestOperation(PackageBundle packageBundle, bool disableUnityWebCache, string url, int timeout = 60) : base(url, timeout)
|
internal UnityAssetBundleRequestOperation(PackageBundle packageBundle, bool disableUnityWebCache, string url) : base(url)
|
||||||
{
|
{
|
||||||
_packageBundle = packageBundle;
|
_packageBundle = packageBundle;
|
||||||
_disableUnityWebCache = disableUnityWebCache;
|
_disableUnityWebCache = disableUnityWebCache;
|
||||||
@@ -40,7 +40,6 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_steps == ESteps.CreateRequest)
|
if (_steps == ESteps.CreateRequest)
|
||||||
{
|
{
|
||||||
ResetTimeout();
|
|
||||||
CreateWebRequest();
|
CreateWebRequest();
|
||||||
_steps = ESteps.Download;
|
_steps = ESteps.Download;
|
||||||
}
|
}
|
||||||
@@ -51,10 +50,7 @@ namespace YooAsset
|
|||||||
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
||||||
Progress = _requestOperation.progress;
|
Progress = _requestOperation.progress;
|
||||||
if (_requestOperation.isDone == false)
|
if (_requestOperation.isDone == false)
|
||||||
{
|
|
||||||
CheckRequestTimeout();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (CheckRequestResult())
|
if (CheckRequestResult())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
using UnityEngine.Networking;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
internal class UnityWebCacheRequestOperation : UnityWebRequestOperation
|
||||||
|
{
|
||||||
|
protected enum ESteps
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
CreateRequest,
|
||||||
|
Download,
|
||||||
|
Done,
|
||||||
|
}
|
||||||
|
|
||||||
|
private UnityWebRequestAsyncOperation _requestOperation;
|
||||||
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
|
||||||
|
internal UnityWebCacheRequestOperation(string url) : base(url)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
internal override void InternalStart()
|
||||||
|
{
|
||||||
|
_steps = ESteps.CreateRequest;
|
||||||
|
}
|
||||||
|
internal override void InternalUpdate()
|
||||||
|
{
|
||||||
|
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_steps == ESteps.CreateRequest)
|
||||||
|
{
|
||||||
|
CreateWebRequest();
|
||||||
|
_steps = ESteps.Download;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_steps == ESteps.Download)
|
||||||
|
{
|
||||||
|
DownloadProgress = _webRequest.downloadProgress;
|
||||||
|
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
||||||
|
Progress = _requestOperation.progress;
|
||||||
|
if (_requestOperation.isDone == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (CheckRequestResult())
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Succeed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注意:最终释放请求器
|
||||||
|
DisposeRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置请求头信息
|
||||||
|
/// </summary>
|
||||||
|
public void SetRequestHeader(string name, string value)
|
||||||
|
{
|
||||||
|
_webRequest.SetRequestHeader(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateWebRequest()
|
||||||
|
{
|
||||||
|
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||||
|
_webRequest.disposeDownloadHandlerOnDispose = true;
|
||||||
|
_requestOperation = _webRequest.SendWebRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 375d88bcf5b9a6146adaf98ceb5369f8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -14,17 +14,24 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
private UnityWebRequestAsyncOperation _requestOperation;
|
private UnityWebRequestAsyncOperation _requestOperation;
|
||||||
private bool _checkTimeout = true;
|
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 响应的超时时间(单位:秒),在经过Timeout的秒数后尝试中止。
|
||||||
|
/// 注意:当Timeout设置为0时,不会应用超时。
|
||||||
|
/// 注意:设置的超时值可能应用于Android上的每个URL重定向,这可能会导致响应时间增加。
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _timeout;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 请求结果
|
/// 请求结果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte[] Result { private set; get; }
|
public byte[] Result { private set; get; }
|
||||||
|
|
||||||
|
|
||||||
internal UnityWebDataRequestOperation(string url, int timeout = 60) : base(url, timeout)
|
internal UnityWebDataRequestOperation(string url, int timeout) : base(url)
|
||||||
{
|
{
|
||||||
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
@@ -37,7 +44,6 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_steps == ESteps.CreateRequest)
|
if (_steps == ESteps.CreateRequest)
|
||||||
{
|
{
|
||||||
ResetTimeout();
|
|
||||||
CreateWebRequest();
|
CreateWebRequest();
|
||||||
_steps = ESteps.Download;
|
_steps = ESteps.Download;
|
||||||
}
|
}
|
||||||
@@ -48,11 +54,7 @@ namespace YooAsset
|
|||||||
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
||||||
Progress = _requestOperation.progress;
|
Progress = _requestOperation.progress;
|
||||||
if (_requestOperation.isDone == false)
|
if (_requestOperation.isDone == false)
|
||||||
{
|
|
||||||
if (_checkTimeout)
|
|
||||||
CheckRequestTimeout();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (CheckRequestResult())
|
if (CheckRequestResult())
|
||||||
{
|
{
|
||||||
@@ -81,18 +83,11 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 不检测超时
|
|
||||||
/// </summary>
|
|
||||||
public void DontCheckTimeout()
|
|
||||||
{
|
|
||||||
_checkTimeout = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateWebRequest()
|
private void CreateWebRequest()
|
||||||
{
|
{
|
||||||
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
|
||||||
DownloadHandlerBuffer handler = new DownloadHandlerBuffer();
|
DownloadHandlerBuffer handler = new DownloadHandlerBuffer();
|
||||||
|
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||||
|
_webRequest.timeout = _timeout;
|
||||||
_webRequest.downloadHandler = handler;
|
_webRequest.downloadHandler = handler;
|
||||||
_webRequest.disposeDownloadHandlerOnDispose = true;
|
_webRequest.disposeDownloadHandlerOnDispose = true;
|
||||||
_requestOperation = _webRequest.SendWebRequest();
|
_requestOperation = _webRequest.SendWebRequest();
|
||||||
|
|||||||
@@ -17,10 +17,18 @@ namespace YooAsset
|
|||||||
private readonly string _fileSavePath;
|
private readonly string _fileSavePath;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 响应的超时时间(单位:秒),在经过Timeout的秒数后尝试中止。
|
||||||
|
/// 注意:当Timeout设置为0时,不会应用超时。
|
||||||
|
/// 注意:设置的超时值可能应用于Android上的每个URL重定向,这可能会导致响应时间增加。
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _timeout;
|
||||||
|
|
||||||
internal UnityWebFileRequestOperation(string url, string fileSavePath, int timeout = 60) : base(url, timeout)
|
|
||||||
|
internal UnityWebFileRequestOperation(string url, string fileSavePath, int timeout) : base(url)
|
||||||
{
|
{
|
||||||
_fileSavePath = fileSavePath;
|
_fileSavePath = fileSavePath;
|
||||||
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
@@ -33,7 +41,6 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_steps == ESteps.CreateRequest)
|
if (_steps == ESteps.CreateRequest)
|
||||||
{
|
{
|
||||||
ResetTimeout();
|
|
||||||
CreateWebRequest();
|
CreateWebRequest();
|
||||||
_steps = ESteps.Download;
|
_steps = ESteps.Download;
|
||||||
}
|
}
|
||||||
@@ -44,10 +51,7 @@ namespace YooAsset
|
|||||||
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
||||||
Progress = _requestOperation.progress;
|
Progress = _requestOperation.progress;
|
||||||
if (_requestOperation.isDone == false)
|
if (_requestOperation.isDone == false)
|
||||||
{
|
|
||||||
CheckRequestTimeout();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (CheckRequestResult())
|
if (CheckRequestResult())
|
||||||
{
|
{
|
||||||
@@ -67,9 +71,10 @@ namespace YooAsset
|
|||||||
|
|
||||||
private void CreateWebRequest()
|
private void CreateWebRequest()
|
||||||
{
|
{
|
||||||
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
|
||||||
DownloadHandlerFile handler = new DownloadHandlerFile(_fileSavePath);
|
DownloadHandlerFile handler = new DownloadHandlerFile(_fileSavePath);
|
||||||
handler.removeFileOnAbort = true;
|
handler.removeFileOnAbort = true;
|
||||||
|
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||||
|
_webRequest.timeout = _timeout;
|
||||||
_webRequest.downloadHandler = handler;
|
_webRequest.downloadHandler = handler;
|
||||||
_webRequest.disposeDownloadHandlerOnDispose = true;
|
_webRequest.disposeDownloadHandlerOnDispose = true;
|
||||||
_requestOperation = _webRequest.SendWebRequest();
|
_requestOperation = _webRequest.SendWebRequest();
|
||||||
|
|||||||
@@ -8,11 +8,6 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
protected UnityWebRequest _webRequest;
|
protected UnityWebRequest _webRequest;
|
||||||
protected readonly string _requestURL;
|
protected readonly string _requestURL;
|
||||||
|
|
||||||
// 超时相关
|
|
||||||
private readonly float _timeout;
|
|
||||||
private ulong _latestDownloadBytes;
|
|
||||||
private float _latestDownloadRealtime;
|
|
||||||
private bool _isAbort = false;
|
private bool _isAbort = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -38,10 +33,9 @@ namespace YooAsset
|
|||||||
get { return _requestURL; }
|
get { return _requestURL; }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal UnityWebRequestOperation(string url, int timeout)
|
internal UnityWebRequestOperation(string url)
|
||||||
{
|
{
|
||||||
_requestURL = url;
|
_requestURL = url;
|
||||||
_timeout = timeout;
|
|
||||||
}
|
}
|
||||||
internal override void InternalAbort()
|
internal override void InternalAbort()
|
||||||
{
|
{
|
||||||
@@ -71,42 +65,6 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 重置超时计时
|
|
||||||
/// </summary>
|
|
||||||
protected void ResetTimeout()
|
|
||||||
{
|
|
||||||
_latestDownloadBytes = 0;
|
|
||||||
_latestDownloadRealtime = Time.realtimeSinceStartup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 检测超时
|
|
||||||
/// </summary>
|
|
||||||
protected void CheckRequestTimeout()
|
|
||||||
{
|
|
||||||
if (_webRequest.isDone)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// 注意:在连续时间段内无新增下载数据及判定为超时
|
|
||||||
if (_isAbort == false)
|
|
||||||
{
|
|
||||||
if (_latestDownloadBytes != _webRequest.downloadedBytes)
|
|
||||||
{
|
|
||||||
_latestDownloadBytes = _webRequest.downloadedBytes;
|
|
||||||
_latestDownloadRealtime = Time.realtimeSinceStartup;
|
|
||||||
}
|
|
||||||
|
|
||||||
float offset = Time.realtimeSinceStartup - _latestDownloadRealtime;
|
|
||||||
if (offset > _timeout)
|
|
||||||
{
|
|
||||||
YooLogger.Warning($"Web request timeout : {_requestURL}");
|
|
||||||
_webRequest.Abort();
|
|
||||||
_isAbort = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检测请求结果
|
/// 检测请求结果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -16,14 +16,22 @@ namespace YooAsset
|
|||||||
private UnityWebRequestAsyncOperation _requestOperation;
|
private UnityWebRequestAsyncOperation _requestOperation;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 响应的超时时间(单位:秒),在经过Timeout的秒数后尝试中止。
|
||||||
|
/// 注意:当Timeout设置为0时,不会应用超时。
|
||||||
|
/// 注意:设置的超时值可能应用于Android上的每个URL重定向,这可能会导致响应时间增加。
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _timeout;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 请求结果
|
/// 请求结果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Result { private set; get; }
|
public string Result { private set; get; }
|
||||||
|
|
||||||
|
|
||||||
internal UnityWebTextRequestOperation(string url, int timeout = 60) : base(url, timeout)
|
internal UnityWebTextRequestOperation(string url, int timeout) : base(url)
|
||||||
{
|
{
|
||||||
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
@@ -36,7 +44,6 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_steps == ESteps.CreateRequest)
|
if (_steps == ESteps.CreateRequest)
|
||||||
{
|
{
|
||||||
ResetTimeout();
|
|
||||||
CreateWebRequest();
|
CreateWebRequest();
|
||||||
_steps = ESteps.Download;
|
_steps = ESteps.Download;
|
||||||
}
|
}
|
||||||
@@ -47,10 +54,7 @@ namespace YooAsset
|
|||||||
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
||||||
Progress = _requestOperation.progress;
|
Progress = _requestOperation.progress;
|
||||||
if (_requestOperation.isDone == false)
|
if (_requestOperation.isDone == false)
|
||||||
{
|
|
||||||
CheckRequestTimeout();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (CheckRequestResult())
|
if (CheckRequestResult())
|
||||||
{
|
{
|
||||||
@@ -81,8 +85,9 @@ namespace YooAsset
|
|||||||
|
|
||||||
private void CreateWebRequest()
|
private void CreateWebRequest()
|
||||||
{
|
{
|
||||||
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
|
||||||
DownloadHandlerBuffer handler = new DownloadHandlerBuffer();
|
DownloadHandlerBuffer handler = new DownloadHandlerBuffer();
|
||||||
|
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||||
|
_webRequest.timeout = _timeout;
|
||||||
_webRequest.downloadHandler = handler;
|
_webRequest.downloadHandler = handler;
|
||||||
_webRequest.disposeDownloadHandlerOnDispose = true;
|
_webRequest.disposeDownloadHandlerOnDispose = true;
|
||||||
_requestOperation = _webRequest.SendWebRequest();
|
_requestOperation = _webRequest.SendWebRequest();
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace YooAsset
|
|||||||
string sourcePath = _fileSystem.GetBuildinPackageHashFilePath(_buildinPackageVersion);
|
string sourcePath = _fileSystem.GetBuildinPackageHashFilePath(_buildinPackageVersion);
|
||||||
string destPath = GetCopyPackageHashDestPath(_buildinPackageVersion);
|
string destPath = GetCopyPackageHashDestPath(_buildinPackageVersion);
|
||||||
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
|
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
|
||||||
_hashFileRequestOp = new UnityWebFileRequestOperation(url, destPath);
|
_hashFileRequestOp = new UnityWebFileRequestOperation(url, destPath, 60);
|
||||||
_hashFileRequestOp.StartOperation();
|
_hashFileRequestOp.StartOperation();
|
||||||
AddChildOperation(_hashFileRequestOp);
|
AddChildOperation(_hashFileRequestOp);
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ namespace YooAsset
|
|||||||
string sourcePath = _fileSystem.GetBuildinPackageManifestFilePath(_buildinPackageVersion);
|
string sourcePath = _fileSystem.GetBuildinPackageManifestFilePath(_buildinPackageVersion);
|
||||||
string destPath = GetCopyPackageManifestDestPath(_buildinPackageVersion);
|
string destPath = GetCopyPackageManifestDestPath(_buildinPackageVersion);
|
||||||
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
|
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
|
||||||
_manifestFileRequestOp = new UnityWebFileRequestOperation(url, destPath);
|
_manifestFileRequestOp = new UnityWebFileRequestOperation(url, destPath, 60);
|
||||||
_manifestFileRequestOp.StartOperation();
|
_manifestFileRequestOp.StartOperation();
|
||||||
AddChildOperation(_manifestFileRequestOp);
|
AddChildOperation(_manifestFileRequestOp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
string filePath = _fileSystem.GetCatalogBinaryFileLoadPath();
|
string filePath = _fileSystem.GetCatalogBinaryFileLoadPath();
|
||||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||||
_webDataRequestOp = new UnityWebDataRequestOperation(url);
|
_webDataRequestOp = new UnityWebDataRequestOperation(url, 60);
|
||||||
_webDataRequestOp.StartOperation();
|
_webDataRequestOp.StartOperation();
|
||||||
AddChildOperation(_webDataRequestOp);
|
AddChildOperation(_webDataRequestOp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
string filePath = _fileSystem.GetBuildinPackageManifestFilePath(_packageVersion);
|
string filePath = _fileSystem.GetBuildinPackageManifestFilePath(_packageVersion);
|
||||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||||
_webDataRequestOp = new UnityWebDataRequestOperation(url);
|
_webDataRequestOp = new UnityWebDataRequestOperation(url, 60);
|
||||||
_webDataRequestOp.StartOperation();
|
_webDataRequestOp.StartOperation();
|
||||||
AddChildOperation(_webDataRequestOp);
|
AddChildOperation(_webDataRequestOp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
string filePath = _fileSystem.GetBuildinPackageHashFilePath(_packageVersion);
|
string filePath = _fileSystem.GetBuildinPackageHashFilePath(_packageVersion);
|
||||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||||
_webTextRequestOp = new UnityWebTextRequestOperation(url);
|
_webTextRequestOp = new UnityWebTextRequestOperation(url, 60);
|
||||||
_webTextRequestOp.StartOperation();
|
_webTextRequestOp.StartOperation();
|
||||||
AddChildOperation(_webTextRequestOp);
|
AddChildOperation(_webTextRequestOp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
string filePath = _fileSystem.GetBuildinPackageVersionFilePath();
|
string filePath = _fileSystem.GetBuildinPackageVersionFilePath();
|
||||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||||
_webTextRequestOp = new UnityWebTextRequestOperation(url);
|
_webTextRequestOp = new UnityWebTextRequestOperation(url, 60);
|
||||||
_webTextRequestOp.StartOperation();
|
_webTextRequestOp.StartOperation();
|
||||||
AddChildOperation(_webTextRequestOp);
|
AddChildOperation(_webTextRequestOp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (_downloadFileOp == null)
|
if (_downloadFileOp == null)
|
||||||
{
|
{
|
||||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
|
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue);
|
||||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, options);
|
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, options);
|
||||||
_downloadFileOp.StartOperation();
|
_downloadFileOp.StartOperation();
|
||||||
AddChildOperation(_downloadFileOp);
|
AddChildOperation(_downloadFileOp);
|
||||||
@@ -304,7 +304,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (_downloadFileOp == null)
|
if (_downloadFileOp == null)
|
||||||
{
|
{
|
||||||
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
|
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue);
|
||||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, options);
|
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, options);
|
||||||
_downloadFileOp.StartOperation();
|
_downloadFileOp.StartOperation();
|
||||||
AddChildOperation(_downloadFileOp);
|
AddChildOperation(_downloadFileOp);
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建下载任务
|
/// 创建下载任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UnityDownloadFileOperation DownloadFileAsync(PackageBundle bundle, string url, int timeout)
|
public UnityDownloadFileOperation DownloadFileAsync(PackageBundle bundle, string url)
|
||||||
{
|
{
|
||||||
// 查询旧的下载器
|
// 查询旧的下载器
|
||||||
if (_downloaders.TryGetValue(bundle.BundleGUID, out var oldDownloader))
|
if (_downloaders.TryGetValue(bundle.BundleGUID, out var oldDownloader))
|
||||||
@@ -99,7 +99,7 @@ namespace YooAsset
|
|||||||
bool isRequestLocalFile = DownloadSystemHelper.IsRequestLocalFile(url);
|
bool isRequestLocalFile = DownloadSystemHelper.IsRequestLocalFile(url);
|
||||||
if (isRequestLocalFile)
|
if (isRequestLocalFile)
|
||||||
{
|
{
|
||||||
newDownloader = new UnityDownloadLocalFileOperation(_fileSystem, bundle, url, timeout);
|
newDownloader = new UnityDownloadLocalFileOperation(_fileSystem, bundle, url);
|
||||||
AddChildOperation(newDownloader);
|
AddChildOperation(newDownloader);
|
||||||
_downloaders.Add(bundle.BundleGUID, newDownloader);
|
_downloaders.Add(bundle.BundleGUID, newDownloader);
|
||||||
}
|
}
|
||||||
@@ -107,13 +107,13 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (bundle.FileSize >= _fileSystem.ResumeDownloadMinimumSize)
|
if (bundle.FileSize >= _fileSystem.ResumeDownloadMinimumSize)
|
||||||
{
|
{
|
||||||
newDownloader = new UnityDownloadResumeFileOperation(_fileSystem, bundle, url, timeout);
|
newDownloader = new UnityDownloadResumeFileOperation(_fileSystem, bundle, url);
|
||||||
AddChildOperation(newDownloader);
|
AddChildOperation(newDownloader);
|
||||||
_downloaders.Add(bundle.BundleGUID, newDownloader);
|
_downloaders.Add(bundle.BundleGUID, newDownloader);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newDownloader = new UnityDownloadNormalFileOperation(_fileSystem, bundle, url, timeout);
|
newDownloader = new UnityDownloadNormalFileOperation(_fileSystem, bundle, url);
|
||||||
AddChildOperation(newDownloader);
|
AddChildOperation(newDownloader);
|
||||||
_downloaders.Add(bundle.BundleGUID, newDownloader);
|
_downloaders.Add(bundle.BundleGUID, newDownloader);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
string url = GetRequestURL();
|
string url = GetRequestURL();
|
||||||
_unityDownloadFileOp = _fileSystem.DownloadCenter.DownloadFileAsync(Bundle, url, _options.Timeout);
|
_unityDownloadFileOp = _fileSystem.DownloadCenter.DownloadFileAsync(Bundle, url);
|
||||||
_steps = ESteps.CheckRequest;
|
_steps = ESteps.CheckRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int RefCount { private set; get; }
|
public int RefCount { private set; get; }
|
||||||
|
|
||||||
internal UnityDownloadFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url, int timeout) : base(url, timeout)
|
internal UnityDownloadFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url) : base(url)
|
||||||
{
|
{
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_bundle = bundle;
|
_bundle = bundle;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ namespace YooAsset
|
|||||||
private VerifyTempFileOperation _verifyOperation;
|
private VerifyTempFileOperation _verifyOperation;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
internal UnityDownloadLocalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url, int timeout = 60)
|
internal UnityDownloadLocalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url)
|
||||||
: base(fileSystem, bundle, url, timeout)
|
: base(fileSystem, bundle, url)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
@@ -32,7 +32,6 @@ namespace YooAsset
|
|||||||
if (File.Exists(_tempFilePath))
|
if (File.Exists(_tempFilePath))
|
||||||
File.Delete(_tempFilePath);
|
File.Delete(_tempFilePath);
|
||||||
|
|
||||||
ResetTimeout();
|
|
||||||
CreateWebRequest();
|
CreateWebRequest();
|
||||||
_steps = ESteps.Download;
|
_steps = ESteps.Download;
|
||||||
}
|
}
|
||||||
@@ -44,10 +43,7 @@ namespace YooAsset
|
|||||||
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
||||||
Progress = DownloadProgress;
|
Progress = DownloadProgress;
|
||||||
if (_webRequest.isDone == false)
|
if (_webRequest.isDone == false)
|
||||||
{
|
|
||||||
CheckRequestTimeout();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// 检查网络错误
|
// 检查网络错误
|
||||||
if (CheckRequestResult())
|
if (CheckRequestResult())
|
||||||
@@ -161,9 +157,9 @@ namespace YooAsset
|
|||||||
|
|
||||||
private void CreateWebRequest()
|
private void CreateWebRequest()
|
||||||
{
|
{
|
||||||
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
|
||||||
DownloadHandlerFile handler = new DownloadHandlerFile(_tempFilePath);
|
DownloadHandlerFile handler = new DownloadHandlerFile(_tempFilePath);
|
||||||
handler.removeFileOnAbort = true;
|
handler.removeFileOnAbort = true;
|
||||||
|
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||||
_webRequest.downloadHandler = handler;
|
_webRequest.downloadHandler = handler;
|
||||||
_webRequest.disposeDownloadHandlerOnDispose = true;
|
_webRequest.disposeDownloadHandlerOnDispose = true;
|
||||||
_webRequest.SendWebRequest();
|
_webRequest.SendWebRequest();
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ namespace YooAsset
|
|||||||
private VerifyTempFileOperation _verifyOperation;
|
private VerifyTempFileOperation _verifyOperation;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
internal UnityDownloadNormalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url, int timeout = 60)
|
internal UnityDownloadNormalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url)
|
||||||
: base(fileSystem, bundle, url, timeout)
|
: base(fileSystem, bundle, url)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
@@ -29,7 +29,6 @@ namespace YooAsset
|
|||||||
if (File.Exists(_tempFilePath))
|
if (File.Exists(_tempFilePath))
|
||||||
File.Delete(_tempFilePath);
|
File.Delete(_tempFilePath);
|
||||||
|
|
||||||
ResetTimeout();
|
|
||||||
CreateWebRequest();
|
CreateWebRequest();
|
||||||
_steps = ESteps.Download;
|
_steps = ESteps.Download;
|
||||||
}
|
}
|
||||||
@@ -41,10 +40,7 @@ namespace YooAsset
|
|||||||
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
||||||
Progress = DownloadProgress;
|
Progress = DownloadProgress;
|
||||||
if (_webRequest.isDone == false)
|
if (_webRequest.isDone == false)
|
||||||
{
|
|
||||||
CheckRequestTimeout();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// 检查网络错误
|
// 检查网络错误
|
||||||
if (CheckRequestResult())
|
if (CheckRequestResult())
|
||||||
@@ -115,9 +111,9 @@ namespace YooAsset
|
|||||||
|
|
||||||
private void CreateWebRequest()
|
private void CreateWebRequest()
|
||||||
{
|
{
|
||||||
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
|
||||||
DownloadHandlerFile handler = new DownloadHandlerFile(_tempFilePath);
|
DownloadHandlerFile handler = new DownloadHandlerFile(_tempFilePath);
|
||||||
handler.removeFileOnAbort = true;
|
handler.removeFileOnAbort = true;
|
||||||
|
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||||
_webRequest.downloadHandler = handler;
|
_webRequest.downloadHandler = handler;
|
||||||
_webRequest.disposeDownloadHandlerOnDispose = true;
|
_webRequest.disposeDownloadHandlerOnDispose = true;
|
||||||
_webRequest.SendWebRequest();
|
_webRequest.SendWebRequest();
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ namespace YooAsset
|
|||||||
private long _fileOriginLength = 0;
|
private long _fileOriginLength = 0;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
internal UnityDownloadResumeFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url, int timeout = 60)
|
internal UnityDownloadResumeFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url)
|
||||||
: base(fileSystem, bundle, url, timeout)
|
: base(fileSystem, bundle, url)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
@@ -46,7 +46,6 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetTimeout();
|
|
||||||
CreateWebRequest(fileBeginLength);
|
CreateWebRequest(fileBeginLength);
|
||||||
_steps = ESteps.Download;
|
_steps = ESteps.Download;
|
||||||
}
|
}
|
||||||
@@ -58,10 +57,7 @@ namespace YooAsset
|
|||||||
DownloadedBytes = _fileOriginLength + (long)_webRequest.downloadedBytes;
|
DownloadedBytes = _fileOriginLength + (long)_webRequest.downloadedBytes;
|
||||||
Progress = DownloadProgress;
|
Progress = DownloadProgress;
|
||||||
if (_webRequest.isDone == false)
|
if (_webRequest.isDone == false)
|
||||||
{
|
|
||||||
CheckRequestTimeout();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// 检查网络错误
|
// 检查网络错误
|
||||||
if (CheckRequestResult())
|
if (CheckRequestResult())
|
||||||
@@ -147,9 +143,9 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
private void CreateWebRequest(long fileBeginLength)
|
private void CreateWebRequest(long fileBeginLength)
|
||||||
{
|
{
|
||||||
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
|
||||||
var handler = new DownloadHandlerFile(_tempFilePath, true);
|
var handler = new DownloadHandlerFile(_tempFilePath, true);
|
||||||
handler.removeFileOnAbort = false;
|
handler.removeFileOnAbort = false;
|
||||||
|
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||||
_webRequest.downloadHandler = handler;
|
_webRequest.downloadHandler = handler;
|
||||||
_webRequest.disposeDownloadHandlerOnDispose = true;
|
_webRequest.disposeDownloadHandlerOnDispose = true;
|
||||||
if (fileBeginLength > 0)
|
if (fileBeginLength > 0)
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace YooAsset
|
|||||||
if (_loadWebPackageManifestOp == null)
|
if (_loadWebPackageManifestOp == null)
|
||||||
{
|
{
|
||||||
string packageHash = _requestWebPackageHashOp.PackageHash;
|
string packageHash = _requestWebPackageHashOp.PackageHash;
|
||||||
_loadWebPackageManifestOp = new LoadWebRemotePackageManifestOperation(_fileSystem, _packageVersion, packageHash);
|
_loadWebPackageManifestOp = new LoadWebRemotePackageManifestOperation(_fileSystem, _packageVersion, packageHash, _timeout);
|
||||||
_loadWebPackageManifestOp.StartOperation();
|
_loadWebPackageManifestOp.StartOperation();
|
||||||
AddChildOperation(_loadWebPackageManifestOp);
|
AddChildOperation(_loadWebPackageManifestOp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace YooAsset
|
|||||||
private readonly DefaultWebRemoteFileSystem _fileSystem;
|
private readonly DefaultWebRemoteFileSystem _fileSystem;
|
||||||
private readonly string _packageVersion;
|
private readonly string _packageVersion;
|
||||||
private readonly string _packageHash;
|
private readonly string _packageHash;
|
||||||
|
private readonly int _timeout;
|
||||||
private UnityWebDataRequestOperation _webDataRequestOp;
|
private UnityWebDataRequestOperation _webDataRequestOp;
|
||||||
private DeserializeManifestOperation _deserializer;
|
private DeserializeManifestOperation _deserializer;
|
||||||
private int _requestCount = 0;
|
private int _requestCount = 0;
|
||||||
@@ -26,11 +27,12 @@ namespace YooAsset
|
|||||||
public PackageManifest Manifest { private set; get; }
|
public PackageManifest Manifest { private set; get; }
|
||||||
|
|
||||||
|
|
||||||
internal LoadWebRemotePackageManifestOperation(DefaultWebRemoteFileSystem fileSystem, string packageVersion, string packageHash)
|
internal LoadWebRemotePackageManifestOperation(DefaultWebRemoteFileSystem fileSystem, string packageVersion, string packageHash, int timeout)
|
||||||
{
|
{
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_packageVersion = packageVersion;
|
_packageVersion = packageVersion;
|
||||||
_packageHash = packageHash;
|
_packageHash = packageHash;
|
||||||
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
@@ -48,7 +50,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, _packageVersion);
|
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, _packageVersion);
|
||||||
string url = GetWebRequestURL(fileName);
|
string url = GetWebRequestURL(fileName);
|
||||||
_webDataRequestOp = new UnityWebDataRequestOperation(url);
|
_webDataRequestOp = new UnityWebDataRequestOperation(url, _timeout);
|
||||||
_webDataRequestOp.StartOperation();
|
_webDataRequestOp.StartOperation();
|
||||||
AddChildOperation(_webDataRequestOp);
|
AddChildOperation(_webDataRequestOp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace YooAsset
|
|||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_loadCatalogFileOp = new LoadWebServerCatalogFileOperation(_fileSystem);
|
_loadCatalogFileOp = new LoadWebServerCatalogFileOperation(_fileSystem, 60);
|
||||||
_loadCatalogFileOp.StartOperation();
|
_loadCatalogFileOp.StartOperation();
|
||||||
AddChildOperation(_loadCatalogFileOp);
|
AddChildOperation(_loadCatalogFileOp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace YooAsset
|
|||||||
if (_loadWebPackageManifestOp == null)
|
if (_loadWebPackageManifestOp == null)
|
||||||
{
|
{
|
||||||
string packageHash = _requestWebPackageHashOp.PackageHash;
|
string packageHash = _requestWebPackageHashOp.PackageHash;
|
||||||
_loadWebPackageManifestOp = new LoadWebServerPackageManifestOperation(_fileSystem, _packageVersion, packageHash);
|
_loadWebPackageManifestOp = new LoadWebServerPackageManifestOperation(_fileSystem, _packageVersion, packageHash, _timeout);
|
||||||
_loadWebPackageManifestOp.StartOperation();
|
_loadWebPackageManifestOp.StartOperation();
|
||||||
AddChildOperation(_loadWebPackageManifestOp);
|
AddChildOperation(_loadWebPackageManifestOp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,12 +16,14 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly DefaultWebServerFileSystem _fileSystem;
|
private readonly DefaultWebServerFileSystem _fileSystem;
|
||||||
|
private readonly int _timeout;
|
||||||
private UnityWebDataRequestOperation _webDataRequestOp;
|
private UnityWebDataRequestOperation _webDataRequestOp;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
internal LoadWebServerCatalogFileOperation(DefaultWebServerFileSystem fileSystem)
|
internal LoadWebServerCatalogFileOperation(DefaultWebServerFileSystem fileSystem, int timeout)
|
||||||
{
|
{
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
@@ -38,7 +40,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
string filePath = _fileSystem.GetCatalogBinaryFileLoadPath();
|
string filePath = _fileSystem.GetCatalogBinaryFileLoadPath();
|
||||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||||
_webDataRequestOp = new UnityWebDataRequestOperation(url);
|
_webDataRequestOp = new UnityWebDataRequestOperation(url, _timeout);
|
||||||
_webDataRequestOp.StartOperation();
|
_webDataRequestOp.StartOperation();
|
||||||
AddChildOperation(_webDataRequestOp);
|
AddChildOperation(_webDataRequestOp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace YooAsset
|
|||||||
private readonly DefaultWebServerFileSystem _fileSystem;
|
private readonly DefaultWebServerFileSystem _fileSystem;
|
||||||
private readonly string _packageVersion;
|
private readonly string _packageVersion;
|
||||||
private readonly string _packageHash;
|
private readonly string _packageHash;
|
||||||
|
private readonly int _timeout;
|
||||||
private UnityWebDataRequestOperation _webDataRequestOp;
|
private UnityWebDataRequestOperation _webDataRequestOp;
|
||||||
private DeserializeManifestOperation _deserializer;
|
private DeserializeManifestOperation _deserializer;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
@@ -25,11 +26,12 @@ namespace YooAsset
|
|||||||
public PackageManifest Manifest { private set; get; }
|
public PackageManifest Manifest { private set; get; }
|
||||||
|
|
||||||
|
|
||||||
internal LoadWebServerPackageManifestOperation(DefaultWebServerFileSystem fileSystem, string packageVersion, string packageHash)
|
internal LoadWebServerPackageManifestOperation(DefaultWebServerFileSystem fileSystem, string packageVersion, string packageHash, int timeout)
|
||||||
{
|
{
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_packageVersion = packageVersion;
|
_packageVersion = packageVersion;
|
||||||
_packageHash = packageHash;
|
_packageHash = packageHash;
|
||||||
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
@@ -46,7 +48,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
string filePath = _fileSystem.GetWebPackageManifestFilePath(_packageVersion);
|
string filePath = _fileSystem.GetWebPackageManifestFilePath(_packageVersion);
|
||||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||||
_webDataRequestOp = new UnityWebDataRequestOperation(url);
|
_webDataRequestOp = new UnityWebDataRequestOperation(url, _timeout);
|
||||||
_webDataRequestOp.StartOperation();
|
_webDataRequestOp.StartOperation();
|
||||||
AddChildOperation(_webDataRequestOp);
|
AddChildOperation(_webDataRequestOp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,6 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly int FailedTryAgain;
|
public readonly int FailedTryAgain;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 超时时间
|
|
||||||
/// </summary>
|
|
||||||
public readonly int Timeout;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 主资源地址
|
/// 主资源地址
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -28,10 +23,9 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string ImportFilePath { set; get; }
|
public string ImportFilePath { set; get; }
|
||||||
|
|
||||||
public DownloadFileOptions(int failedTryAgain, int timeout)
|
public DownloadFileOptions(int failedTryAgain)
|
||||||
{
|
{
|
||||||
FailedTryAgain = failedTryAgain;
|
FailedTryAgain = failedTryAgain;
|
||||||
Timeout = timeout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
internal abstract class DownloadAssetBundleOperation : AsyncOperationBase
|
internal abstract class LoadWebAssetBundleOperation : AsyncOperationBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AssetBundle对象
|
/// AssetBundle对象
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class DownloadEncryptAssetBundleOperation : DownloadAssetBundleOperation
|
internal class LoadWebEncryptAssetBundleOperation : LoadWebAssetBundleOperation
|
||||||
{
|
{
|
||||||
protected enum ESteps
|
protected enum ESteps
|
||||||
{
|
{
|
||||||
@@ -16,7 +16,6 @@ namespace YooAsset
|
|||||||
private UnityWebDataRequestOperation _unityWebDataRequestOp;
|
private UnityWebDataRequestOperation _unityWebDataRequestOp;
|
||||||
private readonly PackageBundle _bundle;
|
private readonly PackageBundle _bundle;
|
||||||
private readonly DownloadFileOptions _options;
|
private readonly DownloadFileOptions _options;
|
||||||
private readonly bool _checkTimeout;
|
|
||||||
private readonly IWebDecryptionServices _decryptionServices;
|
private readonly IWebDecryptionServices _decryptionServices;
|
||||||
|
|
||||||
protected int _requestCount = 0;
|
protected int _requestCount = 0;
|
||||||
@@ -24,11 +23,10 @@ namespace YooAsset
|
|||||||
protected int _failedTryAgain;
|
protected int _failedTryAgain;
|
||||||
private ESteps _steps = ESteps.None;
|
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;
|
_bundle = bundle;
|
||||||
_options = options;
|
_options = options;
|
||||||
_checkTimeout = checkTimeout;
|
|
||||||
_decryptionServices = decryptionServices;
|
_decryptionServices = decryptionServices;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
@@ -53,10 +51,8 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
string url = GetRequestURL();
|
string url = GetRequestURL();
|
||||||
_unityWebDataRequestOp = new UnityWebDataRequestOperation(url, _options.Timeout);
|
_unityWebDataRequestOp = new UnityWebDataRequestOperation(url, 0);
|
||||||
_unityWebDataRequestOp.StartOperation();
|
_unityWebDataRequestOp.StartOperation();
|
||||||
if (_checkTimeout == false)
|
|
||||||
_unityWebDataRequestOp.DontCheckTimeout();
|
|
||||||
_steps = ESteps.CheckRequest;
|
_steps = ESteps.CheckRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class DownloadNormalAssetBundleOperation : DownloadAssetBundleOperation
|
internal class LoadWebNormalAssetBundleOperation : LoadWebAssetBundleOperation
|
||||||
{
|
{
|
||||||
protected enum ESteps
|
protected enum ESteps
|
||||||
{
|
{
|
||||||
@@ -13,10 +13,10 @@ namespace YooAsset
|
|||||||
Done,
|
Done,
|
||||||
}
|
}
|
||||||
|
|
||||||
private UnityAssetBundleRequestOperation _unityAssetBundleRequestOp;
|
|
||||||
private readonly PackageBundle _bundle;
|
private readonly PackageBundle _bundle;
|
||||||
private readonly DownloadFileOptions _options;
|
private readonly DownloadFileOptions _options;
|
||||||
private readonly bool _disableUnityWebCache;
|
private readonly bool _disableUnityWebCache;
|
||||||
|
private UnityAssetBundleRequestOperation _unityAssetBundleRequestOp;
|
||||||
|
|
||||||
protected int _requestCount = 0;
|
protected int _requestCount = 0;
|
||||||
protected float _tryAgainTimer;
|
protected float _tryAgainTimer;
|
||||||
@@ -24,7 +24,7 @@ namespace YooAsset
|
|||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
|
||||||
internal DownloadNormalAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options, bool disableUnityWebCache)
|
internal LoadWebNormalAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options, bool disableUnityWebCache)
|
||||||
{
|
{
|
||||||
_bundle = bundle;
|
_bundle = bundle;
|
||||||
_options = options;
|
_options = options;
|
||||||
@@ -43,7 +43,7 @@ namespace YooAsset
|
|||||||
if (_steps == ESteps.CreateRequest)
|
if (_steps == ESteps.CreateRequest)
|
||||||
{
|
{
|
||||||
string url = GetRequestURL();
|
string url = GetRequestURL();
|
||||||
_unityAssetBundleRequestOp = new UnityAssetBundleRequestOperation(_bundle, _disableUnityWebCache, url, _options.Timeout);
|
_unityAssetBundleRequestOp = new UnityAssetBundleRequestOperation(_bundle, _disableUnityWebCache, url);
|
||||||
_unityAssetBundleRequestOp.StartOperation();
|
_unityAssetBundleRequestOp.StartOperation();
|
||||||
_steps = ESteps.CheckRequest;
|
_steps = ESteps.CheckRequest;
|
||||||
}
|
}
|
||||||
@@ -36,9 +36,9 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建下载器
|
/// 创建下载器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FSDownloadFileOperation CreateDownloader(int failedTryAgain, int timeout)
|
public FSDownloadFileOperation CreateDownloader(int failedTryAgain)
|
||||||
{
|
{
|
||||||
DownloadFileOptions options = new DownloadFileOptions(failedTryAgain, timeout);
|
DownloadFileOptions options = new DownloadFileOptions(failedTryAgain);
|
||||||
options.ImportFilePath = _importFilePath;
|
options.ImportFilePath = _importFilePath;
|
||||||
return _fileSystem.DownloadFileAsync(Bundle, options);
|
return _fileSystem.DownloadFileAsync(Bundle, options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,15 +34,16 @@ namespace YooAsset
|
|||||||
ClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options);
|
ClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options);
|
||||||
|
|
||||||
// 下载相关
|
// 下载相关
|
||||||
ResourceDownloaderOperation CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout);
|
ResourceDownloaderOperation CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain);
|
||||||
ResourceDownloaderOperation CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout);
|
ResourceDownloaderOperation CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain);
|
||||||
ResourceDownloaderOperation CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout);
|
ResourceDownloaderOperation CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain);
|
||||||
|
|
||||||
// 解压相关
|
// 解压相关
|
||||||
ResourceUnpackerOperation CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout);
|
ResourceUnpackerOperation CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain);
|
||||||
ResourceUnpackerOperation CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout);
|
ResourceUnpackerOperation CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain);
|
||||||
|
|
||||||
// 导入相关
|
// 导入相关
|
||||||
ResourceImporterOperation CreateResourceImporterByFilePaths(string[] filePaths, int importerMaxNumber, int failedTryAgain, int timeout);
|
ResourceImporterOperation CreateResourceImporterByFilePaths(string[] filePaths, int importingMaxNumber, int failedTryAgain);
|
||||||
|
ResourceImporterOperation CreateResourceImporterByFileInfos(ImportFileInfo[] fileInfos, int importingMaxNumber, int failedTryAgain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,6 @@ namespace YooAsset
|
|||||||
private readonly string _packageName;
|
private readonly string _packageName;
|
||||||
private readonly int _downloadingMaxNumber;
|
private readonly int _downloadingMaxNumber;
|
||||||
private readonly int _failedTryAgain;
|
private readonly int _failedTryAgain;
|
||||||
private readonly int _timeout;
|
|
||||||
private readonly List<BundleInfo> _bundleInfoList;
|
private readonly List<BundleInfo> _bundleInfoList;
|
||||||
private readonly List<FSDownloadFileOperation> _downloaders = new List<FSDownloadFileOperation>(MAX_LOADER_COUNT);
|
private readonly List<FSDownloadFileOperation> _downloaders = new List<FSDownloadFileOperation>(MAX_LOADER_COUNT);
|
||||||
private readonly List<FSDownloadFileOperation> _removeList = new List<FSDownloadFileOperation>(MAX_LOADER_COUNT);
|
private readonly List<FSDownloadFileOperation> _removeList = new List<FSDownloadFileOperation>(MAX_LOADER_COUNT);
|
||||||
@@ -102,13 +101,12 @@ namespace YooAsset
|
|||||||
public DownloadFileBegin DownloadFileBeginCallback { set; get; }
|
public DownloadFileBegin DownloadFileBeginCallback { set; get; }
|
||||||
|
|
||||||
|
|
||||||
internal DownloaderOperation(string packageName, List<BundleInfo> downloadList, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
internal DownloaderOperation(string packageName, List<BundleInfo> downloadList, int downloadingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
_packageName = packageName;
|
_packageName = packageName;
|
||||||
_bundleInfoList = downloadList;
|
_bundleInfoList = downloadList;
|
||||||
_downloadingMaxNumber = UnityEngine.Mathf.Clamp(downloadingMaxNumber, 1, MAX_LOADER_COUNT); ;
|
_downloadingMaxNumber = UnityEngine.Mathf.Clamp(downloadingMaxNumber, 1, MAX_LOADER_COUNT); ;
|
||||||
_failedTryAgain = failedTryAgain;
|
_failedTryAgain = failedTryAgain;
|
||||||
_timeout = timeout;
|
|
||||||
|
|
||||||
// 设置包裹名称 (fix #210)
|
// 设置包裹名称 (fix #210)
|
||||||
SetPackageName(packageName);
|
SetPackageName(packageName);
|
||||||
@@ -203,7 +201,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
int index = _bundleInfoList.Count - 1;
|
int index = _bundleInfoList.Count - 1;
|
||||||
var bundleInfo = _bundleInfoList[index];
|
var bundleInfo = _bundleInfoList[index];
|
||||||
var downloader = bundleInfo.CreateDownloader(_failedTryAgain, _timeout);
|
var downloader = bundleInfo.CreateDownloader(_failedTryAgain);
|
||||||
downloader.StartOperation();
|
downloader.StartOperation();
|
||||||
this.AddChildOperation(downloader);
|
this.AddChildOperation(downloader);
|
||||||
|
|
||||||
@@ -374,52 +372,52 @@ namespace YooAsset
|
|||||||
|
|
||||||
public sealed class ResourceDownloaderOperation : DownloaderOperation
|
public sealed class ResourceDownloaderOperation : DownloaderOperation
|
||||||
{
|
{
|
||||||
internal ResourceDownloaderOperation(string packageName, List<BundleInfo> downloadList, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
internal ResourceDownloaderOperation(string packageName, List<BundleInfo> downloadList, int downloadingMaxNumber, int failedTryAgain)
|
||||||
: base(packageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout)
|
: base(packageName, downloadList, downloadingMaxNumber, failedTryAgain)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建空的下载器
|
/// 创建空的下载器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static ResourceDownloaderOperation CreateEmptyDownloader(string packageName, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
internal static ResourceDownloaderOperation CreateEmptyDownloader(string packageName, int downloadingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
List<BundleInfo> downloadList = new List<BundleInfo>();
|
List<BundleInfo> downloadList = new List<BundleInfo>();
|
||||||
var operation = new ResourceDownloaderOperation(packageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
var operation = new ResourceDownloaderOperation(packageName, downloadList, downloadingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public sealed class ResourceUnpackerOperation : DownloaderOperation
|
public sealed class ResourceUnpackerOperation : DownloaderOperation
|
||||||
{
|
{
|
||||||
internal ResourceUnpackerOperation(string packageName, List<BundleInfo> downloadList, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
internal ResourceUnpackerOperation(string packageName, List<BundleInfo> downloadList, int downloadingMaxNumber, int failedTryAgain)
|
||||||
: base(packageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout)
|
: base(packageName, downloadList, downloadingMaxNumber, failedTryAgain)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建空的解压器
|
/// 创建空的解压器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static ResourceUnpackerOperation CreateEmptyUnpacker(string packageName, int upackingMaxNumber, int failedTryAgain, int timeout)
|
internal static ResourceUnpackerOperation CreateEmptyUnpacker(string packageName, int upackingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
List<BundleInfo> downloadList = new List<BundleInfo>();
|
List<BundleInfo> downloadList = new List<BundleInfo>();
|
||||||
var operation = new ResourceUnpackerOperation(packageName, downloadList, upackingMaxNumber, failedTryAgain, int.MaxValue);
|
var operation = new ResourceUnpackerOperation(packageName, downloadList, upackingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public sealed class ResourceImporterOperation : DownloaderOperation
|
public sealed class ResourceImporterOperation : DownloaderOperation
|
||||||
{
|
{
|
||||||
internal ResourceImporterOperation(string packageName, List<BundleInfo> downloadList, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
internal ResourceImporterOperation(string packageName, List<BundleInfo> downloadList, int downloadingMaxNumber, int failedTryAgain)
|
||||||
: base(packageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout)
|
: base(packageName, downloadList, downloadingMaxNumber, failedTryAgain)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建空的导入器
|
/// 创建空的导入器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static ResourceImporterOperation CreateEmptyImporter(string packageName, int upackingMaxNumber, int failedTryAgain, int timeout)
|
internal static ResourceImporterOperation CreateEmptyImporter(string packageName, int upackingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
List<BundleInfo> downloadList = new List<BundleInfo>();
|
List<BundleInfo> downloadList = new List<BundleInfo>();
|
||||||
var operation = new ResourceImporterOperation(packageName, downloadList, upackingMaxNumber, failedTryAgain, int.MaxValue);
|
var operation = new ResourceImporterOperation(packageName, downloadList, upackingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,11 +107,11 @@ namespace YooAsset
|
|||||||
if (Status != EOperationStatus.Succeed)
|
if (Status != EOperationStatus.Succeed)
|
||||||
{
|
{
|
||||||
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
|
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
|
||||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<BundleInfo> downloadList = _impl.GetDownloadListByAll(_manifest);
|
List<BundleInfo> downloadList = _impl.GetDownloadListByAll(_manifest);
|
||||||
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,11 +127,11 @@ namespace YooAsset
|
|||||||
if (Status != EOperationStatus.Succeed)
|
if (Status != EOperationStatus.Succeed)
|
||||||
{
|
{
|
||||||
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
|
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
|
||||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<BundleInfo> downloadList = _impl.GetDownloadListByTags(_manifest, new string[] { tag });
|
List<BundleInfo> downloadList = _impl.GetDownloadListByTags(_manifest, new string[] { tag });
|
||||||
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,11 +147,11 @@ namespace YooAsset
|
|||||||
if (Status != EOperationStatus.Succeed)
|
if (Status != EOperationStatus.Succeed)
|
||||||
{
|
{
|
||||||
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
|
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
|
||||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<BundleInfo> downloadList = _impl.GetDownloadListByTags(_manifest, tags);
|
List<BundleInfo> downloadList = _impl.GetDownloadListByTags(_manifest, tags);
|
||||||
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ namespace YooAsset
|
|||||||
if (Status != EOperationStatus.Succeed)
|
if (Status != EOperationStatus.Succeed)
|
||||||
{
|
{
|
||||||
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
|
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
|
||||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AssetInfo> assetInfos = new List<AssetInfo>();
|
List<AssetInfo> assetInfos = new List<AssetInfo>();
|
||||||
@@ -175,7 +175,7 @@ namespace YooAsset
|
|||||||
assetInfos.Add(assetInfo);
|
assetInfos.Add(assetInfo);
|
||||||
|
|
||||||
List<BundleInfo> downloadList = _impl.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), recursiveDownload);
|
List<BundleInfo> downloadList = _impl.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), recursiveDownload);
|
||||||
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ namespace YooAsset
|
|||||||
if (Status != EOperationStatus.Succeed)
|
if (Status != EOperationStatus.Succeed)
|
||||||
{
|
{
|
||||||
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
|
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
|
||||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain, timeout);
|
return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AssetInfo> assetInfos = new List<AssetInfo>(locations.Length);
|
List<AssetInfo> assetInfos = new List<AssetInfo>(locations.Length);
|
||||||
@@ -202,7 +202,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<BundleInfo> downloadList = _impl.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), recursiveDownload);
|
List<BundleInfo> downloadList = _impl.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), recursiveDownload);
|
||||||
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,44 +104,50 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 下载相关
|
// 下载相关
|
||||||
ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout)
|
ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
List<BundleInfo> downloadList = GetDownloadListByAll(ActiveManifest);
|
List<BundleInfo> downloadList = GetDownloadListByAll(ActiveManifest);
|
||||||
var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
List<BundleInfo> downloadList = GetDownloadListByTags(ActiveManifest, tags);
|
List<BundleInfo> downloadList = GetDownloadListByTags(ActiveManifest, tags);
|
||||||
var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
List<BundleInfo> downloadList = GetDownloadListByPaths(ActiveManifest, assetInfos, recursiveDownload);
|
List<BundleInfo> downloadList = GetDownloadListByPaths(ActiveManifest, assetInfos, recursiveDownload);
|
||||||
var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解压相关
|
// 解压相关
|
||||||
ResourceUnpackerOperation IPlayMode.CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout)
|
ResourceUnpackerOperation IPlayMode.CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
List<BundleInfo> unpcakList = GetUnpackListByAll(ActiveManifest);
|
List<BundleInfo> unpcakList = GetUnpackListByAll(ActiveManifest);
|
||||||
var operation = new ResourceUnpackerOperation(PackageName, unpcakList, upackingMaxNumber, failedTryAgain, timeout);
|
var operation = new ResourceUnpackerOperation(PackageName, unpcakList, upackingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
ResourceUnpackerOperation IPlayMode.CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout)
|
ResourceUnpackerOperation IPlayMode.CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
List<BundleInfo> unpcakList = GetUnpackListByTags(ActiveManifest, tags);
|
List<BundleInfo> unpcakList = GetUnpackListByTags(ActiveManifest, tags);
|
||||||
var operation = new ResourceUnpackerOperation(PackageName, unpcakList, upackingMaxNumber, failedTryAgain, timeout);
|
var operation = new ResourceUnpackerOperation(PackageName, unpcakList, upackingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导入相关
|
// 导入相关
|
||||||
ResourceImporterOperation IPlayMode.CreateResourceImporterByFilePaths(string[] filePaths, int importerMaxNumber, int failedTryAgain, int timeout)
|
ResourceImporterOperation IPlayMode.CreateResourceImporterByFilePaths(string[] filePaths, int importingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
List<BundleInfo> importerList = GetImporterListByFilePaths(ActiveManifest, filePaths);
|
List<BundleInfo> importerList = GetImporterListByFilePaths(ActiveManifest, filePaths);
|
||||||
var operation = new ResourceImporterOperation(PackageName, importerList, importerMaxNumber, failedTryAgain, timeout);
|
var operation = new ResourceImporterOperation(PackageName, importerList, importingMaxNumber, failedTryAgain);
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
ResourceImporterOperation IPlayMode.CreateResourceImporterByFileInfos(ImportFileInfo[] fileInfos, int importingMaxNumber, int failedTryAgain)
|
||||||
|
{
|
||||||
|
List<BundleInfo> importerList = GetImporterListByFileInfos(ActiveManifest, fileInfos);
|
||||||
|
var operation = new ResourceImporterOperation(PackageName, importerList, importingMaxNumber, failedTryAgain);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -419,11 +425,56 @@ namespace YooAsset
|
|||||||
if (manifest == null)
|
if (manifest == null)
|
||||||
return new List<BundleInfo>();
|
return new List<BundleInfo>();
|
||||||
|
|
||||||
List<BundleInfo> result = new List<BundleInfo>();
|
ImportFileInfo[] fileInfos = new ImportFileInfo[filePaths.Length];
|
||||||
foreach (var filePath in filePaths)
|
for (int i = 0; i < filePaths.Length; i++)
|
||||||
{
|
{
|
||||||
string fileName = System.IO.Path.GetFileName(filePath);
|
ImportFileInfo fileInfo = new ImportFileInfo();
|
||||||
if (manifest.TryGetPackageBundleByFileName(fileName, out PackageBundle packageBundle))
|
fileInfo.FilePath = filePaths[i];
|
||||||
|
fileInfos[i] = fileInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetImporterListByFileInfos(manifest, fileInfos);
|
||||||
|
}
|
||||||
|
public List<BundleInfo> GetImporterListByFileInfos(PackageManifest manifest, ImportFileInfo[] fileInfos)
|
||||||
|
{
|
||||||
|
if (manifest == null)
|
||||||
|
return new List<BundleInfo>();
|
||||||
|
|
||||||
|
List<BundleInfo> result = new List<BundleInfo>();
|
||||||
|
foreach (var fileInfo in fileInfos)
|
||||||
|
{
|
||||||
|
string filePath = fileInfo.FilePath;
|
||||||
|
if (string.IsNullOrEmpty(filePath))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
PackageBundle packageBundle = null;
|
||||||
|
if (string.IsNullOrEmpty(fileInfo.BundleName) == false)
|
||||||
|
{
|
||||||
|
if (manifest.TryGetPackageBundleByBundleName(fileInfo.BundleName, out packageBundle) == false)
|
||||||
|
{
|
||||||
|
YooLogger.Warning($"Not found package bundle, bundle name : {fileInfo.BundleName}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (string.IsNullOrEmpty(fileInfo.BundleGUID) == false)
|
||||||
|
{
|
||||||
|
if (manifest.TryGetPackageBundleByBundleGUID(fileInfo.BundleGUID, out packageBundle) == false)
|
||||||
|
{
|
||||||
|
YooLogger.Warning($"Not found package bundle, bundle guid : {fileInfo.BundleGUID}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string fileName = System.IO.Path.GetFileName(filePath);
|
||||||
|
if (manifest.TryGetPackageBundleByFileName(fileName, out packageBundle) == false)
|
||||||
|
{
|
||||||
|
YooLogger.Warning($"Not found package bundle, file name : {fileName}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packageBundle != null)
|
||||||
{
|
{
|
||||||
var fileSystem = GetBelongFileSystem(packageBundle);
|
var fileSystem = GetBelongFileSystem(packageBundle);
|
||||||
if (fileSystem == null)
|
if (fileSystem == null)
|
||||||
@@ -435,10 +486,6 @@ namespace YooAsset
|
|||||||
result.Add(bundleInfo);
|
result.Add(bundleInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
YooLogger.Warning($"Not found package bundle, importer file path : {filePath}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -969,7 +969,7 @@ namespace YooAsset
|
|||||||
public ResourceDownloaderOperation CreateResourceDownloader(int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
public ResourceDownloaderOperation CreateResourceDownloader(int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
return _playModeImpl.CreateResourceDownloaderByAll(downloadingMaxNumber, failedTryAgain, timeout);
|
return _playModeImpl.CreateResourceDownloaderByAll(downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -982,7 +982,7 @@ namespace YooAsset
|
|||||||
public ResourceDownloaderOperation CreateResourceDownloader(string tag, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
public ResourceDownloaderOperation CreateResourceDownloader(string tag, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
return _playModeImpl.CreateResourceDownloaderByTags(new string[] { tag }, downloadingMaxNumber, failedTryAgain, timeout);
|
return _playModeImpl.CreateResourceDownloaderByTags(new string[] { tag }, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -995,7 +995,7 @@ namespace YooAsset
|
|||||||
public ResourceDownloaderOperation CreateResourceDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
public ResourceDownloaderOperation CreateResourceDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
return _playModeImpl.CreateResourceDownloaderByTags(tags, downloadingMaxNumber, failedTryAgain, timeout);
|
return _playModeImpl.CreateResourceDownloaderByTags(tags, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1011,11 +1011,11 @@ namespace YooAsset
|
|||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
var assetInfo = ConvertLocationToAssetInfo(location, null);
|
var assetInfo = ConvertLocationToAssetInfo(location, null);
|
||||||
AssetInfo[] assetInfos = new AssetInfo[] { assetInfo };
|
AssetInfo[] assetInfos = new AssetInfo[] { assetInfo };
|
||||||
return _playModeImpl.CreateResourceDownloaderByPaths(assetInfos, recursiveDownload, downloadingMaxNumber, failedTryAgain, timeout);
|
return _playModeImpl.CreateResourceDownloaderByPaths(assetInfos, recursiveDownload, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
public ResourceDownloaderOperation CreateBundleDownloader(string location, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
public ResourceDownloaderOperation CreateBundleDownloader(string location, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||||
{
|
{
|
||||||
return CreateBundleDownloader(location, false, downloadingMaxNumber, failedTryAgain, timeout);
|
return CreateBundleDownloader(location, false, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1035,11 +1035,11 @@ namespace YooAsset
|
|||||||
var assetInfo = ConvertLocationToAssetInfo(location, null);
|
var assetInfo = ConvertLocationToAssetInfo(location, null);
|
||||||
assetInfos.Add(assetInfo);
|
assetInfos.Add(assetInfo);
|
||||||
}
|
}
|
||||||
return _playModeImpl.CreateResourceDownloaderByPaths(assetInfos.ToArray(), recursiveDownload, downloadingMaxNumber, failedTryAgain, timeout);
|
return _playModeImpl.CreateResourceDownloaderByPaths(assetInfos.ToArray(), recursiveDownload, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
public ResourceDownloaderOperation CreateBundleDownloader(string[] locations, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
public ResourceDownloaderOperation CreateBundleDownloader(string[] locations, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||||
{
|
{
|
||||||
return CreateBundleDownloader(locations, false, downloadingMaxNumber, failedTryAgain, timeout);
|
return CreateBundleDownloader(locations, false, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1054,11 +1054,11 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
AssetInfo[] assetInfos = new AssetInfo[] { assetInfo };
|
AssetInfo[] assetInfos = new AssetInfo[] { assetInfo };
|
||||||
return _playModeImpl.CreateResourceDownloaderByPaths(assetInfos, recursiveDownload, downloadingMaxNumber, failedTryAgain, timeout);
|
return _playModeImpl.CreateResourceDownloaderByPaths(assetInfos, recursiveDownload, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
public ResourceDownloaderOperation CreateBundleDownloader(AssetInfo assetInfo, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
public ResourceDownloaderOperation CreateBundleDownloader(AssetInfo assetInfo, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||||
{
|
{
|
||||||
return CreateBundleDownloader(assetInfo, false, downloadingMaxNumber, failedTryAgain, timeout);
|
return CreateBundleDownloader(assetInfo, false, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1072,11 +1072,11 @@ namespace YooAsset
|
|||||||
public ResourceDownloaderOperation CreateBundleDownloader(AssetInfo[] assetInfos, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
public ResourceDownloaderOperation CreateBundleDownloader(AssetInfo[] assetInfos, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
return _playModeImpl.CreateResourceDownloaderByPaths(assetInfos, recursiveDownload, downloadingMaxNumber, failedTryAgain, timeout);
|
return _playModeImpl.CreateResourceDownloaderByPaths(assetInfos, recursiveDownload, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
public ResourceDownloaderOperation CreateBundleDownloader(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
public ResourceDownloaderOperation CreateBundleDownloader(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
|
||||||
{
|
{
|
||||||
return CreateBundleDownloader(assetInfos, false, downloadingMaxNumber, failedTryAgain, timeout);
|
return CreateBundleDownloader(assetInfos, false, downloadingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -1089,7 +1089,7 @@ namespace YooAsset
|
|||||||
public ResourceUnpackerOperation CreateResourceUnpacker(int unpackingMaxNumber, int failedTryAgain)
|
public ResourceUnpackerOperation CreateResourceUnpacker(int unpackingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
return _playModeImpl.CreateResourceUnpackerByAll(unpackingMaxNumber, failedTryAgain, int.MaxValue);
|
return _playModeImpl.CreateResourceUnpackerByAll(unpackingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1101,7 +1101,7 @@ namespace YooAsset
|
|||||||
public ResourceUnpackerOperation CreateResourceUnpacker(string tag, int unpackingMaxNumber, int failedTryAgain)
|
public ResourceUnpackerOperation CreateResourceUnpacker(string tag, int unpackingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
return _playModeImpl.CreateResourceUnpackerByTags(new string[] { tag }, unpackingMaxNumber, failedTryAgain, int.MaxValue);
|
return _playModeImpl.CreateResourceUnpackerByTags(new string[] { tag }, unpackingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1113,7 +1113,7 @@ namespace YooAsset
|
|||||||
public ResourceUnpackerOperation CreateResourceUnpacker(string[] tags, int unpackingMaxNumber, int failedTryAgain)
|
public ResourceUnpackerOperation CreateResourceUnpacker(string[] tags, int unpackingMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
return _playModeImpl.CreateResourceUnpackerByTags(tags, unpackingMaxNumber, failedTryAgain, int.MaxValue);
|
return _playModeImpl.CreateResourceUnpackerByTags(tags, unpackingMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -1128,7 +1128,20 @@ namespace YooAsset
|
|||||||
public ResourceImporterOperation CreateResourceImporter(string[] filePaths, int importerMaxNumber, int failedTryAgain)
|
public ResourceImporterOperation CreateResourceImporter(string[] filePaths, int importerMaxNumber, int failedTryAgain)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
return _playModeImpl.CreateResourceImporterByFilePaths(filePaths, importerMaxNumber, failedTryAgain, int.MaxValue);
|
return _playModeImpl.CreateResourceImporterByFilePaths(filePaths, importerMaxNumber, failedTryAgain);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建资源导入器
|
||||||
|
/// 注意:资源信息里需要指定BundleName或BundleGUID!
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileInfos">资源信息列表</param>
|
||||||
|
/// <param name="importerMaxNumber">同时导入的最大文件数</param>
|
||||||
|
/// <param name="failedTryAgain">导入失败的重试次数</param>
|
||||||
|
public ResourceImporterOperation CreateResourceImporter(ImportFileInfo[] fileInfos, int importerMaxNumber, int failedTryAgain)
|
||||||
|
{
|
||||||
|
DebugCheckInitialize();
|
||||||
|
return _playModeImpl.CreateResourceImporterByFileInfos(fileInfos, importerMaxNumber, failedTryAgain);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user