local UICountryResetTip = UIViewClass() function UICountryResetTip:OnOpened(context) for _, data in DataSheetManager.CountryDailySignin:GetEnumerator() do self.loop_CountryResetGift:AddData(data.Item_Table[1], 0) end self:RegistSystemEvent(EventID.Country_GetSignInfo, self.OnGetSignInfo) self:OnGetSignInfo(MDL.Country.GetCountrySignData()) local desc6, timeStr6 = UTL.Time.GetDateDescAndTime({[1] = 1}) self.txt_Info.text = string.FormatByIdsId(Const_IDS.IDS_Country_UnificationRewardIntro, timeStr6) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_Country_UnificationReward) end function UICountryResetTip:OnGetSignInfo(data) self.signInfo = data self.loop_CountryResetGift:RefreshCells(false) end function UICountryResetTip:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end function UICountryResetTip:OnCellInit(scrollRect, index, cellTable, data) UTL.Item.ItemSquareIcon(cellTable.img_ItemIcon, nil , data.ItemID) cellTable.txt_Date.text = string.FormatByIdsId(Const_IDS.IDS_DayCommon, UIUtils.GetLocalizedTxt(Const_IDS["IDS_Number_Written_"..(index + 1)])) cellTable.effect_CanCollect:StopUIEffect() UIUtils.SetActive(cellTable.img_RedPoint, false) if self.signInfo then if table.containValue(self.signInfo.Days, index + 1) then UIUtils.SetActive(cellTable.mask_Received, true) UIUtils.SetLabelText(cellTable.txt_Date, Const_IDS.IDS_DailySignin_Got) else UIUtils.SetActive(cellTable.mask_Received, false) if index + 1 <= self.signInfo.LoginDay then cellTable.effect_CanCollect:PlayUIEffect() UIUtils.SetActive(cellTable.img_RedPoint, true) end end end if index == self.loop_CountryResetGift.Count - 1 then cellTable.state_Icon:SetState(1) else cellTable.state_Icon:SetState(0) end end function UICountryResetTip:OnCellClicked(scrollRect, index, cellTable, target, data) if not table.containValue(self.signInfo.Days, index + 1) and index + 1 <= self.signInfo.LoginDay then MDL.Country.CountrySignReq(index + 1) else if target == cellTable.btn then UTL.ItemTips.ShowCommonTipsById(data.ItemID) if index + 1 > self.signInfo.LoginDay then CTL.Tips.AddTipsMsgAndPlaySound(Const_IDS.IDS_Country_GetRewardLater) end end end end return UICountryResetTip