local UIContributeReward = UIViewClass() local SolicitContributionsAward = DataSheetManager.ConstData:GetDataByID("SolicitContributionsAward").IntListValue local SolicitContributionsLink = DataSheetManager.ConstData:GetDataByID("SolicitContributionsLink").StringValue function UIContributeReward:OnOpened(context) self:InitReward() self:RegistSystemEvent(EventID.Attention_ShowRedPoint, self.RefreshBtnState) self:RefreshBtnState() end function UIContributeReward:OnButtonClicked(comp) if comp == self.btn_Get then local state = MDL.Attention.GetAttentionState(CTL.Welfare.WelfareType.SolicitContributions) if state == MDL.Attention.AttentionState.CanReceive then MDL.Attention.PushInterfaceOptReq(CTL.Welfare.WelfareType.SolicitContributions, MDL.Attention.OptType.Receive) else UnityEngine.Application.OpenURL(SolicitContributionsLink) MDL.Attention.PushInterfaceOptReq(CTL.Welfare.WelfareType.SolicitContributions, MDL.Attention.OptType.SetReceive) end else for i, v in ipairs(self.group_Item) do if v.item.event_Click == comp then UTL.ItemTips.ShowCommonTipsById(SolicitContributionsAward[i * 2 - 1]) end end end end ----------------------- function UIContributeReward:InitReward() local index = 1 for i = 1, #SolicitContributionsAward, 2 do -- 设置奖励 local itemCell = self.group_Item[index] if not itemCell then itemCell = self:InstantiateCollection(self.group_Item, self.template_Item.gameObject) end UTL.Item.SetItemCell(itemCell.item, SolicitContributionsAward[i], SolicitContributionsAward[i + 1]) UIUtils.SetActive(itemCell.gameObject, true) index = index + 1 end end function UIContributeReward:RefreshBtnState() local state = MDL.Attention.GetAttentionState(CTL.Welfare.WelfareType.SolicitContributions) if state and state == MDL.Attention.AttentionState.CanReceive then UIUtils.SetLabelText(self.lab_Collect, Const_IDS.IDS_NationClimbTower_GetReward) self.btn_Get:SetRedPoint(true) else UIUtils.SetLabelText(self.lab_Collect, Const_IDS.IDS_TeamUI_Myteam_GotoActivety) self.btn_Get:SetRedPoint(false) end end return UIContributeReward