mirror of
https://github.com/DCFApixels/DragonECS-Graphs.git
synced 2025-09-17 19:24:36 +08:00
fixes
This commit is contained in:
parent
777f4e9870
commit
3c79ea24e3
@ -226,10 +226,10 @@ namespace DCFApixels.DragonECS.Relations.Utils
|
||||
// arc.ArcWorld.DelEntity(revereceRelEntitiy);
|
||||
//}
|
||||
|
||||
//int endNodeIndex = _relNodesMapping[relEntityID].endNodeIndex;
|
||||
arc.ArcWorld.DelEntity(relEntityID);
|
||||
//if (!_isLoop)
|
||||
//if (_isLoop)
|
||||
//{
|
||||
// int endNodeIndex = _relNodesMapping[relEntityID].endNodeIndex;
|
||||
// int revereceRelEntitiy = _endBaskets.Get(endNodeIndex);
|
||||
// arc.ArcWorld.DelEntity(revereceRelEntitiy);
|
||||
//}
|
||||
@ -253,10 +253,10 @@ namespace DCFApixels.DragonECS.Relations.Utils
|
||||
// arc.ArcWorld.DelEntity(revereceRelEntitiy);
|
||||
//}
|
||||
|
||||
//int startNodeIndex = _relNodesMapping[relEntityID].startNodeIndex;
|
||||
arc.ArcWorld.DelEntity(relEntityID);
|
||||
//if (!_isLoop)
|
||||
//if (_isLoop)
|
||||
//{
|
||||
// int startNodeIndex = _relNodesMapping[relEntityID].startNodeIndex;
|
||||
// int revereceRelEntitiy = _startBaskets.Get(startNodeIndex);
|
||||
// arc.ArcWorld.DelEntity(revereceRelEntitiy);
|
||||
//}
|
||||
|
@ -19,6 +19,7 @@ namespace DCFApixels.DragonECS
|
||||
private readonly StartWorldHandler _startWorldHandler;
|
||||
private readonly ArcWorldHandler _arcWorldHandler;
|
||||
private readonly EndWorldHandler _endWorldHandler;
|
||||
private readonly LoopWorldHandler _loopWorldHandler;
|
||||
|
||||
private readonly SparseArray64<int> _relationsMatrix = new SparseArray64<int>();
|
||||
|
||||
@ -85,13 +86,19 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
_relEntityInfos = new RelEntityInfo[arcWorld.Capacity];
|
||||
|
||||
_startWorldHandler = new StartWorldHandler(this);
|
||||
_arcWorldHandler = new ArcWorldHandler(this);
|
||||
if (!_isLoop)
|
||||
|
||||
if (_isLoop)
|
||||
{
|
||||
_loopWorldHandler = new LoopWorldHandler(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
_startWorldHandler = new StartWorldHandler(this);
|
||||
_endWorldHandler = new EndWorldHandler(this);
|
||||
}
|
||||
|
||||
|
||||
_relEntities = EcsGroup.New(_arcWorld);
|
||||
_joinEntities = new EcsJoin(this);
|
||||
|
||||
@ -100,12 +107,17 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
public void Destroy()
|
||||
{
|
||||
_startWorldHandler.Destroy();
|
||||
_arcWorldHandler.Destroy();
|
||||
if (!_isLoop)
|
||||
_arcWorldHandler.Destroy();
|
||||
if (_isLoop)
|
||||
{
|
||||
_endWorldHandler.Destroy();
|
||||
_loopWorldHandler.Destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
_startWorldHandler.Destroy();
|
||||
_endWorldHandler.Destroy();
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -281,7 +293,6 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
foreach (var startEntityID in startEntityBuffer)
|
||||
{
|
||||
//_arc._joinEntities.DelStart(startEntityID);
|
||||
_arc._joinEntitiesFriend.DelStartAndDelRelEntities(startEntityID, _arc);
|
||||
}
|
||||
_arc._arcWorld.ReleaseDelEntityBuffer(startEntityBuffer.Length);
|
||||
@ -307,7 +318,6 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
foreach (var endEntityID in endEntityBuffer)
|
||||
{
|
||||
//_arc._joinEntities.DelEnd(endEntityID);
|
||||
_arc._joinEntitiesFriend.DelEndAndDelRelEntities(endEntityID, _arc);
|
||||
}
|
||||
_arc._arcWorld.ReleaseDelEntityBuffer(endEntityBuffer.Length);
|
||||
@ -316,6 +326,32 @@ namespace DCFApixels.DragonECS
|
||||
public void OnWorldResize(int endWorldNewSize) { }
|
||||
#endregion
|
||||
}
|
||||
private class LoopWorldHandler : IEcsWorldEventListener
|
||||
{
|
||||
private readonly EcsArc _arc;
|
||||
public LoopWorldHandler(EcsArc arc)
|
||||
{
|
||||
_arc = arc;
|
||||
_arc.StartWorld.AddListener(this);
|
||||
}
|
||||
public void Destroy()
|
||||
{
|
||||
_arc.StartWorld.RemoveListener(this);
|
||||
}
|
||||
#region Callbacks
|
||||
public void OnReleaseDelEntityBuffer(ReadOnlySpan<int> startEntityBuffer)
|
||||
{
|
||||
foreach (var startEntityID in startEntityBuffer)
|
||||
{
|
||||
_arc._joinEntitiesFriend.DelStartAndDelRelEntities(startEntityID, _arc);
|
||||
_arc._joinEntitiesFriend.DelEndAndDelRelEntities(startEntityID, _arc);
|
||||
}
|
||||
_arc._arcWorld.ReleaseDelEntityBuffer(startEntityBuffer.Length);
|
||||
}
|
||||
public void OnWorldDestroy() { }
|
||||
public void OnWorldResize(int startWorldNewSize) { }
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user