1
This commit is contained in:
parent
899f7dcf11
commit
3a9bf7cfd2
@ -52,6 +52,7 @@ type Team interface {
|
|||||||
HandoverLeader(Player, string)
|
HandoverLeader(Player, string)
|
||||||
CancelMatch()
|
CancelMatch()
|
||||||
SetReady(Player)
|
SetReady(Player)
|
||||||
|
GrantInvitePermission(Player, string)
|
||||||
}
|
}
|
||||||
|
|
||||||
type TeamMgr interface {
|
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) {
|
func (this *player) CMHandoverLeader(hdr *f5.MsgHdr, msg *cs.CMHandoverLeader) {
|
||||||
rspMsg := &cs.SMHandoverLeader{}
|
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)
|
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) {
|
func (this *player) CMCancel(hdr *f5.MsgHdr, msg *cs.CMCancel) {
|
||||||
rspMsg := &cs.SMCancel{}
|
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)
|
this.SendMsg(rspMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *player) CMSetReady(hdr *f5.MsgHdr, msg *cs.CMSetReady) {
|
func (this *player) CMSetReady(hdr *f5.MsgHdr, msg *cs.CMSetReady) {
|
||||||
rspMsg := &cs.SMSetReady{}
|
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)
|
this.SendMsg(rspMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *player) CMGrantInvitePermission(hdr *f5.MsgHdr, msg *cs.CMGrantInvitePermission) {
|
func (this *player) CMGrantInvitePermission(hdr *f5.MsgHdr, msg *cs.CMGrantInvitePermission) {
|
||||||
rspMsg := &cs.SMGrantInvitePermission{}
|
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)
|
this.SendMsg(rspMsg)
|
||||||
}
|
}
|
||||||
|
@ -155,6 +155,10 @@ func (this *team) SetReady(common.Player) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *team) GrantInvitePermission(common.Player, string) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (this *team) genStartGameInfo() {
|
func (this *team) genStartGameInfo() {
|
||||||
startInfo := struct {
|
startInfo := struct {
|
||||||
ZoneId int32 `json:"zone_id"`
|
ZoneId int32 `json:"zone_id"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user