Merge branch 'dev' into next_test_3

This commit is contained in:
DCFApixels 2025-05-01 14:57:00 +08:00
commit e21dd68ee2

View File

@ -100,6 +100,7 @@ namespace DCFApixels.DragonECS
{ {
ref int itemIndex = ref _mapping[entityID]; ref int itemIndex = ref _mapping[entityID];
#if DEBUG #if DEBUG
if (entityID == EcsConsts.NULL_ENTITY_ID) { Throw.Ent_ThrowIsNotAlive(_source, entityID); }
if (_source.IsUsed(entityID) == false) { Throw.Ent_ThrowIsNotAlive(_source, entityID); } if (_source.IsUsed(entityID) == false) { Throw.Ent_ThrowIsNotAlive(_source, entityID); }
if (itemIndex > 0) { EcsPoolThrowHelper.ThrowAlreadyHasComponent<T>(entityID); } if (itemIndex > 0) { EcsPoolThrowHelper.ThrowAlreadyHasComponent<T>(entityID); }
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); } if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
@ -156,6 +157,9 @@ namespace DCFApixels.DragonECS
} }
#if DEBUG
if (entityID == EcsConsts.NULL_ENTITY_ID) { Throw.Ent_ThrowIsNotAlive(_source, entityID); }
#endif
ref int itemIndex = ref _mapping[entityID]; ref int itemIndex = ref _mapping[entityID];
if (itemIndex <= 0) if (itemIndex <= 0)
{ //Add block { //Add block
@ -195,6 +199,7 @@ namespace DCFApixels.DragonECS
{ {
ref int removedItemIndex = ref _mapping[entityID]; ref int removedItemIndex = ref _mapping[entityID];
#if DEBUG #if DEBUG
if (entityID == EcsConsts.NULL_ENTITY_ID) { Throw.Ent_ThrowIsNotAlive(_source, entityID); }
if (removedItemIndex <= 0) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); } if (removedItemIndex <= 0) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); } if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#elif DRAGONECS_STABILITY_MODE #elif DRAGONECS_STABILITY_MODE
@ -265,7 +270,6 @@ namespace DCFApixels.DragonECS
if (_isLocked) { return; } if (_isLocked) { return; }
#endif #endif
if (_itemsCount <= 0) { return; } if (_itemsCount <= 0) { return; }
_itemsCount = 0;
var span = _source.Where(out SingleAspect<T> _); var span = _source.Where(out SingleAspect<T> _);
foreach (var entityID in span) foreach (var entityID in span)
{ {
@ -277,6 +281,8 @@ namespace DCFApixels.DragonECS
_listeners.InvokeOnDel(entityID, _listenersCachedCount); _listeners.InvokeOnDel(entityID, _listenersCachedCount);
#endif #endif
} }
_itemsCount = 0;
_recycledItemsCount = 0;
} }
#endregion #endregion