This commit is contained in:
aozhiwei 2024-03-19 18:44:33 +08:00
parent 2e7ea3619a
commit 5e81710e6a
2 changed files with 40 additions and 18 deletions

View File

@ -108,6 +108,7 @@ func (this *matchMgr) onMatchOk(m *matchingInfo) {
m.team.setMatchOk(m.matchOk.team) m.team.setMatchOk(m.matchOk.team)
m.matchOk.team.setMatchOk(m.team) m.matchOk.team.setMatchOk(m.team)
m.team.onMatchOk() startTime := f5.GetApp().GetNowSeconds()
m.matchOk.team.onMatchOk() m.team.onMatchOk(startTime)
m.matchOk.team.onMatchOk(startTime)
} }

View File

@ -126,16 +126,24 @@ func (this *team) setMatchOk(targetM *team) {
this.matchTick = q5.GetTickCount() this.matchTick = q5.GetTickCount()
} }
func (this *team) isMainTeam() bool{ func (this *team) isMainTeam() bool {
if this.matchOk == nil { return this.getMainTeam() == this
return true
}
return this.GetTeamUuid() < this.matchOk.GetTeamUuid()
} }
func (this *team) onMatchOk() { func (this *team) getMainTeam() *team {
if this.matchOk == nil {
return this
}
if this.GetTeamUuid() < this.matchOk.GetTeamUuid() {
return this
} else {
return this.matchOk
}
}
func (this *team) onMatchOk(startTime int64) {
this.state = constant.TEAM_STATE_STARTED this.state = constant.TEAM_STATE_STARTED
this.startTime = f5.GetApp().GetNowSeconds() this.startTime = startTime
this.stateNotifyMsg.State = proto.Int32(this.state) this.stateNotifyMsg.State = proto.Int32(this.state)
this.genStartGameInfo() this.genStartGameInfo()
this.SendStateNotify() this.SendStateNotify()
@ -311,21 +319,34 @@ func (this *team) genStartGameInfo() {
ZoneId: this.GetZoneId(), ZoneId: this.GetZoneId(),
NodeId: this.GetNodeId(), NodeId: this.GetNodeId(),
MapId: this.mapInfo.MapId, MapId: this.mapInfo.MapId,
RoomUuid: q5.ToString(this.GetTeamUuid()), RoomUuid: q5.ToString(this.getMainTeam().GetTeamUuid()),
StartTime: int32(this.startTime), StartTime: int32(this.startTime),
} }
{ {
q5.NewSlice(&startInfo.TeamList, 0, 10) q5.NewSlice(&startInfo.TeamList, 0, 10)
teamList := []*team{} teamList := []*team{}
q5.NewSlice(&teamList, 0, 10) q5.NewSlice(&teamList, 0, 10)
{ if this.isMainTeam() {
ele := q5.NewSliceElement(&teamList) {
*ele = this
}
{
if this.matchOk != nil {
ele := q5.NewSliceElement(&teamList) ele := q5.NewSliceElement(&teamList)
*ele = this.matchOk *ele = this
}
{
if this.matchOk != nil {
ele := q5.NewSliceElement(&teamList)
*ele = this.matchOk
}
}
} else {
{
if this.matchOk != nil {
ele := q5.NewSliceElement(&teamList)
*ele = this.matchOk
}
}
{
ele := q5.NewSliceElement(&teamList)
*ele = this
} }
} }
for _, t := range teamList { for _, t := range teamList {
@ -341,7 +362,7 @@ func (this *team) genStartGameInfo() {
} }
sign := q5.Md5Str(q5.EncodeJson(&startInfo) + "520d8eAbB(8cf1^#$^&!@d833a42c820432PDAFE^^)") sign := q5.Md5Str(q5.EncodeJson(&startInfo) + "520d8eAbB(8cf1^#$^&!@d833a42c820432PDAFE^^)")
payload := sign + ":" + "normal_room|" + q5.EncodeJson(&startInfo) payload := sign + ":" + "normal_room|" + q5.EncodeJson(&startInfo)
this.stateNotifyMsg.JoinMsg.TeamUuid = proto.String(this.GetTeamUuid()) this.stateNotifyMsg.JoinMsg.TeamUuid = proto.String(this.getMainTeam().GetTeamUuid())
this.stateNotifyMsg.JoinMsg.Payload = proto.String(payload) this.stateNotifyMsg.JoinMsg.Payload = proto.String(payload)
} }