From 3cdf1762facde5741b9bdd5287b0260c39aa645a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 1 Feb 2024 13:58:00 +0800 Subject: [PATCH] 1 --- server/hallserver/proto/cs_msgid.proto | 2 ++ server/hallserver/proto/cs_proto.proto | 20 +++++++++++++++++--- server/hallserver/room/room.go | 7 +++++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/server/hallserver/proto/cs_msgid.proto b/server/hallserver/proto/cs_msgid.proto index 9268efe3..c165426a 100644 --- a/server/hallserver/proto/cs_msgid.proto +++ b/server/hallserver/proto/cs_msgid.proto @@ -23,6 +23,7 @@ enum CMMessageId_e _CMGetCurrentRoom = 117; _CMEnterObserver = 118; _CMLeaveObserver = 119; + _CMSwitchTeam = 120; } enum SMMessageId_e @@ -45,6 +46,7 @@ enum SMMessageId_e _SMGetCurrentRoom = 117; _SMEnterObserver = 118; _SMLeaveObserver = 119; + _SMSwitchTeam = 120; _SMRoomMemberChangeNotify = 1001; _SMRoomKickoutNotify = 1002; diff --git a/server/hallserver/proto/cs_proto.proto b/server/hallserver/proto/cs_proto.proto index a2959462..3c5b08bc 100644 --- a/server/hallserver/proto/cs_proto.proto +++ b/server/hallserver/proto/cs_proto.proto @@ -140,7 +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; //观者者队伍 + repeated MFTeam observer_team_list = 10; //观者者队伍列表 optional MFMember owner = 20; //房主 @@ -228,6 +228,7 @@ message CMJoinRoom optional string team_uuid = 5; //队伍唯一id optional string team_info = 6; //队伍信息 json:{} optional string room_id = 10; //房间号 + optional int32 is_observer = 11; //是否观战 } message SMJoinRoom @@ -368,7 +369,7 @@ message SMRoomGameStartNotify optional int32 map_id = 5; //地图id } -//进入观察队伍 +//进入观战队伍-队长操作 message CMEnterObserver { @@ -380,7 +381,7 @@ message SMEnterObserver optional string errmsg = 2; //错误描述 } -//离开观察队伍 +//离开观战队伍-队长操作 message CMLeaveObserver { @@ -391,3 +392,16 @@ message SMLeaveObserver optional int32 errcode = 1; //错误码 optional string errmsg = 2; //错误描述 } + +//切换战斗/观战-房主操作 +message CMSwitchTeam +{ + optional int32 team_id = 1; //队伍id + optional int32 type = 2; //0:战斗席 1:观战席 +} + +message SMSwitchTeam +{ + optional int32 errcode = 1; //错误码 + optional string errmsg = 2; //错误描述 +} diff --git a/server/hallserver/room/room.go b/server/hallserver/room/room.go index e8cca3d6..99caaafe 100644 --- a/server/hallserver/room/room.go +++ b/server/hallserver/room/room.go @@ -214,7 +214,7 @@ func (this *room) fillMFCurrentRoom(hum common.Player, pb *cs.MFCurrentRoom, obs if observerTeam != nil && observerTeam.room != nil { pbT2 := &cs.MFTeam{} observerTeam.fillMFTeam(pbT2) - pb.ObserverTeam = pbT2 + q5.AppendSlice(&pb.ObserverTeamList, pbT2) } } @@ -452,7 +452,10 @@ func (this *room) genGameStartNotifyMsg() { AccountId string `json:"account_id"` } `json:"members"` } `json:"team_list"` - }{ + ObList []struct { + AccountId string `json:"account_id"` + } `json:"ob_list"` + } { ZoneId: this.config.zoneId, NodeId: this.config.nodeId, RoomUuid: q5.ToString(this.roomIdx),