This commit is contained in:
aozhiwei 2023-09-13 16:40:05 +08:00
parent f3029951ed
commit 1f323b7797
3 changed files with 16 additions and 1 deletions

View File

@ -31,6 +31,7 @@ type Player interface {
GetZoneId() int32
GetNodeId() int32
SendMsg(proto.Message)
IsOnline() bool
}
type PlayerMgr interface {

View File

@ -79,3 +79,7 @@ func (this *player) GetNodeId() int32 {
func (this *player) GetSessionId() string {
return this.sessionId
}
func (this *player) IsOnline() bool {
return this.socket.IsValid()
}

View File

@ -37,7 +37,17 @@ func (this *team) hasAlreadMember() bool {
}
func (this *team) getOwnerCandidate() *member {
return nil
var ownerCandidate *member
this.members.ForEach_r(
func (data interface{}) bool {
m := data.(*member)
if m.hum.IsOnline() {
ownerCandidate = m
return false
}
return true
})
return ownerCandidate
}
func newTeam(teamId int32, leader *member) *team {