mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-11-13 00:55:55 +08:00
Create UncheckedCoreUtility.cs
This commit is contained in:
parent
1904fc4b86
commit
f1c8b6e39f
42
src/Utils/UncheckedCoreUtility.cs
Normal file
42
src/Utils/UncheckedCoreUtility.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
namespace DCFApixels.DragonECS.UncheckedCore
|
||||||
|
{
|
||||||
|
public static class UncheckedCoreUtility
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static EcsSpan CreateSpan(short worldID, int[] entitesArray, int startIndex, int length)
|
||||||
|
{
|
||||||
|
return new EcsSpan(worldID, entitesArray, startIndex, length);
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static EcsSpan CreateSpan(short worldID, int[] entitesArray, int length)
|
||||||
|
{
|
||||||
|
return new EcsSpan(worldID, entitesArray, length);
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static EcsSpan CreateSpan(short worldID, int[] entitesArray)
|
||||||
|
{
|
||||||
|
return new EcsSpan(worldID, entitesArray);
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static EcsSpan CreateEmptySpan(short worldID)
|
||||||
|
{
|
||||||
|
return new EcsSpan(worldID, Array.Empty<int>());
|
||||||
|
}
|
||||||
|
public static bool CheckSpanValideDebug(EcsSpan span)
|
||||||
|
{
|
||||||
|
HashSet<int> set = new HashSet<int>(span.Count);
|
||||||
|
foreach (var e in span)
|
||||||
|
{
|
||||||
|
if (set.Add(e) == false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user