This commit is contained in:
aozhiwei 2024-03-13 19:48:33 +08:00
parent 3a9bf7cfd2
commit 1431ccc2a0
2 changed files with 28 additions and 6 deletions

View File

@ -153,6 +153,7 @@ func (this *player) FillMFTeamMember(member_pb *cs.MFTeamMember) {
func (this *player) CMLeaveTeam(hdr *f5.MsgHdr, msg *cs.CMLeaveTeam) {
rspMsg := &cs.SMLeaveTeam{}
team := this.GetTeam()
if this.GetTeam().Started() {
rspMsg.Errcode = proto.Int32(1)
rspMsg.Errmsg = proto.String("team already started")
@ -160,10 +161,12 @@ func (this *player) CMLeaveTeam(hdr *f5.MsgHdr, msg *cs.CMLeaveTeam) {
this.GetTeam().Leave(this)
}
this.SendMsg(rspMsg)
team.SendStateNotify()
}
func (this *player) CMDisbandTeam(hdr *f5.MsgHdr, msg *cs.CMDisbandTeam) {
rspMsg := &cs.SMDisbandTeam{}
team := this.GetTeam()
if this.GetTeam().Started() {
rspMsg.Errcode = proto.Int32(1)
rspMsg.Errmsg = proto.String("team already started")
@ -171,10 +174,12 @@ func (this *player) CMDisbandTeam(hdr *f5.MsgHdr, msg *cs.CMDisbandTeam) {
this.GetTeam().Disband()
}
this.SendMsg(rspMsg)
team.SendStateNotify()
}
func (this *player) CMKickOut(hdr *f5.MsgHdr, msg *cs.CMKickOut) {
rspMsg := &cs.SMKickOut{}
team := this.GetTeam()
if this.GetTeam().Started() {
rspMsg.Errcode = proto.Int32(1)
rspMsg.Errmsg = proto.String("team already started")
@ -182,10 +187,12 @@ func (this *player) CMKickOut(hdr *f5.MsgHdr, msg *cs.CMKickOut) {
this.GetTeam().KickOut(this, msg.GetTargetId())
}
this.SendMsg(rspMsg)
team.SendStateNotify()
}
func (this *player) CMHandoverLeader(hdr *f5.MsgHdr, msg *cs.CMHandoverLeader) {
rspMsg := &cs.SMHandoverLeader{}
team := this.GetTeam()
if this.GetTeam().Started() {
rspMsg.Errcode = proto.Int32(1)
rspMsg.Errmsg = proto.String("team already started")
@ -193,6 +200,7 @@ func (this *player) CMHandoverLeader(hdr *f5.MsgHdr, msg *cs.CMHandoverLeader) {
this.GetTeam().HandoverLeader(this, msg.GetTargetId())
}
this.SendMsg(rspMsg)
team.SendStateNotify()
}
func (this *player) CMStartGame(hdr *f5.MsgHdr, msg *cs.CMStartGame) {
@ -214,6 +222,7 @@ func (this *player) CMCancel(hdr *f5.MsgHdr, msg *cs.CMCancel) {
this.GetTeam().CancelMatch()
}
this.SendMsg(rspMsg)
this.GetTeam().SendStateNotify()
}
func (this *player) CMSetReady(hdr *f5.MsgHdr, msg *cs.CMSetReady) {
@ -225,6 +234,7 @@ func (this *player) CMSetReady(hdr *f5.MsgHdr, msg *cs.CMSetReady) {
this.GetTeam().SetReady(this)
}
this.SendMsg(rspMsg)
this.GetTeam().SendStateNotify()
}
func (this *player) CMGrantInvitePermission(hdr *f5.MsgHdr, msg *cs.CMGrantInvitePermission) {
@ -236,6 +246,7 @@ func (this *player) CMGrantInvitePermission(hdr *f5.MsgHdr, msg *cs.CMGrantInvit
this.GetTeam().GrantInvitePermission(this, msg.GetTargetId())
}
this.SendMsg(rspMsg)
this.GetTeam().SendStateNotify()
}
func newPlayer() *player {

View File

@ -119,9 +119,13 @@ func (this *team) StartGame() {
}
}
func (this *team) Leave(common.Player) {
func (this *team) Leave(hum common.Player) {
if !this.Started() {
if this.IsLeader(hum) {
} else {
}
}
}
@ -131,32 +135,39 @@ func (this *team) Disband() {
}
}
func (this *team) KickOut(common.Player, string) {
func (this *team) KickOut(hum common.Player, targetId string) {
if !this.Started() {
if this.IsLeader(hum) {
}
}
}
func (this *team) HandoverLeader(common.Player, string) {
func (this *team) HandoverLeader(hum common.Player, targetId string) {
if !this.Started() {
if this.IsLeader(hum) {
}
}
}
func (this *team) CancelMatch() {
if !this.Started() {
}
}
func (this *team) SetReady(common.Player) {
func (this *team) SetReady(hum common.Player) {
if !this.Started() {
}
}
func (this *team) GrantInvitePermission(common.Player, string) {
func (this *team) GrantInvitePermission(hum common.Player, targetId string) {
if !this.Started() {
if this.IsLeader(hum) {
}
}
}
func (this *team) genStartGameInfo() {