55 lines
1.6 KiB
Lua
55 lines
1.6 KiB
Lua
---@class WB_WeaponItem_C:UUserWidget
|
|
---@field HorizontalBox_Part UHorizontalBox
|
|
---@field Image_WeaponIcon UImage
|
|
---@field TextBlock_WeaponName UTextBlock
|
|
--Edit Below--
|
|
---@type WB_WeaponItem_C
|
|
local WB_WeaponItem = { bInitDoOnce = false; };
|
|
|
|
--[==[ Construct
|
|
function WB_WeaponItem:Construct()
|
|
|
|
end
|
|
-- Construct ]==]
|
|
|
|
-- function WB_WeaponItem:Tick(MyGeometry, InDeltaTime)
|
|
|
|
-- end
|
|
|
|
-- function WB_WeaponItem:Destruct()
|
|
|
|
-- end
|
|
|
|
function WB_WeaponItem:SetWeaponId(InWeaponId)
|
|
local Info = UGCItemSystem.GetItemData(InWeaponId)
|
|
UE.AsyncLoadObject(Info.ItemBigIcon_n, function(TargetObject)
|
|
self.Image_WeaponIcon:SetBrushFromTexture(TargetObject);
|
|
end)
|
|
self.TextBlock_WeaponName:SetText(WeaponTable[InWeaponId].ItemName);
|
|
|
|
-- 检查当前有什么配件
|
|
UITool.ForeachAllChildren(self.HorizontalBox_Part, function(index, Widget)
|
|
Widget:SetVisibility(ESlateVisibility.Collapsed);
|
|
end)
|
|
local AllParts = WeaponSuits[InWeaponId];
|
|
if not table.isEmpty(AllParts) then
|
|
local PartLists = AllParts[EWeaponPartType.Best]
|
|
if not table.isEmpty(PartLists) then
|
|
local PartList = PartLists[1];
|
|
if not table.isEmpty(PartList) then
|
|
for i = 1, UITool.GetChildrenCount(self.HorizontalBox_Part) do
|
|
local Item = self.HorizontalBox_Part:GetChildAt(i - 1);
|
|
if PartList[i] == nil then
|
|
Item:SetVisibility(ESlateVisibility.Collapsed);
|
|
else
|
|
Item:SetVisibility(ESlateVisibility.SelfHitTestInvisible);
|
|
Item:SetPartId(PartList[i]);
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
--local PartList = WeaponSuits[WeaponId][EWeaponPartType.Best]
|
|
end
|
|
|
|
return WB_WeaponItem; |