更新协议

This commit is contained in:
殷勇 2023-10-23 11:42:18 +08:00
parent 6e0ccdf125
commit c11ec7e9aa
4 changed files with 73 additions and 6 deletions

View File

@ -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

View File

@ -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))
},
}
}

View File

@ -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;
}

View File

@ -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; //
}