From c11ec7e9aaec277b18256044dc6a682982614efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B7=E5=8B=87?= Date: Mon, 23 Oct 2023 11:42:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/hallserver/constant/constant.go | 4 +- server/hallserver/cs/cs.auto_gen.go | 52 ++++++++++++++++++++++++++ server/hallserver/proto/cs_msgid.proto | 5 +++ server/hallserver/proto/cs_proto.proto | 18 +++++++-- 4 files changed, 73 insertions(+), 6 deletions(-) diff --git a/server/hallserver/constant/constant.go b/server/hallserver/constant/constant.go index ce613f3b..30b87df8 100644 --- a/server/hallserver/constant/constant.go +++ b/server/hallserver/constant/constant.go @@ -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 diff --git a/server/hallserver/cs/cs.auto_gen.go b/server/hallserver/cs/cs.auto_gen.go index 5c6c4148..73e3787b 100644 --- a/server/hallserver/cs/cs.auto_gen.go +++ b/server/hallserver/cs/cs.auto_gen.go @@ -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)) + }, + } + } \ No newline at end of file diff --git a/server/hallserver/proto/cs_msgid.proto b/server/hallserver/proto/cs_msgid.proto index 5819233b..9268efe3 100644 --- a/server/hallserver/proto/cs_msgid.proto +++ b/server/hallserver/proto/cs_msgid.proto @@ -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; } diff --git a/server/hallserver/proto/cs_proto.proto b/server/hallserver/proto/cs_proto.proto index e80e57b8..a2959462 100644 --- a/server/hallserver/proto/cs_proto.proto +++ b/server/hallserver/proto/cs_proto.proto @@ -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; //错误描述 }