81 lines
2.3 KiB
Lua
81 lines
2.3 KiB
Lua
---@class WB_WeaponSelectItem_C:UUserWidget
|
|
---@field Button_Select UNewButton
|
|
---@field Image_IsSelect UImage
|
|
---@field TextBlock_TextName UTextBlock
|
|
---@field WeaponInfo1 UWB_WeaponItem_C
|
|
---@field WeaponInfo2 UWB_WeaponItem_C
|
|
--Edit Below--
|
|
local WB_WeaponSelectItem = {
|
|
bInitDoOnce = false;
|
|
bIsSelect = false;
|
|
ItemID = 0;
|
|
|
|
};
|
|
|
|
|
|
--[==[ Construct
|
|
function WB_WeaponSelectItem:Construct()
|
|
|
|
end
|
|
-- Construct ]==]
|
|
|
|
-- function WB_WeaponSelectItem:Tick(MyGeometry, InDeltaTime)
|
|
|
|
-- end
|
|
|
|
-- function WB_WeaponSelectItem:Destruct()
|
|
|
|
-- end
|
|
|
|
|
|
function WB_WeaponSelectItem:Init(InCombinationType, InCombinationIndex)
|
|
if self.InitBind == nil then
|
|
self.InitBind = true
|
|
WidgetLibrary.BindButtonClicked(self.Button_Select, self.SelectWeaponCombination, self)
|
|
end
|
|
|
|
self.CombinationIndex = InCombinationIndex
|
|
self.TextBlock_TextName:SetText("配置" .. self.CombinationIndex)
|
|
local CombinationList = WeaponSelectionCombinationConfig.WeaponCombinationList[InCombinationType].Weapon
|
|
if CombinationList and CombinationList[self.CombinationIndex] then
|
|
self.WeaponInfo1:SetWeaponID(CombinationList[self.CombinationIndex][1])
|
|
if CombinationList[self.CombinationIndex][2] then
|
|
self.WeaponInfo2:SetWeaponID(CombinationList[self.CombinationIndex][2])
|
|
self.WeaponInfo2:SetVisWeaponInfo(true)
|
|
else
|
|
self.WeaponInfo2:SetVisWeaponInfo(false)
|
|
end
|
|
self:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
|
else
|
|
self:SetVisibility(ESlateVisibility.Collapsed)
|
|
end
|
|
end
|
|
|
|
function WB_WeaponSelectItem:GetCombinationIndex()
|
|
return self.CombinationIndex
|
|
end
|
|
|
|
function WB_WeaponSelectItem:SelectWeaponCombination()
|
|
if self.SelectCallBackFunc then
|
|
if self.SelectCallBackObj then
|
|
self.SelectCallBackFunc(self.SelectCallBackObj, self:GetCombinationIndex())
|
|
else
|
|
self.SelectCallBackFunc(self:GetCombinationIndex())
|
|
end
|
|
end
|
|
end
|
|
|
|
function WB_WeaponSelectItem:BindSelectCallBack(InFunc, InObj)
|
|
self.SelectCallBackFunc = InFunc
|
|
self.SelectCallBackObj = InObj
|
|
end
|
|
|
|
function WB_WeaponSelectItem:SetSelect(IsSelect)
|
|
if IsSelect then
|
|
self.Image_IsSelect:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
|
else
|
|
self.Image_IsSelect:SetVisibility(ESlateVisibility.Collapsed)
|
|
end
|
|
end
|
|
|
|
return WB_WeaponSelectItem; |