MessagePoolComponent 类
消息的对象池组件
继承成员
命名空间: Fantasy.Entitas
程序集: Fantasy.Net.dll
语法
public sealed class MessagePoolComponent : Entity, IEntity, IDisposable, IPool
方法
| 编辑本文 查看源代码Dispose()
销毁组件
声明
public override void Dispose()
重写
| 编辑本文 查看源代码Rent(Type)
声明
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public AMessage Rent(Type type)
参数
类型 | 名称 | 描述 |
---|---|---|
Type | type | 消息的类型 |
返回
类型 | 描述 |
---|---|
AMessage |
异常
类型 | 条件 |
---|---|
NotSupportedException |
Rent<T>()
从对象池里获取一个消息,如果没有就创建一个新的
声明
public T Rent<T>() where T : AMessage, new()
返回
类型 | 描述 |
---|---|
T |
类型参数
名称 | 描述 |
---|---|
T | 消息的泛型类型 |
Return(AMessage)
返还一个消息到对象池中
声明
public void Return(AMessage obj)
参数
类型 | 名称 | 描述 |
---|---|---|
AMessage | obj |
Return<T>(T)
声明
public void Return<T>(T obj) where T : AMessage
参数
类型 | 名称 | 描述 |
---|---|---|
T | obj | 返还的消息 |
类型参数
名称 | 描述 |
---|---|
T | 返还的消息泛型类型 |