This commit is contained in:
aozhiwei 2024-02-02 13:55:38 +08:00
parent 72dd76ffee
commit bbbc3d6401

View File

@ -210,7 +210,6 @@ func (this *room) join(hum common.Player, msg *cs.CMJoinRoom) bool {
m := newMember(this, hum) m := newMember(this, hum)
this.addMember(m) this.addMember(m)
t = newTeam(this, this.genTeamId(), msg.GetTeamUuid(), m) t = newTeam(this, this.genTeamId(), msg.GetTeamUuid(), m)
t.addMember(m)
if msg.GetIsObserver() != 0 { if msg.GetIsObserver() != 0 {
this.addObTeam(t) this.addObTeam(t)
} else { } else {
@ -295,11 +294,12 @@ func (this *room) fillMFCurrentRoom(hum common.Player, pb *cs.MFCurrentRoom) {
sort.Slice(pb.TeamList, func(i, j int) bool { sort.Slice(pb.TeamList, func(i, j int) bool {
return pb.TeamList[i].GetSortIdx() < pb.TeamList[j].GetSortIdx() return pb.TeamList[i].GetSortIdx() < pb.TeamList[j].GetSortIdx()
}) })
q5.NewSlice(&pb.ObserverTeamList, 0, 10)
for _, t := range this.obTeamUuidHash { for _, t := range this.obTeamUuidHash {
pbT := &cs.MFTeam{} pbT := &cs.MFTeam{}
t.fillMFTeam(pbT) t.fillMFTeam(pbT)
pbT.SortIdx = proto.Int32(t.obSortIdx) pbT.SortIdx = proto.Int32(t.obSortIdx)
q5.AppendSlice(&pb.TeamList, pbT) q5.AppendSlice(&pb.ObserverTeamList, pbT)
} }
sort.Slice(pb.ObserverTeamList, func(i, j int) bool { sort.Slice(pb.ObserverTeamList, func(i, j int) bool {
return pb.ObserverTeamList[i].GetSortIdx() < pb.ObserverTeamList[j].GetSortIdx() return pb.ObserverTeamList[i].GetSortIdx() < pb.ObserverTeamList[j].GetSortIdx()