mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-14 19:40:47 +00:00
feat #650
This commit is contained in:
@@ -180,11 +180,7 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public bool CanDestroyLoader()
|
||||
{
|
||||
// 注意:正在加载中的任务不可以销毁
|
||||
if (_steps == ESteps.LoadBundleFile)
|
||||
return false;
|
||||
|
||||
if (RefCount > 0)
|
||||
if (CanReleasableLoader() == false)
|
||||
return false;
|
||||
|
||||
// YOOASSET_LEGACY_DEPENDENCY
|
||||
@@ -194,14 +190,34 @@ namespace YooAsset
|
||||
{
|
||||
foreach (var bundleID in LoadBundleInfo.Bundle.ReferenceBundleIDs)
|
||||
{
|
||||
#if YOOASSET_EXPERIMENTAL
|
||||
if (_resManager.CheckBundleReleasable(bundleID) == false)
|
||||
return false;
|
||||
#else
|
||||
if (_resManager.CheckBundleDestroyed(bundleID) == false)
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以释放
|
||||
/// </summary>
|
||||
public bool CanReleasableLoader()
|
||||
{
|
||||
// 注意:正在加载中的任务不可以销毁
|
||||
if (_steps == ESteps.LoadBundleFile)
|
||||
return false;
|
||||
|
||||
if (RefCount > 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加附属的资源提供者
|
||||
/// </summary>
|
||||
|
||||
@@ -329,6 +329,14 @@ namespace YooAsset
|
||||
return true;
|
||||
return bundleFileLoader.IsDestroyed;
|
||||
}
|
||||
internal bool CheckBundleReleasable(int bundleID)
|
||||
{
|
||||
string bundleName = _bundleQuery.GetMainBundleName(bundleID);
|
||||
var bundleFileLoader = TryGetBundleFileLoader(bundleName);
|
||||
if (bundleFileLoader == null)
|
||||
return true;
|
||||
return bundleFileLoader.CanReleasableLoader();
|
||||
}
|
||||
internal bool HasAnyLoader()
|
||||
{
|
||||
return LoaderDic.Count > 0;
|
||||
|
||||
Reference in New Issue
Block a user