mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 18:14:37 +08:00
rename GetPoolInstance(Type) to FindPoolInstance(Type)
This commit is contained in:
parent
c332289a0a
commit
3a22a914d5
@ -496,7 +496,7 @@ namespace DCFApixels.DragonECS
|
|||||||
EcsWorld world = EcsWorld.GetWorld(worldID);
|
EcsWorld world = EcsWorld.GetWorld(worldID);
|
||||||
foreach (var incTypeID in _mask._inc)
|
foreach (var incTypeID in _mask._inc)
|
||||||
{
|
{
|
||||||
var pool = world.GetPoolInstance(incTypeID);
|
var pool = world.FindPoolInstance(incTypeID);
|
||||||
if (pool != null)
|
if (pool != null)
|
||||||
{
|
{
|
||||||
if (pool.Has(entityID) == false)
|
if (pool.Has(entityID) == false)
|
||||||
@ -513,7 +513,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
foreach (var excTypeID in _mask._exc)
|
foreach (var excTypeID in _mask._exc)
|
||||||
{
|
{
|
||||||
var pool = world.GetPoolInstance(excTypeID);
|
var pool = world.FindPoolInstance(excTypeID);
|
||||||
if (pool != null && pool.Has(entityID))
|
if (pool != null && pool.Has(entityID))
|
||||||
{
|
{
|
||||||
pool.Del(entityID);
|
pool.Del(entityID);
|
||||||
|
@ -16,34 +16,49 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
private readonly PoolsMediator _poolsMediator;
|
private readonly PoolsMediator _poolsMediator;
|
||||||
|
|
||||||
private EcsNullPool _nullPool = EcsNullPool.instance;
|
private readonly EcsNullPool _nullPool = EcsNullPool.instance;
|
||||||
|
|
||||||
#region Getters
|
#region FindPoolInstance
|
||||||
|
[Obsolete("The GetPoolInstance(int componentTypeID) method will be removed in future updates, use FindPoolInstance(Type componentType)")]
|
||||||
public IEcsPool GetPoolInstance(int componentTypeID)
|
public IEcsPool GetPoolInstance(int componentTypeID)
|
||||||
|
{
|
||||||
|
return FindPoolInstance(componentTypeID);
|
||||||
|
}
|
||||||
|
[Obsolete("The GetPoolInstance(Type componentType) method will be removed in future updates, use FindPoolInstance(Type componentType)")]
|
||||||
|
public IEcsPool GetPoolInstance(Type componentType)
|
||||||
|
{
|
||||||
|
return FindPoolInstance(componentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEcsPool FindPoolInstance(int componentTypeID)
|
||||||
{
|
{
|
||||||
if (IsComponentTypeDeclared(componentTypeID))
|
if (IsComponentTypeDeclared(componentTypeID))
|
||||||
{
|
{
|
||||||
var resuult = _pools[componentTypeID];
|
return FindPoolInstance_Internal(componentTypeID);
|
||||||
#if DEBUG
|
|
||||||
if (resuult != _nullPool && resuult.ComponentTypeID != componentTypeID) { Throw.UndefinedException(); }
|
|
||||||
#endif
|
|
||||||
return resuult;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public IEcsPool GetPoolInstance(Type componentType)
|
public IEcsPool FindPoolInstance(Type componentType)
|
||||||
{
|
{
|
||||||
int componentTypeID = GetComponentTypeID(componentType);
|
return FindPoolInstance_Internal(GetComponentTypeID(componentType));
|
||||||
ref var pool = ref _pools[componentTypeID];
|
}
|
||||||
if (pool == _nullPool)
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
private IEcsPool FindPoolInstance_Internal(int componentTypeID)
|
||||||
{
|
{
|
||||||
|
ref var result = ref _pools[componentTypeID];
|
||||||
|
if (result != _nullPool)
|
||||||
|
{
|
||||||
|
#if (DEBUG && !DISABLE_DEBUG)
|
||||||
|
if (result.ComponentTypeID != componentTypeID) { Throw.UndefinedException(); }
|
||||||
|
#endif
|
||||||
|
return result;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return pool;
|
#endregion
|
||||||
}
|
|
||||||
|
|
||||||
|
#region GetPoolInstance
|
||||||
#if UNITY_2020_3_OR_NEWER
|
#if UNITY_2020_3_OR_NEWER
|
||||||
[UnityEngine.Scripting.Preserve]
|
[UnityEngine.Scripting.Preserve]
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user