--[[ 战队排名 ]] local UISpecialTeamRank = UIViewClass() function UISpecialTeamRank:OnOpened(context) self:RegistSystemEvent(EventID.UI_SpecialTeam_RecommendTeamListChange, self.RefreshRightTeamList) local startDate, endDate = CTL.SpecialTeam.GetTeamCreateTime() UIUtils.SetLabel(self.lab_Tip, string.FormatByIdsKey("IDS_TeamFairTournamen_ShortlistTip", endDate, CTL.SpecialTeam.GetEnterMatchTeamCount())) MDL.SpecialTeam.TeamWarGetAllServerTeamRankReq() end function UISpecialTeamRank:OnClosed() MDL.SpecialTeam.ClearRecommendTeamList() end function UISpecialTeamRank:RefreshRightTeamList(beginIndex, myTeamRankInfo, lastTeamIdx, lastTeamScore) if lastTeamIdx and lastTeamIdx>0 then UIUtils.SetActive(self.group_LastCount, true) UIUtils.SetLabel(self.lab_LastCount, string.FormatByIdsKey("IDS_FairTournament_512Point", lastTeamIdx, lastTeamScore)) else UIUtils.SetActive(self.group_LastCount, false) end local recommendTeamList = MDL.SpecialTeam.GetRecommendTeamList() self.targetIndex = #recommendTeamList - 1 for i, v in ipairs(recommendTeamList) do if i >= beginIndex + 1 then self.loop_TeamList:AddData(v, 0) end end if not string.isNilOrEmpty(myTeamRankInfo.teamId) then UIUtils.SetActive(self.Group_MyRank.gameObject, true) self:RefreshSingleTeamInfo(self.Group_MyRank, myTeamRankInfo) else UIUtils.SetActive(self.Group_MyRank.gameObject, false) end UIUtils.SetActive(self.group_Empty, self.loop_TeamList.Count == 0) end function UISpecialTeamRank:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_TeamList then self:RefreshSingleTeamInfo(cellTable, data) if self.targetIndex and index == self.targetIndex then MDL.SpecialTeam.TeamWarGetAllServerTeamRankReq() self.targetIndex = nil end end end function UISpecialTeamRank:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.loop_TeamList then --弹出交互页面弹窗 for i, v in ipairs(cellTable.group_Head) do if target == v.btn then CTL.PlayerInteract.OpenFriendInteractView(data.members[i].memberId) break end end end end function UISpecialTeamRank:RefreshSingleTeamInfo(cellTable, data) if data.teamRankIdx<=0 then UIUtils.SetActive(cellTable.bg_Rank, false) UIUtils.SetActive(cellTable.bg_NoRank, true) else UIUtils.SetActive(cellTable.bg_Rank, true) UIUtils.SetActive(cellTable.bg_NoRank, false) cellTable.txt_Rank.text = data.teamRankIdx if data.teamRankIdx<4 then cellTable.state_Rank:SetState(data.teamRankIdx-1) else cellTable.state_Rank:SetState(3) end end cellTable.txt_TeamName.text = data.teamName cellTable.txt_Server.text = CTL.CrossServer.GetFormatServerShow(data.members[1].playerShowInfo.ShowServerId) for i, v in ipairs(cellTable.group_Head) do if data.members[i] then self:RefreshSingleMember(data.members[i], v) UIUtils.SetActive(v.group_Hero.gameObject, true) else UIUtils.SetActive(v.group_Hero.gameObject, false) end end cellTable.txt_NumCE.text = data.teamTvTScore UIUtils.SetActive(cellTable.btn_Apply, false) end function UISpecialTeamRank:RefreshSingleMember(memberInfo, cell) local baseInfo = memberInfo.playerShowInfo CTL.Character.SetPortraitAndFrame(cell.UIHeroHead150, baseInfo.PortraitId, baseInfo.FrameId) UIUtils.SetCanvasSortingOrderByMainCanvas(cell.UIHeroHead150.effectUpCanvas, cell.UpCanvas, CTL.Character.UpOrder.Common) UIUtils.SetActive(cell.ico_Leader.gameObject, memberInfo.type == MDL.Team.MemberType.Leader) cell.lab_RoleName.text = baseInfo.name UIUtils.SetActive(cell.group_BR, CTL.SpecialTeam.IsShowPlayerGs()) CTL.Player.OperateGenderImage(cell.group_Gender, baseInfo.sex) CTL.Guild.SetGuildEmblem(cell.img_GuildMark, cell.txt_GuildInitiate, baseInfo.EmblemFrame, baseInfo.EmblemContent) cell.txt_NumCE.text = baseInfo.gsSum end function UISpecialTeamRank:OnButtonClicked(comp) if comp == self.group_ScoreInfo then UIUtils.SetActive(self.group_ScoreInfo, false) elseif comp == self.btn_Info then UIUtils.SetActive(self.group_ScoreInfo, true) end end return UISpecialTeamRank