Added pause method and resume method to patch downloader

补丁下载器增加暂停方法和恢复方法
pull/13/head
hevinci 2022-05-21 22:36:06 +08:00
parent 2dd3ba847e
commit e9841a65c6
2 changed files with 21 additions and 1 deletions

View File

@ -28,6 +28,7 @@ namespace YooAsset
// 数据相关
private ESteps _steps = ESteps.None;
private bool _isPause = false;
private long _lastDownloadBytes = 0;
private int _lastDownloadCount = 0;
@ -153,6 +154,9 @@ namespace YooAsset
// 注意:如果期间有下载失败的文件,暂停动态创建下载器
if (_downloadList.Count > 0 && _loadFailedList.Count == 0)
{
if (_isPause)
return;
if (_downloaders.Count < _downloadingMaxNumber)
{
int index = _downloadList.Count - 1;
@ -195,6 +199,22 @@ namespace YooAsset
OperationSystem.StartOperaiton(this);
}
}
/// <summary>
/// 暂停下载
/// </summary>
public void PauseDownload()
{
_isPause = true;
}
/// <summary>
/// 恢复下载
/// </summary>
public void ResumeDownload()
{
_isPause = false;
}
}
public sealed class PackageDownloaderOperation : DownloaderOperation

View File

@ -23,7 +23,7 @@ namespace YooAsset
public int ResourceVersion;
/// <summary>
/// 内置资源的标记列表
/// 内置资源的标签列表(首包资源)
/// </summary>
public string BuildinTags;