local UIHeroMatch3v3Stage1_Filtration = UIViewClass() function UIHeroMatch3v3Stage1_Filtration:OnOpened(context) self:RegistSystemEvent(EventID.UI_RefreshRankInfo, self.RefreshHeroMatch3v3Rank) self:RefreshHeroMatch3v3Rank(MDL.Rank.RankType.HeroMatch3v3) self:UpdateRankListRepeatFunc() end ---@public 筛选赛匹配阶段刷新排行榜 function UIHeroMatch3v3Stage1_Filtration:UpdateRankListRepeatFunc(deltaTime, timeSinceUpdate) self.curMatchTimeID = MDL.HeroMatch3v3.GetCurMatchTimeID() self.winnerStageInfo = MDL.HeroMatch3v3.GetMatchStageInfo(MDL.HeroMatch3v3.GetCurStageID()) local MatchTime = DataSheetManager.TeamMatchTime:GetDataByID(self.curMatchTimeID) if self.curMatchTimeID >= MDL.HeroMatch3v3.Enum_BigStage.Display or self.winnerStageInfo.state == MDL.HeroMatch3v3.Enum_State.Finish or not UTL.Time.IsServerInOpeningTime(MatchTime.StartTime, MatchTime.EndTime) then -- 不在筛选赛时间范围内,停止更新 self:StopRepeatFunc(self.UpdateRankListRepeatFunc) self.updateRankHandle = nil else if not self.updateRankHandle then self:StartRepeatFunc(self.UpdateRankListRepeatFunc, 5) self.updateRankHandle = true end end MDL.Rank.GetRankInfoReq(MDL.Rank.RankType.HeroMatch3v3, { isPreRank = false }, CTL.Rank.SortType.MyServer) end function UIHeroMatch3v3Stage1_Filtration:OnCellInit(scrollRect, index, cellTable, data) cellTable.state_Bg:SetState(data.index % 2) self:SetRankCell(cellTable, data) end function UIHeroMatch3v3Stage1_Filtration:OnCellClicked(scrollRect, index, cellTable, target, data) if target == cellTable.btn_TeamInfo then MDL.HeroMatch3v3.GetHeroMatchTeamSimpleInfoRequest(data.acid) end end function UIHeroMatch3v3Stage1_Filtration:RefreshHeroMatch3v3Rank(rankType, subData) self.state_Open:SetState(0) self.cdTimer:EndTimer() self.curStageID = MDL.HeroMatch3v3.GetCurStageID() if self.curStageID == MDL.HeroMatch3v3.Stage.Filtration_1 then local MatchTime = DataSheetManager.TeamMatchTime:GetDataByID(MDL.HeroMatch3v3.GetCurMatchTimeID()) if UTL.Time.IsServerInOpeningTime(4, 1) then self:UpdateRankList(rankType) else local timer = UTL.Time.GetServerTimestampByTimeId(MatchTime.StartTime) - UTL.Time.GetServerTimestamp() if timer > 0 then self.state_Open:SetState(1) self.cdTimer:ResetAndBeginTimer(false, timer) else self:UpdateRankList(rankType) end end else self:UpdateRankList(rankType) end end function UIHeroMatch3v3Stage1_Filtration:UpdateRankList(rankType) if rankType == MDL.Rank.RankType.HeroMatch3v3 then local rankList = MDL.Rank.GetRankInfoDataByType(MDL.Rank.RankType.HeroMatch3v3) if not rankList or #rankList == 0 then UIUtils.SetActive(self.group_Empty, true) UIUtils.SetActive(self.group_Mine.gameObject, false) else UIUtils.SetActive(self.group_Empty, false) self.LoopScroll_PlayerInfo:ReloadAll(rankList) end -- 设置自己排名信息 local info = MDL.Rank.GetMyRankInfo() if string.isNilOrEmpty(info.name) then UIUtils.SetActive(self.group_Mine.gameObject, false) else UIUtils.SetActive(self.group_Mine.gameObject, true) self:SetRankCell(self.group_Mine, info) end end end function UIHeroMatch3v3Stage1_Filtration:SetRankCell(cellTable, data) local rank = data.index -- 设置排名 if rank == nil or rank <= 0 then UIUtils.SetLabelText(cellTable.group_Rank.txt_Rank, Const_IDS.IDS_Rank_Unranked) cellTable.group_Rank.state_Rank:SetState(3) else UIUtils.SetLabel(cellTable.group_Rank.txt_Rank, rank) cellTable.group_Rank.state_Rank:SetState(rank <= 3 and rank - 1 or 3) end UIUtils.SetLabel(cellTable.txt_TeamName, data.name) -- 设置名字 UIUtils.SetLabel(cellTable.txt_BR, data.param1) -- 战力 UIUtils.SetLabel(cellTable.txt_Win, data.param2) -- 筛选赛胜场数 UIUtils.SetLabel(cellTable.txt_Beat, data.thumbsUpNum) -- 杀敌数 UIUtils.SetLabel(cellTable.txt_ServerNum, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, data.serverId)) end function UIHeroMatch3v3Stage1_Filtration:OnButtonClicked(comp) if comp == self.group_Mine.btn_TeamInfo then MDL.HeroMatch3v3.GetHeroMatchTeamSimpleInfoRequest(MDL.SpecialTeam.GetMyTeamId()) end end return UIHeroMatch3v3Stage1_Filtration