local UISyncTeamPVPHallOfFame = UIViewClass() local RankToImage = { [1] = "mrt_icon_01", [2] = "mrt_icon_02", [3] = "mrt_icon_03" } function UISyncTeamPVPHallOfFame:OnOpened() self:RegistSystemEvent(EventID.UI_Sync_HallOfFameRefresh, self.RefreshPanel) self.seasonIdToDetailDict = nil UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS["IDS_RankOptimization_HOF"]) self:InitData() end function UISyncTeamPVPHallOfFame:InitData() local activityId, titleIDS = MDL.FairPlay.GetFamousFameParams() self.activityId = activityId MDL.FairPlay.HistoryFamousRequest(activityId) end function UISyncTeamPVPHallOfFame:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UISyncTeamPVPHallOfFame:OnButtonClicked(comp) if self.UICommonPopUp.btn_Close == comp then self:CloseView() else for i, v in ipairs (self.cells) do if v.btn == comp then if self.rankInfos and self.rankInfos[i] then local rankInfo = self.rankInfos[i] if rankInfo.acid ~= BattleDataGetter.GetAcID() then CTL.PlayerInteract.OpenFriendInteractView(rankInfo.acid) end end break end end end end function UISyncTeamPVPHallOfFame:OnCellInit(scrollRect, index, cellTable, data) UIUtils.SetActive(cellTable.img_RedDot, false) UIUtils.SetActive(cellTable.img_Arrow, false) UIUtils.SetActive(cellTable.group_SignState, false) UIUtils.SetActive(cellTable.img_ArrowS, false) UIUtils.SetActive(cellTable.group_SignStateS, false) local seasonStr = string.format(UIUtils.GetLocalizedTxt(Const_IDS.IDS_SeasonAndRank_SeasonID), data) UIUtils.SetLabel(cellTable.txt_Name_Nomal, seasonStr) UIUtils.SetLabel(cellTable.txt_Name_Selected, seasonStr) end function UISyncTeamPVPHallOfFame:OnCellSelect(scrollRect, index, cellTable, data) self.rankInfos = self.seasonIdToDetailDict[data] for i, v in ipairs (self.cells) do local rankInfo = (self.rankInfos and self.rankInfos[i]) and self.rankInfos[i] or nil UIUtils.SetActive(v.gameObject, true) UIUtils.SetActive(v.group_Info, rankInfo ~= nil) UIUtils.SetActive(v.group_empty, rankInfo == nil) if rankInfo then UTL.Item.SetAtlasSprite(v.img_Rank, "UI_FairPlay", RankToImage[i]) local tlData = rankInfo.level>0 and DataSheetManager.TeamLevelData:GetDataByTeamLevel(rankInfo.level) or nil local level if tlData ~= nil then level = tlData.TeamLevel end CTL.Character.SetPortraitAndFrame(v.UIHeroHead150, rankInfo.portraitId, rankInfo.frameId,rankInfo.level) local rankCfg = nil if self.activityId == LuaConst.ActivityType.TVT then rankCfg = DataSheetManager.ThreeBattleLevelData:GetDataByLevelID(rankInfo.dan) elseif self.activityId == LuaConst.ActivityType.SyncSolo then rankCfg = DataSheetManager.SyncSoloData:GetDataByLevelID(rankInfo.dan) end if rankCfg then UIUtils.SetLabelText(v.txt_Rank, Const_IDS[rankCfg.LevelName]) end UIUtils.SetLabel(v.txt_Score, string.format(UIUtils.GetLocalizedTxt(Const_IDS["IDS_RankOptimization_Score"]), rankInfo.elo)) UIUtils.SetLabel(v.txt_PlayerName, rankInfo.name) UIUtils.SetLabel(v.txt_Server, string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, rankInfo.serName)) end end end function UISyncTeamPVPHallOfFame:RefreshPanel(msg) self.UICommonPopUp.loop_Tab:ClearCells() if msg.famousInfo and #msg.famousInfo > 0 then self.seasonIdToDetailDict = LuaExt.CreateTable(0, #msg.famousInfo) for _, v in ipairs (msg.famousInfo) do self.UICommonPopUp.loop_Tab:AddData(v.seasonId, 0) self.seasonIdToDetailDict[v.seasonId] = v.infos end self.UICommonPopUp.loop_Tab:SelectIndex(0) else for _, v in ipairs (self.cells) do UIUtils.SetActive(v.group_Info, false) UIUtils.SetActive(v.group_empty, true) end end end return UISyncTeamPVPHallOfFame