1
This commit is contained in:
parent
899f7dcf11
commit
3a9bf7cfd2
@ -52,6 +52,7 @@ type Team interface {
|
||||
HandoverLeader(Player, string)
|
||||
CancelMatch()
|
||||
SetReady(Player)
|
||||
GrantInvitePermission(Player, string)
|
||||
}
|
||||
|
||||
type TeamMgr interface {
|
||||
|
@ -186,8 +186,11 @@ func (this *player) CMKickOut(hdr *f5.MsgHdr, msg *cs.CMKickOut) {
|
||||
|
||||
func (this *player) CMHandoverLeader(hdr *f5.MsgHdr, msg *cs.CMHandoverLeader) {
|
||||
rspMsg := &cs.SMHandoverLeader{}
|
||||
if !this.GetTeam().Started() {
|
||||
|
||||
if this.GetTeam().Started() {
|
||||
rspMsg.Errcode = proto.Int32(1)
|
||||
rspMsg.Errmsg = proto.String("team already started")
|
||||
} else {
|
||||
this.GetTeam().HandoverLeader(this, msg.GetTargetId())
|
||||
}
|
||||
this.SendMsg(rspMsg)
|
||||
}
|
||||
@ -204,24 +207,33 @@ func (this *player) CMStartGame(hdr *f5.MsgHdr, msg *cs.CMStartGame) {
|
||||
|
||||
func (this *player) CMCancel(hdr *f5.MsgHdr, msg *cs.CMCancel) {
|
||||
rspMsg := &cs.SMCancel{}
|
||||
if !this.GetTeam().Started() {
|
||||
|
||||
if this.GetTeam().Started() {
|
||||
rspMsg.Errcode = proto.Int32(1)
|
||||
rspMsg.Errmsg = proto.String("team already started")
|
||||
} else {
|
||||
this.GetTeam().CancelMatch()
|
||||
}
|
||||
this.SendMsg(rspMsg)
|
||||
}
|
||||
|
||||
func (this *player) CMSetReady(hdr *f5.MsgHdr, msg *cs.CMSetReady) {
|
||||
rspMsg := &cs.SMSetReady{}
|
||||
if !this.GetTeam().Started() {
|
||||
|
||||
if this.GetTeam().Started() {
|
||||
rspMsg.Errcode = proto.Int32(1)
|
||||
rspMsg.Errmsg = proto.String("team already started")
|
||||
} else {
|
||||
this.GetTeam().SetReady(this)
|
||||
}
|
||||
this.SendMsg(rspMsg)
|
||||
}
|
||||
|
||||
func (this *player) CMGrantInvitePermission(hdr *f5.MsgHdr, msg *cs.CMGrantInvitePermission) {
|
||||
rspMsg := &cs.SMGrantInvitePermission{}
|
||||
if !this.GetTeam().Started() {
|
||||
|
||||
if this.GetTeam().Started() {
|
||||
rspMsg.Errcode = proto.Int32(1)
|
||||
rspMsg.Errmsg = proto.String("team already started")
|
||||
} else {
|
||||
this.GetTeam().GrantInvitePermission(this, msg.GetTargetId())
|
||||
}
|
||||
this.SendMsg(rspMsg)
|
||||
}
|
||||
|
@ -155,6 +155,10 @@ func (this *team) SetReady(common.Player) {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *team) GrantInvitePermission(common.Player, string) {
|
||||
|
||||
}
|
||||
|
||||
func (this *team) genStartGameInfo() {
|
||||
startInfo := struct {
|
||||
ZoneId int32 `json:"zone_id"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user