local UIFollowDouYin = UIViewClass() ----------------------- function UIFollowDouYin:OnCreated() self.accountAward = DataSheetManager.ConstData:GetDataByID("FollowTiktokAward").IntListValue self.accountLink = DataSheetManager.ConstData:GetDataByID("FollowTiktokLink").StringValue end function UIFollowDouYin:OnOpened(context) self:RegistSystemEvent(EventID.Attention_ShowRedPoint, self.RefreshBtnState) self:RefreshBtnState() self:InitPanel() end function UIFollowDouYin:OnButtonClicked(comp) if comp == self.btn_Get then local state = MDL.Attention.GetAttentionState(CTL.Welfare.WelfareType.DouYinReward) if state == MDL.Attention.AttentionState.CanReceive then MDL.Attention.PushInterfaceOptReq(CTL.Welfare.WelfareType.DouYinReward, MDL.Attention.OptType.Receive) else UnityEngine.Application.OpenURL(self.accountLink) MDL.Attention.PushInterfaceOptReq(CTL.Welfare.WelfareType.DouYinReward, 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(self.accountAward[i * 2 - 1]) end end end end ----------------------- function UIFollowDouYin:InitPanel() local index = 1 for i = 1, #self.accountAward, 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, self.accountAward[i], self.accountAward[i + 1]) UIUtils.SetActive(itemCell.gameObject, true) index = index + 1 end for i = index, #self.group_Item do UIUtils.SetActive(self.group_Item[i].gameObject, false) end end function UIFollowDouYin:RefreshBtnState() local state = MDL.Attention.GetAttentionState(CTL.Welfare.WelfareType.DouYinReward) 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_FollowTiktok_1) self.btn_Get:SetRedPoint(false) end end return UIFollowDouYin