2023-04-06 11:50:31 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace DCFApixels.DragonECS
|
|
|
|
|
{
|
2023-04-06 23:40:47 +08:00
|
|
|
|
public interface IEcsReadonlyTable
|
2023-04-06 11:50:31 +08:00
|
|
|
|
{
|
|
|
|
|
#region Properties
|
2023-04-06 23:40:47 +08:00
|
|
|
|
/// <summary>Table Archetype</summary>
|
2023-04-06 11:50:31 +08:00
|
|
|
|
public Type ArchetypeType { get; }
|
|
|
|
|
#endregion
|
|
|
|
|
|
2023-04-06 23:40:47 +08:00
|
|
|
|
#region Methods
|
2023-04-06 11:50:31 +08:00
|
|
|
|
public ReadOnlySpan<IEcsPool> GetAllPools();
|
2023-04-06 23:40:47 +08:00
|
|
|
|
public int GetComponentID<T>();
|
2023-04-06 11:50:31 +08:00
|
|
|
|
|
|
|
|
|
public EcsPool<T> GetPool<T>() where T : struct;
|
|
|
|
|
public EcsPool<T> UncheckedGetPool<T>() where T : struct;
|
|
|
|
|
|
|
|
|
|
public bool IsMaskCompatible<TInc>(int entity) where TInc : struct, IInc;
|
|
|
|
|
public bool IsMaskCompatible<TInc, TExc>(int entity) where TInc : struct, IInc where TExc : struct, IExc;
|
|
|
|
|
public bool IsMaskCompatible(EcsMask mask, int entity);
|
|
|
|
|
public bool IsMaskCompatibleWithout(EcsMask mask, int entity, int otherPoolID);
|
2023-04-06 23:40:47 +08:00
|
|
|
|
#endregion
|
2023-04-06 11:50:31 +08:00
|
|
|
|
|
2023-04-06 23:40:47 +08:00
|
|
|
|
#region Properties
|
|
|
|
|
internal int Count { get; }
|
|
|
|
|
internal int Capacity { get; }
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Internal Methods
|
2023-04-06 11:50:31 +08:00
|
|
|
|
internal void OnEntityComponentAdded(int entityID, int changedPoolID);
|
|
|
|
|
internal void OnEntityComponentRemoved(int entityID, int changedPoolID);
|
|
|
|
|
internal void RegisterGroup(EcsGroup group);
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
2023-04-06 23:40:47 +08:00
|
|
|
|
|
|
|
|
|
public static class IEcsReadonlyEntityComponentTableExtensions
|
|
|
|
|
{
|
|
|
|
|
public static bool IsNullOrEmpty(this IEcsReadonlyTable self)
|
|
|
|
|
{
|
|
|
|
|
return self == null || self.Count <= 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-06 11:50:31 +08:00
|
|
|
|
}
|