local UITeamFairChampionshipCourse = UIViewClass() local CellEnum = { MDL.TeamFairChampionship.Stage.Filtration_1, MDL.TeamFairChampionship.Stage.Filtration_2, MDL.TeamFairChampionship.Stage.match_64T32, MDL.TeamFairChampionship.Stage.match_32T16, MDL.TeamFairChampionship.Stage.match_16T8, MDL.TeamFairChampionship.Stage.match_8T4, MDL.TeamFairChampionship.Stage.match_4T2, MDL.TeamFairChampionship.Stage.match_2T1, } function UITeamFairChampionshipCourse:OnOpened(context) for i, v in ipairs(CellEnum) do self.loop_CourseList:AddData(v, 0) end end function UITeamFairChampionshipCourse:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() end end function UITeamFairChampionshipCourse:OnCellInit(scrollRect, index, cellTable, data) local colorStr = self:GetColor(data) local stageCfg = DataSheetManager.TeamFairMatchStage:GetDataByID(data) local matchNameStr = UIUtils.GetLocalizedTxt(Const_IDS[stageCfg.InterfaceDes]) if stageCfg.NowStage == MDL.TeamFairChampionship.Enum_BigStage.Rank or stageCfg.NowStage == MDL.TeamFairChampionship.Enum_BigStage.Finals then matchNameStr = UIUtils.GetLocalizedTxt(Const_IDS[stageCfg.IconDes]) .. "-" .. matchNameStr end cellTable.txt_Course.text = UTL.Color.FormatTextByColor(colorStr, matchNameStr) cellTable.txt_Date.text = self:GetTimeShow(data, colorStr) UIUtils.SetActive(cellTable.img_01, index % 2 == 0) UIUtils.SetActive(cellTable.img_02, index % 2 ~= 0) if data == MDL.TeamFairChampionship.Stage.Filtration_1 or data == MDL.TeamFairChampionship.Stage.Filtration_2 then cellTable.txt_Rule.text = UTL.Color.FormatTextByColor(colorStr, string.FormatByIdsId(Const_IDS.IDS_FairTournament_UpCondition, MDL.TeamFairChampionship.GetEnterEachGroup())) else cellTable.txt_Rule.text = UTL.Color.FormatTextByColor(colorStr, UIUtils.GetLocalizedTxt(Const_IDS.IDS_FairTournament_UpCondition2)) end end function UITeamFairChampionshipCourse:GetTimeShow(cellEnum, colorStr) local stageDataCfg = DataSheetManager.TeamFairMatchStage:GetDataByID(cellEnum) local timestamp = MDL.TeamFairChampionship.GetBigMatchZeroStartTime(stageDataCfg.NowStage) if cellEnum == MDL.TeamFairChampionship.Stage.Filtration_2 then timestamp = timestamp+UTL.Time.TotalSecondsOneDay end local targetTimestamp = timestamp + DataSheetManager.TimeRefresh:GetDataByID(stageDataCfg.RaceStartTime).HMS local date = UTL.Time.OsDateOriginal("*t", targetTimestamp) local monthDayStr = UTL.String.FormatMonthDay(date.month, date.day) return UTL.Color.FormatTextByColor(colorStr, monthDayStr .. " " .. os.date(UTL.Time.FormatDateEnum.HMS, targetTimestamp)) end function UITeamFairChampionshipCourse:GetColor(cellEnum) if cellEnum == MDL.TeamFairChampionship.Stage.Filtration_1 or cellEnum == MDL.TeamFairChampionship.Stage.Filtration_2 then return "ffffff" elseif cellEnum >= MDL.TeamFairChampionship.Stage.match_16T8 then return "ff4b4b" else return "eea11a" end end return UITeamFairChampionshipCourse