local UIPurchaseConfirmView = UIViewClass() function UIPurchaseConfirmView:OnOpened(context) UIUtils.SetActive(self.UICommonPopView.refer_Bg.img_Info, false) UIUtils.SetActive(self.UICommonPopView.refer_Bg.btn_Close, true) UIUtils.SetActive(self.UICommonPopView.btn_1, false) UIUtils.SetActive(self.UICommonPopView.btn_2, false) UTL.String.SetLabelContent(self.txt_Content, Const_IDS.IDS_JP_Purchase_Content) UTL.String.SetLabelContent(self.txt_Tax, Const_IDS.IDS_JP_Purchase_TaxIncluded) UTL.String.SetLabelContent(self.txt_Immediate, Const_IDS.IDS_JP_Purchase_TakeEffect) UTL.String.SetLabelContent(self.txt_CantCancel, Const_IDS.IDS_JP_Purchase_CannotCancel) self.txt_Price.text = UIUtils.GetLocalizedTxt(Const_IDS.IDS_JP_Purchase_Price) .. MDL.Currency.GetFullyIAPPrice(context.iapIndex) if context.limit then self.txt_Limit.text = string.FormatByIdsKey("IDS_JP_Purchase_Times", context.limit) else UIUtils.SetActive(self.txt_Limit, false) end if context.time then if type(context.time) == "number" then self.txt_Time.text = string.FormatByIdsKey("IDS_JP_Purchase_Time1", UTL.Time.FormatTimeCompletely(context.time)) self:StartRepeatFunc(self.AutoCloseView, context.time - UTL.Time.GetServerTimestamp(), 1) else UTL.String.SetLabelContent(self.txt_Time, Const_IDS.IDS_JP_Purchase_Time2) end else UIUtils.SetActive(self.img_TimeBg, false) end self.callBack = context.callBack if type(context.title) == "string" then self.UICommonPopView.refer_Bg.txt_Title.text = context.title else UTL.String.SetLabelContent(self.UICommonPopView.refer_Bg.txt_Title, context.title) end end function UIPurchaseConfirmView:AutoCloseView(deltaTime, timeSinceUpdate) self:CloseView() end function UIPurchaseConfirmView:OnClosed() UIUtils.SetActive(self.UICommonPopView.btn_1, true) UIUtils.SetActive(self.UICommonPopView.btn_2, true) end function UIPurchaseConfirmView:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopView.refer_Bg.btn_Close) end function UIPurchaseConfirmView:OnButtonClicked(obj) if obj == self.btn_Buy then self.callBack() self:CloseView() elseif obj == self.btn_Cancel or obj == self.UICommonPopView.refer_Bg.btn_Close then self:CloseView() end end return UIPurchaseConfirmView