From 2e7ea3619a2f9da03db0fca6d0d354b40cb14709 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 19 Mar 2024 17:59:05 +0800 Subject: [PATCH] 1 --- server/matchserver/team/team.go | 47 ++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/server/matchserver/team/team.go b/server/matchserver/team/team.go index 3ff45c12..4388e445 100644 --- a/server/matchserver/team/team.go +++ b/server/matchserver/team/team.go @@ -126,7 +126,24 @@ func (this *team) setMatchOk(targetM *team) { this.matchTick = q5.GetTickCount() } +func (this *team) isMainTeam() bool{ + if this.matchOk == nil { + return true + } + return this.GetTeamUuid() < this.matchOk.GetTeamUuid() +} + func (this *team) onMatchOk() { + this.state = constant.TEAM_STATE_STARTED + this.startTime = f5.GetApp().GetNowSeconds() + this.stateNotifyMsg.State = proto.Int32(this.state) + this.genStartGameInfo() + this.SendStateNotify() + f5.GetTimer().SetInterval(1000, func(e int32, args *q5.Args) { + if e == q5.TIMER_EXEC_EVENT { + this.SendStateNotify() + } + }) } func (this *team) CanStartGame(hum common.Player) bool { @@ -241,6 +258,8 @@ func (this *team) CancelMatch() { if this.Matching() { _matchMgr.cancelMatch(this) this.state = constant.TEAM_STATE_INIT + this.stateNotifyMsg.State = proto.Int32(this.state) + this.SendStateNotify() } } @@ -297,13 +316,27 @@ func (this *team) genStartGameInfo() { } { q5.NewSlice(&startInfo.TeamList, 0, 10) - ele := q5.NewSliceElement(&startInfo.TeamList) - ele.TeamUuid = this.GetTeamUuid() - for _, m := range this.accountIdHash { - ele2 := q5.NewSliceElement(&ele.Members) - ele2.AccountId = m.GetAccountId() - ele2.SpecSkill = m.GetSpecSkill() - ele2.HeroUniId = m.GetHeroUniid() + teamList := []*team{} + q5.NewSlice(&teamList, 0, 10) + { + ele := q5.NewSliceElement(&teamList) + *ele = this + } + { + if this.matchOk != nil { + ele := q5.NewSliceElement(&teamList) + *ele = this.matchOk + } + } + for _, t := range teamList { + ele := q5.NewSliceElement(&startInfo.TeamList) + ele.TeamUuid = t.GetTeamUuid() + for _, m := range t.accountIdHash { + ele2 := q5.NewSliceElement(&ele.Members) + ele2.AccountId = m.GetAccountId() + ele2.SpecSkill = m.GetSpecSkill() + ele2.HeroUniId = m.GetHeroUniid() + } } } sign := q5.Md5Str(q5.EncodeJson(&startInfo) + "520d8eAbB(8cf1^#$^&!@d833a42c820432PDAFE^^)")