This commit is contained in:
aozhiwei 2024-03-12 11:52:35 +08:00
parent 7204cfe4a1
commit ee1e393288
3 changed files with 33 additions and 2 deletions

View File

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

View File

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

View File

@ -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(&notifyMsg.TeamInfo.Members, 0, 1)
for _, m := range this.accountIdHash {
m_pb := &cs.MFTeamMember{}
q5.AppendSlice(&notifyMsg.TeamInfo.Members, m_pb)
m.FillMFTeamMember(m_pb)
}
this.broadcastMsg(notifyMsg)
}