mirror of https://github.com/tuyoogame/YooAsset
refactor : wait for sync complete
parent
9bc0577423
commit
acf2301028
|
@ -94,6 +94,9 @@ namespace YooAsset
|
||||||
// 等待验证完成
|
// 等待验证完成
|
||||||
if (_steps == ESteps.CheckVerifyTempFile)
|
if (_steps == ESteps.CheckVerifyTempFile)
|
||||||
{
|
{
|
||||||
|
if (IsWaitForAsyncComplete)
|
||||||
|
_verifyOperation.WaitForAsyncComplete();
|
||||||
|
|
||||||
if (_verifyOperation.IsDone == false)
|
if (_verifyOperation.IsDone == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -154,9 +157,6 @@ namespace YooAsset
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (_verifyOperation != null)
|
|
||||||
_verifyOperation.WaitForAsyncComplete();
|
|
||||||
|
|
||||||
// 注意:如果是导入或解压本地文件,执行等待完毕
|
// 注意:如果是导入或解压本地文件,执行等待完毕
|
||||||
if (isReuqestLocalFile)
|
if (isReuqestLocalFile)
|
||||||
{
|
{
|
||||||
|
@ -305,6 +305,9 @@ namespace YooAsset
|
||||||
// 等待验证完成
|
// 等待验证完成
|
||||||
if (_steps == ESteps.CheckVerifyTempFile)
|
if (_steps == ESteps.CheckVerifyTempFile)
|
||||||
{
|
{
|
||||||
|
if (IsWaitForAsyncComplete)
|
||||||
|
_verifyOperation.WaitForAsyncComplete();
|
||||||
|
|
||||||
if (_verifyOperation.IsDone == false)
|
if (_verifyOperation.IsDone == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -364,9 +367,6 @@ namespace YooAsset
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (_verifyOperation != null)
|
|
||||||
_verifyOperation.WaitForAsyncComplete();
|
|
||||||
|
|
||||||
// 注意:如果是导入或解压本地文件,执行等待完毕
|
// 注意:如果是导入或解压本地文件,执行等待完毕
|
||||||
if (isReuqestLocalFile)
|
if (isReuqestLocalFile)
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,6 +58,9 @@ namespace YooAsset
|
||||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
|
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsWaitForAsyncComplete)
|
||||||
|
_downloadFileOp.WaitForAsyncComplete();
|
||||||
|
|
||||||
DownloadProgress = _downloadFileOp.DownloadProgress;
|
DownloadProgress = _downloadFileOp.DownloadProgress;
|
||||||
DownloadedBytes = _downloadFileOp.DownloadedBytes;
|
DownloadedBytes = _downloadFileOp.DownloadedBytes;
|
||||||
if (_downloadFileOp.IsDone == false)
|
if (_downloadFileOp.IsDone == false)
|
||||||
|
@ -198,9 +201,6 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (_downloadFileOp != null)
|
|
||||||
_downloadFileOp.WaitForAsyncComplete();
|
|
||||||
|
|
||||||
if (ExecuteWhileDone())
|
if (ExecuteWhileDone())
|
||||||
{
|
{
|
||||||
if (_downloadFileOp != null && _downloadFileOp.Status == EOperationStatus.Failed)
|
if (_downloadFileOp != null && _downloadFileOp.Status == EOperationStatus.Failed)
|
||||||
|
@ -274,6 +274,9 @@ namespace YooAsset
|
||||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
|
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsWaitForAsyncComplete)
|
||||||
|
_downloadFileOp.WaitForAsyncComplete();
|
||||||
|
|
||||||
DownloadProgress = _downloadFileOp.DownloadProgress;
|
DownloadProgress = _downloadFileOp.DownloadProgress;
|
||||||
DownloadedBytes = _downloadFileOp.DownloadedBytes;
|
DownloadedBytes = _downloadFileOp.DownloadedBytes;
|
||||||
if (_downloadFileOp.IsDone == false)
|
if (_downloadFileOp.IsDone == false)
|
||||||
|
@ -313,9 +316,6 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (_downloadFileOp != null)
|
|
||||||
_downloadFileOp.WaitForAsyncComplete();
|
|
||||||
|
|
||||||
if (ExecuteWhileDone())
|
if (ExecuteWhileDone())
|
||||||
{
|
{
|
||||||
if (_downloadFileOp != null && _downloadFileOp.Status == EOperationStatus.Failed)
|
if (_downloadFileOp != null && _downloadFileOp.Status == EOperationStatus.Failed)
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace YooAsset
|
||||||
|
|
||||||
// 当执行次数用完时
|
// 当执行次数用完时
|
||||||
_whileFrame--;
|
_whileFrame--;
|
||||||
if (_whileFrame == 0)
|
if (_whileFrame <= 0)
|
||||||
{
|
{
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
Error = $"Operation {this.GetType().Name} failed to wait for async complete !";
|
Error = $"Operation {this.GetType().Name} failed to wait for async complete !";
|
||||||
|
|
|
@ -69,6 +69,9 @@ namespace YooAsset
|
||||||
if (_loadBundleOp == null)
|
if (_loadBundleOp == null)
|
||||||
_loadBundleOp = BundleFileInfo.LoadBundleFile();
|
_loadBundleOp = BundleFileInfo.LoadBundleFile();
|
||||||
|
|
||||||
|
if (IsWaitForAsyncComplete)
|
||||||
|
_loadBundleOp.WaitForAsyncComplete();
|
||||||
|
|
||||||
DownloadProgress = _loadBundleOp.DownloadProgress;
|
DownloadProgress = _loadBundleOp.DownloadProgress;
|
||||||
DownloadedBytes = _loadBundleOp.DownloadedBytes;
|
DownloadedBytes = _loadBundleOp.DownloadedBytes;
|
||||||
if (_loadBundleOp.IsDone == false)
|
if (_loadBundleOp.IsDone == false)
|
||||||
|
@ -101,9 +104,6 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (_loadBundleOp != null)
|
|
||||||
_loadBundleOp.WaitForAsyncComplete();
|
|
||||||
|
|
||||||
if (ExecuteWhileDone())
|
if (ExecuteWhileDone())
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
|
|
|
@ -36,6 +36,14 @@ namespace YooAsset
|
||||||
|
|
||||||
if (_steps == ESteps.CheckDepend)
|
if (_steps == ESteps.CheckDepend)
|
||||||
{
|
{
|
||||||
|
if (IsWaitForAsyncComplete)
|
||||||
|
{
|
||||||
|
foreach (var loader in Depends)
|
||||||
|
{
|
||||||
|
loader.WaitForAsyncComplete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var loader in Depends)
|
foreach (var loader in Depends)
|
||||||
{
|
{
|
||||||
if (loader.IsDone == false)
|
if (loader.IsDone == false)
|
||||||
|
@ -73,11 +81,6 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
foreach (var loader in Depends)
|
|
||||||
{
|
|
||||||
loader.WaitForAsyncComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ExecuteWhileDone())
|
if (ExecuteWhileDone())
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
|
|
|
@ -96,6 +96,7 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
if (LoadDependBundleFileOp != null)
|
if (LoadDependBundleFileOp != null)
|
||||||
LoadDependBundleFileOp.WaitForAsyncComplete();
|
LoadDependBundleFileOp.WaitForAsyncComplete();
|
||||||
|
|
||||||
if (LoadBundleFileOp != null)
|
if (LoadBundleFileOp != null)
|
||||||
LoadBundleFileOp.WaitForAsyncComplete();
|
LoadBundleFileOp.WaitForAsyncComplete();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue