add kcp
This commit is contained in:
@@ -41,22 +41,22 @@ public class UnityEntitiesServiceSingleton:IEntitiesService
|
||||
|
||||
public IEntity Get(ulong id) => UnityEntitiesService.Get(id);
|
||||
|
||||
public IEntity[] Query<T>() where T : IEntityComponent
|
||||
public IEntity[] Query<T>()
|
||||
{
|
||||
return UnityEntitiesService.Query<T>();
|
||||
}
|
||||
|
||||
public T[] QueryComponents<T>() where T : IEntityComponent
|
||||
public T[] QueryComponents<T>()
|
||||
{
|
||||
return UnityEntitiesService.QueryComponents<T>();
|
||||
}
|
||||
|
||||
public (T, T1)[] QueryComponents<T, T1>() where T : IEntityComponent where T1 : IEntityComponent
|
||||
public (T, T1)[] QueryComponents<T, T1>()
|
||||
{
|
||||
return UnityEntitiesService.QueryComponents<T, T1>();
|
||||
}
|
||||
|
||||
public (T, T1, T2)[] QueryComponents<T, T1, T2>() where T : IEntityComponent where T1 : IEntityComponent where T2 : IEntityComponent
|
||||
public (T, T1, T2)[] QueryComponents<T, T1, T2>()
|
||||
{
|
||||
return UnityEntitiesService.QueryComponents<T, T1, T2>();
|
||||
}
|
||||
@@ -64,13 +64,12 @@ public class UnityEntitiesServiceSingleton:IEntitiesService
|
||||
|
||||
public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
||||
{
|
||||
[RuntimeInitializeOnLoadMethod]
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void Initialize()
|
||||
{
|
||||
Dictionary.Clear();
|
||||
RegisterQueue.Clear();
|
||||
UnRegisterQueue.Clear();
|
||||
|
||||
}
|
||||
public static bool Register(IEntity entity)
|
||||
{
|
||||
@@ -127,12 +126,12 @@ public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
||||
public static IEntity Get(ulong id)=>Dictionary[id];
|
||||
IEntity IEntitiesService.Get(ulong id)=>Get(id);
|
||||
IEntity[] IEntitiesService.Query<T>()=>Query<T>();
|
||||
public static IEntity[] Query<T>() where T : IEntityComponent
|
||||
public static IEntity[] Query<T>()
|
||||
{
|
||||
return Entities.Where(x => ((Entity)x).TryGetComponentAny<T>(out _)).ToArray();
|
||||
}
|
||||
T[] IEntitiesService.QueryComponents<T>()=>QueryComponents<T>();
|
||||
public static T[] QueryComponents<T>() where T : IEntityComponent
|
||||
public static T[] QueryComponents<T>()
|
||||
{
|
||||
var list = ListPool<T>.Get();
|
||||
foreach (var iEntity in Entities)
|
||||
@@ -150,7 +149,7 @@ public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
||||
return value;
|
||||
}
|
||||
(T, T1)[] IEntitiesService.QueryComponents<T,T1>()=>QueryComponents<T,T1>();
|
||||
public static (T, T1)[] QueryComponents<T, T1>() where T : IEntityComponent where T1 : IEntityComponent
|
||||
public static (T, T1)[] QueryComponents<T, T1>()
|
||||
{
|
||||
var list = ListPool<(T t, T1 t1)>.Get();
|
||||
foreach (var iEntity in Entities)
|
||||
@@ -168,7 +167,7 @@ public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
||||
return value;
|
||||
}
|
||||
(T, T1, T2)[] IEntitiesService.QueryComponents<T,T1,T2>()=>QueryComponents<T,T1,T2>();
|
||||
public static (T, T1, T2)[] QueryComponents<T, T1, T2>() where T : IEntityComponent where T1 : IEntityComponent where T2 : IEntityComponent
|
||||
public static (T, T1, T2)[] QueryComponents<T, T1, T2>()
|
||||
{
|
||||
var list = ListPool<(T t, T1 t1, T2 t2)>.Get();
|
||||
foreach (var iEntity in Entities)
|
||||
|
Reference in New Issue
Block a user