room

package
v0.0.0-...-5e99e8e Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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.

View Source
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.

View Source
var File_room_room_common_proto protoreflect.FileDescriptor
View Source
var File_room_room_msgid_proto protoreflect.FileDescriptor
View Source
var File_room_room_notice_proto protoreflect.FileDescriptor
View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use CmdData.ProtoReflect.Descriptor instead.

func (*CmdData) GetAction

func (x *CmdData) GetAction() int32

func (*CmdData) GetCustom

func (x *CmdData) GetCustom() []byte

func (*CmdData) GetUid

func (x *CmdData) GetUid() string

func (*CmdData) GetX

func (x *CmdData) GetX() float32

func (*CmdData) GetY

func (x *CmdData) GetY() float32

func (*CmdData) ProtoMessage

func (*CmdData) ProtoMessage()

func (*CmdData) ProtoReflect

func (x *CmdData) ProtoReflect() protoreflect.Message

func (*CmdData) Reset

func (x *CmdData) Reset()

func (*CmdData) String

func (x *CmdData) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use FrameData.ProtoReflect.Descriptor instead.

func (*FrameData) GetCmds

func (x *FrameData) GetCmds() []*CmdData

func (*FrameData) GetFrameIndex

func (x *FrameData) GetFrameIndex() uint32

func (*FrameData) ProtoMessage

func (*FrameData) ProtoMessage()

func (*FrameData) ProtoReflect

func (x *FrameData) ProtoReflect() protoreflect.Message

func (*FrameData) Reset

func (x *FrameData) Reset()

func (*FrameData) String

func (x *FrameData) String() string

type MsgID

type MsgID int32

MsgID

const (
	MsgID_MSG_ID_INVALID   MsgID = 0
	MsgID_MSG_ID_HEARTBEAT MsgID = 1
	MsgID_MSG_ID_ROOM_JOIN MsgID = 1000
	MsgID_MSG_ID_ROOM_EXIT MsgID = 1001
	MsgID_MSG_ID_ROOM_SYNC MsgID = 1002
)

func (MsgID) Descriptor

func (MsgID) Descriptor() protoreflect.EnumDescriptor

func (MsgID) Enum

func (x MsgID) Enum() *MsgID

func (MsgID) EnumDescriptor deprecated

func (MsgID) EnumDescriptor() ([]byte, []int)

Deprecated: Use MsgID.Descriptor instead.

func (MsgID) Number

func (x MsgID) Number() protoreflect.EnumNumber

func (MsgID) String

func (x MsgID) String() string

func (MsgID) Type

func (MsgID) Type() protoreflect.EnumType

type NoticeID

type NoticeID int32

NoticeID

const (
	NoticeID_NOTICE_ID_INVALID     NoticeID = 0
	NoticeID_NOTICE_ID_ROOM_JOINED NoticeID = 100
	NoticeID_NOTICE_ID_ROOM_EXIT   NoticeID = 101
	NoticeID_NOTICE_ID_ROOM_SYNC   NoticeID = 102
)

func (NoticeID) Descriptor

func (NoticeID) Descriptor() protoreflect.EnumDescriptor

func (NoticeID) Enum

func (x NoticeID) Enum() *NoticeID

func (NoticeID) EnumDescriptor deprecated

func (NoticeID) EnumDescriptor() ([]byte, []int)

Deprecated: Use NoticeID.Descriptor instead.

func (NoticeID) Number

func (x NoticeID) Number() protoreflect.EnumNumber

func (NoticeID) String

func (x NoticeID) String() string

func (NoticeID) Type

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) Descriptor() ([]byte, []int)

Deprecated: Use NtfFrame.ProtoReflect.Descriptor instead.

func (*NtfFrame) GetFrames

func (x *NtfFrame) GetFrames() []*FrameData

func (*NtfFrame) ProtoMessage

func (*NtfFrame) ProtoMessage()

func (*NtfFrame) ProtoReflect

func (x *NtfFrame) ProtoReflect() protoreflect.Message

func (*NtfFrame) Reset

func (x *NtfFrame) Reset()

func (*NtfFrame) String

func (x *NtfFrame) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Player.ProtoReflect.Descriptor instead.

func (*Player) GetAvatar

func (x *Player) GetAvatar() string

func (*Player) GetNickname

func (x *Player) GetNickname() string

func (*Player) GetUid

func (x *Player) GetUid() string

func (*Player) ProtoMessage

func (*Player) ProtoMessage()

func (*Player) ProtoReflect

func (x *Player) ProtoReflect() protoreflect.Message

func (*Player) Reset

func (x *Player) Reset()

func (*Player) String

func (x *Player) String() string

type ReqExit

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

Client leave room

func (*ReqExit) Descriptor deprecated

func (*ReqExit) Descriptor() ([]byte, []int)

Deprecated: Use ReqExit.ProtoReflect.Descriptor instead.

func (*ReqExit) ProtoMessage

func (*ReqExit) ProtoMessage()

func (*ReqExit) ProtoReflect

func (x *ReqExit) ProtoReflect() protoreflect.Message

func (*ReqExit) Reset

func (x *ReqExit) Reset()

func (*ReqExit) String

func (x *ReqExit) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use ReqJoin.ProtoReflect.Descriptor instead.

func (*ReqJoin) GetLastFrameIndex

func (x *ReqJoin) GetLastFrameIndex() uint32

func (*ReqJoin) GetToken

func (x *ReqJoin) GetToken() string

func (*ReqJoin) ProtoMessage

func (*ReqJoin) ProtoMessage()

func (*ReqJoin) ProtoReflect

func (x *ReqJoin) ProtoReflect() protoreflect.Message

func (*ReqJoin) Reset

func (x *ReqJoin) Reset()

func (*ReqJoin) String

func (x *ReqJoin) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use ReqSync.ProtoReflect.Descriptor instead.

func (*ReqSync) GetCmd

func (x *ReqSync) GetCmd() *CmdData

func (*ReqSync) ProtoMessage

func (*ReqSync) ProtoMessage()

func (*ReqSync) ProtoReflect

func (x *ReqSync) ProtoReflect() protoreflect.Message

func (*ReqSync) Reset

func (x *ReqSync) Reset()

func (*ReqSync) String

func (x *ReqSync) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetErrorCode

func (x *Response) GetErrorCode() RoomErrorCode

func (*Response) GetMessage

func (x *Response) GetMessage() []byte

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

func (x *Response) ProtoReflect() protoreflect.Message

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

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) Enum

func (x RoomErrorCode) Enum() *RoomErrorCode

func (RoomErrorCode) EnumDescriptor deprecated

func (RoomErrorCode) EnumDescriptor() ([]byte, []int)

Deprecated: Use RoomErrorCode.Descriptor instead.

func (RoomErrorCode) Number

func (RoomErrorCode) String

func (x RoomErrorCode) String() string

func (RoomErrorCode) Type

type RspExit

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

Server response to client leave room

func (*RspExit) Descriptor deprecated

func (*RspExit) Descriptor() ([]byte, []int)

Deprecated: Use RspExit.ProtoReflect.Descriptor instead.

func (*RspExit) ProtoMessage

func (*RspExit) ProtoMessage()

func (*RspExit) ProtoReflect

func (x *RspExit) ProtoReflect() protoreflect.Message

func (*RspExit) Reset

func (x *RspExit) Reset()

func (*RspExit) String

func (x *RspExit) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use RspJoin.ProtoReflect.Descriptor instead.

func (*RspJoin) GetRandomSeed

func (x *RspJoin) GetRandomSeed() int64

func (*RspJoin) ProtoMessage

func (*RspJoin) ProtoMessage()

func (*RspJoin) ProtoReflect

func (x *RspJoin) ProtoReflect() protoreflect.Message

func (*RspJoin) Reset

func (x *RspJoin) Reset()

func (*RspJoin) String

func (x *RspJoin) String() string

type RspSync

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

Server response to client sync frame data

func (*RspSync) Descriptor deprecated

func (*RspSync) Descriptor() ([]byte, []int)

Deprecated: Use RspSync.ProtoReflect.Descriptor instead.

func (*RspSync) ProtoMessage

func (*RspSync) ProtoMessage()

func (*RspSync) ProtoReflect

func (x *RspSync) ProtoReflect() protoreflect.Message

func (*RspSync) Reset

func (x *RspSync) Reset()

func (*RspSync) String

func (x *RspSync) String() string

Jump to

Keyboard shortcuts

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