45 lines
1.1 KiB
Lua
45 lines
1.1 KiB
Lua
---@class WB_TestButtonItem_C:UUserWidget
|
|
---@field Button_0 UButton
|
|
---@field TextBlock_0 UTextBlock
|
|
--Edit Below--
|
|
---@type WB_TestButtonItem_C
|
|
local WB_TestButtonItem = { bInitDoOnce = false; };
|
|
|
|
WB_TestButtonItem.Func = nil;
|
|
WB_TestButtonItem.OwnerParent = nil;
|
|
|
|
function WB_TestButtonItem:Construct()
|
|
self.Button_0.OnClicked:Add(function()
|
|
UGCLogSystem.Log("[WB_TestButtonItem:Construct] 点击")
|
|
if self.Func and self.OwnerParent then
|
|
self.Func(self.OwnerParent)
|
|
end
|
|
end, self)
|
|
self.bInitDoOnce = true;
|
|
end
|
|
|
|
-- function WB_TestButtonItem:Tick(MyGeometry, InDeltaTime)
|
|
|
|
-- end
|
|
|
|
-- function WB_TestButtonItem:Destruct()
|
|
|
|
-- end
|
|
|
|
function WB_TestButtonItem:SetFunc(InFunc, InParent, InText)
|
|
UGCLogSystem.Log("[WB_TestButtonItem:SetFunc] InParent = %s", UE.GetName(InParent))
|
|
self.Func = InFunc;
|
|
self.OwnerParent = InParent;
|
|
if InText then
|
|
self.TextBlock_0:SetText(InText);
|
|
end
|
|
if self.bInitDoOnce then return end
|
|
self.Button_0.OnClicked:Add(function()
|
|
UGCLogSystem.Log("[WB_TestButtonItem:Construct] 点击")
|
|
if self.Func and self.OwnerParent then
|
|
self.Func(self.OwnerParent)
|
|
end
|
|
end, self)
|
|
end
|
|
|
|
return WB_TestButtonItem; |