local UIPushInterfaceCommon = UIViewClass() --[[ private.GetViewContext(pushInterfaceEnum) 调用这个界面 需要实现这个方法 传入参数 context = { pushInterfaceEnum -- PushInterface_Controller.PushInterfaceEnum rewardList = DataSheetManager.ConstData:GetDataByID("FollowTiktokAward").IntListValue 目前的rewardList 是IntListValue 类型 奖励id 和数量都在一起 -----TODO toggle_Skip 逻辑? 目前这个只支持显示领奖 按钮状态 没有其它的逻辑 如果有其它的逻辑 需要支持 还是在这扩展 到时候可以具体问题具体分析 } ]] function UIPushInterfaceCommon:OnOpened(context) self:RegistSystemEvent(EventID.Attention_ShowRedPoint, self.RefreshBtnState) self:RegistSystemEvent(EventID.PushInterfaceCommon_CloseView, self.ClosePushInterfaceCommonView) self:InitReward() if self.btn_Get then CTL.PushInterface.SetBtnState(self.context.pushInterfaceEnum, self.btn_Get, self.lab_Collect, self.group_Collected) end end function UIPushInterfaceCommon:OnClosed() CTL.PushInterface.OnViewClose(self.context.pushInterfaceEnum, self.toggle_Skip) end function UIPushInterfaceCommon:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() elseif comp == self.btn_Get then CTL.PushInterface.OnClickBtn(self.context.pushInterfaceEnum) else if self.group_Item and self.context.rewardList then for i, v in ipairs(self.group_Item) do if v.item.event_Click == comp then UTL.ItemTips.ShowCommonTipsById(self.context.rewardList[i * 2 - 1]) end end end end end function UIPushInterfaceCommon:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UIPushInterfaceCommon:InitReward() if self.context.rewardList then local index = 1 for i = 1, #self.context.rewardList, 2 do -- 设置奖励 local itemCell = self:InstantiateCollection(self.group_Item, self.template_Item.gameObject) UTL.Item.SetItemCell(itemCell.item, self.context.rewardList[i], self.context.rewardList[i + 1]) UIUtils.SetActive(itemCell.gameObject, true) index = index + 1 end end end function UIPushInterfaceCommon:RefreshBtnState() CTL.PushInterface.SetBtnState(self.context.pushInterfaceEnum, self.btn_Get, self.lab_Collect, self.group_Collected) end function UIPushInterfaceCommon:ClosePushInterfaceCommonView(pushInterfaceEnum) if pushInterfaceEnum == self.context.pushInterfaceEnum then self:CloseView() end end return UIPushInterfaceCommon