64 lines
1.3 KiB
Lua
64 lines
1.3 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.Button_Open.OnClicked:Add(self.OnClickOpen, self)
|
||
|
|
||
|
self.bInitDoOnce = true;
|
||
|
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
|
||
|
|
||
|
function WB_SelectPartButton:SetSelect(IsSelect)
|
||
|
if IsSelect then
|
||
|
self.WidgetSwitcher_Select:SetActiveWidgetIndex(1);
|
||
|
else
|
||
|
self.WidgetSwitcher_Select:SetActiveWidgetIndex(0);
|
||
|
end
|
||
|
end
|
||
|
|
||
|
WB_SelectPartButton.PartType = 0;
|
||
|
|
||
|
function WB_SelectPartButton:SetPartType(InType)
|
||
|
self.PartType = InType;
|
||
|
self.TextBlock_Name:SetText(WeaponTypeName[InType].Chinese);
|
||
|
end
|
||
|
|
||
|
function WB_SelectPartButton:GetPartType()
|
||
|
return self.PartType;
|
||
|
end
|
||
|
|
||
|
-- function WB_SelectPartButton:Tick(MyGeometry, InDeltaTime)
|
||
|
|
||
|
-- end
|
||
|
|
||
|
-- function WB_SelectPartButton:Destruct()
|
||
|
|
||
|
-- end
|
||
|
|
||
|
return WB_SelectPartButton;
|