update resource manager

hevinci 2023-10-24 18:38:31 +08:00
parent d30a8aefa4
commit e8b5a58a90
3 changed files with 13 additions and 7 deletions

View File

@ -116,9 +116,8 @@ namespace YooAsset
return;
*/
_removeList.Clear();
// 获取移除列表
_removeList.Clear();
foreach (var provider in _providers)
{
if (provider.CanDestroy())
@ -136,8 +135,6 @@ namespace YooAsset
// 移除资源提供者
Impl.RemoveBundleProviders(_removeList);
_removeList.Clear();
}

View File

@ -199,8 +199,9 @@ namespace YooAsset
/// </summary>
public void ReleaseAllHandles()
{
foreach (var handle in _handles)
for (int i = _handles.Count - 1; i >= 0; i--)
{
var handle = _handles[i];
handle.ReleaseInternal();
}
}

View File

@ -12,6 +12,14 @@ namespace YooAsset
private static GameObject _driver = null;
private static readonly List<ResourcePackage> _packages = new List<ResourcePackage>();
/// <summary>
/// 是否已经初始化
/// </summary>
public static bool Initialized
{
get { return _isInitialize; }
}
/// <summary>
/// 初始化资源系统
/// </summary>
@ -90,7 +98,7 @@ namespace YooAsset
public static ResourcePackage CreatePackage(string packageName)
{
CheckException(packageName);
if (HasPackage(packageName))
if (ContainsPackage(packageName))
throw new Exception($"Package {packageName} already existed !");
YooLogger.Log($"Create resource package : {packageName}");
@ -142,7 +150,7 @@ namespace YooAsset
/// 检测资源包是否存在
/// </summary>
/// <param name="packageName">资源包名称</param>
public static bool HasPackage(string packageName)
public static bool ContainsPackage(string packageName)
{
CheckException(packageName);
var package = GetPackageInternal(packageName);