1
This commit is contained in:
parent
8914d8eeb6
commit
29e2eddb28
@ -311,6 +311,7 @@ func (this *player) CMChooseHero(hdr *f5.MsgHdr, msg *cs.CMChooseHero) {
|
||||
if this.GetTeam().Started() {
|
||||
rspMsg.Errcode = proto.Int32(1)
|
||||
rspMsg.Errmsg = proto.String("team already started")
|
||||
this.SendMsg(rspMsg)
|
||||
return
|
||||
} else {
|
||||
this.updateChoose(
|
||||
@ -336,11 +337,23 @@ func (this *player) CMChooseMap(hdr *f5.MsgHdr, msg *cs.CMChooseMap) {
|
||||
if this.GetTeam().Started() {
|
||||
rspMsg.Errcode = proto.Int32(1)
|
||||
rspMsg.Errmsg = proto.String("team already started")
|
||||
this.SendMsg(rspMsg)
|
||||
} else {
|
||||
//this.GetTeam().SetMapId(msg.GetMapId())
|
||||
this.updateMap(
|
||||
msg.GetMapId(),
|
||||
func (errCode int32, errMsg string) {
|
||||
if errCode == 0 {
|
||||
this.SendMsg(rspMsg)
|
||||
if this.GetTeam() != nil {
|
||||
this.GetTeam().SendUpdateNotify()
|
||||
}
|
||||
} else {
|
||||
rspMsg.Errcode = proto.Int32(errCode)
|
||||
rspMsg.Errmsg = proto.String(errMsg)
|
||||
this.SendMsg(rspMsg)
|
||||
}
|
||||
})
|
||||
}
|
||||
this.SendMsg(rspMsg)
|
||||
this.GetTeam().SendUpdateNotify()
|
||||
}
|
||||
|
||||
func (this *player) updateChoose(skillId int32, heroUniId string,
|
||||
@ -389,6 +402,50 @@ func (this *player) updateChoose(skillId int32, heroUniId string,
|
||||
})
|
||||
}
|
||||
|
||||
func (this *player) updateMap(mapId int32,
|
||||
cb func (int32, string)) {
|
||||
params := map[string]string{
|
||||
"c": "User",
|
||||
"a": "getMapConf",
|
||||
"account_id": this.accountId,
|
||||
"session_id": this.sessionId,
|
||||
"map_id": q5.ToString(mapId),
|
||||
}
|
||||
url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Config.GetById(0).GetGameapiUrl())
|
||||
f5.GetHttpCliMgr().SendJsStyleRequest(
|
||||
url,
|
||||
params,
|
||||
func(rsp f5.HttpCliResponse) {
|
||||
if this.GetTeam() != nil && !this.GetTeam().Started() {
|
||||
if rsp.GetErr() != nil {
|
||||
cb(500, "server internal error")
|
||||
return
|
||||
}
|
||||
}
|
||||
rspObj := common.MapInfoRsp{}
|
||||
{
|
||||
f5.GetSysLog().Info("updateMap:%s", rsp.GetRawData())
|
||||
err := json.Unmarshal([]byte(rsp.GetRawData()), &rspObj)
|
||||
if err != nil {
|
||||
cb(500, "server internal error")
|
||||
return
|
||||
}
|
||||
if rspObj.MapId == 0 {
|
||||
cb(1, "map error")
|
||||
return
|
||||
}
|
||||
if rspObj.IsOpen == 0 {
|
||||
cb(2, "map no open")
|
||||
return
|
||||
}
|
||||
{
|
||||
this.GetTeam().SetMapInfo(&rspObj)
|
||||
cb(0, "")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (this *player) CMGrantInvitePermission(hdr *f5.MsgHdr, msg *cs.CMGrantInvitePermission) {
|
||||
rspMsg := &cs.SMGrantInvitePermission{}
|
||||
if this.GetTeam().Started() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user