Documentation ¶
Index ¶
- func RegEntityProxy(name string, proxy *EntityProxy)
- type Def
- type Defs
- type Entities
- func (es *Entities) CreateEntity(entityType string, entityID uint64, dbid uint64, cellID uint64, ...) (iserver.IEntity, error)
- func (es *Entities) CreateEntityAll(entityType string, dbid uint64, initParam interface{}, syncInit bool) (iserver.IEntity, error)
- func (es *Entities) Destroy()
- func (es *Entities) DestroyEntity(entityID uint64) error
- func (es *Entities) DestroyEntityAll(entityID uint64) error
- func (es *Entities) DestroyEntityByDBID(entityType string, dbID uint64) error
- func (es *Entities) EntityCount() uint32
- func (es *Entities) GetEntity(entityID uint64) iserver.IEntity
- func (es *Entities) GetEntityByDBID(entityType string, dbid uint64) iserver.IEntity
- func (es *Entities) Init()
- func (es *Entities) MainLoop()
- func (es *Entities) MsgProc_CreateEntityReq(content msgdef.IMsg)
- func (es *Entities) MsgProc_DestroyEntityReq(content msgdef.IMsg)
- func (es *Entities) MsgProc_EntityMsgTransport(content msgdef.IMsg)
- func (es *Entities) MsgProc_SrvMsgTransport(content msgdef.IMsg)
- func (es *Entities) Range(f func(k, v interface{}) bool)
- func (es *Entities) SyncDestroy()
- func (es *Entities) TravsalEntity(entityType string, f func(iserver.IEntity))
- type Entity
- func (e *Entity) Debug(v ...interface{})
- func (e *Entity) Debugf(format string, v ...interface{})
- func (e *Entity) DelayPost(srvType uint8, msg msgdef.IMsg) error
- func (e *Entity) DoLooper()
- func (e *Entity) Error(v ...interface{})
- func (e *Entity) Errorf(format string, v ...interface{})
- func (e *Entity) ExportPackMsg(srvType uint8, cellID uint64, msg msgdef.IMsg) (msgdef.IMsg, error)
- func (e *Entity) FlushDelayedMsgs()
- func (e *Entity) GetCellID() uint64
- func (e *Entity) GetClientSess() iserver.ISess
- func (e *Entity) GetDBID() uint64
- func (e *Entity) GetEntities() iserver.IEntities
- func (e *Entity) GetEntityState() uint8
- func (e *Entity) GetID() uint64
- func (e *Entity) GetInitParam() interface{}
- func (e *Entity) GetProp(name string) interface{}
- func (e *Entity) GetProxy() iserver.IEntityProxy
- func (e *Entity) GetRealCellID() uint64
- func (e *Entity) GetRealPtr() interface{}
- func (e *Entity) GetRealServerID() uint64
- func (e *Entity) GetSrvIDS() map[uint8]*dbservice.EntitySrvInfo
- func (e *Entity) GetType() string
- func (e *Entity) Info(v ...interface{})
- func (e *Entity) Infof(format string, v ...interface{})
- func (e *Entity) InitProp(def *Def)
- func (e *Entity) IsCell() bool
- func (e *Entity) IsCellEntity() bool
- func (e *Entity) IsDestroyed() bool
- func (e *Entity) IsGhost() bool
- func (e *Entity) IsOwnerCellEntity() bool
- func (e *Entity) JcmiaoTempLog(v ...interface{})
- func (e *Entity) LeaveCell()
- func (e *Entity) MainLoop()
- func (e *Entity) MsgProc_EntitySrvInfoNotify(msgdef.IMsg)
- func (e *Entity) MsgProc_PropsSync(content msgdef.IMsg)
- func (e *Entity) MsgProc_RPCMsg(content msgdef.IMsg)
- func (e *Entity) OnAfterInit()
- func (e *Entity) OnDestroy()
- func (e *Entity) OnEntityCreated(entityID uint64, entityType string, dbid uint64, cellID uint64, ...)
- func (e *Entity) OnEntityDestroyed()
- func (e *Entity) OnInit()
- func (e *Entity) OnLoop()
- func (e *Entity) PackMRoleProps() (int, []byte)
- func (e *Entity) PackProps(isClientInterest bool) (int, []byte)
- func (e *Entity) PackPropsToBytes(props []*PropInfo) []byte
- func (e *Entity) Post(srvType uint8, msg msgdef.IMsg) error
- func (e *Entity) PostGateRaw(srvType uint8, rawMsg []byte) error
- func (e *Entity) PostGateRawToCell(rawMsg []byte) error
- func (e *Entity) PostToCell(msg msgdef.IMsg) error
- func (e *Entity) PropDirty(name string)
- func (e *Entity) RPC(srvType uint8, methodName string, args ...interface{}) error
- func (e *Entity) ReflushDirtyProp()
- func (e *Entity) ReflushFromMsg(num int, data []byte)
- func (e *Entity) RefreshSrvIDS()
- func (e *Entity) RegSrvID()
- func (e *Entity) SetClient(s iserver.ISess)
- func (e *Entity) SetProp(name string, v interface{})
- func (e *Entity) SetRealCellID(cellID uint64)
- func (e *Entity) SetRealServerID(srvID uint64)
- func (e *Entity) String() string
- func (e *Entity) UnregSrvID()
- func (e *Entity) Warn(v ...interface{})
- func (e *Entity) Warnf(format string, v ...interface{})
- type EntityProxy
- type PropDef
- type PropInfo
- type ProtoType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegEntityProxy ¶
func RegEntityProxy(name string, proxy *EntityProxy)
RegEntityProxy 注册Proxy信息至global变量
Types ¶
type Entities ¶
type Entities struct { msghandler.IMsgHandlers *timer.Timer *events.GlobalEvents // contains filtered or unexported fields }
Entities entity的集合
func (*Entities) CreateEntity ¶
func (es *Entities) CreateEntity(entityType string, entityID uint64, dbid uint64, cellID uint64, initParam interface{}, syncInit bool, realServerID uint64) (iserver.IEntity, error)
CreateEntity 创建实体
func (*Entities) CreateEntityAll ¶
func (es *Entities) CreateEntityAll(entityType string, dbid uint64, initParam interface{}, syncInit bool) (iserver.IEntity, error)
CreateEntityAll 创建实体的所有部分
func (*Entities) DestroyEntity ¶
DestroyEntity 删除Entity
func (*Entities) DestroyEntityAll ¶
DestroyEntityAll 销毁实体的所有部分
func (*Entities) DestroyEntityByDBID ¶
DestroyEntityByDBID 删除 Entity
func (*Entities) GetEntityByDBID ¶
GetEntityByDBID 获取Entity
func (*Entities) MsgProc_CreateEntityReq ¶
MsgProc_CreateEntityReq 请求创建Entity
func (*Entities) MsgProc_DestroyEntityReq ¶
MsgProc_DestroyEntityReq 请求删除Entity
func (*Entities) MsgProc_EntityMsgTransport ¶
MsgProc_EntityMsgTransport Entity之间转发消息
func (*Entities) MsgProc_SrvMsgTransport ¶
func (*Entities) SyncDestroy ¶
func (es *Entities) SyncDestroy()
SyncDestroy 删除所有Entity, 并等待所有Entity删除结束
type Entity ¶
type Entity struct { msghandler.IMsgHandlers // contains filtered or unexported fields }
Entity 代表服务器端一个可通讯对象
func (*Entity) ExportPackMsg ¶
func (*Entity) GetEntities ¶
GetEntities 获取包含自己的Entities指针
func (*Entity) GetRealServerID ¶
GetRealServerID 获取realServerID
func (*Entity) GetSrvIDS ¶
func (e *Entity) GetSrvIDS() map[uint8]*dbservice.EntitySrvInfo
GetSrvIDS 获取玩家的分布式实体所在的服务器列表
func (*Entity) IsOwnerCellEntity ¶
IsOwnerCellEntity 是否拥有SpaceEntity的部分
func (*Entity) JcmiaoTempLog ¶
func (e *Entity) JcmiaoTempLog(v ...interface{})
func (*Entity) MsgProc_EntitySrvInfoNotify ¶
func (*Entity) MsgProc_PropsSync ¶
MsgProc_PropsSync 实体间同步数据的消息
func (*Entity) MsgProc_RPCMsg ¶
MsgProc_RPCMsg 实体间RPC调用消息处理
func (*Entity) OnEntityCreated ¶
func (e *Entity) OnEntityCreated(entityID uint64, entityType string, dbid uint64, cellID uint64, protoType interface{}, entities iserver.IEntities, initParam interface{}, syncInit bool, realServerID uint64)
OnEntityCreated 初始化
func (*Entity) OnEntityDestroyed ¶
func (e *Entity) OnEntityDestroyed()
OnEntityDestroyed 当Entity销毁时调用
func (*Entity) PackMRoleProps ¶
PackMRoleProps 打包主角关心的属性
func (*Entity) PackPropsToBytes ¶
PackPropsToBytes 把属列表打包成bytes
func (*Entity) PostGateRaw ¶
PostGateRaw 投递一个gateway原始消息
func (*Entity) PostGateRawToCell ¶
PostGateRawToCell 投递一个原始消息给它的SpaceEntity部分
func (*Entity) PostToCell ¶
PostToCell 投递一个消息给它的SpaceEntity部分
func (*Entity) ReflushFromMsg ¶
ReflushFromMsg 从消息中更新属性
func (*Entity) RefreshSrvIDS ¶
func (e *Entity) RefreshSrvIDS()
RefreshSrvIDS 从redis上更新 当前 entity所有的分布式信息
func (*Entity) SetRealCellID ¶
func (*Entity) SetRealServerID ¶
type EntityProxy ¶
EntityProxy 实体的一个代理,可以方便的传递
func NewEntityProxy ¶
func NewEntityProxy(srvID uint64, cellID uint64, entityID uint64) *EntityProxy
NewEntityProxy 创建一个新的实体代理
func (*EntityProxy) RPC ¶
func (e *EntityProxy) RPC(srvType uint8, methodName string, args ...interface{}) error
RPC 快速消息调用,可以快速触发一个其它实体的方法, 服务器间使用
func (*EntityProxy) String ¶
func (e *EntityProxy) String() string
type PropDef ¶
type PropDef struct { Name string Desc string Type reflect.Type TypeName string InterestSrvs []uint8 IsClientInterest bool IsMRoleInterest bool Persistence bool //是否需要持久化, 默认true Sync bool //是否需要同步至其他服务器, 默认true }
PropDef 字段定义
func (*PropDef) CreateInst ¶
CreateInst 创建该属性的一个实例
func (*PropDef) IsValidValue ¶
IsValidValue 当前值是否能设置到该属性上
type PropInfo ¶
type PropInfo struct {
// contains filtered or unexported fields
}
PropInfo 属性相关
func (*PropInfo) GetValueStreamSize ¶
GetValueStreamSize 获取某个属性需要的尺寸
func (*PropInfo) ReadValueFromStream ¶
func (p *PropInfo) ReadValueFromStream(bs *common.ByteStream) error
ReadValueFromStream 从Stream中读取属性
func (*PropInfo) UnPackValue ¶
func (p *PropInfo) UnPackValue(data interface{})
UnPackValue 从Redis中恢复Value
func (*PropInfo) WriteValueToStream ¶
func (p *PropInfo) WriteValueToStream(bs *common.ByteStream) error
WriteValueToStream 把属性值加入到ByteStream中
type ProtoType ¶
type ProtoType struct {
// contains filtered or unexported fields
}
ProtoType 保存实体映射列表
func (*ProtoType) NewEntityByProtoType ¶
NewEntityByProtoType 创建 一个对象