Add progress of async operation

异步操作类增加进度查询。
This commit is contained in:
hevinci
2022-05-07 20:30:16 +08:00
parent ecd4973948
commit bd87e982ef
15 changed files with 61 additions and 21 deletions
@@ -28,7 +28,7 @@ namespace YooAsset
/// <summary>
/// 下载进度(0-100f)
/// 下载进度
/// </summary>
public float DownloadProgress
{
@@ -53,7 +53,7 @@ namespace YooAsset
// 检测下载结果
if (_steps == ESteps.CheckDownload)
{
_downloadProgress = _webRequest.downloadProgress * 100f;
_downloadProgress = _webRequest.downloadProgress;
_downloadedBytes = _webRequest.downloadedBytes;
if (_operationHandle.isDone == false)
{
@@ -203,7 +203,7 @@ namespace YooAsset
if (_steps == ESteps.CheckDownload)
{
_downloadProgress = _threadDownloader.DownloadProgress * 100f;
_downloadProgress = _threadDownloader.DownloadProgress;
_downloadedBytes = _threadDownloader.DownloadedBytes;
if (_threadDownloader.IsDone == false)
return;
@@ -83,6 +83,16 @@ namespace YooAsset
return _operationHandle.isDone;
}
/// <summary>
/// 下载进度
/// </summary>
public float Progress()
{
if (_operationHandle == null)
return 0;
return _operationHandle.progress;
}
/// <summary>
/// 下载是否发生错误
/// </summary>
@@ -60,6 +60,16 @@ namespace YooAsset
return _operationHandle.isDone;
}
/// <summary>
/// 下载进度
/// </summary>
public float Progress()
{
if (_operationHandle == null)
return 0;
return _operationHandle.progress;
}
/// <summary>
/// 下载是否发生错误
/// </summary>