---@class WBP_BossInfoPanel_V2_C:UUserWidget ---@field Boss_1 UOverlay ---@field Boss_2 UOverlay ---@field Boss_3 UOverlay ---@field Boss_4 UOverlay ---@field Button_1 UButton ---@field Button_2 UButton ---@field Button_3 UButton ---@field Button_4 UButton ---@field Image_Icon1 UImage ---@field Image_Icon2 UImage ---@field Image_Icon3 UImage ---@field Image_Icon4 UImage ---@field Image_Select1 UImage ---@field Image_Select2 UImage ---@field Image_Select3 UImage ---@field Image_Select4 UImage ---@field Image_SkillIcon1 UImage ---@field Image_SkillIcon2 UImage ---@field Panel_BG UWBP_WidgetHeader_C ---@field TextBlock_Attack UTextBlock ---@field TextBlock_BossName UTextBlock ---@field TextBlock_Characteristic UTextBlock ---@field TextBlock_Desc1 UTextBlock ---@field TextBlock_Desc2 UTextBlock ---@field TextBlock_Health UTextBlock ---@field TextBlock_SkillName1 UTextBlock ---@field TextBlock_SkillName2 UTextBlock ---@field TextBlock_SpawnTime UTextBlock --Edit Below-- local WBP_BossInfoPanel_V2 = { bInitDoOnce = false, BossList = {}, BossInfo = {}, TotalBossNum = 0, CurSelectedIndex = -1, }; function WBP_BossInfoPanel_V2:Construct() self.Panel_BG.UIType = EUIType.BossInfo self.Panel_BG:Construct() for i = 1, 4 do self["Button_"..tostring(i)].OnClicked:Add(function() self:SetupBossInfoPanel(i) end, self) end self.BossList = UGCGameSystem.GameState.BossList self:UpdateBossInfo(self.BossList) EventSystem:AddListener(EventType.ChangeBossList, WBP_BossInfoPanel_V2.UpdateBossInfo, self) end function WBP_BossInfoPanel_V2:OnShowPanel() if self.CurSelectedIndex <= 0 then self.CurSelectedIndex = 1 end self:SetupBossInfoPanel(self.CurSelectedIndex) NewPlayerGuideManager:RemoveGuide(15) end function WBP_BossInfoPanel_V2:UpdateBossInfo(BossList) if BossList == nil or table.isEmpty(BossList) or table.getCount(BossList) <= 0 then return end for i = 1, 4 do self["Boss_"..tostring(i)]:SetVisibility(ESlateVisibility.Collapsed) end local BossNum = 0 for _, ID in pairs(BossList) do BossNum = BossNum + 1 self:SetupBossData(BossNum, ID); end self.TotalBossNum = BossNum for i = 1, 4 do local BossData = self.BossInfo[i] if BossData then self["Boss_"..tostring(i)]:SetVisibility(ESlateVisibility.SelfHitTestInvisible) self["Image_Select"..tostring(i)]:SetVisibility(ESlateVisibility.Collapsed) UIManager.LoadTexture(self["Image_Icon"..tostring(i)], BossData.BossIcon) end end end function WBP_BossInfoPanel_V2:SetupBossData(Index, BossID) if Tables.MonsterBaseConfig[BossID] == nil or Tables.MonsterBaseConfig[BossID].Type ~= EMonsterType.Boss then return end local BossData = { ID = 0, SpawnWave = "", BossName = "", BossIcon = "", --放按钮上 Characteristic = "", SkillName1 = "", SkillDesc1 = "", SkillIcon1 = "", SkillName2 = "", SkillDesc2 = "", SkillIcon2 = "", } BossData.ID = BossID local FightStageIndex = math.clamp(UGCGameSystem.GameState.GameDifficulty, 1, 4) local MonsterSpawnNum = Tables.GameFightStageConfig[FightStageIndex] local BossSpawnInnings = {} for i = 1, #MonsterSpawnNum do if MonsterSpawnNum[i].MonsterNum.Boss > 0 then table.insert(BossSpawnInnings, i) end end if BossSpawnInnings[Index] then BossData.SpawnWave = string.format("第%d回合", BossSpawnInnings[Index]) else return end local TempBossConfig = Tables.MonsterBaseConfig[BossID] BossData.BossName = TempBossConfig.ChineseName BossData.BossIcon = TempBossConfig.Icon BossData.Characteristic = TempBossConfig.Characteristic BossData.SkillName1 = TempBossConfig.SkillDescs[1].SkillName BossData.SkillDesc1 = TempBossConfig.SkillDescs[1].SkillDesc BossData.SkillIcon1 = TempBossConfig.SkillDescs[1].Icon BossData.SkillName2 = TempBossConfig.SkillDescs[2].SkillName BossData.SkillDesc2 = TempBossConfig.SkillDescs[2].SkillDesc BossData.SkillIcon2 = TempBossConfig.SkillDescs[2].Icon self.BossInfo[Index] = BossData end function WBP_BossInfoPanel_V2:SetupBossInfoPanel(Index) local BossData = self.BossInfo[Index] if BossData == nil then return end for i = 1, 4 do if Index == i then self["Image_Select"..tostring(i)]:SetVisibility(ESlateVisibility.Visible) else self["Image_Select"..tostring(i)]:SetVisibility(ESlateVisibility.Collapsed) end end self.TextBlock_BossName:SetText(BossData.BossName) self.TextBlock_Characteristic:SetText(BossData.Characteristic) self.TextBlock_SpawnTime:SetText(BossData.SpawnWave) self.TextBlock_SkillName1:SetText(BossData.SkillName1) self.TextBlock_SkillName2:SetText(BossData.SkillName2) self.TextBlock_Desc1:SetText(BossData.SkillDesc1) self.TextBlock_Desc2:SetText(BossData.SkillDesc2) UIManager.LoadTexture(self.Image_SkillIcon1, BossData.SkillIcon1) UIManager.LoadTexture(self.Image_SkillIcon2, BossData.SkillIcon2) local AllPlayers = UGCGameSystem.GetAllPlayerPawn() local BossHealthMultiplier = GlobalConfigs.PlayerNumMultiplier[#AllPlayers] local GameDifficulty = UGCGameSystem.GameState.GameDifficulty local HealthMultiplier = GlobalConfigs.DifficultyMultiplier["Health"][GameDifficulty] local AttackMultiplier = GlobalConfigs.DifficultyMultiplier["Attack"][GameDifficulty] local MonsterGradeParam = MonsterParam["Boss"].GradeParam[Index] self.TextBlock_Health:SetText(string.format('生命值:%.1fw', MonsterGradeParam.Health * BossHealthMultiplier * HealthMultiplier / 10000)) local AttackValue = MonsterGradeParam.AttackValue * AttackMultiplier local AttackTxt = AttackValue > 10000 and string.format('威力值:%.1fw', AttackValue / 10000) or string.format('威力值:%d', math.ceil(AttackValue)) self.TextBlock_Attack:SetText(AttackTxt) end return WBP_BossInfoPanel_V2;