This commit is contained in:
aozhiwei 2024-03-19 17:59:05 +08:00
parent 514ff07d8e
commit 2e7ea3619a

View File

@ -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^^)")