57 lines
1.5 KiB
Lua
57 lines
1.5 KiB
Lua
|
---@class WBP_CountDownNotice_C:WBP_NoticeBase_C
|
||
|
---@field FadeOut UWidgetAnimation
|
||
|
---@field FadeIn UWidgetAnimation
|
||
|
---@field Img_Alert UImage
|
||
|
---@field TextBlock_CountDownHeader UTextBlock
|
||
|
---@field TextBlock_CountDownRemainTime UTextBlock
|
||
|
--Edit Below--
|
||
|
|
||
|
local NoticeBase = require('Script.UI.Notice.WBP_NoticeBase')
|
||
|
local WBP_CountDownNotice = setmetatable(
|
||
|
{
|
||
|
bInitDoOnce = false,
|
||
|
RemainTime = -1,
|
||
|
},
|
||
|
{
|
||
|
__index = NoticeBase,
|
||
|
__metatable = NoticeBase
|
||
|
}
|
||
|
);
|
||
|
|
||
|
function WBP_CountDownNotice:Construct()
|
||
|
WBP_CountDownNotice.SuperClass.Construct(self)
|
||
|
end
|
||
|
|
||
|
function WBP_CountDownNotice:Tick(MyGeometry, InDeltaTime)
|
||
|
if self.RemainTime >= 0.0 then
|
||
|
self.RemainTime = self.RemainTime - InDeltaTime
|
||
|
self.TextBlock_CountDownRemainTime:SetText(tostring(math.ceil(self.RemainTime)))
|
||
|
else
|
||
|
self.bCanEverTick = false
|
||
|
return
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function WBP_CountDownNotice:InitNoticeFromParam(InParams)
|
||
|
if type(InParams) ~= "table" then
|
||
|
return
|
||
|
end
|
||
|
|
||
|
local AlertVisibility = InParams.ShowAlert and ESlateVisibility.SelfHitTestInvisible or ESlateVisibility.Collapsed
|
||
|
self.Img_Alert:SetVisibility(AlertVisibility)
|
||
|
|
||
|
self.TextBlock_CountDownHeader:SetText(InParams.Txt)
|
||
|
|
||
|
self.RemainTime = tonumber(InParams.Time)
|
||
|
self.bCanEverTick = true
|
||
|
end
|
||
|
|
||
|
function WBP_CountDownNotice:GetEnterAnimation()
|
||
|
return self.FadeIn
|
||
|
end
|
||
|
|
||
|
function WBP_CountDownNotice:GetExitAnimation()
|
||
|
return self.FadeOut
|
||
|
end
|
||
|
|
||
|
return WBP_CountDownNotice;
|