update resource manager

所有异步加载方法增加权重参数。
This commit is contained in:
hevinci
2023-10-25 18:28:55 +08:00
parent 5b4a188c0b
commit ce62dbc27f
15 changed files with 152 additions and 116 deletions
@@ -2,10 +2,11 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using System;
namespace YooAsset
{
internal abstract class ProviderBase
internal abstract class ProviderBase : IComparable<ProviderBase>
{
public enum EStatus
{
@@ -22,6 +23,11 @@ namespace YooAsset
/// </summary>
public string ProviderGUID { private set; get; }
/// <summary>
/// 资源加载的优先级
/// </summary>
public uint ProviderPriority { private set; get; }
/// <summary>
/// 所属资源系统
/// </summary>
@@ -97,10 +103,11 @@ namespace YooAsset
private readonly List<HandleBase> _handles = new List<HandleBase>();
public ProviderBase(ResourceManager impl, string providerGUID, AssetInfo assetInfo)
public ProviderBase(ResourceManager impl, string providerGUID, uint providerPriority, AssetInfo assetInfo)
{
Impl = impl;
ProviderGUID = providerGUID;
ProviderPriority = providerPriority;
MainAssetInfo = assetInfo;
// 创建资源包加载器
@@ -121,6 +128,14 @@ namespace YooAsset
/// </summary>
public abstract void Update();
/// <summary>
/// 排序接口实现方法
/// </summary>
public int CompareTo(ProviderBase other)
{
return this.ProviderPriority.CompareTo(other.ProviderPriority);
}
/// <summary>
/// 销毁资源提供者
/// </summary>