local UIMessageBoxCountDownView = UIViewClass() function UIMessageBoxCountDownView:OnOpened(context) UTL.String.SetLabelContent(self.UICommonPopShowView.lab_Title, context.title) UTL.String.SetLabelContent(self.lab, context.content) self.curTime = context.time self.UICommonPopShowView.TextBtn2.text = UIUtils.GetLocalizedTxt(context.cancelBtnText) self.okCB = context.okCB self.cancelCB = context.cancelCB self:SetBtnText() self.UICommonPopShowView.btn_1:SetGray(true) self:StartRepeatFunc(self.OnUpdateFun, 1) end function UIMessageBoxCountDownView:SetBtnText() if self.curTime > 0 then local timeStr = string.FormatByIdsId(Const_IDS.IDS_TeamUI_InvitationOrApplyIgnoreTime, self.curTime) self.UICommonPopShowView.TextBtn1.text = UIUtils.GetLocalizedTxt(self.context.okBtnText)..timeStr else UIUtils.SetLabelText(self.UICommonPopShowView.TextBtn1, self.context.okBtnText) self:StopRepeatFunc(self.OnUpdateFun) self.UICommonPopShowView.btn_1:SetGray(false) end end function UIMessageBoxCountDownView:OnUpdateFun(deltaTime, timeSinceUpdate) self.curTime = self.curTime - 1 self:SetBtnText() end function UIMessageBoxCountDownView:OnButtonClicked(comp) if comp == self.UICommonPopShowView.btn_1 then if self.okCB then self.okCB() end self:CloseView() elseif comp == self.UICommonPopShowView.btn_2 then if self.cancelCB then self.cancelCB() end self:CloseView() end end return UIMessageBoxCountDownView