--[[ 充值返利 yuanli ]] local UIRechargeReturn = UIViewClass() function UIRechargeReturn:OnOpened(context) self:RegistSystemEvent(EventID.UI_Welfare_RechargeReturnRewardState, self.RefreshRewardState) if GameAppInfo.IsChinesePackage() then self.state_Data:SetState(1) self.state_Other:SetState(1) elseif GameAppInfo.IsOverseaPackage() or GameAppInfo.IsVietnamPackage() then self.state_Data:SetState(0) self.state_Other:SetState(0) end -- 绝版奖励UI使用代码控制,state组件不能同时满足国服、海外,越南三个地区的需求。 if GameAppInfo.IsChinesePackage() or GameAppInfo.IsVietnamPackage() then UIUtils.SetActive(self.group_LimitReward_CN, true) elseif GameAppInfo.IsOverseaPackage() then UIUtils.SetActive(self.group_LimitReward_CN, false) end self:InitRechargeReturnPanel() UIUtils.SetLabel(self.txt_Score, MDL.RechargeReturn.GetRechargeCount()) local rewardItems = MDL.RechargeReturn.GetRechargeReturnItems() for index, itemCell in ipairs(self.group_Items) do if rewardItems[index] then UIUtils.SetActive(itemCell.gameObject, true) UTL.Item.SetItemCell(itemCell, rewardItems[index].ItemId, rewardItems[index].ItemCount) UIUtils.SetLabel(itemCell.lab_Count, rewardItems[index].ItemCount) else UIUtils.SetActive(itemCell.gameObject.transform.parent.gameObject, false) end end self:RefreshRechargeData() end function UIRechargeReturn:InitRechargeReturnPanel() UIUtils.SetLabelText(self.txt_Title, Const_IDS["IDS_RechargeReturn_Title2"]) UTL.Item.SetLocalizationImage(self.Loc_Title, self.img_Title, "gcfl_msz_01.png") UIUtils.SetLabelText(self.txt_FreeRetrieve, Const_IDS["IDS_RechargeReturn_Hint_1"]) UIUtils.SetLabelText(self.txt_RechargeAmount, Const_IDS["IDS_RechargeReturn_Hint_2"]) self:RefreshRewardState() end function UIRechargeReturn:RefreshRechargeData() for __, returnData in DataSheetManager.RechargeReturnData:GetEnumerator() do if GameAppInfo.IsChinesePackage() then self.loopRechargeReturn_CN:AddData(returnData, 0) elseif GameAppInfo.IsOverseaPackage() or GameAppInfo.IsVietnamPackage() then self.loopRechargeReturn:AddData(returnData, 0) end end end function UIRechargeReturn:RefreshRewardState() self.btn_TotalFree:SetRedPoint(CTL.RechargeReturn.IsHasRechargeReturnRedpoint()) if MDL.RechargeReturn.HasGetReward() then self.btn_TotalFree:SetText(UIUtils.GetLocalizedTxt(Const_IDS["IDS_Gift_Received"])) self.btn_TotalFree:SetGray(true, false) else self.btn_TotalFree:SetText(UIUtils.GetLocalizedTxt(Const_IDS["IDS_RechargeReturn_Hint_5"])) self.btn_TotalFree:SetGray(false, true) end end function UIRechargeReturn:OnButtonClicked(comp) if comp == self.btn_TotalFree then UTL.MessageBox.ShowOKCancelBox("", UIUtils.GetLocalizedTxt(Const_IDS.IDS_RechargeReturn_VerifyHint), self.ConfirmReqGetRechargeReturnReward) else local rewardItems = MDL.RechargeReturn.GetRechargeReturnItems() for index, itemCell in ipairs(self.group_Items) do if comp == itemCell.event_Click then UTL.ItemTips.ShowCommonTipsById(rewardItems[index].ItemId) break end end end end function UIRechargeReturn:ConfirmReqGetRechargeReturnReward() MDL.RechargeReturn.ReqGetRechargeReturnReward(MDL.RechargeReturn.RewardTypeEnum.RewardPay) end function UIRechargeReturn:OnCellInit(scrollRect, index, cellTable, data) UIUtils.SetLabel(cellTable.txt_Level, data.ID) if data.IntegrationMin <= 0 then UIUtils.SetLabel(cellTable.txt_ScoreNumber, "≤" .. data.IntegrationMax) elseif data.IntegrationMax <= 0 then UIUtils.SetLabel(cellTable.txt_ScoreNumber, "≥" .. data.IntegrationMin) else UIUtils.SetLabel(cellTable.txt_ScoreNumber, string.format("%s - %s", data.IntegrationMin, data.IntegrationMax)) end UIUtils.SetLabel(cellTable.txt_JadeReward, data.ReturnLongYu .. "%") if GameAppInfo.IsOverseaPackage() then UIUtils.SetLabel(cellTable.txt_Percentage, data.ReturnProportion .. "%") UIUtils.SetLabel(cellTable.txt_MoneyReward, data.ReturnYuanBao .. "%") elseif GameAppInfo.IsChinesePackage() then if data.ExtraItemID>0 then local titleCfgData = CTL.Title.GetTitleDataByItemId(data.ExtraItemID) CTL.Title.SetTitleShow(self.titleTemplate, titleCfgData) end elseif GameAppInfo.IsVietnamPackage() then UIUtils.SetLabel(cellTable.txt_Percentage, data.ReturnProportion .. "%") UIUtils.SetLabel(cellTable.txt_MoneyReward, data.ReturnYuanBao .. "%") if data.ExtraItemID>0 then local titleCfgData = CTL.Title.GetTitleDataByItemId(data.ExtraItemID) CTL.Title.SetTitleShow(self.titleTemplate, titleCfgData) end end end return UIRechargeReturn