--- 左侧小列表Boss进度子view local UICountryNightBossBattleList = UIViewClass() local EventSystem = require('Event/EventSystem') function UICountryNightBossBattleList:OnOpened(context) self:RegistSystemEvent(EventID.UI_CountryNightBoss_UpdateBossInfo, self.RefreshInfo) self:RefreshInfo() end function UICountryNightBossBattleList:RefreshInfo() self.loop_BossList:ReloadAll(MDL.CountryNightBoss.GetSortedBossInfoList()) end function UICountryNightBossBattleList:OnFocusChanged(isFocus) if isFocus == false then self.sub_View:CloseAll() self.openBossID = nil end end function UICountryNightBossBattleList:OnCellSelect(scrollRect, index, cellTable, data) if self.selectedBossID ~= data.bossId then self.selectedBossID = data.bossId self.loop_BossList:RefreshCells() end if CTL.CountryNightBoss.IsChangAnLevel() and self.openBossID ~= data.bossId then self.sub_View:CloseAll() self.sub_View:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UICountryNightBossBattleRank), {bossID = data.bossId}) self.openBossID = data.bossId EventSystem.Dispatch(EventID.UI_TownHome_HideLeftBtn, false) end end function UICountryNightBossBattleList:OnCellInit(scrollRect, index, cellTable, data) local bossData = DataSheetManager.CountryNightBoss:GetDataByID(data.bossId) UIUtils.SetActive(cellTable.img_Select.gameObject, self.selectedBossID == data.bossId) -- 头像 local heroItemID = DataSheetManager.HeroNum:GetDataByID(bossData.HeroID).HeroItem UTL.Item.SetItemIcon(cellTable.img_BossHead, heroItemID) -- 国家 UIUtils.SetLabel(cellTable.txt_Country, CTL.Country.GetCountryNameWithColorAndColon(bossData.BossNation)) -- boss名字 UIUtils.SetLabelText(cellTable.txt_BossName, Const_IDS[bossData.WordBossName]) -- 血量 local percentVal = CTL.CountryNightBoss.GetHpPercentVal(data.bossHp, data.totalBossHp) UIUtils.SetLabel(cellTable.txt_Blood, CTL.CountryNightBoss.GetHpPercentValStr(data.bossHp, data.totalBossHp)) UIUtils.SetAtlasImageFillAmount(cellTable.img_BossHp, percentVal) -- 剩余时间 local bossLeftTime = MDL.CountryNightBoss.GetBossLeftTimeByID(data.bossId) UIUtils.SetActive(cellTable.txt_Time, bossLeftTime > 0) UIUtils.SetLabel(cellTable.txt_Time, CTL.CountryNightBoss.GetBossTimerStrBySeconds(bossLeftTime)) -- 退字 UIUtils.SetActive(cellTable.img_DeadBg.gameObject, MDL.CountryNightBoss.IsBossOver(data.bossId)) end return UICountryNightBossBattleList