diff --git a/Assets/YooAsset/Runtime/DownloadSystem/DownloadDefine.cs b/Assets/YooAsset/Runtime/DownloadSystem/DownloadDefine.cs
index c6049b53..bacaae33 100644
--- a/Assets/YooAsset/Runtime/DownloadSystem/DownloadDefine.cs
+++ b/Assets/YooAsset/Runtime/DownloadSystem/DownloadDefine.cs
@@ -94,4 +94,25 @@ namespace YooAsset
///
public long FileSize;
}
+
+ ///
+ /// 导入文件的信息
+ ///
+ public struct ImportFileInfo
+ {
+ ///
+ /// 本地文件路径
+ ///
+ public string FilePath;
+
+ ///
+ /// 资源包名称
+ ///
+ public string BundleName;
+
+ ///
+ /// 资源包GUID
+ ///
+ public string BundleGUID;
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityAssetBundleRequestOperation.cs b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityAssetBundleRequestOperation.cs
index 621f2702..3ffcd966 100644
--- a/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityAssetBundleRequestOperation.cs
+++ b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityAssetBundleRequestOperation.cs
@@ -24,7 +24,7 @@ namespace YooAsset
///
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;
_disableUnityWebCache = disableUnityWebCache;
@@ -40,7 +40,6 @@ namespace YooAsset
if (_steps == ESteps.CreateRequest)
{
- ResetTimeout();
CreateWebRequest();
_steps = ESteps.Download;
}
@@ -51,10 +50,7 @@ namespace YooAsset
DownloadedBytes = (long)_webRequest.downloadedBytes;
Progress = _requestOperation.progress;
if (_requestOperation.isDone == false)
- {
- CheckRequestTimeout();
return;
- }
if (CheckRequestResult())
{
diff --git a/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebCacheRequestOperation.cs b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebCacheRequestOperation.cs
new file mode 100644
index 00000000..ae8080a8
--- /dev/null
+++ b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebCacheRequestOperation.cs
@@ -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();
+ }
+ }
+
+ ///
+ /// 设置请求头信息
+ ///
+ public void SetRequestHeader(string name, string value)
+ {
+ _webRequest.SetRequestHeader(name, value);
+ }
+
+ private void CreateWebRequest()
+ {
+ _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
+ _webRequest.disposeDownloadHandlerOnDispose = true;
+ _requestOperation = _webRequest.SendWebRequest();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebCacheRequestOperation.cs.meta b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebCacheRequestOperation.cs.meta
new file mode 100644
index 00000000..fba41120
--- /dev/null
+++ b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebCacheRequestOperation.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 375d88bcf5b9a6146adaf98ceb5369f8
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebDataRequestOperation.cs b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebDataRequestOperation.cs
index d0ad4b69..1ffbad24 100644
--- a/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebDataRequestOperation.cs
+++ b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebDataRequestOperation.cs
@@ -14,17 +14,24 @@ namespace YooAsset
}
private UnityWebRequestAsyncOperation _requestOperation;
- private bool _checkTimeout = true;
private ESteps _steps = ESteps.None;
+ ///
+ /// 响应的超时时间(单位:秒),在经过Timeout的秒数后尝试中止。
+ /// 注意:当Timeout设置为0时,不会应用超时。
+ /// 注意:设置的超时值可能应用于Android上的每个URL重定向,这可能会导致响应时间增加。
+ ///
+ private readonly int _timeout;
+
///
/// 请求结果
///
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()
{
@@ -37,7 +44,6 @@ namespace YooAsset
if (_steps == ESteps.CreateRequest)
{
- ResetTimeout();
CreateWebRequest();
_steps = ESteps.Download;
}
@@ -48,11 +54,7 @@ namespace YooAsset
DownloadedBytes = (long)_webRequest.downloadedBytes;
Progress = _requestOperation.progress;
if (_requestOperation.isDone == false)
- {
- if (_checkTimeout)
- CheckRequestTimeout();
return;
- }
if (CheckRequestResult())
{
@@ -81,18 +83,11 @@ namespace YooAsset
}
}
- ///
- /// 不检测超时
- ///
- public void DontCheckTimeout()
- {
- _checkTimeout = false;
- }
-
private void CreateWebRequest()
{
- _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
DownloadHandlerBuffer handler = new DownloadHandlerBuffer();
+ _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
+ _webRequest.timeout = _timeout;
_webRequest.downloadHandler = handler;
_webRequest.disposeDownloadHandlerOnDispose = true;
_requestOperation = _webRequest.SendWebRequest();
diff --git a/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebFileRequestOperation.cs b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebFileRequestOperation.cs
index acc90fbe..20077fdf 100644
--- a/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebFileRequestOperation.cs
+++ b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebFileRequestOperation.cs
@@ -17,10 +17,18 @@ namespace YooAsset
private readonly string _fileSavePath;
private ESteps _steps = ESteps.None;
+ ///
+ /// 响应的超时时间(单位:秒),在经过Timeout的秒数后尝试中止。
+ /// 注意:当Timeout设置为0时,不会应用超时。
+ /// 注意:设置的超时值可能应用于Android上的每个URL重定向,这可能会导致响应时间增加。
+ ///
+ 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;
+ _timeout = timeout;
}
internal override void InternalStart()
{
@@ -33,7 +41,6 @@ namespace YooAsset
if (_steps == ESteps.CreateRequest)
{
- ResetTimeout();
CreateWebRequest();
_steps = ESteps.Download;
}
@@ -44,10 +51,7 @@ namespace YooAsset
DownloadedBytes = (long)_webRequest.downloadedBytes;
Progress = _requestOperation.progress;
if (_requestOperation.isDone == false)
- {
- CheckRequestTimeout();
return;
- }
if (CheckRequestResult())
{
@@ -67,9 +71,10 @@ namespace YooAsset
private void CreateWebRequest()
{
- _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
DownloadHandlerFile handler = new DownloadHandlerFile(_fileSavePath);
handler.removeFileOnAbort = true;
+ _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
+ _webRequest.timeout = _timeout;
_webRequest.downloadHandler = handler;
_webRequest.disposeDownloadHandlerOnDispose = true;
_requestOperation = _webRequest.SendWebRequest();
diff --git a/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebRequestOperation.cs b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebRequestOperation.cs
index a1c03e6b..c8229ae1 100644
--- a/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebRequestOperation.cs
+++ b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebRequestOperation.cs
@@ -8,11 +8,6 @@ namespace YooAsset
{
protected UnityWebRequest _webRequest;
protected readonly string _requestURL;
-
- // 超时相关
- private readonly float _timeout;
- private ulong _latestDownloadBytes;
- private float _latestDownloadRealtime;
private bool _isAbort = false;
///
@@ -38,10 +33,9 @@ namespace YooAsset
get { return _requestURL; }
}
- internal UnityWebRequestOperation(string url, int timeout)
+ internal UnityWebRequestOperation(string url)
{
_requestURL = url;
- _timeout = timeout;
}
internal override void InternalAbort()
{
@@ -71,42 +65,6 @@ namespace YooAsset
}
}
- ///
- /// 重置超时计时
- ///
- protected void ResetTimeout()
- {
- _latestDownloadBytes = 0;
- _latestDownloadRealtime = Time.realtimeSinceStartup;
- }
-
- ///
- /// 检测超时
- ///
- 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;
- }
- }
- }
-
///
/// 检测请求结果
///
diff --git a/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebTextRequestOperation.cs b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebTextRequestOperation.cs
index a57a3f92..609cd1cf 100644
--- a/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebTextRequestOperation.cs
+++ b/Assets/YooAsset/Runtime/DownloadSystem/Operation/Internal/UnityWebTextRequestOperation.cs
@@ -16,14 +16,22 @@ namespace YooAsset
private UnityWebRequestAsyncOperation _requestOperation;
private ESteps _steps = ESteps.None;
+ ///
+ /// 响应的超时时间(单位:秒),在经过Timeout的秒数后尝试中止。
+ /// 注意:当Timeout设置为0时,不会应用超时。
+ /// 注意:设置的超时值可能应用于Android上的每个URL重定向,这可能会导致响应时间增加。
+ ///
+ private readonly int _timeout;
+
///
/// 请求结果
///
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()
{
@@ -36,7 +44,6 @@ namespace YooAsset
if (_steps == ESteps.CreateRequest)
{
- ResetTimeout();
CreateWebRequest();
_steps = ESteps.Download;
}
@@ -47,10 +54,7 @@ namespace YooAsset
DownloadedBytes = (long)_webRequest.downloadedBytes;
Progress = _requestOperation.progress;
if (_requestOperation.isDone == false)
- {
- CheckRequestTimeout();
return;
- }
if (CheckRequestResult())
{
@@ -81,8 +85,9 @@ namespace YooAsset
private void CreateWebRequest()
{
- _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
DownloadHandlerBuffer handler = new DownloadHandlerBuffer();
+ _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
+ _webRequest.timeout = _timeout;
_webRequest.downloadHandler = handler;
_webRequest.disposeDownloadHandlerOnDispose = true;
_requestOperation = _webRequest.SendWebRequest();
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/CopyBuildinPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/CopyBuildinPackageManifestOperation.cs
index 67f16f13..7b4f417d 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/CopyBuildinPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/CopyBuildinPackageManifestOperation.cs
@@ -83,7 +83,7 @@ namespace YooAsset
string sourcePath = _fileSystem.GetBuildinPackageHashFilePath(_buildinPackageVersion);
string destPath = GetCopyPackageHashDestPath(_buildinPackageVersion);
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
- _hashFileRequestOp = new UnityWebFileRequestOperation(url, destPath);
+ _hashFileRequestOp = new UnityWebFileRequestOperation(url, destPath, 60);
_hashFileRequestOp.StartOperation();
AddChildOperation(_hashFileRequestOp);
}
@@ -124,7 +124,7 @@ namespace YooAsset
string sourcePath = _fileSystem.GetBuildinPackageManifestFilePath(_buildinPackageVersion);
string destPath = GetCopyPackageManifestDestPath(_buildinPackageVersion);
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
- _manifestFileRequestOp = new UnityWebFileRequestOperation(url, destPath);
+ _manifestFileRequestOp = new UnityWebFileRequestOperation(url, destPath, 60);
_manifestFileRequestOp.StartOperation();
AddChildOperation(_manifestFileRequestOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs
index 08ba4196..0eba7b1e 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs
@@ -35,7 +35,7 @@ namespace YooAsset
{
string filePath = _fileSystem.GetCatalogBinaryFileLoadPath();
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
- _webDataRequestOp = new UnityWebDataRequestOperation(url);
+ _webDataRequestOp = new UnityWebDataRequestOperation(url, 60);
_webDataRequestOp.StartOperation();
AddChildOperation(_webDataRequestOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs
index 0e65591d..4a20bc91 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs
@@ -46,7 +46,7 @@ namespace YooAsset
{
string filePath = _fileSystem.GetBuildinPackageManifestFilePath(_packageVersion);
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
- _webDataRequestOp = new UnityWebDataRequestOperation(url);
+ _webDataRequestOp = new UnityWebDataRequestOperation(url, 60);
_webDataRequestOp.StartOperation();
AddChildOperation(_webDataRequestOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/RequestBuildinPackageHashOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/RequestBuildinPackageHashOperation.cs
index 5fdfefda..c707a611 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/RequestBuildinPackageHashOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/RequestBuildinPackageHashOperation.cs
@@ -41,7 +41,7 @@ namespace YooAsset
{
string filePath = _fileSystem.GetBuildinPackageHashFilePath(_packageVersion);
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
- _webTextRequestOp = new UnityWebTextRequestOperation(url);
+ _webTextRequestOp = new UnityWebTextRequestOperation(url, 60);
_webTextRequestOp.StartOperation();
AddChildOperation(_webTextRequestOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/RequestBuildinPackageVersionOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/RequestBuildinPackageVersionOperation.cs
index b70598cb..5ebab685 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/RequestBuildinPackageVersionOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/RequestBuildinPackageVersionOperation.cs
@@ -39,7 +39,7 @@ namespace YooAsset
{
string filePath = _fileSystem.GetBuildinPackageVersionFilePath();
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
- _webTextRequestOp = new UnityWebTextRequestOperation(url);
+ _webTextRequestOp = new UnityWebTextRequestOperation(url, 60);
_webTextRequestOp.StartOperation();
AddChildOperation(_webTextRequestOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs
index 22620533..9111ec86 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs
@@ -57,7 +57,7 @@ namespace YooAsset
{
if (_downloadFileOp == null)
{
- DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
+ DownloadFileOptions options = new DownloadFileOptions(int.MaxValue);
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, options);
_downloadFileOp.StartOperation();
AddChildOperation(_downloadFileOp);
@@ -304,7 +304,7 @@ namespace YooAsset
{
if (_downloadFileOp == null)
{
- DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
+ DownloadFileOptions options = new DownloadFileOptions(int.MaxValue);
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, options);
_downloadFileOp.StartOperation();
AddChildOperation(_downloadFileOp);
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadCenterOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadCenterOperation.cs
index 4caa97da..06247a93 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadCenterOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadCenterOperation.cs
@@ -85,7 +85,7 @@ namespace YooAsset
///
/// 创建下载任务
///
- public UnityDownloadFileOperation DownloadFileAsync(PackageBundle bundle, string url, int timeout)
+ public UnityDownloadFileOperation DownloadFileAsync(PackageBundle bundle, string url)
{
// 查询旧的下载器
if (_downloaders.TryGetValue(bundle.BundleGUID, out var oldDownloader))
@@ -99,7 +99,7 @@ namespace YooAsset
bool isRequestLocalFile = DownloadSystemHelper.IsRequestLocalFile(url);
if (isRequestLocalFile)
{
- newDownloader = new UnityDownloadLocalFileOperation(_fileSystem, bundle, url, timeout);
+ newDownloader = new UnityDownloadLocalFileOperation(_fileSystem, bundle, url);
AddChildOperation(newDownloader);
_downloaders.Add(bundle.BundleGUID, newDownloader);
}
@@ -107,13 +107,13 @@ namespace YooAsset
{
if (bundle.FileSize >= _fileSystem.ResumeDownloadMinimumSize)
{
- newDownloader = new UnityDownloadResumeFileOperation(_fileSystem, bundle, url, timeout);
+ newDownloader = new UnityDownloadResumeFileOperation(_fileSystem, bundle, url);
AddChildOperation(newDownloader);
_downloaders.Add(bundle.BundleGUID, newDownloader);
}
else
{
- newDownloader = new UnityDownloadNormalFileOperation(_fileSystem, bundle, url, timeout);
+ newDownloader = new UnityDownloadNormalFileOperation(_fileSystem, bundle, url);
AddChildOperation(newDownloader);
_downloaders.Add(bundle.BundleGUID, newDownloader);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageBundleOperation.cs
index 8ee4f2fd..7b0fc57f 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageBundleOperation.cs
@@ -67,7 +67,7 @@ namespace YooAsset
}
string url = GetRequestURL();
- _unityDownloadFileOp = _fileSystem.DownloadCenter.DownloadFileAsync(Bundle, url, _options.Timeout);
+ _unityDownloadFileOp = _fileSystem.DownloadCenter.DownloadFileAsync(Bundle, url);
_steps = ESteps.CheckRequest;
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadFileOperation.cs
index a2c80106..0f2279ad 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadFileOperation.cs
@@ -22,7 +22,7 @@ namespace YooAsset
///
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;
_bundle = bundle;
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadLocalFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadLocalFileOperation.cs
index 3fece090..5600ad70 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadLocalFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadLocalFileOperation.cs
@@ -9,8 +9,8 @@ namespace YooAsset
private VerifyTempFileOperation _verifyOperation;
private ESteps _steps = ESteps.None;
- internal UnityDownloadLocalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url, int timeout = 60)
- : base(fileSystem, bundle, url, timeout)
+ internal UnityDownloadLocalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url)
+ : base(fileSystem, bundle, url)
{
}
internal override void InternalStart()
@@ -32,7 +32,6 @@ namespace YooAsset
if (File.Exists(_tempFilePath))
File.Delete(_tempFilePath);
- ResetTimeout();
CreateWebRequest();
_steps = ESteps.Download;
}
@@ -44,10 +43,7 @@ namespace YooAsset
DownloadedBytes = (long)_webRequest.downloadedBytes;
Progress = DownloadProgress;
if (_webRequest.isDone == false)
- {
- CheckRequestTimeout();
return;
- }
// 检查网络错误
if (CheckRequestResult())
@@ -161,9 +157,9 @@ namespace YooAsset
private void CreateWebRequest()
{
- _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
DownloadHandlerFile handler = new DownloadHandlerFile(_tempFilePath);
handler.removeFileOnAbort = true;
+ _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
_webRequest.downloadHandler = handler;
_webRequest.disposeDownloadHandlerOnDispose = true;
_webRequest.SendWebRequest();
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadNormalFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadNormalFileOperation.cs
index 546a9c2e..ce883107 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadNormalFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadNormalFileOperation.cs
@@ -9,8 +9,8 @@ namespace YooAsset
private VerifyTempFileOperation _verifyOperation;
private ESteps _steps = ESteps.None;
- internal UnityDownloadNormalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url, int timeout = 60)
- : base(fileSystem, bundle, url, timeout)
+ internal UnityDownloadNormalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url)
+ : base(fileSystem, bundle, url)
{
}
internal override void InternalStart()
@@ -29,7 +29,6 @@ namespace YooAsset
if (File.Exists(_tempFilePath))
File.Delete(_tempFilePath);
- ResetTimeout();
CreateWebRequest();
_steps = ESteps.Download;
}
@@ -41,10 +40,7 @@ namespace YooAsset
DownloadedBytes = (long)_webRequest.downloadedBytes;
Progress = DownloadProgress;
if (_webRequest.isDone == false)
- {
- CheckRequestTimeout();
return;
- }
// 检查网络错误
if (CheckRequestResult())
@@ -115,9 +111,9 @@ namespace YooAsset
private void CreateWebRequest()
{
- _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
DownloadHandlerFile handler = new DownloadHandlerFile(_tempFilePath);
handler.removeFileOnAbort = true;
+ _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
_webRequest.downloadHandler = handler;
_webRequest.disposeDownloadHandlerOnDispose = true;
_webRequest.SendWebRequest();
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadResumeFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadResumeFileOperation.cs
index 9ae3c8bb..a7748172 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadResumeFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/UnityDownloadResumeFileOperation.cs
@@ -10,8 +10,8 @@ namespace YooAsset
private long _fileOriginLength = 0;
private ESteps _steps = ESteps.None;
- internal UnityDownloadResumeFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url, int timeout = 60)
- : base(fileSystem, bundle, url, timeout)
+ internal UnityDownloadResumeFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, string url)
+ : base(fileSystem, bundle, url)
{
}
internal override void InternalStart()
@@ -46,7 +46,6 @@ namespace YooAsset
}
}
- ResetTimeout();
CreateWebRequest(fileBeginLength);
_steps = ESteps.Download;
}
@@ -58,10 +57,7 @@ namespace YooAsset
DownloadedBytes = _fileOriginLength + (long)_webRequest.downloadedBytes;
Progress = DownloadProgress;
if (_webRequest.isDone == false)
- {
- CheckRequestTimeout();
return;
- }
// 检查网络错误
if (CheckRequestResult())
@@ -147,9 +143,9 @@ namespace YooAsset
}
private void CreateWebRequest(long fileBeginLength)
{
- _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
var handler = new DownloadHandlerFile(_tempFilePath, true);
handler.removeFileOnAbort = false;
+ _webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
_webRequest.downloadHandler = handler;
_webRequest.disposeDownloadHandlerOnDispose = true;
if (fileBeginLength > 0)
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadPackageManifestOperation.cs
index 5a53eeec..03b2af3f 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadPackageManifestOperation.cs
@@ -64,7 +64,7 @@ namespace YooAsset
if (_loadWebPackageManifestOp == null)
{
string packageHash = _requestWebPackageHashOp.PackageHash;
- _loadWebPackageManifestOp = new LoadWebRemotePackageManifestOperation(_fileSystem, _packageVersion, packageHash);
+ _loadWebPackageManifestOp = new LoadWebRemotePackageManifestOperation(_fileSystem, _packageVersion, packageHash, _timeout);
_loadWebPackageManifestOp.StartOperation();
AddChildOperation(_loadWebPackageManifestOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/internal/LoadWebRemotePackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/internal/LoadWebRemotePackageManifestOperation.cs
index b2cb756f..556f5e67 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/internal/LoadWebRemotePackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/internal/LoadWebRemotePackageManifestOperation.cs
@@ -15,6 +15,7 @@ namespace YooAsset
private readonly DefaultWebRemoteFileSystem _fileSystem;
private readonly string _packageVersion;
private readonly string _packageHash;
+ private readonly int _timeout;
private UnityWebDataRequestOperation _webDataRequestOp;
private DeserializeManifestOperation _deserializer;
private int _requestCount = 0;
@@ -26,11 +27,12 @@ namespace YooAsset
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;
_packageVersion = packageVersion;
_packageHash = packageHash;
+ _timeout = timeout;
}
internal override void InternalStart()
{
@@ -48,7 +50,7 @@ namespace YooAsset
{
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, _packageVersion);
string url = GetWebRequestURL(fileName);
- _webDataRequestOp = new UnityWebDataRequestOperation(url);
+ _webDataRequestOp = new UnityWebDataRequestOperation(url, _timeout);
_webDataRequestOp.StartOperation();
AddChildOperation(_webDataRequestOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSInitializeOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSInitializeOperation.cs
index 79c4daab..caca6ae8 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSInitializeOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSInitializeOperation.cs
@@ -48,7 +48,7 @@ namespace YooAsset
*/
#endif
- _loadCatalogFileOp = new LoadWebServerCatalogFileOperation(_fileSystem);
+ _loadCatalogFileOp = new LoadWebServerCatalogFileOperation(_fileSystem, 60);
_loadCatalogFileOp.StartOperation();
AddChildOperation(_loadCatalogFileOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSLoadPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSLoadPackageManifestOperation.cs
index ab5672b3..ee1f8645 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSLoadPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSLoadPackageManifestOperation.cs
@@ -64,7 +64,7 @@ namespace YooAsset
if (_loadWebPackageManifestOp == null)
{
string packageHash = _requestWebPackageHashOp.PackageHash;
- _loadWebPackageManifestOp = new LoadWebServerPackageManifestOperation(_fileSystem, _packageVersion, packageHash);
+ _loadWebPackageManifestOp = new LoadWebServerPackageManifestOperation(_fileSystem, _packageVersion, packageHash, _timeout);
_loadWebPackageManifestOp.StartOperation();
AddChildOperation(_loadWebPackageManifestOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerCatalogFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerCatalogFileOperation.cs
index d9aaeb64..adca34d7 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerCatalogFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerCatalogFileOperation.cs
@@ -16,12 +16,14 @@ namespace YooAsset
}
private readonly DefaultWebServerFileSystem _fileSystem;
+ private readonly int _timeout;
private UnityWebDataRequestOperation _webDataRequestOp;
private ESteps _steps = ESteps.None;
- internal LoadWebServerCatalogFileOperation(DefaultWebServerFileSystem fileSystem)
+ internal LoadWebServerCatalogFileOperation(DefaultWebServerFileSystem fileSystem, int timeout)
{
_fileSystem = fileSystem;
+ _timeout = timeout;
}
internal override void InternalStart()
{
@@ -38,7 +40,7 @@ namespace YooAsset
{
string filePath = _fileSystem.GetCatalogBinaryFileLoadPath();
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
- _webDataRequestOp = new UnityWebDataRequestOperation(url);
+ _webDataRequestOp = new UnityWebDataRequestOperation(url, _timeout);
_webDataRequestOp.StartOperation();
AddChildOperation(_webDataRequestOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerPackageManifestOperation.cs
index 0dbce2d2..5ac17b40 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerPackageManifestOperation.cs
@@ -15,6 +15,7 @@ namespace YooAsset
private readonly DefaultWebServerFileSystem _fileSystem;
private readonly string _packageVersion;
private readonly string _packageHash;
+ private readonly int _timeout;
private UnityWebDataRequestOperation _webDataRequestOp;
private DeserializeManifestOperation _deserializer;
private ESteps _steps = ESteps.None;
@@ -25,11 +26,12 @@ namespace YooAsset
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;
_packageVersion = packageVersion;
_packageHash = packageHash;
+ _timeout = timeout;
}
internal override void InternalStart()
{
@@ -46,7 +48,7 @@ namespace YooAsset
{
string filePath = _fileSystem.GetWebPackageManifestFilePath(_packageVersion);
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
- _webDataRequestOp = new UnityWebDataRequestOperation(url);
+ _webDataRequestOp = new UnityWebDataRequestOperation(url, _timeout);
_webDataRequestOp.StartOperation();
AddChildOperation(_webDataRequestOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOperation.cs
index 6ff3c3ed..102fc9e5 100644
--- a/Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOperation.cs
@@ -8,11 +8,6 @@ namespace YooAsset
///
public readonly int FailedTryAgain;
- ///
- /// 超时时间
- ///
- public readonly int Timeout;
-
///
/// 主资源地址
///
@@ -28,10 +23,9 @@ namespace YooAsset
///
public string ImportFilePath { set; get; }
- public DownloadFileOptions(int failedTryAgain, int timeout)
+ public DownloadFileOptions(int failedTryAgain)
{
FailedTryAgain = failedTryAgain;
- Timeout = timeout;
}
///
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleOperation.cs
similarity index 100%
rename from Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleFileOperation.cs
rename to Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleOperation.cs
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleFileOperation.cs.meta b/Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleOperation.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleFileOperation.cs.meta
rename to Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleOperation.cs.meta
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/FSQueryPackageVersionOperation.cs b/Assets/YooAsset/Runtime/FileSystem/Operation/FSRequestPackageVersionOperation.cs
similarity index 100%
rename from Assets/YooAsset/Runtime/FileSystem/Operation/FSQueryPackageVersionOperation.cs
rename to Assets/YooAsset/Runtime/FileSystem/Operation/FSRequestPackageVersionOperation.cs
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/FSQueryPackageVersionOperation.cs.meta b/Assets/YooAsset/Runtime/FileSystem/Operation/FSRequestPackageVersionOperation.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/FileSystem/Operation/FSQueryPackageVersionOperation.cs.meta
rename to Assets/YooAsset/Runtime/FileSystem/Operation/FSRequestPackageVersionOperation.cs.meta
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadAssetBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebAssetBundleOperation.cs
similarity index 84%
rename from Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadAssetBundleOperation.cs
rename to Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebAssetBundleOperation.cs
index a66d2fe3..5662cc2b 100644
--- a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadAssetBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebAssetBundleOperation.cs
@@ -2,7 +2,7 @@
namespace YooAsset
{
- internal abstract class DownloadAssetBundleOperation : AsyncOperationBase
+ internal abstract class LoadWebAssetBundleOperation : AsyncOperationBase
{
///
/// AssetBundle对象
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadAssetBundleOperation.cs.meta b/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebAssetBundleOperation.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadAssetBundleOperation.cs.meta
rename to Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebAssetBundleOperation.cs.meta
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebEncryptAssetBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebEncryptAssetBundleOperation.cs
similarity index 91%
rename from Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebEncryptAssetBundleOperation.cs
rename to Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebEncryptAssetBundleOperation.cs
index 18aef86c..5937459e 100644
--- a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebEncryptAssetBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebEncryptAssetBundleOperation.cs
@@ -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;
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebEncryptAssetBundleOperation.cs.meta b/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebEncryptAssetBundleOperation.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebEncryptAssetBundleOperation.cs.meta
rename to Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebEncryptAssetBundleOperation.cs.meta
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebNormalAssetBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebNormalAssetBundleOperation.cs
similarity index 92%
rename from Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebNormalAssetBundleOperation.cs
rename to Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebNormalAssetBundleOperation.cs
index 7025c318..95843e55 100644
--- a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebNormalAssetBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebNormalAssetBundleOperation.cs
@@ -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;
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebNormalAssetBundleOperation.cs.meta b/Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebNormalAssetBundleOperation.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebNormalAssetBundleOperation.cs.meta
rename to Assets/YooAsset/Runtime/FileSystem/Operation/Internal/LoadWebNormalAssetBundleOperation.cs.meta
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/BundleInfo.cs b/Assets/YooAsset/Runtime/ResourcePackage/BundleInfo.cs
index 09a6db29..db6a158d 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/BundleInfo.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/BundleInfo.cs
@@ -36,9 +36,9 @@ namespace YooAsset
///
/// 创建下载器
///
- 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;
return _fileSystem.DownloadFileAsync(Bundle, options);
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs b/Assets/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs
index e859ae5e..2e7e9645 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs
@@ -34,15 +34,16 @@ namespace YooAsset
ClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options);
// 下载相关
- ResourceDownloaderOperation CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout);
- ResourceDownloaderOperation CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout);
- ResourceDownloaderOperation CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout);
+ ResourceDownloaderOperation CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain);
+ ResourceDownloaderOperation CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain);
+ ResourceDownloaderOperation CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain);
// 解压相关
- ResourceUnpackerOperation CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout);
- ResourceUnpackerOperation CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout);
-
+ ResourceUnpackerOperation CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain);
+ 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);
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOperation.cs
index 12d604e6..b87bcd67 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOperation.cs
@@ -40,7 +40,6 @@ namespace YooAsset
private readonly string _packageName;
private readonly int _downloadingMaxNumber;
private readonly int _failedTryAgain;
- private readonly int _timeout;
private readonly List _bundleInfoList;
private readonly List _downloaders = new List(MAX_LOADER_COUNT);
private readonly List _removeList = new List(MAX_LOADER_COUNT);
@@ -102,13 +101,12 @@ namespace YooAsset
public DownloadFileBegin DownloadFileBeginCallback { set; get; }
- internal DownloaderOperation(string packageName, List downloadList, int downloadingMaxNumber, int failedTryAgain, int timeout)
+ internal DownloaderOperation(string packageName, List downloadList, int downloadingMaxNumber, int failedTryAgain)
{
_packageName = packageName;
_bundleInfoList = downloadList;
_downloadingMaxNumber = UnityEngine.Mathf.Clamp(downloadingMaxNumber, 1, MAX_LOADER_COUNT); ;
_failedTryAgain = failedTryAgain;
- _timeout = timeout;
// 设置包裹名称 (fix #210)
SetPackageName(packageName);
@@ -203,7 +201,7 @@ namespace YooAsset
{
int index = _bundleInfoList.Count - 1;
var bundleInfo = _bundleInfoList[index];
- var downloader = bundleInfo.CreateDownloader(_failedTryAgain, _timeout);
+ var downloader = bundleInfo.CreateDownloader(_failedTryAgain);
downloader.StartOperation();
this.AddChildOperation(downloader);
@@ -374,52 +372,52 @@ namespace YooAsset
public sealed class ResourceDownloaderOperation : DownloaderOperation
{
- internal ResourceDownloaderOperation(string packageName, List downloadList, int downloadingMaxNumber, int failedTryAgain, int timeout)
- : base(packageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout)
+ internal ResourceDownloaderOperation(string packageName, List downloadList, int downloadingMaxNumber, int failedTryAgain)
+ : base(packageName, downloadList, downloadingMaxNumber, failedTryAgain)
{
}
///
/// 创建空的下载器
///
- internal static ResourceDownloaderOperation CreateEmptyDownloader(string packageName, int downloadingMaxNumber, int failedTryAgain, int timeout)
+ internal static ResourceDownloaderOperation CreateEmptyDownloader(string packageName, int downloadingMaxNumber, int failedTryAgain)
{
List downloadList = new List();
- var operation = new ResourceDownloaderOperation(packageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
+ var operation = new ResourceDownloaderOperation(packageName, downloadList, downloadingMaxNumber, failedTryAgain);
return operation;
}
}
public sealed class ResourceUnpackerOperation : DownloaderOperation
{
- internal ResourceUnpackerOperation(string packageName, List downloadList, int downloadingMaxNumber, int failedTryAgain, int timeout)
- : base(packageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout)
+ internal ResourceUnpackerOperation(string packageName, List downloadList, int downloadingMaxNumber, int failedTryAgain)
+ : base(packageName, downloadList, downloadingMaxNumber, failedTryAgain)
{
}
///
/// 创建空的解压器
///
- internal static ResourceUnpackerOperation CreateEmptyUnpacker(string packageName, int upackingMaxNumber, int failedTryAgain, int timeout)
+ internal static ResourceUnpackerOperation CreateEmptyUnpacker(string packageName, int upackingMaxNumber, int failedTryAgain)
{
List downloadList = new List();
- var operation = new ResourceUnpackerOperation(packageName, downloadList, upackingMaxNumber, failedTryAgain, int.MaxValue);
+ var operation = new ResourceUnpackerOperation(packageName, downloadList, upackingMaxNumber, failedTryAgain);
return operation;
}
}
public sealed class ResourceImporterOperation : DownloaderOperation
{
- internal ResourceImporterOperation(string packageName, List downloadList, int downloadingMaxNumber, int failedTryAgain, int timeout)
- : base(packageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout)
+ internal ResourceImporterOperation(string packageName, List downloadList, int downloadingMaxNumber, int failedTryAgain)
+ : base(packageName, downloadList, downloadingMaxNumber, failedTryAgain)
{
}
///
/// 创建空的导入器
///
- internal static ResourceImporterOperation CreateEmptyImporter(string packageName, int upackingMaxNumber, int failedTryAgain, int timeout)
+ internal static ResourceImporterOperation CreateEmptyImporter(string packageName, int upackingMaxNumber, int failedTryAgain)
{
List downloadList = new List();
- var operation = new ResourceImporterOperation(packageName, downloadList, upackingMaxNumber, failedTryAgain, int.MaxValue);
+ var operation = new ResourceImporterOperation(packageName, downloadList, upackingMaxNumber, failedTryAgain);
return operation;
}
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs
index 16a8b8ef..eda69dc0 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs
@@ -107,11 +107,11 @@ namespace YooAsset
if (Status != EOperationStatus.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 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;
}
@@ -127,11 +127,11 @@ namespace YooAsset
if (Status != EOperationStatus.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 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;
}
@@ -147,11 +147,11 @@ namespace YooAsset
if (Status != EOperationStatus.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 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;
}
@@ -167,7 +167,7 @@ namespace YooAsset
if (Status != EOperationStatus.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 assetInfos = new List();
@@ -175,7 +175,7 @@ namespace YooAsset
assetInfos.Add(assetInfo);
List 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;
}
@@ -191,7 +191,7 @@ namespace YooAsset
if (Status != EOperationStatus.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 assetInfos = new List(locations.Length);
@@ -202,7 +202,7 @@ namespace YooAsset
}
List 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;
}
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeImpl.cs b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeImpl.cs
index 15c91f0b..a640e515 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeImpl.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeImpl.cs
@@ -104,44 +104,50 @@ namespace YooAsset
}
// 下载相关
- ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout)
+ ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain)
{
List downloadList = GetDownloadListByAll(ActiveManifest);
- var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
+ var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
return operation;
}
- ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout)
+ ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain)
{
List downloadList = GetDownloadListByTags(ActiveManifest, tags);
- var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
+ var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
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 downloadList = GetDownloadListByPaths(ActiveManifest, assetInfos, recursiveDownload);
- var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain, timeout);
+ var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
return operation;
}
// 解压相关
- ResourceUnpackerOperation IPlayMode.CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout)
+ ResourceUnpackerOperation IPlayMode.CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain)
{
List unpcakList = GetUnpackListByAll(ActiveManifest);
- var operation = new ResourceUnpackerOperation(PackageName, unpcakList, upackingMaxNumber, failedTryAgain, timeout);
+ var operation = new ResourceUnpackerOperation(PackageName, unpcakList, upackingMaxNumber, failedTryAgain);
return operation;
}
- ResourceUnpackerOperation IPlayMode.CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout)
+ ResourceUnpackerOperation IPlayMode.CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain)
{
List unpcakList = GetUnpackListByTags(ActiveManifest, tags);
- var operation = new ResourceUnpackerOperation(PackageName, unpcakList, upackingMaxNumber, failedTryAgain, timeout);
+ var operation = new ResourceUnpackerOperation(PackageName, unpcakList, upackingMaxNumber, failedTryAgain);
return operation;
}
// 导入相关
- ResourceImporterOperation IPlayMode.CreateResourceImporterByFilePaths(string[] filePaths, int importerMaxNumber, int failedTryAgain, int timeout)
+ ResourceImporterOperation IPlayMode.CreateResourceImporterByFilePaths(string[] filePaths, int importingMaxNumber, int failedTryAgain)
{
List 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 importerList = GetImporterListByFileInfos(ActiveManifest, fileInfos);
+ var operation = new ResourceImporterOperation(PackageName, importerList, importingMaxNumber, failedTryAgain);
return operation;
}
#endregion
@@ -419,11 +425,56 @@ namespace YooAsset
if (manifest == null)
return new List();
- List result = new List();
- foreach (var filePath in filePaths)
+ ImportFileInfo[] fileInfos = new ImportFileInfo[filePaths.Length];
+ for (int i = 0; i < filePaths.Length; i++)
{
- string fileName = System.IO.Path.GetFileName(filePath);
- if (manifest.TryGetPackageBundleByFileName(fileName, out PackageBundle packageBundle))
+ ImportFileInfo fileInfo = new ImportFileInfo();
+ fileInfo.FilePath = filePaths[i];
+ fileInfos[i] = fileInfo;
+ }
+
+ return GetImporterListByFileInfos(manifest, fileInfos);
+ }
+ public List GetImporterListByFileInfos(PackageManifest manifest, ImportFileInfo[] fileInfos)
+ {
+ if (manifest == null)
+ return new List();
+
+ List result = new List();
+ 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);
if (fileSystem == null)
@@ -435,10 +486,6 @@ namespace YooAsset
result.Add(bundleInfo);
}
}
- else
- {
- YooLogger.Warning($"Not found package bundle, importer file path : {filePath}");
- }
}
return result;
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs b/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
index 3a8c0256..7f5663f9 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
@@ -969,7 +969,7 @@ namespace YooAsset
public ResourceDownloaderOperation CreateResourceDownloader(int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
{
DebugCheckInitialize();
- return _playModeImpl.CreateResourceDownloaderByAll(downloadingMaxNumber, failedTryAgain, timeout);
+ return _playModeImpl.CreateResourceDownloaderByAll(downloadingMaxNumber, failedTryAgain);
}
///
@@ -982,7 +982,7 @@ namespace YooAsset
public ResourceDownloaderOperation CreateResourceDownloader(string tag, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
{
DebugCheckInitialize();
- return _playModeImpl.CreateResourceDownloaderByTags(new string[] { tag }, downloadingMaxNumber, failedTryAgain, timeout);
+ return _playModeImpl.CreateResourceDownloaderByTags(new string[] { tag }, downloadingMaxNumber, failedTryAgain);
}
///
@@ -995,7 +995,7 @@ namespace YooAsset
public ResourceDownloaderOperation CreateResourceDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
{
DebugCheckInitialize();
- return _playModeImpl.CreateResourceDownloaderByTags(tags, downloadingMaxNumber, failedTryAgain, timeout);
+ return _playModeImpl.CreateResourceDownloaderByTags(tags, downloadingMaxNumber, failedTryAgain);
}
///
@@ -1011,11 +1011,11 @@ namespace YooAsset
DebugCheckInitialize();
var assetInfo = ConvertLocationToAssetInfo(location, null);
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)
{
- return CreateBundleDownloader(location, false, downloadingMaxNumber, failedTryAgain, timeout);
+ return CreateBundleDownloader(location, false, downloadingMaxNumber, failedTryAgain);
}
///
@@ -1035,11 +1035,11 @@ namespace YooAsset
var assetInfo = ConvertLocationToAssetInfo(location, null);
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)
{
- return CreateBundleDownloader(locations, false, downloadingMaxNumber, failedTryAgain, timeout);
+ return CreateBundleDownloader(locations, false, downloadingMaxNumber, failedTryAgain);
}
///
@@ -1054,11 +1054,11 @@ namespace YooAsset
{
DebugCheckInitialize();
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)
{
- return CreateBundleDownloader(assetInfo, false, downloadingMaxNumber, failedTryAgain, timeout);
+ return CreateBundleDownloader(assetInfo, false, downloadingMaxNumber, failedTryAgain);
}
///
@@ -1072,11 +1072,11 @@ namespace YooAsset
public ResourceDownloaderOperation CreateBundleDownloader(AssetInfo[] assetInfos, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
{
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)
{
- return CreateBundleDownloader(assetInfos, false, downloadingMaxNumber, failedTryAgain, timeout);
+ return CreateBundleDownloader(assetInfos, false, downloadingMaxNumber, failedTryAgain);
}
#endregion
@@ -1089,7 +1089,7 @@ namespace YooAsset
public ResourceUnpackerOperation CreateResourceUnpacker(int unpackingMaxNumber, int failedTryAgain)
{
DebugCheckInitialize();
- return _playModeImpl.CreateResourceUnpackerByAll(unpackingMaxNumber, failedTryAgain, int.MaxValue);
+ return _playModeImpl.CreateResourceUnpackerByAll(unpackingMaxNumber, failedTryAgain);
}
///
@@ -1101,7 +1101,7 @@ namespace YooAsset
public ResourceUnpackerOperation CreateResourceUnpacker(string tag, int unpackingMaxNumber, int failedTryAgain)
{
DebugCheckInitialize();
- return _playModeImpl.CreateResourceUnpackerByTags(new string[] { tag }, unpackingMaxNumber, failedTryAgain, int.MaxValue);
+ return _playModeImpl.CreateResourceUnpackerByTags(new string[] { tag }, unpackingMaxNumber, failedTryAgain);
}
///
@@ -1113,7 +1113,7 @@ namespace YooAsset
public ResourceUnpackerOperation CreateResourceUnpacker(string[] tags, int unpackingMaxNumber, int failedTryAgain)
{
DebugCheckInitialize();
- return _playModeImpl.CreateResourceUnpackerByTags(tags, unpackingMaxNumber, failedTryAgain, int.MaxValue);
+ return _playModeImpl.CreateResourceUnpackerByTags(tags, unpackingMaxNumber, failedTryAgain);
}
#endregion
@@ -1128,7 +1128,20 @@ namespace YooAsset
public ResourceImporterOperation CreateResourceImporter(string[] filePaths, int importerMaxNumber, int failedTryAgain)
{
DebugCheckInitialize();
- return _playModeImpl.CreateResourceImporterByFilePaths(filePaths, importerMaxNumber, failedTryAgain, int.MaxValue);
+ return _playModeImpl.CreateResourceImporterByFilePaths(filePaths, importerMaxNumber, failedTryAgain);
+ }
+
+ ///
+ /// 创建资源导入器
+ /// 注意:资源信息里需要指定BundleName或BundleGUID!
+ ///
+ /// 资源信息列表
+ /// 同时导入的最大文件数
+ /// 导入失败的重试次数
+ public ResourceImporterOperation CreateResourceImporter(ImportFileInfo[] fileInfos, int importerMaxNumber, int failedTryAgain)
+ {
+ DebugCheckInitialize();
+ return _playModeImpl.CreateResourceImporterByFileInfos(fileInfos, importerMaxNumber, failedTryAgain);
}
#endregion