mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-23 09:10:11 +00:00
Update DownloadSystem
下载错误提示增加HTTP Response Code
This commit is contained in:
@@ -24,6 +24,7 @@ namespace YooAsset
|
|||||||
protected string _requestURL;
|
protected string _requestURL;
|
||||||
|
|
||||||
protected string _lastError = string.Empty;
|
protected string _lastError = string.Empty;
|
||||||
|
protected long _lastCode = 0;
|
||||||
protected float _downloadProgress = 0f;
|
protected float _downloadProgress = 0f;
|
||||||
protected ulong _downloadedBytes = 0;
|
protected ulong _downloadedBytes = 0;
|
||||||
|
|
||||||
@@ -119,7 +120,7 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string GetLastError()
|
public string GetLastError()
|
||||||
{
|
{
|
||||||
return $"Failed to download : {_requestURL} Error : {_lastError}";
|
return $"Failed to download : {_requestURL} Error : {_lastError} Code : {_lastCode}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,12 +134,14 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
hasError = true;
|
hasError = true;
|
||||||
_lastError = _webRequest.error;
|
_lastError = _webRequest.error;
|
||||||
|
_lastCode = _webRequest.responseCode;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (_webRequest.isNetworkError || _webRequest.isHttpError)
|
if (_webRequest.isNetworkError || _webRequest.isHttpError)
|
||||||
{
|
{
|
||||||
hasError = true;
|
hasError = true;
|
||||||
_lastError = _webRequest.error;
|
_lastError = _webRequest.error;
|
||||||
|
_lastCode = _webRequest.responseCode;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -151,6 +153,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
hasError = true;
|
hasError = true;
|
||||||
_lastError = $"Verify bundle content failed : {_bundleInfo.Bundle.FileName}";
|
_lastError = $"Verify bundle content failed : {_bundleInfo.Bundle.FileName}";
|
||||||
|
_lastCode = _webRequest.responseCode;
|
||||||
|
|
||||||
// 验证失败后删除文件
|
// 验证失败后删除文件
|
||||||
string cacheFilePath = _bundleInfo.Bundle.CachedFilePath;
|
string cacheFilePath = _bundleInfo.Bundle.CachedFilePath;
|
||||||
@@ -198,6 +201,7 @@ namespace YooAsset
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_lastError = string.Empty;
|
_lastError = string.Empty;
|
||||||
|
_lastCode = 0;
|
||||||
_steps = ESteps.Succeed;
|
_steps = ESteps.Succeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,6 +227,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
_steps = ESteps.Failed;
|
_steps = ESteps.Failed;
|
||||||
_lastError = "user abort";
|
_lastError = "user abort";
|
||||||
|
_lastCode = 0;
|
||||||
DisposeWebRequest();
|
DisposeWebRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user