64 lines
2.0 KiB
Lua
64 lines
2.0 KiB
Lua
---@class WBP_GlobalNotice_C:WBP_NoticeBase_C
|
|
---@field FadeOut UWidgetAnimation
|
|
---@field FadeIn UWidgetAnimation
|
|
---@field Img_Alert UImage
|
|
---@field TextBlock_Txt1 UTextBlock
|
|
---@field TextBlock_Txt2 UTextBlock
|
|
---@field TextBlock_Txt3 UTextBlock
|
|
--Edit Below--
|
|
|
|
local NoticeBase = require('Script.UI.Notice.WBP_NoticeBase')
|
|
local WBP_GlobalNotice = setmetatable(
|
|
{
|
|
bInitDoOnce = false,
|
|
},
|
|
{
|
|
__index = NoticeBase,
|
|
__metatable = NoticeBase
|
|
}
|
|
);
|
|
|
|
function WBP_GlobalNotice: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_Txt1:SetVisibility(ESlateVisibility.Collapsed)
|
|
self.TextBlock_Txt2:SetVisibility(ESlateVisibility.Collapsed)
|
|
self.TextBlock_Txt3:SetVisibility(ESlateVisibility.Collapsed)
|
|
|
|
local Log =""
|
|
local Txt = InParams.Txt
|
|
local TxtType = type(Txt)
|
|
if type(Txt) == "table" then
|
|
for index, str in pairs(Txt) do
|
|
if type(str) == "string" then
|
|
local TextBlock = self["TextBlock_Txt"..tostring(index)]
|
|
if UE.IsValid(TextBlock) then
|
|
TextBlock:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
|
TextBlock:SetText(str)
|
|
Log = Log..str..", index = "..tostring(index)
|
|
end
|
|
end
|
|
end
|
|
elseif type(Txt) == "string" then
|
|
Log = Log..Txt..", "
|
|
self.TextBlock_Txt1:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
|
self.TextBlock_Txt1:SetText(Txt)
|
|
Log = Log.."Txt1"
|
|
end
|
|
UE.Log("[WBP_GlobalNotice:InitNoticeFromParam] Type=%s, ShowAlert = %d, Txt = %s", TxtType, AlertVisibility, Log)
|
|
end
|
|
|
|
function WBP_GlobalNotice:GetEnterAnimation()
|
|
return self.FadeIn
|
|
end
|
|
|
|
function WBP_GlobalNotice:GetExitAnimation()
|
|
return self.FadeOut
|
|
end
|
|
|
|
return WBP_GlobalNotice; |