add kcp
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
using System.Threading;
|
||||
using System;
|
||||
using System.ComponentModel.Design;
|
||||
#if NET5_0_OR_GREATER
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
#endif
|
||||
namespace BITKit.Core.Entites
|
||||
{
|
||||
/// <summary>
|
||||
@@ -8,14 +12,11 @@ namespace BITKit.Core.Entites
|
||||
public interface IEntity
|
||||
{
|
||||
ulong Id { get; }
|
||||
#if NET5_0_OR_GREATER
|
||||
bool TryGetComponent<T>(out T component) where T : IEntityComponent;
|
||||
CancellationToken CancellationToken { get; }
|
||||
bool TryGetComponent<T>(out T component);
|
||||
IEntityComponent[] Components { get; }
|
||||
bool RegisterComponent<T>(T component) where T : IEntityComponent;
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
bool RegisterComponent<T>(T component);
|
||||
IServiceProvider ServiceProvider { get; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 基本实体组件
|
||||
@@ -24,6 +25,9 @@ namespace BITKit.Core.Entites
|
||||
{
|
||||
Type BaseType { get; }
|
||||
IEntity Entity { get; set; }
|
||||
#if NET5_0_OR_GREATER
|
||||
void BuildService(IServiceCollection serviceCollection);
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// 基本实体服务
|
||||
@@ -61,24 +65,28 @@ namespace BITKit.Core.Entites
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
IEntity Get(ulong id);
|
||||
|
||||
/// <summary>
|
||||
/// 查询Entity,例如
|
||||
/// </summary>
|
||||
/// <para>var rotationEntities=EntitiesService.Query<RotationComponent></para>
|
||||
IEntity[] Query<T>() where T : IEntityComponent;
|
||||
IEntity[] Query<T>();
|
||||
|
||||
/// <summary>
|
||||
/// 查询1个组件
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
T[] QueryComponents<T>() where T : IEntityComponent;
|
||||
T[] QueryComponents<T>();
|
||||
|
||||
/// <summary>
|
||||
/// 查询2个组件
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <returns></returns>
|
||||
ValueTuple<T,T1>[] QueryComponents<T,T1>()where T : IEntityComponent where T1 : IEntityComponent;
|
||||
ValueTuple<T, T1>[] QueryComponents<T, T1>();
|
||||
|
||||
/// <summary>
|
||||
/// 查询3个组件
|
||||
/// </summary>
|
||||
@@ -86,7 +94,7 @@ namespace BITKit.Core.Entites
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <typeparam name="T2"></typeparam>
|
||||
/// <returns></returns>
|
||||
ValueTuple<T,T1,T2>[] QueryComponents<T,T1,T2>() where T : IEntityComponent where T1 : IEntityComponent where T2 : IEntityComponent;
|
||||
|
||||
ValueTuple<T, T1, T2>[] QueryComponents<T, T1, T2>();
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user