local UIGoldenHeroBossRecord = UIViewClass() function UIGoldenHeroBossRecord:OnOpened(context) self.heroType = context.heroType self.activityId = context.activityId self:RegistSystemEvent(EventID.UI_GoldenHeroBoss_UpdateBossRecord, self.UpdateBossRecord) self:RegistSystemEvent(EventID.UI_GoldenHeroBoss_AddNewBossRecord, self.RefreshBossRecord) self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) self:RegistSystemEvent(CTL.GoldenHeroMain.RpEventId[self.activityId].BossFindReward, self.RefreshFindRewardRedPoint) -- 金将体验关入口红点 self:RefreshFindRewardRedPoint(MDL.RedPoint.GetNodeStateByLogicParams(CTL.GoldenHeroMain.RpEventId[self.activityId].TownHome, CTL.GoldenHeroMain.RpEventId[self.activityId].BossFindReward)) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_GoldHeroActivity_SynergyBoss_Button2) self:RefreshBossRecord(self.activityId, true) end function UIGoldenHeroBossRecord:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView() end end end function UIGoldenHeroBossRecord:RefreshFindRewardRedPoint(state) self.btn_FindByMe:SetRedPoint(state) UIUtils.SetActive(self.btn_Receive_All, state) end function UIGoldenHeroBossRecord:UpdateBossRecord(activityId, bossId) if activityId == self.activityId then if self.recordDict[bossId] then self.loop_BossRecords:UpdateIndex(self.recordDict[bossId] - 1, MDL.GoldenHeroBoss.GetBossRecordById(activityId, bossId)) end end end function UIGoldenHeroBossRecord:RefreshBossRecord(activityId, isMine) if self.activityId == activityId then UIUtils.SetActive(self.img_FindByMeSelected, isMine) UIUtils.SetActive(self.img_ParticipateSelected, not isMine) local cellIndex = isMine and 0 or 1 self.state_Title:SetState(cellIndex) self.recordDict = {} if self.loop_BossRecords.Count > 0 then self.loop_BossRecords:ClearCells() end local index = 1 for i, v in ipairs(MDL.GoldenHeroBoss.GetSortedBossRecords(self.activityId)) do if (BattleDataGetter.GetAcID() == v.finder) == isMine then self.loop_BossRecords:AddData(v, cellIndex) self.recordDict[v.bossId] = index index = index + 1 end end UIUtils.SetActive(self.group_Empty, self.loop_BossRecords.Count == 0) end end function UIGoldenHeroBossRecord:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGoldenHeroBossRecord:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() elseif comp == self.btn_FindByMe then self:RefreshBossRecord(self.activityId, true) elseif comp == self.btn_Participate then self:RefreshBossRecord(self.activityId, false) elseif comp == self.btn_Receive_All then local timeId = DataSheetManager.GoldHeroActivityModeData:GetDataByHeroType(self.heroType).DailyRankEndTime if UTL.Time.IsServerInOpeningTime(1, timeId) then MDL.GoldenHeroBoss.GoldHeroGetAllFindBossRewardReq(self.activityId) else UTL.MessageBox.ShowOKCancelBox(nil, Const_IDS.IDS_GoldHeroActivity_NewHint_9, function() MDL.GoldenHeroBoss.GoldHeroGetAllFindBossRewardReq(self.activityId) end) end end end function UIGoldenHeroBossRecord:OnCellInit(scrollRect, index, cellTable, data) cellTable.state_Bg:SetState(index % 2) local bossData = DataSheetManager.GoldHeroSynergyBossData[self.heroType]:GetDataByID(data.bossCfgId) UIUtils.SetLabelText(cellTable.txt_BossName, Const_IDS[bossData.BossName]) CTL.GoldenHeroBoss.ShowBossStar(cellTable.group_Star, bossData.BossStar) cellTable.txt_Time.text = os.date(UTL.Time.FormatDateEnum.YMDHM, data.killTime ~= 0 and data.killTime or data.endTime) cellTable.txt_Damage.text = data.totalDamage cellTable.txt_PlayerName.text = string.isNilOrEmpty(data.killName) and "---" or data.killName if data.killTime ~= 0 then cellTable.state_BossState:SetState(2) else cellTable.state_BossState:SetState(data.endTime > UTL.Time.GetServerTimestamp() and 1 or 0) end if cellTable.btn_ChestReward then if data.rewardState then UIUtils.SetActive(cellTable.btn_ChestReward, true) cellTable.effect_ChestReward:PlayUIEffect() cellTable.group_Chest:PlayAnim() else UIUtils.SetActive(cellTable.btn_ChestReward, false) cellTable.effect_ChestReward:StopUIEffect() end end if cellTable.txt_FinderName then cellTable.txt_FinderName.text = data.finderName end end function UIGoldenHeroBossRecord:OnCellClicked(scrollRect, index, cellTable, target, data) if target == cellTable.btn_ChestReward then local timeId = DataSheetManager.GoldHeroActivityModeData:GetDataByHeroType(self.heroType).DailyRankEndTime if UTL.Time.IsServerInOpeningTime(1, timeId) then MDL.GoldenHeroBoss.GoldHeroGetFindBossRewardReq(self.activityId, data.bossId) else -- 23点~隔日5点 扫荡不会发现讨伐boss UTL.MessageBox.ShowOKCancelBox(nil, Const_IDS.IDS_GoldHeroActivity_NewHint_9, function() MDL.GoldenHeroBoss.GoldHeroGetFindBossRewardReq(self.activityId, data.bossId) end) end end end return UIGoldenHeroBossRecord