local UIOfficialPositionRankLast = UIViewClass() function UIOfficialPositionRankLast:OnOpened(context) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS["IDS_OfficialPosition_LastRoundPromotionList"]) self:RegistSystemEvent(EventID.UI_UpdateAdmissionResult, self.UpdateInfo) self.curTitle = MDL.OfficialPosition.GetCurTitle() local moveIndex = 1 local index = 0 --只显示type为4的官职 for i, v in DataSheetManager.OfficialPosition:GetEnumerator() do if v.Type == 4 then index = index + 1 if v.ID == self.curTitle then moveIndex = index end self.LoopScroll_LeftMenu_OfficialPositionRank:AddData(v, 0) end end self.LoopScroll_LeftMenu_OfficialPositionRank:SelectIndex(moveIndex - 1, true) end function UIOfficialPositionRankLast:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.LoopScroll_LeftMenu_OfficialPositionRank then UIUtils.SetActive(cellTable.img_LeftMenu_OfficialPositionRank_Present_Check, self.curTitle == data.ID) UIUtils.SetActive(cellTable.img_LeftMenu_OfficialPositionRank_Present_UnCheck, self.curTitle == data.ID) local txt = CTL.OfficialPosition.GetTitleFullTxt(data) cellTable.lab_LeftMenu_OfficialPositionRank_UnCheck.text = UTL.Color.FormatQualityText(txt, data.QualityColor) cellTable.lab_LeftMenu_OfficialPositionRank_Check.text = UTL.Color.FormatQualityText(txt, data.QualityColor) else local info = data.PersonalInformation CTL.Character.SetPortraitAndFrame(cellTable.UIHeroHead, info.portraitId, info.frameId, info.level) cellTable.txt_CE.text = info.power local sortIndex = index + 1 --排名 if sortIndex <= 3 then UIUtils.SetActive(cellTable.img_Rank, true) cellTable.section_Rank:SetState(sortIndex - 1) cellTable.txt_Rank.text = nil else UIUtils.SetActive(cellTable.img_Rank, false) cellTable.txt_Rank.text = sortIndex end if info.acid == BattleDataGetter.GetAcID() then UIUtils.SetActive(cellTable.btn_Add, false) UIUtils.SetActive(cellTable.btn_Chat, false) cellTable.txt_Name.text = UTL.Color.FormatGreenColor(info.name) else if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Friend) and MDL.Friend.IsPlayerFriend(info.acid) == false and MDL.Friend.IsPlayerBlack(info.acid) == false then UIUtils.SetActive(cellTable.btn_Add, true) else UIUtils.SetActive(cellTable.btn_Add, false) end if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Friend) and MDL.Friend.IsPlayerBlack(info.acid) == false then UIUtils.SetActive(cellTable.btn_Chat, true) else UIUtils.SetActive(cellTable.btn_Chat, false) end cellTable.txt_Name.text = info.name end cellTable.img_BgState:SetState(info.acid == BattleDataGetter.GetAcID() and 1 or 0) end end function UIOfficialPositionRankLast:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.LoopScroll_LeftMenu_OfficialPositionRank then CTL.Sound.PlayGameSound("UI_sound_Qieye01") local pvpData = DataSheetManager.OfficialPositionPromotion:GetDataByGradeID(data.GradeID) if pvpData then self.PromotionsNum = pvpData.PromotionsNum MDL.OfficialPosition.GetPromotionMemberInfoReq(data.ID) end else if target == cellTable.UIHeroHead.Img_HeroHeadBg then CTL.PlayerInteract.OpenFriendInteractView(data.PersonalInformation.acid) elseif target == cellTable.btn_Add then MDL.Friend.SendApplyFriend(data.PersonalInformation.acid) elseif target == cellTable.btn_Chat then CTL.Friend.PrivateTalkToAcid(data.PersonalInformation.acid) end end end function UIOfficialPositionRankLast:UpdateInfo(info) self.LoopScroll_Main_OfficialPositionRank:ClearCells() if IsServerDataNotNil(info) and #info > 0 then UIUtils.SetActive(self.section_Empty, false) --取前N个数 for i = 1, self.PromotionsNum do local vo = info[i] if vo then self.LoopScroll_Main_OfficialPositionRank:AddData(vo, 0) end end else UIUtils.SetActive(self.section_Empty, true) end end function UIOfficialPositionRankLast:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIOfficialPositionRankLast:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end return UIOfficialPositionRankLast