1
This commit is contained in:
parent
f46ef668cc
commit
6fb616dc61
@ -139,6 +139,7 @@ func (this *player) SetSortIdx(sortIdx int32) {
|
|||||||
func (this *player) FillMFTeamMember(member_pb *cs.MFTeamMember) {
|
func (this *player) FillMFTeamMember(member_pb *cs.MFTeamMember) {
|
||||||
member_pb.AccountId = proto.String(this.accountId)
|
member_pb.AccountId = proto.String(this.accountId)
|
||||||
member_pb.Name = proto.String(this.name)
|
member_pb.Name = proto.String(this.name)
|
||||||
|
member_pb.Id = proto.Int32(this.sortIdx)
|
||||||
if this.GetTeam().IsLeader(this) {
|
if this.GetTeam().IsLeader(this) {
|
||||||
member_pb.IsLeader = proto.Int32(1)
|
member_pb.IsLeader = proto.Int32(1)
|
||||||
} else {
|
} else {
|
||||||
|
@ -130,6 +130,7 @@ message MFTeamMember
|
|||||||
optional int32 online = 7; //是否在线
|
optional int32 online = 7; //是否在线
|
||||||
optional int32 permission = 8; //是否有邀请权限
|
optional int32 permission = 8; //是否有邀请权限
|
||||||
optional int32 is_ready = 9; //是否已准备
|
optional int32 is_ready = 9; //是否已准备
|
||||||
|
optional int32 id = 10; //编号
|
||||||
}
|
}
|
||||||
|
|
||||||
//队伍信息
|
//队伍信息
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"main/common"
|
"main/common"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
|
|
||||||
|
"sort"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -85,6 +86,7 @@ func (this *team) Join(hum common.Player) bool {
|
|||||||
hum.SetTeam(this)
|
hum.SetTeam(this)
|
||||||
hum.SetSortIdx(this.sortIdx)
|
hum.SetSortIdx(this.sortIdx)
|
||||||
this.accountIdHash[hum.GetAccountId()] = hum
|
this.accountIdHash[hum.GetAccountId()] = hum
|
||||||
|
this.rearrangementSortIdx()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,6 +177,22 @@ func (this *team) GrantInvitePermission(hum common.Player, targetId string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *team) rearrangementSortIdx() {
|
||||||
|
members := []common.Player{}
|
||||||
|
q5.NewSlice(&members, 0, 4)
|
||||||
|
for _, m := range this.accountIdHash {
|
||||||
|
q5.AppendSlice(&members, m)
|
||||||
|
}
|
||||||
|
sort.Slice(members, func(i, j int) bool {
|
||||||
|
return members[i].GetSortIdx() < members[j].GetSortIdx()
|
||||||
|
})
|
||||||
|
idx := int32(0)
|
||||||
|
for _, m := range members {
|
||||||
|
idx++
|
||||||
|
m.SetSortIdx(idx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (this *team) genStartGameInfo() {
|
func (this *team) genStartGameInfo() {
|
||||||
startInfo := struct {
|
startInfo := struct {
|
||||||
ZoneId int32 `json:"zone_id"`
|
ZoneId int32 `json:"zone_id"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user