Documentation
¶
Index ¶
- Variables
- type CmdData
- func (*CmdData) Descriptor() ([]byte, []int)deprecated
- func (x *CmdData) GetAction() int32
- func (x *CmdData) GetCustom() []byte
- func (x *CmdData) GetUid() string
- func (x *CmdData) GetX() float32
- func (x *CmdData) GetY() float32
- func (*CmdData) ProtoMessage()
- func (x *CmdData) ProtoReflect() protoreflect.Message
- func (x *CmdData) Reset()
- func (x *CmdData) String() string
- type FrameData
- type MsgID
- type NoticeID
- type NtfFrame
- type NtfRoomExit
- type NtfRoomJoined
- type Player
- func (*Player) Descriptor() ([]byte, []int)deprecated
- func (x *Player) GetAvatar() string
- func (x *Player) GetNickname() string
- func (x *Player) GetUid() string
- func (*Player) ProtoMessage()
- func (x *Player) ProtoReflect() protoreflect.Message
- func (x *Player) Reset()
- func (x *Player) String() string
- type ReqExit
- type ReqJoin
- type ReqSync
- type Response
- type RoomErrorCode
- func (RoomErrorCode) Descriptor() protoreflect.EnumDescriptor
- func (x RoomErrorCode) Enum() *RoomErrorCode
- func (RoomErrorCode) EnumDescriptor() ([]byte, []int)deprecated
- func (x RoomErrorCode) Number() protoreflect.EnumNumber
- func (x RoomErrorCode) String() string
- func (RoomErrorCode) Type() protoreflect.EnumType
- type RspExit
- type RspJoin
- type RspSync
Constants ¶
This section is empty.
Variables ¶
var ( RoomErrorCode_name = map[int32]string{ 0: "ROOM_ERROR_CODE_OK", 1: "ROOM_ERROR_CODE_INVALID", 2: "ROOM_ERROR_CODE_NOT_FOUND", 3: "ROOM_ERROR_CODE_FULL", 4: "ROOM_ERROR_CODE_ALREADY_IN", 5: "ROOM_ERROR_CODE_NOT_IN", 6: "ROOM_ERROR_CODE_NOT_READY", 7: "ROOM_ERROR_CODE_ALREADY_READY", 8: "ROOM_ERROR_CODE_NOT_STARTED", 9: "ROOM_ERROR_CODE_ALREADY_STARTED", 10: "ROOM_ERROR_CODE_NOT_ENDED", 11: "ROOM_ERROR_CODE_ALREADY_ENDED", 12: "ROOM_ERROR_CODE_NOT_SYNC", 13: "ROOM_ERROR_CODE_ALREADY_SYNC", } RoomErrorCode_value = map[string]int32{ "ROOM_ERROR_CODE_OK": 0, "ROOM_ERROR_CODE_INVALID": 1, "ROOM_ERROR_CODE_NOT_FOUND": 2, "ROOM_ERROR_CODE_FULL": 3, "ROOM_ERROR_CODE_ALREADY_IN": 4, "ROOM_ERROR_CODE_NOT_IN": 5, "ROOM_ERROR_CODE_NOT_READY": 6, "ROOM_ERROR_CODE_ALREADY_READY": 7, "ROOM_ERROR_CODE_NOT_STARTED": 8, "ROOM_ERROR_CODE_ALREADY_STARTED": 9, "ROOM_ERROR_CODE_NOT_ENDED": 10, "ROOM_ERROR_CODE_ALREADY_ENDED": 11, "ROOM_ERROR_CODE_NOT_SYNC": 12, "ROOM_ERROR_CODE_ALREADY_SYNC": 13, } )
Enum value maps for RoomErrorCode.
var ( MsgID_name = map[int32]string{ 0: "MSG_ID_INVALID", 1: "MSG_ID_HEARTBEAT", 1000: "MSG_ID_ROOM_JOIN", 1001: "MSG_ID_ROOM_EXIT", 1002: "MSG_ID_ROOM_SYNC", } MsgID_value = map[string]int32{ "MSG_ID_INVALID": 0, "MSG_ID_HEARTBEAT": 1, "MSG_ID_ROOM_JOIN": 1000, "MSG_ID_ROOM_EXIT": 1001, "MSG_ID_ROOM_SYNC": 1002, } )
Enum value maps for MsgID.
var ( NoticeID_name = map[int32]string{ 0: "NOTICE_ID_INVALID", 100: "NOTICE_ID_ROOM_JOINED", 101: "NOTICE_ID_ROOM_EXIT", 102: "NOTICE_ID_ROOM_SYNC", } NoticeID_value = map[string]int32{ "NOTICE_ID_INVALID": 0, "NOTICE_ID_ROOM_JOINED": 100, "NOTICE_ID_ROOM_EXIT": 101, "NOTICE_ID_ROOM_SYNC": 102, } )
Enum value maps for NoticeID.
var File_room_room_common_proto protoreflect.FileDescriptor
var File_room_room_msgid_proto protoreflect.FileDescriptor
var File_room_room_notice_proto protoreflect.FileDescriptor
var File_room_room_req_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type CmdData ¶
type CmdData struct {
// player uid
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` // player uid
// joystick x axis value
X float32 `protobuf:"fixed32,2,opt,name=x,proto3" json:"x,omitempty"` // x position
// joystick y axis value
Y float32 `protobuf:"fixed32,3,opt,name=y,proto3" json:"y,omitempty"` // y position
// player action
Action int32 `protobuf:"varint,4,opt,name=action,proto3" json:"action,omitempty"` // action
// custom data
Custom []byte `protobuf:"bytes,5,opt,name=custom,proto3" json:"custom,omitempty"` // custom data
// contains filtered or unexported fields
}
Command data Operation frame data, used for client to send to the server, and the server broadcasts to all clients in the room 操作帧数据, 用于客户端发送给服务器,服务器广播给房间内所有客户端
func (*CmdData) Descriptor
deprecated
func (*CmdData) ProtoMessage ¶
func (*CmdData) ProtoMessage()
func (*CmdData) ProtoReflect ¶
func (x *CmdData) ProtoReflect() protoreflect.Message
type FrameData ¶
type FrameData struct {
// frame index
FrameIndex uint32 `protobuf:"varint,1,opt,name=frame_index,json=frameIndex,proto3" json:"frame_index,omitempty"`
// operation data
Cmds []*CmdData `protobuf:"bytes,2,rep,name=cmds,proto3" json:"cmds,omitempty"`
// contains filtered or unexported fields
}
Frame data
func (*FrameData) Descriptor
deprecated
func (*FrameData) GetFrameIndex ¶
func (*FrameData) ProtoMessage ¶
func (*FrameData) ProtoMessage()
func (*FrameData) ProtoReflect ¶
func (x *FrameData) ProtoReflect() protoreflect.Message
type MsgID ¶
type MsgID int32
MsgID
func (MsgID) Descriptor ¶
func (MsgID) Descriptor() protoreflect.EnumDescriptor
func (MsgID) EnumDescriptor
deprecated
func (MsgID) Number ¶
func (x MsgID) Number() protoreflect.EnumNumber
func (MsgID) Type ¶
func (MsgID) Type() protoreflect.EnumType
type NoticeID ¶
type NoticeID int32
NoticeID
func (NoticeID) Descriptor ¶
func (NoticeID) Descriptor() protoreflect.EnumDescriptor
func (NoticeID) EnumDescriptor
deprecated
func (NoticeID) Number ¶
func (x NoticeID) Number() protoreflect.EnumNumber
func (NoticeID) Type ¶
func (NoticeID) Type() protoreflect.EnumType
type NtfFrame ¶
type NtfFrame struct {
// frame data
// 帧数据
Frames []*FrameData `protobuf:"bytes,1,rep,name=frames,proto3" json:"frames,omitempty"`
// contains filtered or unexported fields
}
Notice client to sync frame data Room will send this notice every frame to all clients in the room 房间会每帧向房间内所有客户端发送此同步信息
func (*NtfFrame) Descriptor
deprecated
func (*NtfFrame) ProtoMessage ¶
func (*NtfFrame) ProtoMessage()
func (*NtfFrame) ProtoReflect ¶
func (x *NtfFrame) ProtoReflect() protoreflect.Message
type NtfRoomExit ¶
type NtfRoomExit struct {
// need remove player uids
// 需要移除的玩家uid
Uids []string `protobuf:"bytes,1,rep,name=uids,proto3" json:"uids,omitempty"`
// contains filtered or unexported fields
}
Notice client to exit room when client exit room, server will send this notice to all clients in the room 当客户端退出房间时,服务器会向房间内所有客户端发送此通知
func (*NtfRoomExit) Descriptor
deprecated
func (*NtfRoomExit) Descriptor() ([]byte, []int)
Deprecated: Use NtfRoomExit.ProtoReflect.Descriptor instead.
func (*NtfRoomExit) GetUids ¶
func (x *NtfRoomExit) GetUids() []string
func (*NtfRoomExit) ProtoMessage ¶
func (*NtfRoomExit) ProtoMessage()
func (*NtfRoomExit) ProtoReflect ¶
func (x *NtfRoomExit) ProtoReflect() protoreflect.Message
func (*NtfRoomExit) Reset ¶
func (x *NtfRoomExit) Reset()
func (*NtfRoomExit) String ¶
func (x *NtfRoomExit) String() string
type NtfRoomJoined ¶
type NtfRoomJoined struct {
// need add player info
// 需要添加的玩家信息
Players []*Player `protobuf:"bytes,1,rep,name=players,proto3" json:"players,omitempty"`
// contains filtered or unexported fields
}
Notice client to join room when client join room, server will send this notice to all clients in the room if client is already in the room, notice will not be sent 当客户端加入房间时,服务器会向房间内所有客户端发送此通知
func (*NtfRoomJoined) Descriptor
deprecated
func (*NtfRoomJoined) Descriptor() ([]byte, []int)
Deprecated: Use NtfRoomJoined.ProtoReflect.Descriptor instead.
func (*NtfRoomJoined) GetPlayers ¶
func (x *NtfRoomJoined) GetPlayers() []*Player
func (*NtfRoomJoined) ProtoMessage ¶
func (*NtfRoomJoined) ProtoMessage()
func (*NtfRoomJoined) ProtoReflect ¶
func (x *NtfRoomJoined) ProtoReflect() protoreflect.Message
func (*NtfRoomJoined) Reset ¶
func (x *NtfRoomJoined) Reset()
func (*NtfRoomJoined) String ¶
func (x *NtfRoomJoined) String() string
type Player ¶
type Player struct {
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
Nickname string `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname,omitempty"`
Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar,omitempty"`
// contains filtered or unexported fields
}
Player info
func (*Player) Descriptor
deprecated
func (*Player) GetNickname ¶
func (*Player) ProtoMessage ¶
func (*Player) ProtoMessage()
func (*Player) ProtoReflect ¶
func (x *Player) ProtoReflect() protoreflect.Message
type ReqExit ¶
type ReqExit struct {
// contains filtered or unexported fields
}
Client leave room
func (*ReqExit) Descriptor
deprecated
func (*ReqExit) ProtoMessage ¶
func (*ReqExit) ProtoMessage()
func (*ReqExit) ProtoReflect ¶
func (x *ReqExit) ProtoReflect() protoreflect.Message
type ReqJoin ¶
type ReqJoin struct {
// room jwt token contains: uid,room_id
// 房间jwt token包含: uid,room_id
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
// last frame index: default 0,
// if client has cache data and want to reconnect from a frame index,
// set this value to the corresponding frame index
// 最后一帧的索引: 默认为0,
// 如果客户端本地有缓存数据,想要从某个帧索引重新连接,设置这个值为对应的帧索引
LastFrameIndex uint32 `protobuf:"varint,2,opt,name=last_frame_index,json=lastFrameIndex,proto3" json:"last_frame_index,omitempty"`
// contains filtered or unexported fields
}
Client join room
func (*ReqJoin) Descriptor
deprecated
func (*ReqJoin) GetLastFrameIndex ¶
func (*ReqJoin) ProtoMessage ¶
func (*ReqJoin) ProtoMessage()
func (*ReqJoin) ProtoReflect ¶
func (x *ReqJoin) ProtoReflect() protoreflect.Message
type ReqSync ¶
type ReqSync struct {
Cmd *CmdData `protobuf:"bytes,1,opt,name=cmd,proto3" json:"cmd,omitempty"`
// contains filtered or unexported fields
}
Client sync frame data
func (*ReqSync) Descriptor
deprecated
func (*ReqSync) ProtoMessage ¶
func (*ReqSync) ProtoMessage()
func (*ReqSync) ProtoReflect ¶
func (x *ReqSync) ProtoReflect() protoreflect.Message
type Response ¶
type Response struct {
ErrorCode RoomErrorCode `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3,enum=room.v1.RoomErrorCode" json:"error_code,omitempty"`
Message []byte `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
// contains filtered or unexported fields
}
Common response Common response message, all Response messages should be returned to the client as the message field of this message 通用响应消息,所有Response消息都应该作为此消息的message字段返回给客户端
func (*Response) Descriptor
deprecated
func (*Response) GetErrorCode ¶
func (x *Response) GetErrorCode() RoomErrorCode
func (*Response) GetMessage ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
type RoomErrorCode ¶
type RoomErrorCode int32
Room error code
const ( RoomErrorCode_ROOM_ERROR_CODE_OK RoomErrorCode = 0 RoomErrorCode_ROOM_ERROR_CODE_INVALID RoomErrorCode = 1 RoomErrorCode_ROOM_ERROR_CODE_NOT_FOUND RoomErrorCode = 2 RoomErrorCode_ROOM_ERROR_CODE_FULL RoomErrorCode = 3 RoomErrorCode_ROOM_ERROR_CODE_ALREADY_IN RoomErrorCode = 4 RoomErrorCode_ROOM_ERROR_CODE_NOT_IN RoomErrorCode = 5 RoomErrorCode_ROOM_ERROR_CODE_NOT_READY RoomErrorCode = 6 RoomErrorCode_ROOM_ERROR_CODE_ALREADY_READY RoomErrorCode = 7 RoomErrorCode_ROOM_ERROR_CODE_NOT_STARTED RoomErrorCode = 8 RoomErrorCode_ROOM_ERROR_CODE_ALREADY_STARTED RoomErrorCode = 9 RoomErrorCode_ROOM_ERROR_CODE_NOT_ENDED RoomErrorCode = 10 RoomErrorCode_ROOM_ERROR_CODE_ALREADY_ENDED RoomErrorCode = 11 RoomErrorCode_ROOM_ERROR_CODE_NOT_SYNC RoomErrorCode = 12 RoomErrorCode_ROOM_ERROR_CODE_ALREADY_SYNC RoomErrorCode = 13 )
func (RoomErrorCode) Descriptor ¶
func (RoomErrorCode) Descriptor() protoreflect.EnumDescriptor
func (RoomErrorCode) Enum ¶
func (x RoomErrorCode) Enum() *RoomErrorCode
func (RoomErrorCode) EnumDescriptor
deprecated
func (RoomErrorCode) EnumDescriptor() ([]byte, []int)
Deprecated: Use RoomErrorCode.Descriptor instead.
func (RoomErrorCode) Number ¶
func (x RoomErrorCode) Number() protoreflect.EnumNumber
func (RoomErrorCode) String ¶
func (x RoomErrorCode) String() string
func (RoomErrorCode) Type ¶
func (RoomErrorCode) Type() protoreflect.EnumType
type RspExit ¶
type RspExit struct {
// contains filtered or unexported fields
}
Server response to client leave room
func (*RspExit) Descriptor
deprecated
func (*RspExit) ProtoMessage ¶
func (*RspExit) ProtoMessage()
func (*RspExit) ProtoReflect ¶
func (x *RspExit) ProtoReflect() protoreflect.Message
type RspJoin ¶
type RspJoin struct {
// room random seed
// 房间随机种子
RandomSeed int64 `protobuf:"varint,1,opt,name=random_seed,json=randomSeed,proto3" json:"random_seed,omitempty"`
// contains filtered or unexported fields
}
Server response to client join room
func (*RspJoin) Descriptor
deprecated
func (*RspJoin) GetRandomSeed ¶
func (*RspJoin) ProtoMessage ¶
func (*RspJoin) ProtoMessage()
func (*RspJoin) ProtoReflect ¶
func (x *RspJoin) ProtoReflect() protoreflect.Message
type RspSync ¶
type RspSync struct {
// contains filtered or unexported fields
}
Server response to client sync frame data
func (*RspSync) Descriptor
deprecated
func (*RspSync) ProtoMessage ¶
func (*RspSync) ProtoMessage()
func (*RspSync) ProtoReflect ¶
func (x *RspSync) ProtoReflect() protoreflect.Message