-- 名将列传一键扫荡更换扫荡优先度 local UIHeroBiographySweepSelectPanel = UIViewClass() local EventSystem = require('Event/EventSystem') function UIHeroBiographySweepSelectPanel:OnOpened(context) self.slotIndex = context.slotIndex self:Init() end function UIHeroBiographySweepSelectPanel:Init() if self.LoopScroll.Count > 0 then self.LoopScroll:ClearCells() end for i, v in DataSheetManager.HeroBiographyData:GetEnumerator() do self.LoopScroll:AddData(v, 0) end end function UIHeroBiographySweepSelectPanel:OnBackButtonPressed() self:OnButtonClicked(self.event_Close) end function UIHeroBiographySweepSelectPanel:OnButtonClicked(comp) if comp == self.event_Close then self:CloseView() end end function UIHeroBiographySweepSelectPanel:OnCellInit(scrollRect, index, cellTable, data) -- 武将头像 UTL.Item.ItemSquareItemIconByHeroId(data.HeroID, cellTable.img_HeroHead, cellTable.bg_HeroHead) -- 突破 local heroBreak = MDL.HeroStar.GetHeroStarLevel(data.HeroID) UIUtils.SetActive(cellTable.bg_Break.gameObject, true) UIUtils.SetLabel(cellTable.lab_Break, "+"..heroBreak) UIUtils.SetActive(cellTable.bg_Array_1.gameObject, MDL.Player.HeroIsLineUp(data.HeroID)) UIUtils.SetActive(cellTable.bg_Array_2.gameObject, MDL.AssistanceFight.IsHeroOnAssistancePos(data.HeroID)) -- 解锁遮罩 UIUtils.SetActive(cellTable.bg_Mask.gameObject, self:IsChapterLocked(data.ID)) end function UIHeroBiographySweepSelectPanel:OnCellSelect(scrollRect, index, cellTable, data) if self:IsChapterLocked(data.ID) then CTL.Tips.AddTipsMsg(Const_IDS.IDS_HeroBiography_Sweep7) else EventSystem.Dispatch(EventID.UI_HeroBiography_ModifySweepList, self.slotIndex, data.ID) self:CloseView() end end function UIHeroBiographySweepSelectPanel:IsChapterLocked(id) local chapterTotalStar = MDL.Biography.GetHeroBiographyStarNums(id) return chapterTotalStar <= 0 end return UIHeroBiographySweepSelectPanel