local UIDemonGodRewardMain = UIViewClass() local demonGodRewardIDS = { [1] = Const_IDS.IDS_DemonGod_UI_15, --排行奖励 [2] = Const_IDS.IDS_DemonGod_UI_17, --日常奖励 [3] = Const_IDS.IDS_DemonGod_UI_16, --达标奖励 } local INDEX_REWARD_RANK = 0 local INDEX_REWARD_DAILY = 1 local INDEX_REWARD_ACHIEVE = 2 function UIDemonGodRewardMain:OnOpened(context) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.DemonGold_Reward, self.OnRefreshRed) UIUtils.SetLabelText(self.UICommonPopUpTab.txt_Title, Const_IDS.IDS_DemonGod_UI_4) for _, v in ipairs(demonGodRewardIDS) do self.UICommonPopUpTab.loop_Tab:AddData(v, 0) end self.UICommonPopUpTab.loop_Tab:SelectIndex(0) end function UIDemonGodRewardMain:OnRefreshRed() self.UICommonPopUpTab.loop_Tab:UpdateIndex(INDEX_REWARD_ACHIEVE, demonGodRewardIDS[INDEX_REWARD_ACHIEVE + 1]) end function UIDemonGodRewardMain:OnButtonClicked(comp) if comp == self.UICommonPopUpTab.btn_Close then self:CloseView() end end function UIDemonGodRewardMain:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUpTab.btn_Close) end function UIDemonGodRewardMain:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.UICommonPopUpTab.loop_Tab then if index == INDEX_REWARD_ACHIEVE and CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.DemonGold_Reward) then --只有达标奖励才有红点 UIUtils.SetActive(cellTable.img_RedDot, true) else UIUtils.SetActive(cellTable.img_RedDot, false) end UIUtils.SetLabelText(cellTable.txt_Name_Nomal, data) UIUtils.SetLabelText(cellTable.txt_Name_Selected, data) UIUtils.SetActive(cellTable.img_Arrow, false) UIUtils.SetActive(cellTable.img_ArrowS, false) end end function UIDemonGodRewardMain:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.UICommonPopUpTab.loop_Tab then if self.subViewIndex == index then return end self.subViewIndex = index if self.subViewIndex then self.subView:CloseAll() end if index == INDEX_REWARD_RANK then self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UIDemonGodRewardRank)) elseif index == INDEX_REWARD_DAILY then self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UIDemonGodRewardDaily)) elseif index == INDEX_REWARD_ACHIEVE then self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UIDemonGodRewardAchievement)) end end end return UIDemonGodRewardMain