local UIMessageConsumeView = UIViewClass() local ItemIconPath = ConstAssetPathConfig.ItemIconPath function UIMessageConsumeView:OnOpened(context) UTL.String.SetLabelContent(self.UICommonPopView.lab_Title, context.title) UTL.String.SetLabelContent(self.Text_Local_1,context.content1) if context.content2 and context.content2 ~= "" then UIUtils.SetActive(self.Text_Local_2.gameObject,true) UTL.String.SetLabelContent(self.Text_Local_2,context.content2) else UIUtils.SetActive(self.Text_Local_2.gameObject,false) end self.UICommonPopView.btn_1:SetText(context.okBtnText) self.UICommonPopView.btn_2:SetText(context.cancelBtnText) self.okCB = context.okCB self.cancelCB = context.cancelCB if context.unClickContent then self.obj_state:SetState(1) self.UICommonPopView.btn_1:SetGray(true,true) self.grayContent = context.unClickContent else self.UICommonPopView.btn_1:SetGray(false) if context.freeContent then self.obj_state:SetState(0) UTL.String.SetLabelContent(self.Text_Free,context.freeContent) else self.obj_state:SetState(1) local coinData = DataSheetManager.ItemData:GetDataByID(context.coinType) UIUtils.SetImageByAssetBundle(self.icon_Cost,string.format(ItemIconPath,coinData.Icon)) local curNum = MDL.Currency.GetSoftTokenCountById(context.coinType) if curNum >= context.coinValue then self.Text_Cost.text = UTL.Color.FormatGreenColor(context.coinValue) else self.Text_Cost.text = UTL.Color.FormatRedColor(context.coinValue) self.grayContent = string.FormatByIdsId(Const_IDS.IDS_ClimbTower_NoMoney, UTL.Item.GetItemDataSpliceByType(context.coinType).Name) end end end if context.isHideCoin then self.obj_state:SetState(2) end self.UICommonPopView.Btn_Close.gameObject:SetActive(true) end function UIMessageConsumeView:OnClosed() end function UIMessageConsumeView:OnButtonClicked(obj) if obj == self.UICommonPopView.btn_1 then self:CloseView() if self.grayContent then CTL.Tips.AddTipsMsg(self.grayContent) return end if self.okCB then self.okCB() end elseif obj == self.UICommonPopView.btn_2 then if self.cancelCB then self.cancelCB() end self:CloseView() elseif obj == self.UICommonPopView.Btn_Close then self:CloseView() end end return UIMessageConsumeView