mirror of https://github.com/tuyoogame/YooAsset
style : resource manager
parent
e5f5241879
commit
22cb3c3942
|
@ -23,7 +23,7 @@ namespace YooAsset
|
|||
add
|
||||
{
|
||||
if (IsValidWithWarning == false)
|
||||
throw new System.Exception($"{nameof(SceneHandle)} is invalid");
|
||||
throw new System.Exception($"{nameof(SceneHandle)} is invalid !");
|
||||
if (Provider.IsDone)
|
||||
value.Invoke(this);
|
||||
else
|
||||
|
@ -32,7 +32,7 @@ namespace YooAsset
|
|||
remove
|
||||
{
|
||||
if (IsValidWithWarning == false)
|
||||
throw new System.Exception($"{nameof(SceneHandle)} is invalid");
|
||||
throw new System.Exception($"{nameof(SceneHandle)} is invalid !");
|
||||
_callback -= value;
|
||||
}
|
||||
}
|
||||
|
@ -168,13 +168,12 @@ namespace YooAsset
|
|||
}
|
||||
|
||||
// 卸载子场景
|
||||
// 注意:如果场景正在加载过程,必须等待加载完成后才可以卸载该场景。
|
||||
{
|
||||
var operation = new UnloadSceneOperation(Provider);
|
||||
OperationSystem.StartOperation(packageName, operation);
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -14,14 +14,13 @@ namespace YooAsset
|
|||
CheckError,
|
||||
PrepareDone,
|
||||
UnLoadScene,
|
||||
Checking,
|
||||
Done,
|
||||
}
|
||||
|
||||
private ESteps _steps = ESteps.None;
|
||||
private readonly string _error;
|
||||
private readonly ProviderOperation _provider;
|
||||
private AsyncOperation _asyncOp;
|
||||
private AsyncOperation _asyncOp = null;
|
||||
|
||||
internal UnloadSceneOperation(string error)
|
||||
{
|
||||
|
@ -95,17 +94,17 @@ namespace YooAsset
|
|||
}
|
||||
|
||||
if (_steps == ESteps.UnLoadScene)
|
||||
{
|
||||
if (_asyncOp == null)
|
||||
{
|
||||
_asyncOp = SceneManager.UnloadSceneAsync(_provider.SceneObject);
|
||||
_provider.ResourceMgr.UnloadSubScene(_provider.SceneName);
|
||||
_steps = ESteps.Checking;
|
||||
}
|
||||
|
||||
if (_steps == ESteps.Checking)
|
||||
{
|
||||
Progress = _asyncOp.progress;
|
||||
if (_asyncOp.isDone == false)
|
||||
return;
|
||||
|
||||
_provider.ResourceMgr.TryUnloadUnusedAsset(_provider.MainAssetInfo);
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace YooAsset
|
|||
long downloadBytes = _cachedDownloadBytes;
|
||||
foreach (var downloader in _downloaders)
|
||||
{
|
||||
downloadBytes += (long)downloader.DownloadedBytes;
|
||||
downloadBytes += downloader.DownloadedBytes;
|
||||
if (downloader.IsDone == false)
|
||||
continue;
|
||||
|
||||
|
@ -145,7 +145,7 @@ namespace YooAsset
|
|||
// 下载成功
|
||||
_removeList.Add(downloader);
|
||||
_cachedDownloadCount++;
|
||||
_cachedDownloadBytes += (long)downloader.DownloadedBytes;
|
||||
_cachedDownloadBytes += downloader.DownloadedBytes;
|
||||
}
|
||||
|
||||
// 移除已经完成的下载器(无论成功或失败)
|
||||
|
|
Loading…
Reference in New Issue