local UIGoldenHeroBossPointsReward = UIViewClass() function UIGoldenHeroBossPointsReward:OnOpened(context) self.heroType = context.heroType self.activityId = context.activityId self:RegistSystemEvent(EventID.UI_GoldenHeroBoss_RefreshDailyReward, self.RefreshDailyReward) self:RegistSystemEvent(EventID.UI_GoldenHeroBoss_RefreshDailyPoint, self.RefreshDailyReward) self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_GoldHeroActivity_SynergyBoss_DailyReward_Hint1) self.txt_TimeTips.text = string.format(UIUtils.GetLocalizedTxt(Const_IDS.IDS_GoldHeroActivity_SynergyBoss_DailyReward_Hint3),UTL.Time.GetDiffLocalStrById(1)) self:RefreshDailyReward(self.activityId) end function UIGoldenHeroBossPointsReward:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView() end end end function UIGoldenHeroBossPointsReward:RefreshDailyReward(activityId) if activityId == self.activityId then self.point = MDL.GoldenHeroBoss.GetTodayScore(self.activityId) if self.loop_PointReward.Count > 0 then self.loop_PointReward:ClearCells() end local firstInsertIndex = 0 local secondInsertIndex = 0 for i, v in DataSheetManager.GoldHeroSynergyBossDailyReward[self.heroType]:GetEnumerator() do if self.point >= v.Integration then if CTL.GoldenHeroBoss.IsDailyRewardCollected(self.activityId, v.ID) then --已领取 self.loop_PointReward:AddData(v, 0) else --可领取 self.loop_PointReward:InsertData(firstInsertIndex, v, 0) firstInsertIndex = firstInsertIndex + 1 end else --不可领取 self.loop_PointReward:InsertData(firstInsertIndex + secondInsertIndex, v, 0) secondInsertIndex = secondInsertIndex + 1 end end end end function UIGoldenHeroBossPointsReward:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGoldenHeroBossPointsReward:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end function UIGoldenHeroBossPointsReward:OnCellInit(scrollRect, index, cellTable, data) local colorNumText = self.point >= data.Integration and UTL.Color.FormatGreenColor(self.point) or UTL.Color.FormatRedColor(self.point) cellTable.txt_Point.text = colorNumText .. "/" .. data.Integration local itemData = data.Reward_Table for i, v in ipairs(cellTable.Content) do if #itemData >= i then UTL.Item.SetItemCell(v, itemData[i].Item, itemData[i].ItemNum) v.gameObject.transform.parent.gameObject:SetActive(true) else v.gameObject.transform.parent.gameObject:SetActive(false) end end if self.point >= data.Integration then if CTL.GoldenHeroBoss.IsDailyRewardCollected(self.activityId, data.ID) then cellTable.state_Button:SetState(2) else cellTable.state_Button:SetState(1) cellTable.btn_Receive:SetRedPoint(true) end else cellTable.state_Button:SetState(0) end end function UIGoldenHeroBossPointsReward:OnCellClicked(scrollRect, index, cellTable, target, data) if cellTable.btn_Receive == target then MDL.GoldenHeroBoss.GoldHeroGetDailyRewardReq(self.activityId, data.ID) else local itemData = data.Reward_Table for i,v in ipairs(cellTable.Content) do if v.event_Click == target then UTL.ItemTips.ShowCommonTipsById(itemData[i].Item) break end end end end return UIGoldenHeroBossPointsReward