fix naming

This commit is contained in:
Mikhail 2024-11-05 15:56:46 +08:00
parent 7460b0299f
commit 4e54be72bf
3 changed files with 26 additions and 26 deletions

View File

@ -83,8 +83,8 @@ namespace DCFApixels.DragonECS
{ {
ref int itemIndex = ref _mapping[entityID]; ref int itemIndex = ref _mapping[entityID];
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (itemIndex > 0) { EcsPoolThrowHalper.ThrowAlreadyHasComponent<T>(entityID); } if (itemIndex > 0) { EcsPoolThrowHelper.ThrowAlreadyHasComponent<T>(entityID); }
if (_isLocked) { EcsPoolThrowHalper.ThrowPoolLocked(); } if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif #endif
if (_recycledItemsCount > 0) if (_recycledItemsCount > 0)
{ {
@ -110,7 +110,7 @@ namespace DCFApixels.DragonECS
public ref T Get(int entityID) public ref T Get(int entityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!Has(entityID)) { EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID); } if (!Has(entityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
#endif #endif
#if !DISABLE_POOLS_EVENTS #if !DISABLE_POOLS_EVENTS
_listeners.InvokeOnGet(entityID, _listenersCachedCount); _listeners.InvokeOnGet(entityID, _listenersCachedCount);
@ -121,7 +121,7 @@ namespace DCFApixels.DragonECS
public ref readonly T Read(int entityID) public ref readonly T Read(int entityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!Has(entityID)) { EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID); } if (!Has(entityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
#endif #endif
return ref _items[_mapping[entityID]]; return ref _items[_mapping[entityID]];
} }
@ -131,7 +131,7 @@ namespace DCFApixels.DragonECS
if (itemIndex <= 0) if (itemIndex <= 0)
{ //Add block { //Add block
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_isLocked) { EcsPoolThrowHalper.ThrowPoolLocked(); } if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif #endif
if (_recycledItemsCount > 0) if (_recycledItemsCount > 0)
{ {
@ -165,11 +165,11 @@ namespace DCFApixels.DragonECS
public void Del(int entityID) public void Del(int entityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_isLocked) { EcsPoolThrowHalper.ThrowPoolLocked(); } if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif #endif
ref int itemIndex = ref _mapping[entityID]; ref int itemIndex = ref _mapping[entityID];
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (itemIndex <= 0) { EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID); } if (itemIndex <= 0) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
#endif #endif
DisableComponent(ref _items[itemIndex]); DisableComponent(ref _items[itemIndex]);
if (_recycledItemsCount >= _recycledItems.Length) if (_recycledItemsCount >= _recycledItems.Length)
@ -194,14 +194,14 @@ namespace DCFApixels.DragonECS
public void Copy(int fromEntityID, int toEntityID) public void Copy(int fromEntityID, int toEntityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!Has(fromEntityID)) { EcsPoolThrowHalper.ThrowNotHaveComponent<T>(fromEntityID); } if (!Has(fromEntityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(fromEntityID); }
#endif #endif
CopyComponent(ref Get(fromEntityID), ref TryAddOrGet(toEntityID)); CopyComponent(ref Get(fromEntityID), ref TryAddOrGet(toEntityID));
} }
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID) public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!Has(fromEntityID)) { EcsPoolThrowHalper.ThrowNotHaveComponent<T>(fromEntityID); } if (!Has(fromEntityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(fromEntityID); }
#endif #endif
CopyComponent(ref Get(fromEntityID), ref toWorld.GetPool<T>().TryAddOrGet(toEntityID)); CopyComponent(ref Get(fromEntityID), ref toWorld.GetPool<T>().TryAddOrGet(toEntityID));
} }
@ -209,7 +209,7 @@ namespace DCFApixels.DragonECS
public void ClearAll() public void ClearAll()
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_isLocked) { EcsPoolThrowHalper.ThrowPoolLocked(); } if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif #endif
var span = _source.Where(out SingleAspect<EcsPool<T>> _); var span = _source.Where(out SingleAspect<EcsPool<T>> _);
_itemsCount = 0; _itemsCount = 0;
@ -274,13 +274,13 @@ namespace DCFApixels.DragonECS
#if !DISABLE_POOLS_EVENTS #if !DISABLE_POOLS_EVENTS
public void AddListener(IEcsPoolEventListener listener) public void AddListener(IEcsPoolEventListener listener)
{ {
if (listener == null) { EcsPoolThrowHalper.ThrowNullListener(); } if (listener == null) { EcsPoolThrowHelper.ThrowNullListener(); }
_listeners.Add(listener); _listeners.Add(listener);
_listenersCachedCount++; _listenersCachedCount++;
} }
public void RemoveListener(IEcsPoolEventListener listener) public void RemoveListener(IEcsPoolEventListener listener)
{ {
if (listener == null) { EcsPoolThrowHalper.ThrowNullListener(); } if (listener == null) { EcsPoolThrowHelper.ThrowNullListener(); }
if (_listeners.Remove(listener)) if (_listeners.Remove(listener))
{ {
_listenersCachedCount--; _listenersCachedCount--;

View File

@ -22,7 +22,7 @@ namespace DCFApixels.DragonECS.PoolsCore
/// <typeparam name="T">Component type</typeparam> /// <typeparam name="T">Component type</typeparam>
public interface IEcsPoolImplementation<T> : IEcsPoolImplementation { } public interface IEcsPoolImplementation<T> : IEcsPoolImplementation { }
public static class EcsPoolThrowHalper public static class EcsPoolThrowHelper
{ {
public static void ThrowAlreadyHasComponent<T>(int entityID) public static void ThrowAlreadyHasComponent<T>(int entityID)
{ {

View File

@ -92,8 +92,8 @@ namespace DCFApixels.DragonECS
public void Add(int entityID) public void Add(int entityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (Has(entityID)) { EcsPoolThrowHalper.ThrowAlreadyHasComponent<T>(entityID); } if (Has(entityID)) { EcsPoolThrowHelper.ThrowAlreadyHasComponent<T>(entityID); }
if (_isLocked) { EcsPoolThrowHalper.ThrowPoolLocked(); } if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif #endif
_count++; _count++;
_mapping[entityID] = true; _mapping[entityID] = true;
@ -117,8 +117,8 @@ namespace DCFApixels.DragonECS
public void Del(int entityID) public void Del(int entityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!Has(entityID)) { EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID); } if (!Has(entityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
if (_isLocked) { EcsPoolThrowHalper.ThrowPoolLocked(); } if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif #endif
_mapping[entityID] = false; _mapping[entityID] = false;
_count--; _count--;
@ -138,14 +138,14 @@ namespace DCFApixels.DragonECS
public void Copy(int fromEntityID, int toEntityID) public void Copy(int fromEntityID, int toEntityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!Has(fromEntityID)) { EcsPoolThrowHalper.ThrowNotHaveComponent<T>(fromEntityID); } if (!Has(fromEntityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(fromEntityID); }
#endif #endif
TryAdd(toEntityID); TryAdd(toEntityID);
} }
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID) public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!Has(fromEntityID)) { EcsPoolThrowHalper.ThrowNotHaveComponent<T>(fromEntityID); } if (!Has(fromEntityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(fromEntityID); }
#endif #endif
toWorld.GetPool<T>().TryAdd(toEntityID); toWorld.GetPool<T>().TryAdd(toEntityID);
} }
@ -178,7 +178,7 @@ namespace DCFApixels.DragonECS
public void ClearAll() public void ClearAll()
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_isLocked) { EcsPoolThrowHalper.ThrowPoolLocked(); } if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif #endif
var span = _source.Where(out SingleAspect<EcsTagPool<T>> _); var span = _source.Where(out SingleAspect<EcsTagPool<T>> _);
_count = 0; _count = 0;
@ -228,14 +228,14 @@ namespace DCFApixels.DragonECS
object IEcsReadonlyPool.GetRaw(int entityID) object IEcsReadonlyPool.GetRaw(int entityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (Has(entityID) == false) { EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID); } if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
#endif #endif
return _fakeComponent; return _fakeComponent;
} }
void IEcsPool.SetRaw(int entityID, object dataRaw) void IEcsPool.SetRaw(int entityID, object dataRaw)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (Has(entityID) == false) { EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID); } if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
#endif #endif
} }
ref T IEcsStructPool<T>.Add(int entityID) ref T IEcsStructPool<T>.Add(int entityID)
@ -246,14 +246,14 @@ namespace DCFApixels.DragonECS
ref readonly T IEcsStructPool<T>.Read(int entityID) ref readonly T IEcsStructPool<T>.Read(int entityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (Has(entityID) == false) { EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID); } if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
#endif #endif
return ref _fakeComponent; return ref _fakeComponent;
} }
ref T IEcsStructPool<T>.Get(int entityID) ref T IEcsStructPool<T>.Get(int entityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (Has(entityID) == false) { EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID); } if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
#endif #endif
return ref _fakeComponent; return ref _fakeComponent;
} }
@ -263,13 +263,13 @@ namespace DCFApixels.DragonECS
#if !DISABLE_POOLS_EVENTS #if !DISABLE_POOLS_EVENTS
public void AddListener(IEcsPoolEventListener listener) public void AddListener(IEcsPoolEventListener listener)
{ {
if (listener == null) { EcsPoolThrowHalper.ThrowNullListener(); } if (listener == null) { EcsPoolThrowHelper.ThrowNullListener(); }
_listeners.Add(listener); _listeners.Add(listener);
_listenersCachedCount++; _listenersCachedCount++;
} }
public void RemoveListener(IEcsPoolEventListener listener) public void RemoveListener(IEcsPoolEventListener listener)
{ {
if (listener == null) { EcsPoolThrowHalper.ThrowNullListener(); } if (listener == null) { EcsPoolThrowHelper.ThrowNullListener(); }
if (_listeners.Remove(listener)) if (_listeners.Remove(listener))
{ {
_listenersCachedCount--; _listenersCachedCount--;