From ee1e39328827973fcdebb173b0624f61216f2e4f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 12 Mar 2024 11:52:35 +0800 Subject: [PATCH] 1 --- server/matchserver/player/player.go | 21 +++++++++++++++++++-- server/matchserver/proto/cs_proto.proto | 1 + server/matchserver/team/team.go | 13 +++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/server/matchserver/player/player.go b/server/matchserver/player/player.go index da36ddd6..2f50e070 100644 --- a/server/matchserver/player/player.go +++ b/server/matchserver/player/player.go @@ -20,6 +20,11 @@ type player struct { heroId string headFrame string ping int32 + isLeader int32 + specSkill int32 + state int32 + isReady int32 + permission int32 team common.Team } @@ -125,8 +130,20 @@ func (this *player) GetTeam() common.Team { return this.team } -func (this *player) FillMFTeamMember(team_pb *cs.MFTeamMember) { - +func (this *player) FillMFTeamMember(member_pb *cs.MFTeamMember) { + member_pb.AccountId = proto.String(this.accountId) + member_pb.Name = proto.String(this.name) + member_pb.IsLeader = proto.Int32(this.isLeader) + member_pb.SpecSkill = proto.Int32(this.specSkill) + //hero + member_pb.State = proto.Int32(this.state) + if this.IsOnline() { + member_pb.Online = proto.Int32(1) + } else { + member_pb.Online = proto.Int32(0) + } + member_pb.Permission = proto.Int32(this.permission) + member_pb.IsReady = proto.Int32(this.isReady) } func (this *player) CMLeaveTeam(hdr *f5.MsgHdr, msg *cs.CMLeaveTeam) { diff --git a/server/matchserver/proto/cs_proto.proto b/server/matchserver/proto/cs_proto.proto index 27c35b1d..1fe710dd 100644 --- a/server/matchserver/proto/cs_proto.proto +++ b/server/matchserver/proto/cs_proto.proto @@ -131,6 +131,7 @@ message MFTeam optional string team_uuid = 1; //队伍唯一id repeated MFTeamMember members = 2; //成员信息 optional string next_team_uuid = 3; //下一次队伍唯一id + optional int32 map_id = 4; //地图id } //登录 diff --git a/server/matchserver/team/team.go b/server/matchserver/team/team.go index cda9e418..bfbb9d50 100644 --- a/server/matchserver/team/team.go +++ b/server/matchserver/team/team.go @@ -1,6 +1,7 @@ package team import ( + "q5" "cs" "main/common" @@ -10,9 +11,11 @@ import ( type team struct { cs.MsgHandlerImpl teamUuid string + nextTeamUuid string isCopy bool zoneId int32 nodeId int32 + mapId int32 owner common.Player accountIdHash map[string]common.Player } @@ -87,6 +90,16 @@ func (this *team) broadcastMsg(msg proto.Message) { func (this *team) SendUpdateNotify() { notifyMsg := &cs.SMTeamUpdateNotify{} + notifyMsg.TeamInfo = &cs.MFTeam{} + notifyMsg.TeamInfo.TeamUuid = proto.String(this.teamUuid) + notifyMsg.TeamInfo.NextTeamUuid = proto.String(this.nextTeamUuid) + notifyMsg.TeamInfo.MapId = proto.Int32(this.mapId) + q5.NewSlice(¬ifyMsg.TeamInfo.Members, 0, 1) + for _, m := range this.accountIdHash { + m_pb := &cs.MFTeamMember{} + q5.AppendSlice(¬ifyMsg.TeamInfo.Members, m_pb) + m.FillMFTeamMember(m_pb) + } this.broadcastMsg(notifyMsg) }