42 lines
1.3 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
---@class WB_MechanismInfo_Select_C:UUserWidget
---@field Image_1 UImage
---@field Image_Icon UImage
---@field TextBlock_Name UTextBlock
--Edit Below--
---@type WB_MechanismInfo_C
local WB_MechanismInfo_Select = { bInitDoOnce = false; };
--[==[ Construct
function WB_MechanismInfo_Select:Construct()
end
-- Construct ]==]
-- function WB_MechanismInfo_Select:Tick(MyGeometry, InDeltaTime)
-- end
-- function WB_MechanismInfo_Select:Destruct()
-- end
function WB_MechanismInfo_Select:UpdateInfo(MechanismType)
local IconInfo = MechanismConfig.MechanismIconInfo[MechanismType]
if IconInfo then
self.Image_Icon:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
self.TextBlock_Name:SetVisibility(ESlateVisibility.SelfHitTestInvisible);
local IconTex = UGCSystemLibrary.LoadAsset(IconInfo.Icon, true)
if UE.IsValid(IconTex) then
self.Image_Icon:SetBrushFromTexture(IconTex)
self.Image_Icon:SetColorAndOpacity(IconInfo.Color)
end
local Name = MechanismConfig.MechanismTypeName[MechanismType]
self.TextBlock_Name:SetText(Name)
else
self.Image_Icon:SetVisibility(ESlateVisibility.Hidden)
self.TextBlock_Name:SetVisibility(ESlateVisibility.Hidden);
end
end
return WB_MechanismInfo_Select;