This commit is contained in:
aozhiwei 2024-03-11 11:12:23 +08:00
parent d55122d764
commit 413fe047f5
2 changed files with 19 additions and 5 deletions

View File

@ -18,6 +18,7 @@ type Team interface {
type TeamMgr interface {
ProcessCMMsg(*cs.CsNetMsgHandler, *f5.MsgHdr)
GetTeamByUuid(string) Team
}
type Player interface {

View File

@ -170,12 +170,25 @@ func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.HttpCli
return
}
hum := new(player)
hum.init(pendingReq, rspObj.Info.Name, rspObj.Info.HeadId, rspObj.Info.HeroId, rspObj.Info.HeadFrame)
this.socketHash[pendingReq.hdr.GetSocket()] = hum
if msg.GetCreateTeamParam() != nil {
hum := new(player)
hum.init(pendingReq, rspObj.Info.Name, rspObj.Info.HeadId, rspObj.Info.HeroId, rspObj.Info.HeadFrame)
this.socketHash[pendingReq.hdr.GetSocket()] = hum
rspMsg.ServerInfo = proto.String(mt.Table.MatchCluster.GetServerInfo())
GetWspListener().SendProxyMsg(hdr.Conn, hdr.SocketHandle, &rspMsg)
rspMsg.ServerInfo = proto.String(mt.Table.MatchCluster.GetServerInfo())
GetWspListener().SendProxyMsg(hdr.Conn, hdr.SocketHandle, &rspMsg)
} else if msg.GetJoinTeamParam() != nil {
team := GetTeamMgr().GetTeamByUuid(msg.GetJoinTeamParam().GetTeamUuid())
if team == nil {
rspMsg.Errcode = proto.Int32(101)
rspMsg.Errmsg = proto.String("join team error team not found")
GetWspListener().SendProxyMsg(pendingReq.hdr.Conn, pendingReq.hdr.SocketHandle, &rspMsg)
f5.GetSysLog().Warning("game2006api login auth errcode:%d", rspObj.Errcode)
return
}
} else {
panic("CMLogin Param error")
}
}
func (this *playerMgr) reportServerState(masterIp string, masterPort int32) {