msgdef

package
v0.0.0-...-135b9b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ClientVertifyReqMsgID 验证消息的ID号
	ClientVertifyReqMsgID = 1
	//ClientVertifySucceedRetMsgID 验证结果成功返回的ID号
	ClientVertifySucceedRetMsgID = 2
	//ClientVertifyFailedRetMsgID 验证结果失败返回的ID号
	ClientVertifyFailedRetMsgID = 3

	// HeartBeatMsgID 心跳消息ID
	HeartBeatMsgID = 4

	// TestBinMsgID 测试消息
	TestBinMsgID = 8

	//EntitySrvInfoNotifyID 实体变化消息
	EntitySrvInfoNotifyID = 9

	//ProtoSyncMsgID ProtoSync消息ID
	ProtoSyncMsgID = 10

	// ClientFrameMsgID 客户端过来的帧消息
	ClientFrameMsgID = 20
	// ServerFrameMsgID 服务器下发的单帧消息
	ServerFrameMsgID = 21
	// FramesMsgID 服务器下发的多帧消息
	FramesMsgID = 22
	// RequireFramesMsgID 客户端
	RequireFramesMsgID = 23
	// 	UserDuplicateLoginNotifyMsgID 玩家重复登录的消息
	UserDuplicateLoginNotifyMsgID = 24

	// PropsSyncMsgID 属性消息ID
	PropsSyncMsgID = 30
	// PropsSyncClientMsgID 发给客户端的属性消息ID
	PropsSyncClientMsgID = 31
	// MRolePropsSyncClientMsgID 主角属性同步消息DI
	MRolePropsSyncClientMsgID = 32

	// EnterCellReqMsgID 进入空间的消息
	EnterCellReqMsgID = 40
	// LeaveCellReqMsgID 离开空间的消息
	LeaveCellReqMsgID = 41
	// EnterAOIMsgID 进入AOI消息
	EnterAOIMsgID = 42
	// LeaveAOIMsgID 离开AOI消息
	LeaveAOIMsgID = 43
	// AOIPosChangeMsgID AOI位置改变消息
	AOIPosChangeMsgID = 44
	// EnterCellMsgID 玩家进入场景
	EnterCellMsgID = 45
	// LeaveCellMsgID 玩家离开场景
	LeaveCellMsgID = 46
	// UserMoveMsgID 玩家移动
	UserMoveMsgID = 47
	// CellEntityMsgID 空间实体消息
	CellEntityMsgID = 48
	// EntityPosSetMsgID 玩家移动
	EntityPosSetMsgID = 49

	// ClientTransportMsgID 客户端中转消息ID
	ClientTransportMsgID = 50
	// CreateEntityReqMsgID 请求创建实体消息ID
	CreateEntityReqMsgID = 51
	// CreateEntityRetMsgID 创建实体返回消息ID
	CreateEntityRetMsgID = 52
	// DestroyEntityReqMsgID 请求删除实体消息ID
	DestroyEntityReqMsgID = 53
	// DestroyEntityRetMsgID 销毁实体返回消息ID
	DestroyEntityRetMsgID = 54
	// EntityMsgTransportMsgID 分布式实体之间传递消息用
	EntityMsgTransportMsgID = 55
	// EntityMsgChangeMsgID 分布式实体之间同步数据使用
	EntityMsgChangeMsgID = 56
	// SrvMsgTransportMsgID 服务器间消息转发ID
	SrvMsgTransportMsgID = 57
	// RPCMsgID RPC消息
	RPCMsgID       = 58
	SyncClockMsgID = 59

	SpaceUserConnectMsgID           = 61
	SpaceUserConnectSucceedRetMsgID = 62
	SyncUserStateMsgID              = 63
	AOISyncUserStateMsgID           = 64
	AdjustUserStateMsgID            = 65
	EntityAOISMsgID                 = 66
	EntityBasePropsMsgID            = 67
	EntityEventMsgID                = 68

	// CellMsgTransportMsgID 发消息给某个cell
	CellMsgTransportMsgID = 71

	//创建ghost
	CreateGhostReqMsgID = 72
	//删除ghost
	DeleteGhostReqMsgID = 73
	//切换real
	TransferRealReqMsgID = 74
	//新real通知
	NewRealNotifyMsgID = 75
)
View Source
const (
	// Connected 正常连接
	Connected uint8 = 1
	// ReConnect 断线重连
	ReConnect uint8 = 2
	// DupConnect 重复连接
	DupConnect uint8 = 3
)

ClientVertifySucceedRet 中登录类型

View Source
const (
	// SessHBTimeout 心跳超时
	SessHBTimeout uint8 = 1
	// SessDisconnect 断线
	SessDisconnect uint8 = 2
	// SessError 出错
	SessError uint8 = 3
)
View Source
const (
	// ClientMSG 来自客户端的验证消息
	ClientMSG uint8 = 0
)

Variables

This section is empty.

Functions

func Init

func Init()

Init 初始化

Types

type AOISyncUserState

type AOISyncUserState struct {
	Num  uint32
	EIDS []uint64
	EDS  [][]byte
}

AOISyncUserState AOI同步信息

func NewAOISyncUserState

func NewAOISyncUserState() *AOISyncUserState

func (*AOISyncUserState) AddData

func (msg *AOISyncUserState) AddData(id uint64, data []byte)

AddData 增加一个玩家数据

func (*AOISyncUserState) Clear

func (msg *AOISyncUserState) Clear()

Clear 清理

func (*AOISyncUserState) MarshalTo

func (msg *AOISyncUserState) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*AOISyncUserState) Name

func (msg *AOISyncUserState) Name() string

Name 获取消息名称

func (*AOISyncUserState) Size

func (msg *AOISyncUserState) Size() (n int)

Size 获取长度

func (*AOISyncUserState) String

func (msg *AOISyncUserState) String() string

func (*AOISyncUserState) Unmarshal

func (msg *AOISyncUserState) Unmarshal(data []byte) error

Unmarshal 反序列化

type AdjustUserState

type AdjustUserState struct {
	Data []byte
}

AdjustUserState 纠正状态

func (*AdjustUserState) MarshalTo

func (msg *AdjustUserState) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*AdjustUserState) Name

func (msg *AdjustUserState) Name() string

Name 获取消息名称

func (*AdjustUserState) Size

func (msg *AdjustUserState) Size() (n int)

Size 获取长度

func (*AdjustUserState) String

func (msg *AdjustUserState) String() string

func (*AdjustUserState) Unmarshal

func (msg *AdjustUserState) Unmarshal(data []byte) error

Unmarshal 反序列化

type CellEntityMsg

type CellEntityMsg struct {
	UID  uint64
	Data []byte //具体的消息
}

CellEntityMsg 客户端直接投递到spaceEntity时的包装消息

func (*CellEntityMsg) MarshalTo

func (msg *CellEntityMsg) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*CellEntityMsg) Name

func (msg *CellEntityMsg) Name() string

Name 消息名

func (*CellEntityMsg) Size

func (msg *CellEntityMsg) Size() (n int)

Size 消息长度

func (*CellEntityMsg) String

func (msg *CellEntityMsg) String() string

func (*CellEntityMsg) Unmarshal

func (msg *CellEntityMsg) Unmarshal(data []byte) error

Unmarshal 反序列化

type ClientFrameMsg

type ClientFrameMsg struct {
	Data []byte
}

ClientFrameMsg 客户端上发的帧消息

func (*ClientFrameMsg) MarshalTo

func (msg *ClientFrameMsg) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*ClientFrameMsg) Name

func (msg *ClientFrameMsg) Name() string

func (*ClientFrameMsg) Size

func (msg *ClientFrameMsg) Size() int

Size 获取长度

func (*ClientFrameMsg) Unmarshal

func (msg *ClientFrameMsg) Unmarshal(data []byte) error

Unmarshal 反序列化

type ClientFrameMsgData

type ClientFrameMsgData struct {
	// 最高位 0标识正常玩家, 1标识AI托管
	UID  uint8
	Data []byte
}

ClientFrameMsgData 拼接UID之后的单用户帧消息

func (*ClientFrameMsgData) MarshalTo

func (msg *ClientFrameMsgData) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*ClientFrameMsgData) Name

func (msg *ClientFrameMsgData) Name() string

func (*ClientFrameMsgData) Size

func (msg *ClientFrameMsgData) Size() int

Size 获取长度

func (*ClientFrameMsgData) Unmarshal

func (msg *ClientFrameMsgData) Unmarshal(data []byte) error

Unmarshal 反序列化

type ClientTransport

type ClientTransport struct {
	SrvType    uint8
	MsgFlag    uint8
	MsgContent []byte
}

ClientTransport 客户端中转消息 当客户端消息要投递给非网关对象时,用该消息包装

func (*ClientTransport) MarshalTo

func (msg *ClientTransport) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*ClientTransport) Name

func (msg *ClientTransport) Name() string

Name 获取名字

func (*ClientTransport) Size

func (msg *ClientTransport) Size() (n int)

Size 获取长度 []byte长度额外2个字节, 两个uint8 2个字节 固定长度4字节

func (*ClientTransport) String

func (msg *ClientTransport) String() string

func (*ClientTransport) Unmarshal

func (msg *ClientTransport) Unmarshal(data []byte) error

Unmarshal 反序列化

type ClientVertifyFailedRet

type ClientVertifyFailedRet struct {
}

ClientVertifyFailedRet 验证成功返回消息

func (*ClientVertifyFailedRet) MarshalTo

func (msg *ClientVertifyFailedRet) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*ClientVertifyFailedRet) Name

func (msg *ClientVertifyFailedRet) Name() string

Name 名字

func (*ClientVertifyFailedRet) Size

func (msg *ClientVertifyFailedRet) Size() (n int)

Size 获取长度

func (*ClientVertifyFailedRet) String

func (msg *ClientVertifyFailedRet) String() string

func (*ClientVertifyFailedRet) Unmarshal

func (msg *ClientVertifyFailedRet) Unmarshal(data []byte) error

Unmarshal 反序列化

type ClientVertifyReq

type ClientVertifyReq struct {
	// Source: 消息来源, 分客户端或者服务器(ClientMSG/服务器类型)
	Source uint8 //data[0]
	// UID: 玩家UID或者服务器ID
	UID uint64 //data[1:9]
	// Token: 客户端登录时需要携带Token
	Token string //data[9:41]
}

ClientVertifyReq 验证消息

func (*ClientVertifyReq) MarshalTo

func (msg *ClientVertifyReq) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*ClientVertifyReq) Name

func (msg *ClientVertifyReq) Name() string

Name 消息名

func (*ClientVertifyReq) Size

func (msg *ClientVertifyReq) Size() (n int)

Size 获取长度

func (*ClientVertifyReq) String

func (msg *ClientVertifyReq) String() string

func (*ClientVertifyReq) Unmarshal

func (msg *ClientVertifyReq) Unmarshal(data []byte) error

Unmarshal 反序列化

type ClientVertifySucceedRet

type ClientVertifySucceedRet struct {
	// Source: 消息来源, 分客户端或者服务器(ClientMSG/服务器类型)
	Source uint8
	// UID: 客户端验证时返回UID
	UID uint64
	// SourceID: 验证成功消息的来源
	SourceID uint64
	// Type: 连接类型
	Type uint8
}

ClientVertifySucceedRet 验证成功返回消息

func (*ClientVertifySucceedRet) MarshalTo

func (msg *ClientVertifySucceedRet) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*ClientVertifySucceedRet) Name

func (msg *ClientVertifySucceedRet) Name() string

Name 名字

func (*ClientVertifySucceedRet) Size

func (msg *ClientVertifySucceedRet) Size() (n int)

Size 获取长度

func (*ClientVertifySucceedRet) String

func (msg *ClientVertifySucceedRet) String() string

func (*ClientVertifySucceedRet) Unmarshal

func (msg *ClientVertifySucceedRet) Unmarshal(data []byte) error

Unmarshal 反序列化

type CreateEntityReq

type CreateEntityReq struct {
	EntityType string
	EntityID   uint64
	CellID     uint64
	DBID       uint64
	InitParam  []byte
	SrcSrvType uint8
	SrcSrvID   uint64
	CallbackID uint32
}

CreateEntityReq 请求创建实体消息

func (*CreateEntityReq) MarshalTo

func (msg *CreateEntityReq) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*CreateEntityReq) Name

func (msg *CreateEntityReq) Name() string

Name 获取名字

func (*CreateEntityReq) Size

func (msg *CreateEntityReq) Size() (n int)

Size 获取长度

func (*CreateEntityReq) String

func (msg *CreateEntityReq) String() string

func (*CreateEntityReq) Unmarshal

func (msg *CreateEntityReq) Unmarshal(data []byte) error

Unmarshal 反序列化

type CreateEntityRet

type CreateEntityRet struct {
	SrvType    uint8
	EntityID   uint64
	SpaceID    uint64
	CallbackID uint32
	ErrorStr   string
}

CreateEntityRet 创建实体返回

func (*CreateEntityRet) MarshalTo

func (msg *CreateEntityRet) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*CreateEntityRet) Name

func (msg *CreateEntityRet) Name() string

Name 获取名字

func (*CreateEntityRet) Size

func (msg *CreateEntityRet) Size() (n int)

Size 获取长度 1 + 8 + 8 + 4 + 2 + len(string)

func (*CreateEntityRet) String

func (msg *CreateEntityRet) String() string

func (*CreateEntityRet) Unmarshal

func (msg *CreateEntityRet) Unmarshal(data []byte) error

Unmarshal 反序列化

type CreateGhostReq

type CreateGhostReq struct {
	EntityType   string
	EntityID     uint64
	DBID         uint64
	InitParam    []byte
	CellID       uint64
	Pos          linmath.Vector3
	RealServerID uint64
	RealCellID   uint64
	PropNum      uint32
	Props        []byte
}

CreateGhostReq 请求创建ghost

func (*CreateGhostReq) MarshalTo

func (msg *CreateGhostReq) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*CreateGhostReq) Name

func (msg *CreateGhostReq) Name() string

Name 获取消息名称

func (*CreateGhostReq) Size

func (msg *CreateGhostReq) Size() (n int)

Size 获取长度

func (*CreateGhostReq) String

func (msg *CreateGhostReq) String() string

func (*CreateGhostReq) Unmarshal

func (msg *CreateGhostReq) Unmarshal(data []byte) error

Unmarshal 反序列化

type DeleteGhostReq

type DeleteGhostReq struct {
	EntityID uint64
}

DeleteGhostReq 请求删除ghost

func (*DeleteGhostReq) MarshalTo

func (msg *DeleteGhostReq) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*DeleteGhostReq) Name

func (msg *DeleteGhostReq) Name() string

Name 获取消息名称

func (*DeleteGhostReq) Size

func (msg *DeleteGhostReq) Size() (n int)

Size 获取长度

func (*DeleteGhostReq) String

func (msg *DeleteGhostReq) String() string

func (*DeleteGhostReq) Unmarshal

func (msg *DeleteGhostReq) Unmarshal(data []byte) error

Unmarshal 反序列化

type DestroyEntityReq

type DestroyEntityReq struct {
	EntityID   uint64
	SrcSrvType uint8
	SrcSrvID   uint64
	CallbackID uint32
	CellID     uint64
}

DestroyEntityReq 请求删除实体消息

func (*DestroyEntityReq) MarshalTo

func (msg *DestroyEntityReq) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*DestroyEntityReq) Name

func (msg *DestroyEntityReq) Name() string

Name 获取名字

func (*DestroyEntityReq) Size

func (msg *DestroyEntityReq) Size() (n int)

Size 获取长度 8 + 1 + 8 + 4 + 8

func (*DestroyEntityReq) String

func (msg *DestroyEntityReq) String() string

func (*DestroyEntityReq) Unmarshal

func (msg *DestroyEntityReq) Unmarshal(data []byte) error

Unmarshal 反序列化

type DestroyEntityRet

type DestroyEntityRet struct {
	SrvType    uint8
	SrvID      uint64
	EntityID   uint64
	SpaceID    uint64
	CallbackID uint32
	ErrorStr   string
}

DestroyEntityRet 销毁实体返回

func (*DestroyEntityRet) MarshalTo

func (msg *DestroyEntityRet) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*DestroyEntityRet) Name

func (msg *DestroyEntityRet) Name() string

Name 获取名字

func (*DestroyEntityRet) Size

func (msg *DestroyEntityRet) Size() (n int)

Size 获取长度 1 + 8 + 8 + 8 + 4 + 2 + len(string)

func (*DestroyEntityRet) String

func (msg *DestroyEntityRet) String() string

func (*DestroyEntityRet) Unmarshal

func (msg *DestroyEntityRet) Unmarshal(data []byte) error

Unmarshal 反序列化

type EnterAOI

type EnterAOI struct {
	EntityID   uint64
	EntityType string
	State      []byte
	PropNum    uint16
	Properties []byte

	Pos  linmath.Vector3
	Rota linmath.Vector3
}

EnterAOI 玩家进入AOI

func (*EnterAOI) MarshalTo

func (msg *EnterAOI) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*EnterAOI) Name

func (msg *EnterAOI) Name() string

Name 获取消息名称

func (*EnterAOI) Size

func (msg *EnterAOI) Size() (n int)

Size 获取长度 8 + 2 + len(string) + 4*3 + 4*3 + 2 + 2 + len([]byte)

func (*EnterAOI) String

func (msg *EnterAOI) String() string

func (*EnterAOI) Unmarshal

func (msg *EnterAOI) Unmarshal(data []byte) error

Unmarshal 反序列化

type EnterCell

type EnterCell struct {
	CellID    uint64
	MapName   string
	EntityID  uint64
	Addr      string
	TimeStamp uint32
}

EnterCell 玩家进入场景

func (*EnterCell) MarshalTo

func (msg *EnterCell) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*EnterCell) Name

func (msg *EnterCell) Name() string

Name 获取消息名称

func (*EnterCell) Size

func (msg *EnterCell) Size() (n int)

Size 获取长度

func (*EnterCell) String

func (msg *EnterCell) String() string

func (*EnterCell) Unmarshal

func (msg *EnterCell) Unmarshal(data []byte) error

Unmarshal 反序列化

type EnterCellReq

type EnterCellReq struct {
	SrvID      uint64
	CellID     uint64
	EntityType string
	EntityID   uint64
	DBID       uint64
	InitParam  []byte
	OldSrvID   uint64
	OldCellID  uint64
	Pos        linmath.Vector3
}

EnterCellReq 请求进入空间

func (*EnterCellReq) MarshalTo

func (msg *EnterCellReq) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*EnterCellReq) Name

func (msg *EnterCellReq) Name() string

Name 获取消息名称

func (*EnterCellReq) Size

func (msg *EnterCellReq) Size() (n int)

Size 获取长度 8 + 8 + 2 + len(string) + 8 + 8 + 8 + 8

func (*EnterCellReq) String

func (msg *EnterCellReq) String() string

func (*EnterCellReq) Unmarshal

func (msg *EnterCellReq) Unmarshal(data []byte) error

Unmarshal 反序列化

type EntityAOIS

type EntityAOIS struct {
	Num uint32
	// contains filtered or unexported fields
}

EntityAOIS 进入AOI范围

func NewEntityAOISMsg

func NewEntityAOISMsg() *EntityAOIS

NewEntityAOISMsg 新建进入AOI消息

func (*EntityAOIS) AddData

func (msg *EntityAOIS) AddData(data []byte)

AddData 增加一个玩家数据

func (*EntityAOIS) Clear

func (msg *EntityAOIS) Clear()

Clear 清理

func (*EntityAOIS) GetData

func (msg *EntityAOIS) GetData() [][]byte

func (*EntityAOIS) MarshalTo

func (msg *EntityAOIS) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*EntityAOIS) Name

func (msg *EntityAOIS) Name() string

Name 获取消息名称

func (*EntityAOIS) Size

func (msg *EntityAOIS) Size() (n int)

Size 获取长度

func (*EntityAOIS) String

func (msg *EntityAOIS) String() string

func (*EntityAOIS) Unmarshal

func (msg *EntityAOIS) Unmarshal(data []byte) error

Unmarshal 反序列化

type EntityEvent

type EntityEvent struct {
	SrcEntityID uint64
	EventName   string
	Data        []byte //参数
}

EntityEvent 分布式实体之间调用方法

func (*EntityEvent) MarshalTo

func (msg *EntityEvent) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*EntityEvent) Name

func (msg *EntityEvent) Name() string

Name 消息名

func (*EntityEvent) Size

func (msg *EntityEvent) Size() (n int)

Size 消息长度

func (*EntityEvent) String

func (msg *EntityEvent) String() string

func (*EntityEvent) Unmarshal

func (msg *EntityEvent) Unmarshal(data []byte) error

Unmarshal 反序列化

type EntityMsgChange

type EntityMsgChange struct {
	VarData []EntityVarData
}

EntityMsgChange 分布式实体之间同步数据使用

func (*EntityMsgChange) MarshalTo

func (msg *EntityMsgChange) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*EntityMsgChange) Name

func (msg *EntityMsgChange) Name() string

Name 获取名字

func (*EntityMsgChange) Size

func (msg *EntityMsgChange) Size() (n int)

Size 获取长度

func (*EntityMsgChange) String

func (msg *EntityMsgChange) String() string

func (*EntityMsgChange) Unmarshal

func (msg *EntityMsgChange) Unmarshal(data []byte) error

Unmarshal 反序列化 这里代码如果data数据有问题,会导致v.Unmarshal(data[pos:]) crash,先记录下

type EntityMsgTransport

type EntityMsgTransport struct {
	SrvType    uint8
	EntityID   uint64
	CellID     uint64
	IsGateway  bool //是不是gateway中转过来的数据
	MsgContent []byte
}

EntityMsgTransport 分布式实体之间传递消息用

func (*EntityMsgTransport) MarshalTo

func (msg *EntityMsgTransport) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*EntityMsgTransport) Name

func (msg *EntityMsgTransport) Name() string

Name 获取名字

func (*EntityMsgTransport) Size

func (msg *EntityMsgTransport) Size() (n int)

Size 获取长度

func (*EntityMsgTransport) String

func (msg *EntityMsgTransport) String() string

func (*EntityMsgTransport) Unmarshal

func (msg *EntityMsgTransport) Unmarshal(data []byte) error

Unmarshal 反序列化

type EntitySrvInfoNotify

type EntitySrvInfoNotify struct {
}

EntitySrvInfoNotify 客户端直接投递到spaceEntity时的包装消息

func (*EntitySrvInfoNotify) MarshalTo

func (msg *EntitySrvInfoNotify) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*EntitySrvInfoNotify) Name

func (msg *EntitySrvInfoNotify) Name() string

Name 消息名

func (*EntitySrvInfoNotify) Size

func (msg *EntitySrvInfoNotify) Size() (n int)

Size 消息长度

func (*EntitySrvInfoNotify) String

func (msg *EntitySrvInfoNotify) String() string

func (*EntitySrvInfoNotify) Unmarshal

func (msg *EntitySrvInfoNotify) Unmarshal(data []byte) error

Unmarshal 反序列化

type EntityVarData

type EntityVarData struct {
	Identifier string
	Variant    []byte
}

EntityVarData 分布式实体变量的消息

func (*EntityVarData) MarshalTo

func (msg *EntityVarData) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*EntityVarData) Name

func (msg *EntityVarData) Name() string

Name 获取名字

func (*EntityVarData) Size

func (msg *EntityVarData) Size() (n int)

Size 获取长度 2 + len(string) + 2 + len([]byte)

func (*EntityVarData) String

func (msg *EntityVarData) String() string

func (*EntityVarData) Unmarshal

func (msg *EntityVarData) Unmarshal(data []byte) error

Unmarshal 反序列化

type FramesMsg

type FramesMsg struct {
	Frames []ServerFrameMsg
}

FramesMsg 服务器下发的多帧消息

func (*FramesMsg) MarshalTo

func (msg *FramesMsg) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*FramesMsg) Name

func (msg *FramesMsg) Name() string

func (*FramesMsg) Size

func (msg *FramesMsg) Size() int

Size 获取长度

func (*FramesMsg) Unmarshal

func (msg *FramesMsg) Unmarshal(data []byte) error

Unmarshal 反序列化

type HeartBeat

type HeartBeat struct {
}

HeartBeat 心跳消息

func (*HeartBeat) MarshalTo

func (hb *HeartBeat) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*HeartBeat) Name

func (hb *HeartBeat) Name() string

func (*HeartBeat) Size

func (hb *HeartBeat) Size() (n int)

Size 获取长度

func (*HeartBeat) Unmarshal

func (hb *HeartBeat) Unmarshal(data []byte) error

Unmarshal 反序列化

type IMsg

type IMsg interface {
	MarshalTo(data []byte) (n int, err error)
	Unmarshal(data []byte) error
	Size() (n int)
	Name() string
}

IMsg 消息接口,所有的消息类都必须实现的接口

type LeaveAOI

type LeaveAOI struct {
	EntityID uint64
}

LeaveAOI 离开AOI

func (*LeaveAOI) MarshalTo

func (msg *LeaveAOI) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*LeaveAOI) Name

func (msg *LeaveAOI) Name() string

Name 获取消息名称

func (*LeaveAOI) Size

func (msg *LeaveAOI) Size() (n int)

Size 获取长度

func (*LeaveAOI) String

func (msg *LeaveAOI) String() string

func (*LeaveAOI) Unmarshal

func (msg *LeaveAOI) Unmarshal(data []byte) error

Unmarshal 反序列化

type LeaveCell

type LeaveCell struct {
}

LeaveCell 离开空间

func (*LeaveCell) MarshalTo

func (msg *LeaveCell) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*LeaveCell) Name

func (msg *LeaveCell) Name() string

Name 获取消息名称

func (*LeaveCell) Size

func (msg *LeaveCell) Size() (n int)

Size 获取长度

func (*LeaveCell) String

func (msg *LeaveCell) String() string

func (*LeaveCell) Unmarshal

func (msg *LeaveCell) Unmarshal(data []byte) error

Unmarshal 反序列化

type LeaveCellReq

type LeaveCellReq struct {
	EntityID uint64
}

LeaveCellReq 请求离开空间

func (*LeaveCellReq) MarshalTo

func (msg *LeaveCellReq) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*LeaveCellReq) Name

func (msg *LeaveCellReq) Name() string

Name 获取消息名称

func (*LeaveCellReq) Size

func (msg *LeaveCellReq) Size() (n int)

Size 获取长度

func (*LeaveCellReq) String

func (msg *LeaveCellReq) String() string

func (*LeaveCellReq) Unmarshal

func (msg *LeaveCellReq) Unmarshal(data []byte) error

Unmarshal 反序列化

type MRolePropsSyncClient

type MRolePropsSyncClient struct {
	EntityID uint64
	Num      uint32
	Data     []byte
}

MRolePropsSyncClient 主角属性变化,客户端主角关注的属性变化由该消息发出

func (*MRolePropsSyncClient) MarshalTo

func (msg *MRolePropsSyncClient) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*MRolePropsSyncClient) Name

func (msg *MRolePropsSyncClient) Name() string

Name 获取名字

func (*MRolePropsSyncClient) Size

func (msg *MRolePropsSyncClient) Size() (n int)

Size 获取长度 8 + 4 + 2 + len([]byte)

func (*MRolePropsSyncClient) String

func (msg *MRolePropsSyncClient) String() string

func (*MRolePropsSyncClient) Unmarshal

func (msg *MRolePropsSyncClient) Unmarshal(data []byte) error

Unmarshal 反序列化

type MsgDef

type MsgDef struct {
	// contains filtered or unexported fields
}

MsgDef 消息定义管理器,包含是消息与消息号的映射结构,客户端初始化的时候,由服务器下发下去

func GetMsgDef

func GetMsgDef() *MsgDef

GetMsgDef 获取消息定义对象的全局实例

func (*MsgDef) GetMsgIDByName

func (def *MsgDef) GetMsgIDByName(msgName string) (uint16, error)

GetMsgIDByName 通过名字获取ID号

func (*MsgDef) GetMsgInfo

func (def *MsgDef) GetMsgInfo(msgID uint16) (msgName string, msgContent IMsg, err error)

GetMsgInfo 根据消息号,获得消息的类型,名称,如果是protobuf消息,获得proto消息的容器

func (*MsgDef) Init

func (def *MsgDef) Init()

Init 初始消息定义管理器

func (*MsgDef) InitBytesMsg

func (def *MsgDef) InitBytesMsg()

InitBytesMsg 初始字节流消息

func (*MsgDef) IsMsgExist

func (def *MsgDef) IsMsgExist(msgID uint16) bool

IsMsgExist 消息是否存在

func (*MsgDef) RegMsg

func (def *MsgDef) RegMsg(msgID uint16, msgBody interface{})

RegMsg 注册消息

type MsgInfo

type MsgInfo struct {
	// contains filtered or unexported fields
}

MsgInfo 消息信息

type NewRealNotify

type NewRealNotify struct {
	RealServerID uint64
	RealCellID   uint64
}

NewRealNotify 通知有新的real出现

func (*NewRealNotify) MarshalTo

func (msg *NewRealNotify) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*NewRealNotify) Name

func (msg *NewRealNotify) Name() string

Name 获取消息名称

func (*NewRealNotify) Size

func (msg *NewRealNotify) Size() (n int)

Size 获取长度

func (*NewRealNotify) String

func (msg *NewRealNotify) String() string

func (*NewRealNotify) Unmarshal

func (msg *NewRealNotify) Unmarshal(data []byte) error

Unmarshal 反序列化

type PropsSync

type PropsSync struct {
	Num  uint32
	Data []byte
}

PropsSync 玩家属性变化,服务器之间交换属性信息

func (*PropsSync) MarshalTo

func (msg *PropsSync) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*PropsSync) Name

func (msg *PropsSync) Name() string

Name 获取名字

func (*PropsSync) Size

func (msg *PropsSync) Size() (n int)

Size 获取长度 4 + 2 + len([]byte)

func (*PropsSync) String

func (msg *PropsSync) String() string

func (*PropsSync) Unmarshal

func (msg *PropsSync) Unmarshal(data []byte) error

Unmarshal 反序列化

type PropsSyncClient

type PropsSyncClient struct {
	EntityID uint64
	Num      uint32
	Data     []byte
}

PropsSyncClient 玩家属性变化,客户端关注的属性变化都由该消息发出

func (*PropsSyncClient) MarshalTo

func (msg *PropsSyncClient) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*PropsSyncClient) Name

func (msg *PropsSyncClient) Name() string

Name 获取名字

func (*PropsSyncClient) Size

func (msg *PropsSyncClient) Size() (n int)

Size 获取长度 8 + 4 + 2 + len([]byte)

func (*PropsSyncClient) String

func (msg *PropsSyncClient) String() string

func (*PropsSyncClient) Unmarshal

func (msg *PropsSyncClient) Unmarshal(data []byte) error

Unmarshal 反序列化

type ProtoSync

type ProtoSync struct {
	Data []byte
}

ProtoSync 同步Proto消息号和名字

func (*ProtoSync) MarshalTo

func (msg *ProtoSync) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*ProtoSync) Name

func (msg *ProtoSync) Name() string

Name 消息名

func (*ProtoSync) Size

func (msg *ProtoSync) Size() (n int)

Size 消息长度

func (*ProtoSync) String

func (msg *ProtoSync) String() string

func (*ProtoSync) Unmarshal

func (msg *ProtoSync) Unmarshal(data []byte) error

Unmarshal 反序列化

type RPCMsg

type RPCMsg struct {
	ServerType  uint8
	SrcEntityID uint64
	MethodName  string
	Data        []byte //proto消息参数
}

RPCMsg 分布式实体之间调用方法

func (*RPCMsg) MarshalTo

func (msg *RPCMsg) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*RPCMsg) Name

func (msg *RPCMsg) Name() string

Name 消息名

func (*RPCMsg) Size

func (msg *RPCMsg) Size() (n int)

Size 消息长度 1 + 8 + 2 + len(string) + 2 + len([]byte)

func (*RPCMsg) String

func (msg *RPCMsg) String() string

func (*RPCMsg) Unmarshal

func (msg *RPCMsg) Unmarshal(data []byte) error

Unmarshal 反序列化

type RequireFramesMsg

type RequireFramesMsg struct {
	FrameID uint16
}

RequireFramesMsg 客户端请求重传帧的消息

func (*RequireFramesMsg) MarshalTo

func (msg *RequireFramesMsg) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*RequireFramesMsg) Name

func (msg *RequireFramesMsg) Name() string

func (*RequireFramesMsg) Size

func (msg *RequireFramesMsg) Size() int

Size 获取长度

func (*RequireFramesMsg) Unmarshal

func (msg *RequireFramesMsg) Unmarshal(data []byte) error

Unmarshal 反序列化

type ServerFrameMsg

type ServerFrameMsg struct {
	FrameID uint16
	Msgs    []ClientFrameMsgData
}

ServerFrameMsg 服务器下发的帧消息

func (*ServerFrameMsg) MarshalTo

func (msg *ServerFrameMsg) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*ServerFrameMsg) Name

func (msg *ServerFrameMsg) Name() string

func (*ServerFrameMsg) Size

func (msg *ServerFrameMsg) Size() int

Size 获取长度

func (*ServerFrameMsg) Unmarshal

func (msg *ServerFrameMsg) Unmarshal(data []byte) error

Unmarshal 反序列化

type SpaceUserConnect

type SpaceUserConnect struct {
	UID     uint64
	SpaceID uint64
}

SpaceUserConnect 空间玩家专用连接成功,由客户端发给服务器

func (*SpaceUserConnect) MarshalTo

func (msg *SpaceUserConnect) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*SpaceUserConnect) Name

func (msg *SpaceUserConnect) Name() string

Name 获取消息名称

func (*SpaceUserConnect) Size

func (msg *SpaceUserConnect) Size() (n int)

Size 获取长度

func (*SpaceUserConnect) String

func (msg *SpaceUserConnect) String() string

func (*SpaceUserConnect) Unmarshal

func (msg *SpaceUserConnect) Unmarshal(data []byte) error

Unmarshal 反序列化

type SpaceUserConnectSucceedRet

type SpaceUserConnectSucceedRet struct {
}

SpaceUserConnectSucceedRet 空间玩家专用连接成功

func (*SpaceUserConnectSucceedRet) MarshalTo

func (msg *SpaceUserConnectSucceedRet) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*SpaceUserConnectSucceedRet) Name

func (msg *SpaceUserConnectSucceedRet) Name() string

Name 获取消息名称

func (*SpaceUserConnectSucceedRet) Size

func (msg *SpaceUserConnectSucceedRet) Size() (n int)

Size 获取长度

func (*SpaceUserConnectSucceedRet) String

func (msg *SpaceUserConnectSucceedRet) String() string

func (*SpaceUserConnectSucceedRet) Unmarshal

func (msg *SpaceUserConnectSucceedRet) Unmarshal(data []byte) error

Unmarshal 反序列化

type SrvMsgTransport

type SrvMsgTransport struct {
	CellID     uint64
	MsgContent []byte
}

SrvMsgTransport 分布式实体之间传递消息用

func (*SrvMsgTransport) MarshalTo

func (msg *SrvMsgTransport) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*SrvMsgTransport) Name

func (msg *SrvMsgTransport) Name() string

Name 获取名字

func (*SrvMsgTransport) Size

func (msg *SrvMsgTransport) Size() (n int)

Size 获取长度 8 + 2 + len([]byte)

func (*SrvMsgTransport) String

func (msg *SrvMsgTransport) String() string

func (*SrvMsgTransport) Unmarshal

func (msg *SrvMsgTransport) Unmarshal(data []byte) error

Unmarshal 反序列化

type SyncClock

type SyncClock struct {
	TimeStamp uint32
}

SyncClock 对时

func (*SyncClock) MarshalTo

func (msg *SyncClock) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*SyncClock) Name

func (msg *SyncClock) Name() string

Name 获取消息名称

func (*SyncClock) Size

func (msg *SyncClock) Size() (n int)

Size 获取长度

func (*SyncClock) String

func (msg *SyncClock) String() string

func (*SyncClock) Unmarshal

func (msg *SyncClock) Unmarshal(data []byte) error

Unmarshal 反序列化

type SyncUserState

type SyncUserState struct {
	EntityID uint64
	Data     []byte
}

SyncUserState 同步信息

func (*SyncUserState) MarshalTo

func (msg *SyncUserState) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*SyncUserState) Name

func (msg *SyncUserState) Name() string

Name 获取消息名称

func (*SyncUserState) Size

func (msg *SyncUserState) Size() (n int)

Size 获取长度

func (*SyncUserState) String

func (msg *SyncUserState) String() string

func (*SyncUserState) Unmarshal

func (msg *SyncUserState) Unmarshal(data []byte) error

Unmarshal 反序列化

type TestBinMsg

type TestBinMsg struct {
	State uint32
}

TestBinMsg 会话状态通知, 交给业务层处理

func (*TestBinMsg) MarshalTo

func (msg *TestBinMsg) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*TestBinMsg) Name

func (msg *TestBinMsg) Name() string

Name 获取名字

func (*TestBinMsg) Size

func (msg *TestBinMsg) Size() (n int)

Size 获取长度

func (*TestBinMsg) String

func (msg *TestBinMsg) String() string

func (*TestBinMsg) Unmarshal

func (msg *TestBinMsg) Unmarshal(data []byte) error

Unmarshal 反序列化

type TransferRealReq

type TransferRealReq struct {
	EntityID     uint64
	PropNum      uint32
	Props        []byte
	Pos          linmath.Vector3
	RealServerID uint64
	GhostNum     uint32
	GhostData    []byte
}

TransferRealReq 把real转移至新的cell

func (*TransferRealReq) MarshalTo

func (msg *TransferRealReq) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*TransferRealReq) Name

func (msg *TransferRealReq) Name() string

Name 获取消息名称

func (*TransferRealReq) Size

func (msg *TransferRealReq) Size() (n int)

Size 获取长度

func (*TransferRealReq) String

func (msg *TransferRealReq) String() string

func (*TransferRealReq) Unmarshal

func (msg *TransferRealReq) Unmarshal(data []byte) error

Unmarshal 反序列化

type UserDuplicateLoginNotify

type UserDuplicateLoginNotify struct {
}

UserDuplicateLoginNotify 玩家重复登录通知

func (*UserDuplicateLoginNotify) MarshalTo

func (msg *UserDuplicateLoginNotify) MarshalTo(data []byte) (n int, err error)

MarshalTo 序列化

func (*UserDuplicateLoginNotify) Name

func (msg *UserDuplicateLoginNotify) Name() string

Name 名字

func (*UserDuplicateLoginNotify) Size

func (msg *UserDuplicateLoginNotify) Size() (n int)

Size 获取长度

func (*UserDuplicateLoginNotify) String

func (msg *UserDuplicateLoginNotify) String() string

func (*UserDuplicateLoginNotify) Unmarshal

func (msg *UserDuplicateLoginNotify) Unmarshal(data []byte) error

Unmarshal 反序列化

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL