This commit is contained in:
aozhiwei 2024-03-13 20:47:27 +08:00
parent c1d413c169
commit f46ef668cc
3 changed files with 12 additions and 1 deletions

View File

@ -73,6 +73,7 @@ type Player interface {
SetTeam(Team)
FillMFTeamMember(*cs.MFTeamMember)
GetSortIdx() int32
SetSortIdx(int32)
}
type PlayerMgr interface {

View File

@ -31,6 +31,7 @@ type player struct {
permission int32
hero hero
team common.Team
sortIdx int32
}
func (this *player) SendMsg(rspMsg proto.Message) {
@ -128,7 +129,11 @@ func (this *player) SetTeam(team common.Team) {
}
func (this *player) GetSortIdx() int32 {
return 0
return this.sortIdx
}
func (this *player) SetSortIdx(sortIdx int32) {
this.sortIdx = sortIdx
}
func (this *player) FillMFTeamMember(member_pb *cs.MFTeamMember) {

View File

@ -18,6 +18,7 @@ type team struct {
zoneId int32
nodeId int32
mapId int32
sortIdx int32
owner common.Player
state int32
startTime int64
@ -26,6 +27,7 @@ type team struct {
}
func (this *team) init(teamUuid string, owner common.Player, msg *cs.CMLogin) {
this.sortIdx++
this.teamUuid = teamUuid
this.zoneId = owner.GetZoneId()
this.nodeId = owner.GetNodeId()
@ -33,6 +35,7 @@ func (this *team) init(teamUuid string, owner common.Player, msg *cs.CMLogin) {
this.owner = owner
this.stateNotifyMsg.JoinMsg.TeamUuid = proto.String(this.teamUuid)
owner.SetTeam(this)
owner.SetSortIdx(this.sortIdx)
this.accountIdHash[owner.GetAccountId()] = owner
}
@ -78,7 +81,9 @@ func (this *team) OnPlayerOnline(hum common.Player) {
}
func (this *team) Join(hum common.Player) bool {
this.sortIdx++
hum.SetTeam(this)
hum.SetSortIdx(this.sortIdx)
this.accountIdHash[hum.GetAccountId()] = hum
return true
}