local UIDailyGiftReward = UIViewClass() function UIDailyGiftReward:OnOpened() UIUtils.SetLabelText(self.template_PopUp.txt_Title, Const_IDS.IDS_Gift_RewardPreview) for i, v in DataSheetManager.DailyGiftPreview:GetEnumerator() do self.loop_DailyGiftReward:AddData(v, 0) end end function UIDailyGiftReward:OnCellInit(scrollRect, index, cellTable, data) local sum = 0 for _, v in ipairs(data.Money) do if v > 0 then local price = MDL.Currency.GetIAPPriceNum(v) sum = sum + price end end if sum > 0 then cellTable.txt_Info.text = string.FormatByIdsId(Const_IDS.IDS_Gift_RechargePreviousDay, MDL.Currency.FormatPriceNum(sum)) else UIUtils.SetLabelText(cellTable.txt_Info,Const_IDS.IDS_Gift_NotPurchased) end local reward = DataSheetManager.DailyGiftReward:GetDataByID(data.Reward).Item_Table UTL.Item.SetItemCell(cellTable.item, reward[1].ItemID, reward[1].ItemNum) end function UIDailyGiftReward:OnCellClicked(scrollRect, index, cellTable, target, data) if target == cellTable.item.event_Click then local reward = DataSheetManager.DailyGiftReward:GetDataByID(data.Reward).Item_Table UTL.ItemTips.ShowCommonTipsById(reward[1].ItemID) end end function UIDailyGiftReward:OnBackButtonPressed() self:OnButtonClicked(self.template_PopUp.btn_Close) end function UIDailyGiftReward:OnButtonClicked(comp) if comp == self.template_PopUp.btn_Close then self:CloseView() end end return UIDailyGiftReward