This commit is contained in:
Mikhail 2024-07-05 22:05:21 +08:00
parent 2165342fb0
commit 6123f26765
2 changed files with 12 additions and 8 deletions

View File

@ -7,7 +7,7 @@ using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS
{
public sealed class EcsJoinToSubGraphExecutor<TAspect> : EcsJoinToSubGraphExecutor
where TAspect : EcsAspect
where TAspect : EcsAspect, new()
{
private TAspect _aspect;
@ -362,18 +362,18 @@ namespace DCFApixels.DragonECS
#region JoinToGraph
public static EcsSubGraph JoinToSubGraph<TCollection, TAspect>(this TCollection entities, out TAspect aspect, EcsSubGraphMode mode = EcsSubGraphMode.StartToEnd)
where TAspect : EcsAspect
where TAspect : EcsAspect, new()
where TCollection : IEntityStorage
{
return entities.ToSpan().JoinToSubGraph(out aspect, mode);
}
public static EcsSubGraph JoinToSubGraph<TAspect>(this EcsReadonlyGroup group, out TAspect aspect, EcsSubGraphMode mode = EcsSubGraphMode.StartToEnd)
where TAspect : EcsAspect
where TAspect : EcsAspect, new()
{
return group.ToSpan().JoinToSubGraph(out aspect, mode);
}
public static EcsSubGraph JoinToSubGraph<TAspect>(this EcsSpan span, out TAspect aspect, EcsSubGraphMode mode = EcsSubGraphMode.StartToEnd)
where TAspect : EcsAspect
where TAspect : EcsAspect, new()
{
EcsWorld world = span.World;
if (world.IsEnableReleaseDelEntBuffer)

View File

@ -346,15 +346,19 @@ namespace DCFApixels.DragonECS.Graphs.Internal
x ^= x >> 17;
return x;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static bool EqualsInFind(Key a, Key b) { return a.x == b.x; }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Key a, Key b) { return a.x == b.x && a.yHash == b.yHash; }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Key a, Key b) { return a.x != b.x || a.yHash != b.yHash; }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return yHash; }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Key other) { return this == other; }
public override bool Equals(object obj) { return obj is Key && Equals((Key)obj); }
public override string ToString()
{
return $"({x}, {yHash})";
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString() { return $"({x}, {yHash})"; }
}
#endregion
}