UGCProjects/GZJ/Script/UI/Notice/WBP_WarningFrameNotice.lua
2025-01-08 22:46:12 +08:00

65 lines
1.8 KiB
Lua

---@class WBP_WarningFrameNotice_C:WBP_NoticeBase_C
---@field FadeOut UWidgetAnimation
---@field WarningLoop UWidgetAnimation
---@field FadeIn UWidgetAnimation
---@field Img_Alert UImage
---@field Img_Warning UImage
---@field TextBlock_Warning UTextBlock
--Edit Below--
local NoticeBase = require('Script.UI.Notice.WBP_NoticeBase')
local WBP_WarningFrameNotice = setmetatable(
{
bInitDoOnce = false,
},
{
__index = NoticeBase,
__metatable = NoticeBase
}
);
function WBP_WarningFrameNotice:Construct()
WBP_WarningFrameNotice.SuperClass.Construct(self)
self.Img_Warning:SetVisibility(ESlateVisibility.Collapsed)
end
function WBP_WarningFrameNotice:InitNoticeFromParam(InParams)
if type(InParams) ~= "table" then
return
end
self.TextBlock_Warning:SetText(InParams.Txt)
self:SetupAnimation(InParams.NeedFrame)
end
function WBP_WarningFrameNotice:SetupAnimation(bNeedFrame)
self:UnbindAllFromAnimationFinished(self.FadeIn)
if bNeedFrame then
local AnimFinishDelegate = ObjectExtend.CreateDelegate(self,
function()
self.Img_Warning:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
self:PlayAnimation(self.WarningLoop, 0.0, 0, EUMGSequencePlayMode.Forward, 1.0)
end)
self:BindToAnimationFinished(self.FadeIn, AnimFinishDelegate)
end
end
function WBP_WarningFrameNotice:GetEnterAnimation()
return self.FadeIn
end
function WBP_WarningFrameNotice:GetExitAnimation()
return self.FadeOut
end
function WBP_WarningFrameNotice:CloseNotice()
if self:IsAnimationPlaying(self.WarningLoop) then
self:StopAnimation(self.WarningLoop)
end
self.Img_Warning:SetVisibility(ESlateVisibility.Collapsed)
self:SetVisibility(ESlateVisibility.Collapsed)
end
return WBP_WarningFrameNotice;