mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
rename GetPool to GetPoolInstance
This commit is contained in:
parent
04691e1716
commit
672e253b49
@ -106,19 +106,19 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Include/Exclude/Optional/Combine
|
#region Include/Exclude/Optional/Combine
|
||||||
public TPool Include<TPool>() where TPool : IEcsPoolImplementation, new()
|
public TPool Include<TPool>() where TPool : IEcsPoolImplementation, new()
|
||||||
{
|
{
|
||||||
var pool = _world.GetPool<TPool>();
|
var pool = _world.GetPoolInstance<TPool>();
|
||||||
IncludeImplicit(pool.ComponentType);
|
IncludeImplicit(pool.ComponentType);
|
||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
public TPool Exclude<TPool>() where TPool : IEcsPoolImplementation, new()
|
public TPool Exclude<TPool>() where TPool : IEcsPoolImplementation, new()
|
||||||
{
|
{
|
||||||
var pool = _world.GetPool<TPool>();
|
var pool = _world.GetPoolInstance<TPool>();
|
||||||
ExcludeImplicit(pool.ComponentType);
|
ExcludeImplicit(pool.ComponentType);
|
||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
public TPool Optional<TPool>() where TPool : IEcsPoolImplementation, new()
|
public TPool Optional<TPool>() where TPool : IEcsPoolImplementation, new()
|
||||||
{
|
{
|
||||||
return _world.GetPool<TPool>();
|
return _world.GetPoolInstance<TPool>();
|
||||||
}
|
}
|
||||||
private void IncludeImplicit(Type type)
|
private void IncludeImplicit(Type type)
|
||||||
{
|
{
|
||||||
|
@ -611,30 +611,30 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
#region Debug Components
|
#region Debug Components
|
||||||
private static int[] _componentIDsBuffer = new int[64];
|
private static int[] _componentIDsBuffer = new int[64];
|
||||||
public ReadOnlySpan<int> GetComponentTypeIDs(int entityID)
|
public ReadOnlySpan<int> GetComponentTypeIDsFor(int entityID)
|
||||||
{
|
{
|
||||||
int count = GetComponentTypeIDs(entityID, ref _componentIDsBuffer);
|
int count = GetComponentTypeIDsFor(entityID, ref _componentIDsBuffer);
|
||||||
return new ReadOnlySpan<int>(_componentIDsBuffer, 0, count);
|
return new ReadOnlySpan<int>(_componentIDsBuffer, 0, count);
|
||||||
}
|
}
|
||||||
public void GetComponents(int entityID, List<object> list)
|
public void GetComponentsFor(int entityID, List<object> list)
|
||||||
{
|
{
|
||||||
list.Clear();
|
list.Clear();
|
||||||
int count = GetComponentTypeIDs(entityID, ref _componentIDsBuffer);
|
int count = GetComponentTypeIDsFor(entityID, ref _componentIDsBuffer);
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
list.Add(_pools[_componentIDsBuffer[i]].GetRaw(entityID));
|
list.Add(_pools[_componentIDsBuffer[i]].GetRaw(entityID));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void GetComponentTypes(int entityID, HashSet<Type> typeSet)
|
public void GetComponentTypesFor(int entityID, HashSet<Type> typeSet)
|
||||||
{
|
{
|
||||||
typeSet.Clear();
|
typeSet.Clear();
|
||||||
int count = GetComponentTypeIDs(entityID, ref _componentIDsBuffer);
|
int count = GetComponentTypeIDsFor(entityID, ref _componentIDsBuffer);
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
typeSet.Add(_pools[_componentIDsBuffer[i]].ComponentType);
|
typeSet.Add(_pools[_componentIDsBuffer[i]].ComponentType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int GetComponentTypeIDs(int entityID, ref int[] componentIDs)
|
private int GetComponentTypeIDsFor(int entityID, ref int[] componentIDs)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
var itemsCount = GetComponentsCount(entityID);
|
var itemsCount = GetComponentsCount(entityID);
|
||||||
|
@ -18,7 +18,7 @@ namespace DCFApixels.DragonECS
|
|||||||
private EcsNullPool _nullPool = EcsNullPool.instance;
|
private EcsNullPool _nullPool = EcsNullPool.instance;
|
||||||
|
|
||||||
#region Getters
|
#region Getters
|
||||||
public IEcsPool GetPool(int componentTypeID)
|
public IEcsPool GetPoolInstance(int componentTypeID)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (_pools[componentTypeID].ComponentTypeID != componentTypeID) { Throw.UndefinedException(); }
|
if (_pools[componentTypeID].ComponentTypeID != componentTypeID) { Throw.UndefinedException(); }
|
||||||
@ -27,7 +27,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public IEcsPool GetPool(Type componentType)
|
public IEcsPool GetPoolInstance(Type componentType)
|
||||||
{
|
{
|
||||||
int componentTypeID = GetComponentTypeID(componentType);
|
int componentTypeID = GetComponentTypeID(componentType);
|
||||||
ref var pool = ref _pools[componentTypeID];
|
ref var pool = ref _pools[componentTypeID];
|
||||||
@ -42,7 +42,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[UnityEngine.Scripting.Preserve]
|
[UnityEngine.Scripting.Preserve]
|
||||||
#endif
|
#endif
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public TPool GetPool<TPool>() where TPool : IEcsPoolImplementation, new()
|
public TPool GetPoolInstance<TPool>() where TPool : IEcsPoolImplementation, new()
|
||||||
{
|
{
|
||||||
return Get<PoolCache<TPool>>().instance;
|
return Get<PoolCache<TPool>>().instance;
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[UnityEngine.Scripting.Preserve]
|
[UnityEngine.Scripting.Preserve]
|
||||||
#endif
|
#endif
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public TPool GetPoolUnchecked<TPool>() where TPool : IEcsPoolImplementation, new()
|
public TPool GetPoolInstanceUnchecked<TPool>() where TPool : IEcsPoolImplementation, new()
|
||||||
{
|
{
|
||||||
return GetUnchecked<PoolCache<TPool>>().instance;
|
return GetUnchecked<PoolCache<TPool>>().instance;
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[UnityEngine.Scripting.Preserve]
|
[UnityEngine.Scripting.Preserve]
|
||||||
#endif
|
#endif
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static TPool GetPool<TPool>(int worldID) where TPool : IEcsPoolImplementation, new()
|
public static TPool GetPoolInstance<TPool>(int worldID) where TPool : IEcsPoolImplementation, new()
|
||||||
{
|
{
|
||||||
return Get<PoolCache<TPool>>(worldID).instance;
|
return Get<PoolCache<TPool>>(worldID).instance;
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[UnityEngine.Scripting.Preserve]
|
[UnityEngine.Scripting.Preserve]
|
||||||
#endif
|
#endif
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static TPool UncheckedGetPool<TPool>(int worldID) where TPool : IEcsPoolImplementation, new()
|
public static TPool GetPoolInstanceUnchecked<TPool>(int worldID) where TPool : IEcsPoolImplementation, new()
|
||||||
{
|
{
|
||||||
return GetUnchecked<PoolCache<TPool>>(worldID).instance;
|
return GetUnchecked<PoolCache<TPool>>(worldID).instance;
|
||||||
}
|
}
|
||||||
|
@ -258,12 +258,12 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static EcsPool<TComponent> GetPool<TComponent>(this EcsWorld self) where TComponent : struct, IEcsComponent
|
public static EcsPool<TComponent> GetPool<TComponent>(this EcsWorld self) where TComponent : struct, IEcsComponent
|
||||||
{
|
{
|
||||||
return self.GetPool<EcsPool<TComponent>>();
|
return self.GetPoolInstance<EcsPool<TComponent>>();
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static EcsPool<TComponent> GetPoolUnchecked<TComponent>(this EcsWorld self) where TComponent : struct, IEcsComponent
|
public static EcsPool<TComponent> GetPoolUnchecked<TComponent>(this EcsWorld self) where TComponent : struct, IEcsComponent
|
||||||
{
|
{
|
||||||
return self.GetPoolUnchecked<EcsPool<TComponent>>();
|
return self.GetPoolInstanceUnchecked<EcsPool<TComponent>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
@ -239,12 +239,12 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static EcsTagPool<TTagComponent> GetPool<TTagComponent>(this EcsWorld self) where TTagComponent : struct, IEcsTagComponent
|
public static EcsTagPool<TTagComponent> GetPool<TTagComponent>(this EcsWorld self) where TTagComponent : struct, IEcsTagComponent
|
||||||
{
|
{
|
||||||
return self.GetPool<EcsTagPool<TTagComponent>>();
|
return self.GetPoolInstance<EcsTagPool<TTagComponent>>();
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static EcsTagPool<TTagComponent> GetPoolUnchecked<TTagComponent>(this EcsWorld self) where TTagComponent : struct, IEcsTagComponent
|
public static EcsTagPool<TTagComponent> GetPoolUnchecked<TTagComponent>(this EcsWorld self) where TTagComponent : struct, IEcsTagComponent
|
||||||
{
|
{
|
||||||
return self.GetPoolUnchecked<EcsTagPool<TTagComponent>>();
|
return self.GetPoolInstanceUnchecked<EcsTagPool<TTagComponent>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@ -268,12 +268,12 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static EcsTagPool<TTagComponent> GetTagPool<TTagComponent>(this EcsWorld self) where TTagComponent : struct, IEcsTagComponent
|
public static EcsTagPool<TTagComponent> GetTagPool<TTagComponent>(this EcsWorld self) where TTagComponent : struct, IEcsTagComponent
|
||||||
{
|
{
|
||||||
return self.GetPool<EcsTagPool<TTagComponent>>();
|
return self.GetPoolInstance<EcsTagPool<TTagComponent>>();
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static EcsTagPool<TTagComponent> GetTagPoolUnchecked<TTagComponent>(this EcsWorld self) where TTagComponent : struct, IEcsTagComponent
|
public static EcsTagPool<TTagComponent> GetTagPoolUnchecked<TTagComponent>(this EcsWorld self) where TTagComponent : struct, IEcsTagComponent
|
||||||
{
|
{
|
||||||
return self.GetPoolUnchecked<EcsTagPool<TTagComponent>>();
|
return self.GetPoolInstanceUnchecked<EcsTagPool<TTagComponent>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
@ -231,7 +231,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
_value.World.GetComponents(_value.ID, _componentsList);
|
_value.World.GetComponentsFor(_value.ID, _componentsList);
|
||||||
return _componentsList;
|
return _componentsList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
_value.World.GetComponents(_value.ID, _componentsList);
|
_value.World.GetComponentsFor(_value.ID, _componentsList);
|
||||||
return _componentsList;
|
return _componentsList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user