90 lines
2.5 KiB
Lua
90 lines
2.5 KiB
Lua
---@class WB_WeaponConfigPartItem_C:UUserWidget
|
|
---@field Image_5 UImage
|
|
---@field Image_PartIcon UImage
|
|
---@field NewButton_ChangePart UNewButton
|
|
---@field WidgetSwitcher_IsNilPart UWidgetSwitcher
|
|
---@field WidgetSwitcher_IsSelect UWidgetSwitcher
|
|
---@field WidgetSwitcher_IsSelect_OLD UWidgetSwitcher
|
|
---@field WidgetSwitcher_SelectStyle UWidgetSwitcher
|
|
--Edit Below--
|
|
local WB_WeaponConfigPartItem = {
|
|
bInitDoOnce = false;
|
|
};
|
|
|
|
--[==[ Construct
|
|
function WB_WeaponConfigPartItem:Construct()
|
|
|
|
end
|
|
-- Construct ]==]
|
|
|
|
-- function WB_WeaponConfigPartItem:Tick(MyGeometry, InDeltaTime)
|
|
|
|
-- end
|
|
|
|
-- function WB_WeaponConfigPartItem:Destruct()
|
|
|
|
-- end
|
|
|
|
function WB_WeaponConfigPartItem:LuaInit()
|
|
if self.bInitDoOnce then return end
|
|
self.bInitDoOnce = true
|
|
WidgetLibrary.BindButtonClicked(self.NewButton_ChangePart, self.ClickCallBack, self)
|
|
end
|
|
|
|
function WB_WeaponConfigPartItem:ClickCallBack()
|
|
if self.SelectCallBackFunc then
|
|
if self.SelectCallBackObj then
|
|
self.SelectCallBackFunc(self.SelectCallBackObj, self:GetItemID(), self:GetPartType())
|
|
else
|
|
self.SelectCallBackFunc(self:GetItemID(), self:GetPartType())
|
|
end
|
|
end
|
|
end
|
|
|
|
function WB_WeaponConfigPartItem:BindSelectCallBack(InFunc, InObj)
|
|
self.SelectCallBackFunc = InFunc
|
|
self.SelectCallBackObj = InObj
|
|
end
|
|
|
|
|
|
WB_WeaponConfigPartItem.PartID = -1
|
|
function WB_WeaponConfigPartItem:SetItemID(InPartID)
|
|
if self.PartID ~= InPartID then
|
|
self.PartID = InPartID
|
|
|
|
if self.PartID and self.PartID >= 0 then
|
|
self:SetVisibility(ESlateVisibility.Visible)
|
|
if self.PartID == 0 then
|
|
self.WidgetSwitcher_IsNilPart:SetActiveWidgetIndex(1)
|
|
else
|
|
self.WidgetSwitcher_IsNilPart:SetActiveWidgetIndex(0)
|
|
MyWeaponSystem.AsyncLoadItemSmallIconToBrush(self.PartID, self.Image_PartIcon)
|
|
end
|
|
else
|
|
self:SetVisibility(ESlateVisibility.Collapsed)
|
|
end
|
|
end
|
|
end
|
|
|
|
function WB_WeaponConfigPartItem:GetItemID()
|
|
return self.PartID
|
|
end
|
|
|
|
function WB_WeaponConfigPartItem:SetPartType(InType)
|
|
self:LuaInit()
|
|
self.PartType = InType
|
|
end
|
|
|
|
function WB_WeaponConfigPartItem:GetPartType()
|
|
return self.PartType
|
|
end
|
|
|
|
function WB_WeaponConfigPartItem:SetIsSelect(InIsSelect)
|
|
self.WidgetSwitcher_IsSelect:SetActiveWidgetIndex(InIsSelect and 1 or 0)
|
|
end
|
|
|
|
function WB_WeaponConfigPartItem:SetSelectStyle(StyleIndex)
|
|
self.WidgetSwitcher_SelectStyle:SetActiveWidgetIndex(StyleIndex)
|
|
end
|
|
|
|
return WB_WeaponConfigPartItem; |