48 lines
1.2 KiB
Lua
48 lines
1.2 KiB
Lua
---@class WB_Tip1_C:UUserWidget
|
|
---@field ShowTips UWidgetAnimation
|
|
---@field TextBlock_Tips UTextBlock
|
|
--Edit Below--
|
|
---@type WB_Tip1_C
|
|
local WB_Tip1 = { bInitDoOnce = false; };
|
|
|
|
--[==[ Construct
|
|
function WB_Tip1:Construct()
|
|
|
|
end
|
|
-- Construct ]==]
|
|
|
|
-- function WB_Tip1:Tick(MyGeometry, InDeltaTime)
|
|
|
|
-- end
|
|
|
|
-- function WB_Tip1:Destruct()
|
|
|
|
-- end
|
|
|
|
function WB_Tip1:OnShowPanel(ShowTime, fmt, ...)
|
|
UGCLogSystem.Log("[WB_Tip1:OnShowPanel] 执行")
|
|
if ShowTime then
|
|
self:PlayAnimation(self.ShowTips, 0, 1, EUMGSequencePlayMode.Forward, 1);
|
|
--self.ShowTips.GetEndTime()
|
|
local Time = 0;
|
|
if type(ShowTime) == 'number' then
|
|
Time = ShowTime > 1 and ShowTime or 1;
|
|
self:SetTips(fmt, ...)
|
|
elseif type(ShowTime) == 'string' or ShowTime == nil then
|
|
Time = 3;
|
|
self:SetTips(fmt, ...)
|
|
end
|
|
-- 动画默认是 0.5 秒显示
|
|
UGCEventSystem.SetTimer(self, function()
|
|
self:PlayAnimation(self.ShowTips, 0, 1, EUMGSequencePlayMode.Reverse, 1);
|
|
end, Time - (self.ShowTips:GetEndTime() - self.ShowTips:GetStartTime()) * 2)
|
|
end
|
|
end
|
|
|
|
function WB_Tip1:SetTips(fmt, ...)
|
|
if fmt ~= nil then
|
|
self.TextBlock_Tips:SetText(string.format(fmt, ...));
|
|
end
|
|
end
|
|
|
|
return WB_Tip1; |