local UITestingGiftLihui = UIViewClass() local LIHUI_PATH = ConstAssetPathConfig.LIHUI_PATH function UITestingGiftLihui:OnOpened(context) UIUtils.SetImageByAssetBundle(self.img_Hero, LIHUI_PATH) self:RegistSystemEvent(EventID.UI_TestingGift_Refresh, self.UpdateInfo) self:RegistSystemEvent(EventID.UI_TestingGift_GetReward, self.UpdateReward) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.TestingGift_FaceBook, self.UpdateBtnRed) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.TestingGift_StoreScore, self.UpdateBtnRed) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.TestingGift_BindAccount, self.UpdateBtnRed) self:UpdateInfo(context) end function UITestingGiftLihui:UpdateReward() self:UpdateInfo(self.context) end function UITestingGiftLihui:UpdateInfo(data) self.context = data local hasReward = MDL.TestingGift.HasClaimReward(data.ID) if data.IsLocal then UIUtils.SetLocalizationImage(self.img_Activities, data.Image) else UIUtils.SetImageByAssetBundle(self.img_Activities, data.Image) end self.btn_Concern:SetGray(false) if data.Button == "FB" then self.state_Btn:SetState(1) self.state_Lab:SetState(0) elseif data.Button == "Reviews" then self.state_Btn:SetState(0) self.state_Lab:SetState(2) elseif data.Button == "Bind" then self.state_Lab:SetState(1) if hasReward then self.state_Btn:SetState(3) self.btn_Concern:SetGray(true, false) else self.state_Btn:SetState(2) end end --奖励数量固定 local reward = DataSheetManager.PromotionReward:GetDataByID(data.Reward) for i, v in ipairs(reward.Item_Table) do UTL.Item.SetItemCell(self.group_Reward[i], v.ItemID, v.ItemNum) end --奖励是否发放 if hasReward then UIUtils.SetLabelText(self.lab_MailTips, Const_IDS.IDS_BindAccount_MailTips) else self.lab_MailTips.text = nil end --设置红点 self:UpdateBtnRed() end function UITestingGiftLihui:UpdateBtnRed() local data = self.context local redKey = MDL.TestingGift.RedPointKey[data.ID] if redKey then local isRed = CTL.RedPoint.GetRedPointActive(redKey) self.btn_Concern:SetRedPoint(isRed) else self.btn_Concern:SetRedPoint(false) end end function UITestingGiftLihui:OnButtonClicked(comp) if comp == self.btn_Concern then CTL.TestingGift.OnSDKCall(self.context.Button, self.context.ID) end end return UITestingGiftLihui