71 lines
1.5 KiB
Lua
71 lines
1.5 KiB
Lua
---@class WB_SelectPartButton_C:UUserWidget
|
|
---@field Button_Open UButton
|
|
---@field TextBlock_Name UTextBlock
|
|
---@field WidgetSwitcher_Select UWidgetSwitcher
|
|
--Edit Below--
|
|
---@type WB_SelectPartButton_C
|
|
local WB_SelectPartButton = { bInitDoOnce = false; };
|
|
|
|
function WB_SelectPartButton:Construct()
|
|
self:LuaInit();
|
|
end
|
|
|
|
function WB_SelectPartButton:LuaInit()
|
|
if self.bInitDoOnce then return ; end
|
|
self.bInitDoOnce = true;
|
|
self.Button_Open.OnClicked:Add(self.OnClickOpen, self)
|
|
|
|
if self.IsSelect ~= nil then
|
|
self:SetSelect(self.IsSelect);
|
|
end
|
|
|
|
if self.PartType then
|
|
self:SetPartType(self.PartType)
|
|
end
|
|
end
|
|
|
|
function WB_SelectPartButton:OnClickOpen()
|
|
if self.Owner then self.Func(self.Owner, self); end
|
|
end
|
|
|
|
WB_SelectPartButton.Owner = nil;
|
|
WB_SelectPartButton.Func = nil;
|
|
|
|
function WB_SelectPartButton:Init(Owner, InFunc)
|
|
self.Owner = Owner;
|
|
self.Func = InFunc;
|
|
self:LuaInit();
|
|
end
|
|
|
|
WB_SelectPartButton.IsSelect = nil;
|
|
|
|
function WB_SelectPartButton:SetSelect(IsSelect)
|
|
if self.WidgetSwitcher_Select then
|
|
self.WidgetSwitcher_Select:SetActiveWidgetIndex(IsSelect and 1 or 0);
|
|
else
|
|
self.IsSelect = IsSelect;
|
|
end
|
|
end
|
|
|
|
WB_SelectPartButton.PartType = nil;
|
|
|
|
function WB_SelectPartButton:SetPartType(InType)
|
|
self.PartType = InType;
|
|
if self.TextBlock_Name then
|
|
self.TextBlock_Name:SetText(WeaponTypeName[InType].Chinese);
|
|
end
|
|
end
|
|
|
|
function WB_SelectPartButton:GetPartType()
|
|
return self.PartType;
|
|
end
|
|
|
|
-- function WB_SelectPartButton:Tick(MyGeometry, InDeltaTime)
|
|
|
|
-- end
|
|
|
|
-- function WB_SelectPartButton:Destruct()
|
|
|
|
-- end
|
|
|
|
return WB_SelectPartButton; |