This commit is contained in:
DCFApixels 2025-04-23 17:48:40 +08:00
parent 82d6a8aeec
commit c38f1c152c

View File

@ -112,8 +112,6 @@ namespace DCFApixels.DragonECS
itemIndex = GetFreeItemIndex(entityID); itemIndex = GetFreeItemIndex(entityID);
_mediator.RegisterComponent(entityID, _componentTypeID, _maskBit); _mediator.RegisterComponent(entityID, _componentTypeID, _maskBit);
ref T result = ref _items[itemIndex]; ref T result = ref _items[itemIndex];
//_sparseEntities[itemIndex] = entityID;
//_table[itemIndex] = entityID;
EnableComponent(ref result); EnableComponent(ref result);
#if !DRAGONECS_DISABLE_POOLS_EVENTS #if !DRAGONECS_DISABLE_POOLS_EVENTS
_listeners.InvokeOnAddAndGet(entityID, _listenersCachedCount); _listeners.InvokeOnAddAndGet(entityID, _listenersCachedCount);
@ -362,7 +360,6 @@ namespace DCFApixels.DragonECS
} }
#endif #endif
UpdateDenseEntities(); UpdateDenseEntities();
//var span = new EcsSpan(_source.ID, _denseEntitiesDelayed, 1, _itemsCount);
var span = new EcsSpan(_source.ID, _table, 1 + _capacity, _itemsCount); var span = new EcsSpan(_source.ID, _table, 1 + _capacity, _itemsCount);
#if DRAGONECS_DEEP_DEBUG #if DRAGONECS_DEEP_DEBUG
if (DCFApixels.DragonECS.UncheckedCore.UncheckedCoreUtility.CheckSpanValideDebug(span) == false) if (DCFApixels.DragonECS.UncheckedCore.UncheckedCoreUtility.CheckSpanValideDebug(span) == false)
@ -411,7 +408,6 @@ namespace DCFApixels.DragonECS
using (_source.DisableAutoReleaseDelEntBuffer()) using (var group = EcsGroup.New(_source)) using (_source.DisableAutoReleaseDelEntBuffer()) using (var group = EcsGroup.New(_source))
{ {
EcsStaticMask.Inc<T>().Build().ToMask(_source).GetIterator().IterateTo(World.Entities, group); EcsStaticMask.Inc<T>().Build().ToMask(_source).GetIterator().IterateTo(World.Entities, group);
//var span = new EcsSpan(_source.ID, _denseEntitiesDelayed, 1, _itemsCount);
var span = new EcsSpan(_source.ID, _table, 1 + _capacity, _itemsCount); var span = new EcsSpan(_source.ID, _table, 1 + _capacity, _itemsCount);
if (group.SetEquals(span) == false) if (group.SetEquals(span) == false)
{ {
@ -421,9 +417,7 @@ namespace DCFApixels.DragonECS
_lockToSpan = false; _lockToSpan = false;
for (int i = _denseEntitiesDelayePtr; i < _denseEntitiesDelayePtr + _recycledCount; i++) for (int i = _denseEntitiesDelayePtr; i < _denseEntitiesDelayePtr + _recycledCount; i++)
{ {
//var index = _denseEntitiesDelayed[i];
var index = _table[i]; var index = _table[i];
//if (_sparseEntities[index] != 0)
if (_table[index] != 0) if (_table[index] != 0)
{ {
Throw.UndefinedException(); Throw.UndefinedException();
@ -445,14 +439,14 @@ namespace DCFApixels.DragonECS
} }
int result = 0; int result = 0;
if (_recycledCount != 0) if (_recycledCount == 0)
{ {
_recycledCount--; result = _denseEntitiesDelayePtr - _capacity;
result = _table[_denseEntitiesDelayePtr];
} }
else else
{ {
result = _denseEntitiesDelayePtr - _capacity; _recycledCount--;
result = _table[_denseEntitiesDelayePtr];
} }
#if DRAGONECS_DEEP_DEBUG #if DRAGONECS_DEEP_DEBUG