local UIOfficialPositionApplyList = UIViewClass() function UIOfficialPositionApplyList:OnOpened(context) self:RegistSystemEvent(EventID.UI_UpdateOfficialPositionApplyInfo, self.UpdateInfo) self:RegistSystemEvent(EventID.UI_CancelOfficialPositionApply, self.OnCancelApply) self.title = context[1] self.titleTxt = CTL.OfficialPosition.GetColorTitleFullTxt(self.title) self.UICommonPopUp.txt_Title.text = string.FormatByIdsId(Const_IDS.IDS_OfficialPosition_Apply, self.titleTxt) self:UpdateInfo() end function UIOfficialPositionApplyList:OnCancelApply() MDL.OfficialPosition.GetExamInfoReq(self.title) end function UIOfficialPositionApplyList:UpdateInfo() if MDL.OfficialPosition.ExamInfoList and #MDL.OfficialPosition.ExamInfoList > 0 then UIUtils.SetActive(self.section_Empty, false) self.LoopScroll_Main_OfficialPositionApplyList:ReloadAll(MDL.OfficialPosition.ExamInfoList) else self.LoopScroll_Main_OfficialPositionApplyList:ClearCells() UIUtils.SetActive(self.section_Empty, true) end end function UIOfficialPositionApplyList:OnCellInit(scrollRect, index, cellTable, data) UIUtils.SetLabel(cellTable.txt_Name, data.name) if data.acid == BattleDataGetter.GetAcID() then --是否在报名时间内 local isInTime = CTL.OfficialPosition.IsInApplyTime(self.title) UIUtils.SetActive(cellTable.btn_Close, isInTime) else UIUtils.SetActive(cellTable.btn_Close, false) end CTL.Character.SetPortraitAndFrame(cellTable.UIHeroHead150, data.portraitId, data.frameId, data.level) cellTable.txt_State:SetState(data.acid == BattleDataGetter.GetAcID() and 1 or 0) end function UIOfficialPositionApplyList:OnCellClicked(scrollRect, index, cellTable, target, data) if target == cellTable.btn_Close then local content = string.FormatByIdsId(Const_IDS.IDS_OfficialPosition_CancellationOfRegistration, self.titleTxt) local function CancelApply() local isInTime = CTL.OfficialPosition.IsInApplyTime(self.title) if isInTime then MDL.OfficialPosition.CancelExamReq() else CTL.Tips.AddTipsMsg(Const_IDS["IDS_OfficialPosition_InvalidOperation"]) self:UpdateInfo() end end UTL.MessageBox.ShowOKCancelBox(nil, content, CancelApply, nil) elseif target == cellTable.UIHeroHead150.img_PlayerAvatarBg then CTL.PlayerInteract.OpenFriendInteractView(data.acid) end end function UIOfficialPositionApplyList:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIOfficialPositionApplyList:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end return UIOfficialPositionApplyList