local UIWorldBossWait = UIViewClass() function UIWorldBossWait:OnOpened(context) self:RegistSystemEvent(EventID.UI_WorldBoss_UpdateDamageInfo, self.RefreshRankList) self.worldBossType = context.bossType self:UpdateRankInfo() end function UIWorldBossWait:UpdateRankInfo() if self.worldBossType == LuaConst.WorldBossType.WorldBoss then UIUtils.SetLabel(self.labLocal_SubTitle01, UIUtils.GetLocalizedTxt(Const_IDS.IDS_WorldBoss_BuChongTanChuang_5)) elseif self.worldBossType == LuaConst.WorldBossType.WarZoneWorldBoss then UIUtils.SetLabel(self.labLocal_SubTitle01, UIUtils.GetLocalizedTxt(Const_IDS.IDS_CountryWorldBoss_BattleType)) end -- 通过关卡ID反查系统BossID local bossConfig = MDL.WorldBoss.GetBossConfigDataByLevelID(BattleDataGetter.GetLevelID()) if bossConfig then -- boss等级、名字 local levelStr = UTL.Item.GetNobilityByTeamLevel(bossConfig.ShowLevel) -- 爵位转换 local teamLevelName = string.FormatByIdsId(Const_IDS.IDS_HeroLevelShow, levelStr) UIUtils.SetLabel(self.txt_Title, string.FormatByIdsId(Const_IDS.IDS_WorldBoss_BuChongTanChuang_1, teamLevelName, UIUtils.GetLocalizedTxt(Const_IDS[bossConfig.WordBossName]))) --boss头像 UIUtils.SetImageByAssetBundle(self.img_LiHui, bossConfig.Icon) else logging.error(LTAG.ERROR, "世界Boss系统 : 请检查WorldBoss表;MissonDataID = ", BattleDataGetter.GetLevelID()) end self:RefreshRankList() -- 弹窗关闭倒计时 self.LeaveTimeNum = DataSheetManager.ConstData:GetDataByID("WorldBossRankingPopup").IntValue self.timer_CloseView:ResetAndBeginCustomTimer(false, self.LeaveTimeNum, 0, UIUtils.GetLocalizedTxt(Const_IDS.IDS_WorldBoss_BuChongTanChuang_7), 1) self:StartRepeatFunc(self.OnUpdateFun, self.LeaveTimeNum) end function UIWorldBossWait:RefreshRankList() -- 参与讨伐Boss的玩家列表 self.loop_Rank:ClearCells() local rankList = BattleDataGetter.GetWorldBossRank() for _, playerData in ipairs(rankList) do self.loop_Rank:AddData(playerData,0) end end function UIWorldBossWait:OnClosed() -- 关闭这个弹窗后打开结算面板 CTL.WorldBoss.OpenResultPanel() end function UIWorldBossWait:OnUpdateFun(deltaTime, timeSinceUpdate) self:StopRepeatFunc(self.OnUpdateFun) self:CloseView() end function UIWorldBossWait:OnCellInit(scrollRect, index, cellTable, data) local realIndex = index + 1 -- 第一名有特殊背景板,后面隔行出现不同的背景图片 if realIndex == 1 then cellTable.state_BG:SetState(0) else cellTable.state_BG:SetState(realIndex % 2 == 0 and 1 or 2) end local isCurPlayer = false if BattleDataGetter.GetCurEntity() and data.teamLeaderName == BattleDataGetter.GetCurEntity():GetTeamLeaderName() then isCurPlayer = true end -- 排名、玩家名 UIUtils.SetLabel(cellTable.txt_Rank, realIndex) local name = data.hasTeam and string.FormatByIdsId(Const_IDS.IDS_Team_WorldBoss_Team, data.teamLeaderName) or data.teamLeaderName UIUtils.SetLabel(cellTable.txt_Name, isCurPlayer and UTL.Color.FormatGreenColor(name) or UTL.Color.FormatWhiteColor(name)) if self.worldBossType == LuaConst.WorldBossType.WorldBoss then cellTable.obj_GuildOrCountryState:SetState(0) -- 势力名、徽记 if string.isNilOrEmpty(data.guildName) then UIUtils.SetActive(cellTable.img_GuildlIcon, false) local guildName = UIUtils.GetLocalizedTxt(Const_IDS.IDS_None) UIUtils.SetLabel(cellTable.txt_GuildName, isCurPlayer and UTL.Color.FormatGreenColor(guildName) or UTL.Color.FormatWhiteColor(guildName)) else UIUtils.SetActive(cellTable.img_GuildlIcon, true) UIUtils.SetLabel(cellTable.txt_GuildName, isCurPlayer and UTL.Color.FormatGreenColor(data.guildName) or UTL.Color.FormatWhiteColor(data.guildName)) UIUtils.SetLabel(cellTable.txt_Guile, data.guildEmblemContent) UTL.Item.SetAtlasSprite(cellTable.img_GuildlIcon, "UI_Guild", DataSheetManager.GuildEmblem:GetDataByID(data.guildEmblemFrame).Image) end elseif self.worldBossType == LuaConst.WorldBossType.WarZoneWorldBoss then if data.countryId == nil or data.countryId < LuaConst.EHeroKingdomType.WEI or data.countryId > LuaConst.EHeroKingdomType.QUN then cellTable.obj_GuildOrCountryState:SetState(2) else cellTable.obj_GuildOrCountryState:SetState(1) cellTable.uistate_Country:SetState(data.countryId - 1) -- c# index从0开始 end end -- 伤害数值 local damageNum = UTL.String.GetCountStr(math.ceil(data.damage)) UIUtils.SetLabel(cellTable.txt_Damage, isCurPlayer and UTL.Color.FormatGreenColor(damageNum) or UTL.Color.FormatWhiteColor(damageNum)) end return UIWorldBossWait