This commit is contained in:
aozhiwei 2024-03-12 17:49:51 +08:00
parent 15ca5cc7c0
commit d79f947b7d
3 changed files with 8 additions and 6 deletions

View File

@ -47,6 +47,7 @@ type TeamMgr interface {
ProcessCMMsg(*cs.CsNetMsgHandler, *f5.MsgHdr)
CreateTeam(Player, *cs.CMLogin) Team
GetTeamByUuid(string) Team
RefreshHisTeam(Player)
}
type Player interface {
@ -66,10 +67,6 @@ type PlayerMgr interface {
ProcessCMMsg(*cs.CsNetMsgHandler, *f5.MsgHdr)
GetPlayerBySocket(f5.WspCliConn) Player
GetPlayerByAccountId(string) Player
HasHisPendingTeam(Player) bool
TraverseHisPendingTeam(Player)
HasHisStartedTeam(Player) bool
TraverseHisStartedTeam(Player)
}
type WspListener interface {

View File

@ -174,3 +174,8 @@ func (this *player) CMSetReady(hdr *f5.MsgHdr, msg *cs.CMSetReady) {
func (this *player) CMGrantInvitePermission(hdr *f5.MsgHdr, msg *cs.CMGrantInvitePermission) {
}
func newPlayer() *player {
hum := new(player)
return hum
}

View File

@ -158,7 +158,7 @@ func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.HttpCli
}
if msg.GetCreateTeamParam() != nil {
hum := new(player)
hum := newPlayer()
hum.init(pendingReq, &rspObj)
this.socketHash[pendingReq.hdr.GetSocket()] = hum
team := GetTeamMgr().CreateTeam(hum, msg)
@ -196,7 +196,7 @@ func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.HttpCli
hum.againInit(pendingReq, &rspObj)
this.socketHash[pendingReq.hdr.GetSocket()] = hum
} else {
hum := new(player)
hum := newPlayer()
hum.init(pendingReq, &rspObj)
this.socketHash[pendingReq.hdr.GetSocket()] = hum
team.Join(hum)