This commit is contained in:
aozhiwei 2024-04-20 11:46:20 +08:00
parent 8557cf5062
commit 097633cc40
3 changed files with 14 additions and 1 deletions

View File

@ -102,9 +102,9 @@ type Team interface {
GetTeamUuid() string GetTeamUuid() string
CanJoin(string) bool CanJoin(string) bool
Join(Player) bool Join(Player) bool
ReJoin(Player)
GetMemberByAccountId(string) Player GetMemberByAccountId(string) Player
OnPlayerOffline(Player) OnPlayerOffline(Player)
OnPlayerOnline(Player)
IsCopy() bool IsCopy() bool
GetCopyIdx() int32 GetCopyIdx() int32
SendUpdateNotify() SendUpdateNotify()

View File

@ -217,6 +217,7 @@ func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.HttpCli
} }
hum.againInit(pendingReq, &rspObj) hum.againInit(pendingReq, &rspObj)
this.socketHash[pendingReq.hdr.GetSocket()] = hum this.socketHash[pendingReq.hdr.GetSocket()] = hum
team.ReJoin(hum)
} else { } else {
hum = newPlayer() hum = newPlayer()
hum.init(pendingReq, &rspObj) hum.init(pendingReq, &rspObj)

View File

@ -32,6 +32,7 @@ type team struct {
startTime int64 startTime int64
stateNotifyMsg *cs.SMTeamStateNotify stateNotifyMsg *cs.SMTeamStateNotify
memberIdHash map[string]common.Player memberIdHash map[string]common.Player
preTeamRealPlayerHash map[string]int64
robotList []*robot robotList []*robot
matchOk *team matchOk *team
matchTick int64 matchTick int64
@ -74,6 +75,12 @@ func (this *team) init(copyIdx int32, zoneId int32, nodeId int32,
this.memberIdHash[owner.GetAccountId()] = owner this.memberIdHash[owner.GetAccountId()] = owner
} }
func (this *team) postInit() {
if this.IsCopy() {
}
}
func (this *team) GetZoneId() int32 { func (this *team) GetZoneId() int32 {
return this.zoneId return this.zoneId
} }
@ -119,6 +126,9 @@ func (this *team) OnPlayerOnline(hum common.Player) {
} }
func (this *team) ReJoin(hum common.Player) {
}
func (this *team) Join(hum common.Player) bool { func (this *team) Join(hum common.Player) bool {
this.sortIdx++ this.sortIdx++
hum.SetTeam(this) hum.SetTeam(this)
@ -499,6 +509,7 @@ func (this *team) genNextCopyTeam() {
} }
} }
_teamMgr.addTeam(nextTeam) _teamMgr.addTeam(nextTeam)
nextTeam.postInit()
} }
func (this *team) broadcastMsg(msg proto.Message) { func (this *team) broadcastMsg(msg proto.Message) {
@ -559,6 +570,7 @@ func newTeam() *team {
t.stateNotifyMsg = &cs.SMTeamStateNotify{} t.stateNotifyMsg = &cs.SMTeamStateNotify{}
t.stateNotifyMsg.JoinMsg = &cs.MFJoinMsg{} t.stateNotifyMsg.JoinMsg = &cs.MFJoinMsg{}
t.memberIdHash = map[string]common.Player{} t.memberIdHash = map[string]common.Player{}
t.preTeamRealPlayerHash = make(map[string]int64)
t.robotList = []*robot{} t.robotList = []*robot{}
{ {
cb := func (meta *mt.Robot) bool { cb := func (meta *mt.Robot) bool {