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.matchOk.team.setMatchOk(m.team)
m.team.onMatchOk()
m.matchOk.team.onMatchOk()
startTime := f5.GetApp().GetNowSeconds()
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()
}
func (this *team) isMainTeam() bool{
if this.matchOk == nil {
return true
}
return this.GetTeamUuid() < this.matchOk.GetTeamUuid()
func (this *team) isMainTeam() bool {
return this.getMainTeam() == this
}
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.startTime = f5.GetApp().GetNowSeconds()
this.startTime = startTime
this.stateNotifyMsg.State = proto.Int32(this.state)
this.genStartGameInfo()
this.SendStateNotify()
@ -311,13 +319,14 @@ func (this *team) genStartGameInfo() {
ZoneId: this.GetZoneId(),
NodeId: this.GetNodeId(),
MapId: this.mapInfo.MapId,
RoomUuid: q5.ToString(this.GetTeamUuid()),
RoomUuid: q5.ToString(this.getMainTeam().GetTeamUuid()),
StartTime: int32(this.startTime),
}
{
q5.NewSlice(&startInfo.TeamList, 0, 10)
teamList := []*team{}
q5.NewSlice(&teamList, 0, 10)
if this.isMainTeam() {
{
ele := q5.NewSliceElement(&teamList)
*ele = this
@ -328,6 +337,18 @@ func (this *team) genStartGameInfo() {
*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 {
ele := q5.NewSliceElement(&startInfo.TeamList)
ele.TeamUuid = t.GetTeamUuid()
@ -341,7 +362,7 @@ func (this *team) genStartGameInfo() {
}
sign := q5.Md5Str(q5.EncodeJson(&startInfo) + "520d8eAbB(8cf1^#$^&!@d833a42c820432PDAFE^^)")
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)
}