107 lines
3.3 KiB
Lua
107 lines
3.3 KiB
Lua
|
---@class WBP_BossInfo_Item_V2_C:UUserWidget
|
||
|
---@field Button_1 UButton
|
||
|
---@field Image_1 UImage
|
||
|
---@field Image_Icon1 UImage
|
||
|
---@field Image_Select UImage
|
||
|
--Edit Below--
|
||
|
local WBP_BossInfo_Item_V2 = {
|
||
|
bInitDoOnce = false;
|
||
|
bBossIDIsUpdate = false;
|
||
|
|
||
|
BossID = 0;
|
||
|
BossName = "";
|
||
|
SpawnTime = "";
|
||
|
Characteristic = "";
|
||
|
SkillIcon1 = nil;
|
||
|
SkillIcon2 = nil;
|
||
|
SkillName1 = "";
|
||
|
SkillName2 = "";
|
||
|
SkillDesc1 = "";
|
||
|
SkillDesc2 = "";
|
||
|
BossLevel = 0;
|
||
|
};
|
||
|
|
||
|
|
||
|
function WBP_BossInfo_Item_V2:Construct()
|
||
|
self.Button_1.OnClicked:Add(WBP_BossInfo_Item_V2.ClickBossInfo, self)
|
||
|
EventSystem:AddListener(EventType.ChangeBossList, WBP_BossInfo_Item_V2.UpdateBossSpawnTime, self)
|
||
|
self:ShowSelect(false)
|
||
|
end
|
||
|
|
||
|
|
||
|
-- function WBP_BossInfo_Item_V2:Tick(MyGeometry, InDeltaTime)
|
||
|
|
||
|
-- end
|
||
|
|
||
|
-- function WBP_BossInfo_Item_V2:Destruct()
|
||
|
|
||
|
-- end
|
||
|
|
||
|
function WBP_BossInfo_Item_V2:OnShowPanel()
|
||
|
if not self.bBossIDIsUpdate then return end
|
||
|
self.bBossIDIsUpdate = false
|
||
|
if UGCGameSystem.GameState.BossList and #UGCGameSystem.GameState.BossList > 0 then
|
||
|
self.UpdateBossSpawnTime(UGCGameSystem.GameState.BossList)
|
||
|
end
|
||
|
|
||
|
local TempBossConfig = Tables.MonsterBaseConfig[self.BossID]
|
||
|
|
||
|
self.BossName = TempBossConfig.ChineseName
|
||
|
if TempBossConfig.Icon then
|
||
|
UIManager.LoadTexture(self.Image_Icon1, TempBossConfig.Icon)
|
||
|
else
|
||
|
print("WBP_BossInfo_Item_V2_Fun_" .. "UpdateInfo_TempBossConfig.Icon is nil")
|
||
|
end
|
||
|
self.Characteristic = TempBossConfig.Characteristic
|
||
|
|
||
|
self.SkillName1 = TempBossConfig.SkillDescs[1].SkillName
|
||
|
self.SkillDesc1 = TempBossConfig.SkillDescs[1].SkillDesc
|
||
|
self.SkillIcon1 = UE.LoadObject(TempBossConfig.SkillDescs[1].Icon)
|
||
|
|
||
|
self.SkillName2 = TempBossConfig.SkillDescs[2].SkillName
|
||
|
self.SkillDesc2 = TempBossConfig.SkillDescs[2].SkillDesc
|
||
|
self.SkillIcon2 = UE.LoadObject(TempBossConfig.SkillDescs[2].Icon)
|
||
|
end
|
||
|
|
||
|
function WBP_BossInfo_Item_V2:UpdateInfo(BossID)
|
||
|
|
||
|
print("WBP_BossInfo_Item_V2_Fun_" .. "UpdateInfo_BossID: " .. BossID)
|
||
|
if Tables.MonsterBaseConfig[BossID] == nil or Tables.MonsterBaseConfig[BossID].Type == EMonsterType.Bossthen then return end
|
||
|
self.BossID = BossID
|
||
|
self.bBossIDIsUpdate = true
|
||
|
|
||
|
end
|
||
|
|
||
|
function WBP_BossInfo_Item_V2:ClickBossInfo()
|
||
|
EventSystem:SendEvent(EventType.UpdateBossInfoToWidget, self, self.BossLevel)
|
||
|
end
|
||
|
|
||
|
function WBP_BossInfo_Item_V2:ShowSelect(IsShow)
|
||
|
if IsShow then
|
||
|
self.Image_Select:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
||
|
else
|
||
|
self.Image_Select:SetVisibility(ESlateVisibility.Collapsed)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function WBP_BossInfo_Item_V2:UpdateBossSpawnTime(BossList)
|
||
|
if BossList == nil or #BossList <= 0 then return end
|
||
|
local FightStageIndex = UGCGameSystem.GameState.GameDifficulty <= 4 and UGCGameSystem.GameState.GameDifficulty or 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
|
||
|
for i = 1, #BossList do
|
||
|
if BossList[i] == self.BossID then
|
||
|
if BossSpawnInnings[i] then
|
||
|
self.SpawnTime = string.format("第%d回合", BossSpawnInnings[i])
|
||
|
break
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
return WBP_BossInfo_Item_V2;
|