local UIAnniversaryLuckyDrawRewardGainPanel = UIViewClass() local ItemIconPath = ConstAssetPathConfig.ItemIconPath function UIAnniversaryLuckyDrawRewardGainPanel:OnOpened(context) self.itemId = context.itemId self.itemNum = context.itemNum self.card = context.card self.duration = DataSheetManager.ConstData:GetDataByID("ItemGetUITimeOut").IntValue UIUtils.SetLabel(self.labLocal_Timer,string.FormatByIdsId(Const_IDS.IDS_Item_GetUI_TimeOut,math.ceil(self.duration))) self:StartRepeatFunc(self.OnUpdateFun, 1) self:RefreshItem() end function UIAnniversaryLuckyDrawRewardGainPanel:OnUpdateFun(deltaTime, timeSinceUpdate) if timeSinceUpdate > self.duration then self:CloseView() else UIUtils.SetLabel(self.labLocal_Timer,string.FormatByIdsId(Const_IDS.IDS_Item_GetUI_TimeOut, math.ceil(self.duration- timeSinceUpdate))) end end function UIAnniversaryLuckyDrawRewardGainPanel:RefreshItem() local itemData = DataSheetManager.ItemData:GetDataByID(self.itemId) local itemIcon = string.format(ItemIconPath, itemData.Icon) UIUtils.SetImageByAssetBundle(self.group_Cell.icon, itemIcon) UIUtils.SetLabelText(self.group_Cell.txt_Name, Const_IDS[itemData.Name]) UIUtils.SetLabel(self.group_Cell.txt_Num, self.itemNum) UTL.Color.SetQualityImageByType(self.group_Cell.img, itemData.Color, UTL.Color.QualityType.Square) if not string.isNilOrEmpty(self.card) then UIUtils.SetActive(self.group_lab_Tips, true) UIUtils.SetActive(self.group_NumCopy, true) UIUtils.SetLabel(self.txt_code, self.card) else UIUtils.SetActive(self.group_lab_Tips, false) UIUtils.SetActive(self.group_NumCopy, false) end end function UIAnniversaryLuckyDrawRewardGainPanel:OnButtonClicked(comp) if comp == self.event_Bottom then self:CloseView() elseif comp == self.group_Cell.event_Click then UTL.ItemTips.ShowCommonTipsById(self.itemId) elseif comp == self.img_Copy then UIUtils.GetSystemCopyText(self.txt_code.text) CTL.Tips.AddTipsMsg(Const_IDS.IDS_VIPInvitation_CopyHint) end end return UIAnniversaryLuckyDrawRewardGainPanel