210 lines
7.1 KiB
Lua
210 lines
7.1 KiB
Lua
---@class WBP_ForceGuide_BossInfo_C:UUserWidget
|
|
---@field Boss_1 UOverlay
|
|
---@field Boss_2 UOverlay
|
|
---@field Boss_3 UOverlay
|
|
---@field Boss_4 UBorder
|
|
---@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 Panel_Tip_1 UCanvasPanel
|
|
---@field Panel_Tip_2 UCanvasPanel
|
|
---@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_ForceGuide_BossInfo = { bInitDoOnce = false; };
|
|
|
|
|
|
function WBP_ForceGuide_BossInfo:OnStartGuideProgress()
|
|
self:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
|
|
|
self.Panel_BG:Construct()
|
|
|
|
for i = 1, 4 do
|
|
self["Button_"..tostring(i)].OnClicked:Add(function()
|
|
self:SetupBossInfoPanel(i)
|
|
end, self)
|
|
end
|
|
|
|
local BossList = UGCGameSystem.GameState.BossList
|
|
self:UpdateBossInfo(BossList)
|
|
|
|
self.NextAllowedIndex = 1
|
|
self:SetupBossInfoPanel(1)
|
|
|
|
EventSystem:SendEvent(EventType.ForceGuide_OnGuideTriggered, 2)
|
|
end
|
|
|
|
function WBP_ForceGuide_BossInfo:OnEndGuideProgress()
|
|
self:SetVisibility(ESlateVisibility.Collapsed)
|
|
|
|
EventSystem:SendEvent(EventType.ForceGuide_OnGuideFinished, 2)
|
|
end
|
|
|
|
function WBP_ForceGuide_BossInfo:UpdateBossInfo(BossList)
|
|
self.Panel_Tip_1:SetVisibility(ESlateVisibility.Collapsed)
|
|
self.Panel_Tip_2:SetVisibility(ESlateVisibility.Collapsed)
|
|
|
|
if BossList == nil or #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_ForceGuide_BossInfo:SetupBossData(Index, BossID)
|
|
if Tables.MonsterBaseConfig[BossID] == nil or Tables.MonsterBaseConfig[BossID].Type ~= EMonsterType.Boss then return end
|
|
|
|
if self.BossInfo == nil then
|
|
self.BossInfo = {}
|
|
end
|
|
|
|
local BossData = {
|
|
ID = 0,
|
|
SpawnWave = "",
|
|
BossName = "",
|
|
BossIcon = "", --放按钮上
|
|
Characteristic = "",
|
|
SkillName1 = "",
|
|
SkillDesc1 = "",
|
|
SkillIcon1 = "",
|
|
SkillName2 = "",
|
|
SkillDesc2 = "",
|
|
SkillIcon2 = "",
|
|
}
|
|
BossData.ID = BossID
|
|
|
|
local FightStageIndex = UGCGameSystem.GameState.GameDifficulty <= 3 and UGCGameSystem.GameState.GameDifficulty or 3
|
|
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_ForceGuide_BossInfo:SetupBossInfoPanel(Index)
|
|
local BossData = self.BossInfo[Index]
|
|
if BossData == nil then
|
|
return
|
|
end
|
|
|
|
if self.NextAllowedIndex ~= 0 and Index ~= self.NextAllowedIndex then
|
|
return
|
|
end
|
|
|
|
if Index == self.TotalBossNum then
|
|
self.Panel_Tip_1:SetVisibility(ESlateVisibility.Collapsed)
|
|
self.Panel_Tip_2:SetVisibility(ESlateVisibility.Collapsed)
|
|
self.NextAllowedIndex = 0
|
|
|
|
if self.CloseHandle == nil then
|
|
self.CloseHandle = EventSystem.SetTimer(self, function()
|
|
self:OnEndGuideProgress()
|
|
EventSystem.StopTimer(self.CloseHandle)
|
|
self.CloseHandle = nil
|
|
end, 1.0)
|
|
end
|
|
elseif Index == 1 then
|
|
if self.NextAllowedIndex ~= 0 then
|
|
self.Panel_Tip_1:SetVisibility(ESlateVisibility.HitTestInvisible)
|
|
self.Panel_Tip_2:SetVisibility(ESlateVisibility.Collapsed)
|
|
self.NextAllowedIndex = 2
|
|
end
|
|
elseif Index == 2 then
|
|
if self.NextAllowedIndex ~= 0 then
|
|
self.Panel_Tip_2:SetVisibility(ESlateVisibility.HitTestInvisible)
|
|
self.Panel_Tip_1:SetVisibility(ESlateVisibility.Collapsed)
|
|
self.NextAllowedIndex = 3
|
|
end
|
|
else
|
|
self.Panel_Tip_1:SetVisibility(ESlateVisibility.Collapsed)
|
|
self.Panel_Tip_2:SetVisibility(ESlateVisibility.Collapsed)
|
|
self.NextAllowedIndex = 0
|
|
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 MonsterGradeParam = MonsterParam["Boss"].GradeParam[Index]
|
|
self.TextBlock_Health:SetText(string.format('生命值:%.1fw', MonsterGradeParam.Health / 10000))
|
|
|
|
local AttackValue = MonsterGradeParam.AttackValue
|
|
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_ForceGuide_BossInfo; |