74 lines
1.8 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
---@class WB_SelectSaveWeapon_C:UUserWidget
---@field Image_Weapon UImage
---@field NewButton_Weapon UNewButton
---@field TextBlock_WeaponName UTextBlock
---@field WidgetSwitcher_IsSelect UWidgetSwitcher
--Edit Below--
local WB_SelectSaveWeapon = { bInitDoOnce = false }
--[==[ Construct
function WB_SelectSaveWeapon:Construct()
end
-- Construct ]==]
-- function WB_SelectSaveWeapon:Tick(MyGeometry, InDeltaTime)
-- end
-- function WB_SelectSaveWeapon:Destruct()
-- end
function WB_SelectSaveWeapon:LuaInit()
if self.bInitDoOnce then
return;
end
self.bInitDoOnce = true;
WidgetLibrary.BindButtonClicked(self.NewButton_Weapon, self.ClickSelect, self)
self.NewButton_Weapon:SetTouchMethod(EButtonTouchMethod.PreciseTap)
end
function WB_SelectSaveWeapon:SetIndex(InIndex)
self.Index = InIndex
end
function WB_SelectSaveWeapon:GetIndex()
return self.Index
end
function WB_SelectSaveWeapon:BindClickSelect(Func, Obj)
self.SelectCallBackFunc = Func
self.SelectCallBackObj = Obj
end
function WB_SelectSaveWeapon:ClickSelect()
if self.SelectCallBackFunc then
if self.SelectCallBackObj then
self.SelectCallBackFunc(self.SelectCallBackObj, self:GetIndex())
else
self.SelectCallBackFunc(self:GetIndex())
end
end
end
function WB_SelectSaveWeapon:SetSelect(IsSelect)
if IsSelect then
self.WidgetSwitcher_IsSelect:SetActiveWidgetIndex(1);
else
self.WidgetSwitcher_IsSelect:SetActiveWidgetIndex(0);
end
end
function WB_SelectSaveWeapon:SetWeaponID(InWeaponID)
self:LuaInit()
self.WeaponID = InWeaponID
MyWeaponSystem.AsyncLoadItemWhiteIconToBrush(self.WeaponID, self.Image_Weapon)
self.TextBlock_WeaponName:SetText(MyWeaponSystem.GetItemName(self.WeaponID))
end
function WB_SelectSaveWeapon:GetWeaponID()
return self.WeaponID
end
return WB_SelectSaveWeapon