1
This commit is contained in:
@@ -38,10 +38,10 @@ public class UnityEntitiesServiceSingleton:IEntitiesService
|
||||
|
||||
public CancellationToken CancellationToken => UnityEntitiesService.CancellationToken;
|
||||
|
||||
public IEntity Get(ulong id) => UnityEntitiesService.Get(id);
|
||||
public bool TryGetEntity(ulong id, out IEntity entity) => UnityEntitiesService.TryGetEntity(id, out entity);
|
||||
public IEntity Get(int id) => UnityEntitiesService.Get(id);
|
||||
public bool TryGetEntity(int id, out IEntity entity) => UnityEntitiesService.TryGetEntity(id, out entity);
|
||||
|
||||
public IEntity GetOrAdd(ulong id, Func<ulong, IEntity> factory)=>UnityEntitiesService.GetOrAdd(id,factory);
|
||||
public IEntity GetOrAdd(int id, Func<int, IEntity> factory)=>UnityEntitiesService.GetOrAdd(id,factory);
|
||||
|
||||
|
||||
public IEntity[] Query<T>()
|
||||
@@ -85,7 +85,7 @@ public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
||||
return false;
|
||||
}
|
||||
public static CancellationToken CancellationToken;
|
||||
private static readonly ConcurrentDictionary<ulong,IEntity> Dictionary=new();
|
||||
private static readonly ConcurrentDictionary<int,IEntity> Dictionary=new();
|
||||
private static readonly Queue<IEntity> RegisterQueue = new();
|
||||
private static readonly Queue<IEntity> UnRegisterQueue = new();
|
||||
private void Awake()
|
||||
@@ -126,18 +126,18 @@ public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
||||
}
|
||||
|
||||
CancellationToken IEntitiesService.CancellationToken => CancellationToken;
|
||||
public static IEntity Get(ulong id)=>Dictionary[id];
|
||||
IEntity IEntitiesService.Get(ulong id)=>Get(id);
|
||||
public static bool TryGetEntity(ulong id, out IEntity entity)
|
||||
public static IEntity Get(int id)=>Dictionary[id];
|
||||
IEntity IEntitiesService.Get(int id)=>Get(id);
|
||||
public static bool TryGetEntity(int id, out IEntity entity)
|
||||
{
|
||||
return Dictionary.TryGetValue(id, out entity);
|
||||
}
|
||||
bool IEntitiesService.TryGetEntity(ulong id, out IEntity entity)=>TryGetEntity(id,out entity);
|
||||
public static IEntity GetOrAdd(ulong id, Func<ulong, IEntity> factory)
|
||||
bool IEntitiesService.TryGetEntity(int id, out IEntity entity)=>TryGetEntity(id,out entity);
|
||||
public static IEntity GetOrAdd(int id, Func<int, IEntity> factory)
|
||||
{
|
||||
return Dictionary.GetOrAdd(id, factory);
|
||||
}
|
||||
IEntity IEntitiesService.GetOrAdd(ulong id, Func<ulong, IEntity> factory)=>GetOrAdd(id,factory);
|
||||
IEntity IEntitiesService.GetOrAdd(int id, Func<int, IEntity> factory)=>GetOrAdd(id,factory);
|
||||
|
||||
IEntity[] IEntitiesService.Query<T>()=>Query<T>();
|
||||
public static IEntity[] Query<T>()
|
||||
|
Reference in New Issue
Block a user