74 lines
2.0 KiB
Lua
74 lines
2.0 KiB
Lua
|
---@class WBP_AttackWaveRemainTimeNotice_C:UUserWidget
|
||
|
---@field FadeOut UWidgetAnimation
|
||
|
---@field FadeIn UWidgetAnimation
|
||
|
---@field TextBlock_Minute UTextBlock
|
||
|
---@field TextBlock_RecommandAttackValue UTextBlock
|
||
|
---@field TextBlock_Second UTextBlock
|
||
|
--Edit Below--
|
||
|
|
||
|
local NoticeBase = require('Script.UI.Notice.WBP_NoticeBase')
|
||
|
local WBP_AttackWaveRemainTimeNotice = setmetatable(
|
||
|
{
|
||
|
bInitDoOnce = false,
|
||
|
},
|
||
|
{
|
||
|
__index = NoticeBase,
|
||
|
__metatable = NoticeBase
|
||
|
}
|
||
|
);
|
||
|
|
||
|
local RecommandAttackValueTable = {
|
||
|
421,
|
||
|
793,
|
||
|
1453,
|
||
|
2421,
|
||
|
3871,
|
||
|
5406,
|
||
|
8637,
|
||
|
10416,
|
||
|
15157,
|
||
|
18949,
|
||
|
29138,
|
||
|
34304,
|
||
|
}
|
||
|
|
||
|
function WBP_AttackWaveRemainTimeNotice:Construct()
|
||
|
EventSystem:AddListener(EventType.OnCurAttackWaveChanged, WBP_AttackWaveRemainTimeNotice.OnCurAttackWaveChanged, self)
|
||
|
end
|
||
|
|
||
|
function WBP_AttackWaveRemainTimeNotice:InitNoticeFromParam(InParams)
|
||
|
if type(InParams) ~= "table" then
|
||
|
return
|
||
|
end
|
||
|
|
||
|
local RemainTime = InParams.RemainTime
|
||
|
if type(RemainTime) == "number" then
|
||
|
local Min = string.format("%02d", RemainTime // 60)
|
||
|
local Sec = string.format("%02d", RemainTime % 60)
|
||
|
|
||
|
self.TextBlock_Minute:SetText(Min)
|
||
|
self.TextBlock_Second:SetText(Sec)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function WBP_AttackWaveRemainTimeNotice:GetEnterAnimation()
|
||
|
return self.FadeIn
|
||
|
end
|
||
|
|
||
|
function WBP_AttackWaveRemainTimeNotice:GetExitAnimation()
|
||
|
return self.FadeOut
|
||
|
end
|
||
|
|
||
|
function WBP_AttackWaveRemainTimeNotice:OnCurAttackWaveChanged(CurAttackWave)
|
||
|
if CurAttackWave > 0 then
|
||
|
local CurAttackValue = RecommandAttackValueTable[CurAttackWave]
|
||
|
if CurAttackValue then
|
||
|
self.TextBlock_RecommandAttackValue:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
||
|
self.TextBlock_RecommandAttackValue:SetText("推荐战斗力: "..tostring(math.floor(CurAttackValue)))
|
||
|
end
|
||
|
else
|
||
|
self.TextBlock_RecommandAttackValue:SetVisibility(ESlateVisibility.Collapsed)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
return WBP_AttackWaveRemainTimeNotice;
|