mirror of
https://github.com/DCFApixels/DragonECS-Graphs.git
synced 2025-09-17 19:24:36 +08:00
stash
This commit is contained in:
parent
6123f26765
commit
ed521a5b8a
@ -6,28 +6,7 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
public sealed class EcsJoinToSubGraphExecutor<TAspect> : EcsJoinToSubGraphExecutor
|
public sealed class EcsJoinToSubGraphExecutor : EcsQueryExecutor, IEcsWorldEventListener
|
||||||
where TAspect : EcsAspect, new()
|
|
||||||
{
|
|
||||||
private TAspect _aspect;
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
public TAspect Aspect
|
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get { return _aspect; }
|
|
||||||
}
|
|
||||||
protected override EcsAspect AspectRaw
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_aspect == null) { _aspect = World.GetAspect<TAspect>(); }
|
|
||||||
return _aspect;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
public abstract class EcsJoinToSubGraphExecutor : EcsQueryExecutor, IEcsWorldEventListener
|
|
||||||
{
|
{
|
||||||
private EcsAspect _aspect;
|
private EcsAspect _aspect;
|
||||||
|
|
||||||
@ -44,7 +23,6 @@ namespace DCFApixels.DragonECS
|
|||||||
private EcsProfilerMarker _executeMarker = new EcsProfilerMarker("JoinAttach");
|
private EcsProfilerMarker _executeMarker = new EcsProfilerMarker("JoinAttach");
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
protected abstract EcsAspect AspectRaw { get; }
|
|
||||||
public sealed override long Version
|
public sealed override long Version
|
||||||
{
|
{
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@ -63,7 +41,6 @@ namespace DCFApixels.DragonECS
|
|||||||
_linkedList = new EntityLinkedList(World.Capacity);
|
_linkedList = new EntityLinkedList(World.Capacity);
|
||||||
_baskets = new Basket[World.Capacity];
|
_baskets = new Basket[World.Capacity];
|
||||||
World.AddListener(this);
|
World.AddListener(this);
|
||||||
_aspect = AspectRaw;
|
|
||||||
_graph = World.GetGraph();
|
_graph = World.GetGraph();
|
||||||
}
|
}
|
||||||
protected override void OnDestroy()
|
protected override void OnDestroy()
|
||||||
@ -110,8 +87,8 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var iterator = _aspect.GetIteratorFor(span);
|
var iterator = _aspect.Mask.GetIterator();
|
||||||
foreach (var relationEntityID in iterator) { AddStart(relationEntityID); }
|
foreach (var relationEntityID in iterator.Iterate(span)) { AddStart(relationEntityID); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((mode & EcsSubGraphMode.EndToStart) != 0)
|
if ((mode & EcsSubGraphMode.EndToStart) != 0)
|
||||||
@ -122,8 +99,8 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var iterator = _aspect.GetIteratorFor(span);
|
var iterator = _aspect.Mask.GetIterator();
|
||||||
foreach (var relationEntityID in iterator) { AddEnd(relationEntityID); }
|
foreach (var relationEntityID in iterator.Iterate(span)) { AddEnd(relationEntityID); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,12 +331,11 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
world.ReleaseDelEntityBufferAll();
|
world.ReleaseDelEntityBufferAll();
|
||||||
}
|
}
|
||||||
var executor = world.GetExecutor<EcsJoinToSubGraphExecutor<EmptyAspect>>();
|
world.GetQueryCache(out EcsJoinToSubGraphExecutor executor, out EmptyAspect _);
|
||||||
return executor.ExecuteFor(span, mode);
|
return executor.ExecuteFor(span, mode);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region JoinToGraph
|
#region JoinToGraph
|
||||||
public static EcsSubGraph JoinToSubGraph<TCollection, TAspect>(this TCollection entities, out TAspect aspect, EcsSubGraphMode mode = EcsSubGraphMode.StartToEnd)
|
public static EcsSubGraph JoinToSubGraph<TCollection, TAspect>(this TCollection entities, out TAspect aspect, EcsSubGraphMode mode = EcsSubGraphMode.StartToEnd)
|
||||||
where TAspect : EcsAspect, new()
|
where TAspect : EcsAspect, new()
|
||||||
@ -380,8 +356,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
world.ReleaseDelEntityBufferAll();
|
world.ReleaseDelEntityBufferAll();
|
||||||
}
|
}
|
||||||
var executor = world.GetExecutor<EcsJoinToSubGraphExecutor<TAspect>>();
|
world.GetQueryCache(out EcsJoinToSubGraphExecutor executor, out aspect);
|
||||||
aspect = executor.Aspect;
|
|
||||||
return executor.ExecuteFor(span, mode);
|
return executor.ExecuteFor(span, mode);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user