Fantasy
搜索结果

    显示/隐藏目录

    Entity 类

    Entity的抽象类,任何Entity必须继承这个接口才可以使用

    继承
    object
    Entity
    CoroutineLockComponent
    EntityComponent
    MessagePoolComponent
    EventComponent
    ANetwork
    MessageDispatcherComponent
    AddressableManageComponent
    AddressableMessageComponent
    AddressableRouteComponent
    RouteComponent
    Session
    SessionIdleCheckerComponent
    Scene
    NetworkMessagingComponent
    SingleCollectionComponent
    TimerComponent
    实现
    IEntity
    IDisposable
    IPool
    继承成员
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    命名空间: Fantasy.Entitas
    程序集: Fantasy.Net.dll
    语法
    public abstract class Entity : IEntity, IDisposable, IPool

    属性

    | 编辑本文 查看源代码

    ForEachEntity

    查找当前实体下的所有实体,不包括实现ISupportedMultiEntity接口的实体

    声明
    [BsonIgnore]
    [JsonIgnore]
    [IgnoreDataMember]
    [ProtoIgnore]
    public IEnumerable<Entity> ForEachEntity { get; }
    属性值
    类型 描述
    IEnumerable<Entity>
    | 编辑本文 查看源代码

    ForEachMultiEntity

    查询当前实体下的实现了ISupportedMultiEntity接口的实体

    声明
    [BsonIgnore]
    [JsonIgnore]
    [IgnoreDataMember]
    [ProtoIgnore]
    public IEnumerable<Entity> ForEachMultiEntity { get; }
    属性值
    类型 描述
    IEnumerable<Entity>
    | 编辑本文 查看源代码

    ForEachSingleCollection

    查询当前实体下支持数据库分表存储实体

    声明
    [BsonIgnore]
    [JsonIgnore]
    [IgnoreDataMember]
    [ProtoIgnore]
    public IEnumerable<Entity> ForEachSingleCollection { get; }
    属性值
    类型 描述
    IEnumerable<Entity>
    | 编辑本文 查看源代码

    ForEachTransfer

    查询当前实体下支持传送实体

    声明
    [BsonIgnore]
    [JsonIgnore]
    [IgnoreDataMember]
    [ProtoIgnore]
    public IEnumerable<Entity> ForEachTransfer { get; }
    属性值
    类型 描述
    IEnumerable<Entity>
    | 编辑本文 查看源代码

    Id

    实体的Id

    声明
    [BsonId]
    [BsonElement]
    [BsonIgnoreIfDefault]
    [BsonDefaultValue(0)]
    public long Id { get; protected set; }
    属性值
    类型 描述
    long
    | 编辑本文 查看源代码

    IsDisposed

    当前实体是否已经被销毁

    声明
    [BsonIgnore]
    [JsonIgnore]
    [IgnoreDataMember]
    [ProtoIgnore]
    public bool IsDisposed { get; }
    属性值
    类型 描述
    bool
    | 编辑本文 查看源代码

    Parent

    实体的父实体

    声明
    [BsonIgnore]
    [JsonIgnore]
    [IgnoreDataMember]
    [ProtoIgnore]
    public Entity Parent { get; protected set; }
    属性值
    类型 描述
    Entity
    | 编辑本文 查看源代码

    RunTimeId

    实体的RunTimeId,其他系统可以通过这个Id发送Route消息,这个Id也可以理解为RouteId

    声明
    [BsonIgnore]
    [IgnoreDataMember]
    [ProtoIgnore]
    public long RunTimeId { get; protected set; }
    属性值
    类型 描述
    long
    | 编辑本文 查看源代码

    Scene

    当前实体所归属的Scene

    声明
    [BsonIgnore]
    [JsonIgnore]
    [IgnoreDataMember]
    [ProtoIgnore]
    public Scene Scene { get; protected set; }
    属性值
    类型 描述
    Scene
    | 编辑本文 查看源代码

    Type

    实体的真实Type

    声明
    [BsonIgnore]
    [JsonIgnore]
    [IgnoreDataMember]
    [ProtoIgnore]
    public Type Type { get; protected set; }
    属性值
    类型 描述
    Type

    方法

    | 编辑本文 查看源代码

    AddComponent(Entity)

    添加一个组件到当前实体上

    声明
    public void AddComponent(Entity component)
    参数
    类型 名称 描述
    Entity component

    要添加的实体实例

    | 编辑本文 查看源代码

    AddComponent<T>(bool)

    添加一个组件到当前实体上

    声明
    public T AddComponent<T>(bool isPool = true) where T : Entity, new()
    参数
    类型 名称 描述
    bool isPool

    是否从对象池里创建

    返回
    类型 描述
    T

    返回添加到实体上组件的实例

    类型参数
    名称 描述
    T

    要添加组件的泛型类型

    | 编辑本文 查看源代码

    AddComponent<T>(long, bool)

    添加一个组件到当前实体上

    声明
    public T AddComponent<T>(long id, bool isPool = true) where T : Entity, new()
    参数
    类型 名称 描述
    long id

    要添加组件的Id

    bool isPool

    是否从对象池里创建

    返回
    类型 描述
    T

    返回添加到实体上组件的实例

    类型参数
    名称 描述
    T

    要添加组件的泛型类型

    | 编辑本文 查看源代码

    AddComponent<T>(T)

    添加一个组件到当前实体上

    声明
    public void AddComponent<T>(T component) where T : Entity
    参数
    类型 名称 描述
    T component

    要添加的实体实例

    类型参数
    名称 描述
    T

    要添加组件的泛型类型

    | 编辑本文 查看源代码

    Create<T>(Scene, bool, bool)

    创建一个实体

    声明
    public static T Create<T>(Scene scene, bool isPool, bool isRunEvent) where T : Entity, new()
    参数
    类型 名称 描述
    Scene scene

    所属的Scene

    bool isPool

    是否从对象池创建,如果选择的是,销毁的时候同样会进入对象池

    bool isRunEvent

    是否执行实体事件

    返回
    类型 描述
    T
    类型参数
    名称 描述
    T

    要创建的实体泛型类型

    | 编辑本文 查看源代码

    Create<T>(Scene, long, bool, bool)

    创建一个实体

    声明
    public static T Create<T>(Scene scene, long id, bool isPool, bool isRunEvent) where T : Entity, new()
    参数
    类型 名称 描述
    Scene scene

    所属的Scene

    long id

    指定实体的Id

    bool isPool

    是否从对象池创建,如果选择的是,销毁的时候同样会进入对象池

    bool isRunEvent

    是否执行实体事件

    返回
    类型 描述
    T
    类型参数
    名称 描述
    T

    要创建的实体泛型类型

    | 编辑本文 查看源代码

    Deserialize(Scene, bool)

    反序列化当前实体,因为在数据库加载过来的或通过协议传送过来的实体并没有跟当前Scene做关联。 所以必须要执行一下这个反序列化的方法才可以使用。

    声明
    public void Deserialize(Scene scene, bool resetId = false)
    参数
    类型 名称 描述
    Scene scene

    Scene

    bool resetId

    是否是重新生成实体的Id,如果是数据库加载过来的一般是不需要的

    | 编辑本文 查看源代码

    Dispose()

    销毁当前实体,销毁后会自动销毁当前实体下的所有实体。

    声明
    public virtual void Dispose()
    | 编辑本文 查看源代码

    GetComponent(Type)

    当前实体上查找一个字实体

    声明
    public Entity GetComponent(Type type)
    参数
    类型 名称 描述
    Type type

    要查找实体类型

    返回
    类型 描述
    Entity

    查找的实体实例

    | 编辑本文 查看源代码

    GetComponent<T>()

    当前实体上查找一个字实体

    声明
    public T GetComponent<T>() where T : Entity, new()
    返回
    类型 描述
    T

    查找的实体实例

    类型参数
    名称 描述
    T

    要查找实体泛型类型

    | 编辑本文 查看源代码

    GetComponent<T>(long)

    当前实体上查找一个字实体

    声明
    public T GetComponent<T>(long id) where T : Entity, ISupportedMultiEntity, new()
    参数
    类型 名称 描述
    long id

    要查找实体的Id

    返回
    类型 描述
    T

    查找的实体实例

    类型参数
    名称 描述
    T

    要查找实体泛型类型

    | 编辑本文 查看源代码

    GetOrAddComponent<T>(bool)

    当前实体上查找一个字实体,如果没有就创建一个新的并添加到当前实体上

    声明
    public T GetOrAddComponent<T>(bool isPool = true) where T : Entity, new()
    参数
    类型 名称 描述
    bool isPool

    是否从对象池创建

    返回
    类型 描述
    T

    查找的实体实例

    类型参数
    名称 描述
    T

    要查找或添加实体泛型类型

    | 编辑本文 查看源代码

    GetParent<T>()

    获得父Entity

    声明
    public T GetParent<T>() where T : Entity, new()
    返回
    类型 描述
    T
    类型参数
    名称 描述
    T

    父实体的泛型类型

    | 编辑本文 查看源代码

    IsPool()

    获取一个值,该值指示当前实例是否为对象池中的实例。

    声明
    public bool IsPool()
    返回
    类型 描述
    bool
    | 编辑本文 查看源代码

    RemoveComponent(Entity, bool)

    当前实体下删除一个实体

    声明
    public void RemoveComponent(Entity component, bool isDispose = true)
    参数
    类型 名称 描述
    Entity component

    要删除的实体实例

    bool isDispose

    是否执行删除实体的Dispose方法

    | 编辑本文 查看源代码

    RemoveComponent<T>(bool)

    当前实体下删除一个实体

    声明
    public void RemoveComponent<T>(bool isDispose = true) where T : Entity, new()
    参数
    类型 名称 描述
    bool isDispose

    是否执行删除实体的Dispose方法

    类型参数
    名称 描述
    T

    实体的泛型类型

    异常
    类型 条件
    NotSupportedException
    | 编辑本文 查看源代码

    RemoveComponent<T>(long, bool)

    当前实体下删除一个实体

    声明
    public void RemoveComponent<T>(long id, bool isDispose = true) where T : Entity, ISupportedMultiEntity, new()
    参数
    类型 名称 描述
    long id

    要删除的实体Id

    bool isDispose

    是否执行删除实体的Dispose方法

    类型参数
    名称 描述
    T

    实体的泛型类型

    | 编辑本文 查看源代码

    RemoveComponent<T>(T, bool)

    当前实体下删除一个实体

    声明
    public void RemoveComponent<T>(T component, bool isDispose = true) where T : Entity
    参数
    类型 名称 描述
    T component

    要删除的实体实例

    bool isDispose

    是否执行删除实体的Dispose方法

    类型参数
    名称 描述
    T

    实体的泛型类型

    | 编辑本文 查看源代码

    SetIsPool(bool)

    设置一个值,该值指示当前实例是否为对象池中的实例。

    声明
    public void SetIsPool(bool isPool)
    参数
    类型 名称 描述
    bool isPool

    实现

    IEntity
    IDisposable
    IPool

    扩展方法

    JsonHelper.ToJson<T>(T)
    • 编辑本文
    • 查看源代码
    本文内容
    Back to top Generated by DocFX