更新协议
This commit is contained in:
parent
6e0ccdf125
commit
c11ec7e9aa
@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
PLAYER_MGR_HANDLER_ID = iota
|
||||
PLAYER_MGR_HANDLER_ID = iota
|
||||
PLAYER_HANDLER_ID
|
||||
ROOM_HANDLER_ID
|
||||
ROOM_MGR_HANDLER_ID
|
||||
@ -37,5 +37,5 @@ const (
|
||||
|
||||
const SEARCH_ROOM_PAGE_SIZE = 20
|
||||
const ROOM_MAX_PLAYER_NUM = 40
|
||||
const ROOM_MAX_TEAM_NUM = 10
|
||||
const ROOM_MAX_TEAM_NUM = 2
|
||||
const ROOM_MAX_TEAM_MEMBER_NUM = 4
|
||||
|
@ -51,6 +51,8 @@ type MsgHandler interface {
|
||||
CMCloseNotify(*f5.MsgHdr, *CMCloseNotify)
|
||||
CMReportPingValue(*f5.MsgHdr, *CMReportPingValue)
|
||||
CMGetCurrentRoom(*f5.MsgHdr, *CMGetCurrentRoom)
|
||||
CMEnterObserver(*f5.MsgHdr, *CMEnterObserver)
|
||||
CMLeaveObserver(*f5.MsgHdr, *CMLeaveObserver)
|
||||
}
|
||||
|
||||
func (this *MsgHandlerImpl) CMPing(hdr *f5.MsgHdr, msg *CMPing) {
|
||||
@ -101,6 +103,12 @@ func (this *MsgHandlerImpl) CMReportPingValue(hdr *f5.MsgHdr, msg *CMReportPingV
|
||||
func (this *MsgHandlerImpl) CMGetCurrentRoom(hdr *f5.MsgHdr, msg *CMGetCurrentRoom) {
|
||||
}
|
||||
|
||||
func (this *MsgHandlerImpl) CMEnterObserver(hdr *f5.MsgHdr, msg *CMEnterObserver) {
|
||||
}
|
||||
|
||||
func (this *MsgHandlerImpl) CMLeaveObserver(hdr *f5.MsgHdr, msg *CMLeaveObserver) {
|
||||
}
|
||||
|
||||
func (this *CMPing) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMPing)
|
||||
}
|
||||
@ -233,10 +241,30 @@ func (this *SMRoomChangeNotify) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMRoomChangeNotify)
|
||||
}
|
||||
|
||||
func (this *SMAutoStartGameCountdownNotify) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMAutoStartGameCountdownNotify)
|
||||
}
|
||||
|
||||
func (this *SMRoomGameStartNotify) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMRoomGameStartNotify)
|
||||
}
|
||||
|
||||
func (this *CMEnterObserver) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMEnterObserver)
|
||||
}
|
||||
|
||||
func (this *SMEnterObserver) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMEnterObserver)
|
||||
}
|
||||
|
||||
func (this *CMLeaveObserver) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMLeaveObserver)
|
||||
}
|
||||
|
||||
func (this *SMLeaveObserver) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMLeaveObserver)
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
handlers[int(CMMessageIdE__CMPing)] = &CsNetMsgHandler{
|
||||
@ -431,4 +459,28 @@ func init() {
|
||||
},
|
||||
}
|
||||
|
||||
handlers[int(CMMessageIdE__CMEnterObserver)] = &CsNetMsgHandler{
|
||||
MsgId: int(CMMessageIdE__CMEnterObserver),
|
||||
ParseCb: func (data []byte) interface{} {
|
||||
msg := &CMEnterObserver{}
|
||||
proto.Unmarshal(data, msg)
|
||||
return msg
|
||||
},
|
||||
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
|
||||
handler.CMEnterObserver(hdr, hdr.Msg.(*CMEnterObserver))
|
||||
},
|
||||
}
|
||||
|
||||
handlers[int(CMMessageIdE__CMLeaveObserver)] = &CsNetMsgHandler{
|
||||
MsgId: int(CMMessageIdE__CMLeaveObserver),
|
||||
ParseCb: func (data []byte) interface{} {
|
||||
msg := &CMLeaveObserver{}
|
||||
proto.Unmarshal(data, msg)
|
||||
return msg
|
||||
},
|
||||
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
|
||||
handler.CMLeaveObserver(hdr, hdr.Msg.(*CMLeaveObserver))
|
||||
},
|
||||
}
|
||||
|
||||
}
|
@ -21,6 +21,8 @@ enum CMMessageId_e
|
||||
_CMCloseNotify = 115;
|
||||
_CMReportPingValue = 116;
|
||||
_CMGetCurrentRoom = 117;
|
||||
_CMEnterObserver = 118;
|
||||
_CMLeaveObserver = 119;
|
||||
}
|
||||
|
||||
enum SMMessageId_e
|
||||
@ -41,6 +43,8 @@ enum SMMessageId_e
|
||||
_SMKickoutTeam = 113;
|
||||
_SMKickoutMember = 114;
|
||||
_SMGetCurrentRoom = 117;
|
||||
_SMEnterObserver = 118;
|
||||
_SMLeaveObserver = 119;
|
||||
|
||||
_SMRoomMemberChangeNotify = 1001;
|
||||
_SMRoomKickoutNotify = 1002;
|
||||
@ -48,4 +52,5 @@ enum SMMessageId_e
|
||||
_SMRoomDisbandNotify = 1004;
|
||||
_SMRoomChangeNotify = 1005;
|
||||
_SMRoomGameStartNotify = 1006;
|
||||
_SMAutoStartGameCountdownNotify = 1007;
|
||||
}
|
||||
|
@ -140,6 +140,7 @@ message MFCurrentRoom
|
||||
optional int32 team_max_num = 7; //最大队伍数
|
||||
optional int32 player_max_num = 8; //最大玩家数
|
||||
optional int32 my_team_id = 9; //我的队伍id
|
||||
optional MFTeam observer_team = 10; //观者者队伍
|
||||
|
||||
optional MFMember owner = 20; //房主
|
||||
|
||||
@ -201,6 +202,7 @@ message SMCreateRoom
|
||||
optional int32 errcode = 1; //错误码 0:成功 1:重连失败
|
||||
optional string errmsg = 2; //错误描述
|
||||
optional string room_id = 3; //房间号
|
||||
optional MFRoom room = 4; //房间信息
|
||||
}
|
||||
|
||||
//获取房间列表
|
||||
@ -224,6 +226,7 @@ message CMJoinRoom
|
||||
optional int32 node_id = 3; //节点id
|
||||
optional string passwd = 4; //密码,空:无密码
|
||||
optional string team_uuid = 5; //队伍唯一id
|
||||
optional string team_info = 6; //队伍信息 json:{}
|
||||
optional string room_id = 10; //房间号
|
||||
}
|
||||
|
||||
@ -231,6 +234,7 @@ message SMJoinRoom
|
||||
{
|
||||
optional int32 errcode = 1; //错误码 0:成功 1:重连失败
|
||||
optional string errmsg = 2; //错误描述
|
||||
optional MFRoom room = 3; //房间信息
|
||||
}
|
||||
|
||||
//解散房间
|
||||
@ -348,6 +352,12 @@ message SMRoomChangeNotify
|
||||
optional MFRoom room = 1; //房间信息
|
||||
}
|
||||
|
||||
//自动开始游戏倒计时通知
|
||||
message SMAutoStartGameCountdownNotify
|
||||
{
|
||||
optional int32 seconds = 1; // 秒数
|
||||
}
|
||||
|
||||
//房间游戏开始通知,这个消息游戏开始后10秒内每秒通知,客户端需要做重复消息处理
|
||||
message SMRoomGameStartNotify
|
||||
{
|
||||
@ -361,23 +371,23 @@ message SMRoomGameStartNotify
|
||||
//进入观察队伍
|
||||
message CMEnterObserver
|
||||
{
|
||||
optional string room_id = 1; //房间号
|
||||
|
||||
}
|
||||
|
||||
message SMEnterObserver
|
||||
{
|
||||
optional int32 errcode = 1; //错误码 0:成功 1:权限不足
|
||||
optional int32 errcode = 1; //错误码
|
||||
optional string errmsg = 2; //错误描述
|
||||
}
|
||||
|
||||
//离开观察队伍
|
||||
message CMLeaveObserver
|
||||
{
|
||||
optional string room_id = 1; //房间号
|
||||
|
||||
}
|
||||
|
||||
message SMLeaveObserver
|
||||
{
|
||||
optional int32 errcode = 1; //错误码 0:成功 1:权限不足
|
||||
optional int32 errcode = 1; //错误码
|
||||
optional string errmsg = 2; //错误描述
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user