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