UGCProjects/BoltGods/Script/UI/Tip/WB_BoltTips.lua

49 lines
1.1 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
---@class WB_BoltTips_C:UUserWidget
---@field Image_Tips UImage
---@field TextBlock_Tips UTextBlock
--Edit Below--
---@type WB_BoltTips_C
local WB_BoltTips = { bInitDoOnce = false }
function WB_BoltTips:Construct()
end
function WB_BoltTips:LuaInit()
if self.bInitDoOnce then return ; end
self:SetBoltType(nil);
self.bInitDoOnce = true;
end
-- function WB_BoltTips:Tick(MyGeometry, InDeltaTime)
-- end
-- function WB_BoltTips:Destruct()
-- end
WB_BoltTips.ShowTimer = nil;
WB_BoltTips.BoltType = nil;
function WB_BoltTips:SetBoltType(BoltType)
-- 显示出来然后过2秒隐藏
if BoltType == nil then
self:SetVisibility(ESlateVisibility.Collapsed);
end
if BoltType == self.BoltType then return; end
if self.ShowTimer then
UGCEventSystem.StopTimer(self.ShowTimer)
self.ShowTimer = nil;
end
if not self:IsVisible() then
self:SetVisibility(ESlateVisibility.HitTestInvisible);
end
self.ShowTimer = UGCEventSystem.SetTimer(self, function()
self:SetVisibility(ESlateVisibility.Collapsed);
end, 3);
self.TextBlock_Tips:SetText(BoltInfo[BoltType].Desc);
end
return WB_BoltTips