---@class WB_WeaponProficiencyTop_C:UUserWidget ---@field Image_CD UImage ---@field Image_Weapon UImage ---@field TextBlock_AllDamage UTextBlock ---@field TextBlock_Proficiency UTextBlock ---@field TextBlock_WeaponName UTextBlock ---@field WidgetSwitcher_IsFullProficiency UWidgetSwitcher --Edit Below-- local WB_WeaponProficiencyTop = { bInitDoOnce = false } --[==[ Construct function WB_WeaponProficiencyTop:Construct() end -- Construct ]==] -- function WB_WeaponProficiencyTop:Tick(MyGeometry, InDeltaTime) -- end -- function WB_WeaponProficiencyTop:Destruct() -- end function WB_WeaponProficiencyTop:SetWeaponID(InWeaponID) self.WeaponID = InWeaponID if UGCItemSystem.IsUGCItem(self.WeaponID) then local Info = UGCItemSystem.GetItemData(self.WeaponID); local ItemName = Info.ItemName; if WeaponTable[self.WeaponID] then local TypeNew = WeaponTable[self.WeaponID].TypeNew if TypeNew then if type(WeaponTypePost[TypeNew]) == 'string' then ItemName = string.gsub(Info.ItemName, WeaponTypePost[TypeNew], "") elseif type(WeaponTypePost[TypeNew]) == 'table' then for i, v in pairs(WeaponTypePost[TypeNew]) do ItemName = string.gsub(Info.ItemName, v, "") end end end end self.TextBlock_WeaponName:SetText(ItemName); UE.AsyncLoadObject_Cached(Info.ItemBigIcon_n, function(ImageIcon) if UE.IsValid(ImageIcon) then self.Image_Weapon:SetBrushFromTexture(ImageIcon, false) end end) end end function WB_WeaponProficiencyTop:SetWeaponProficiencyInfo(WeaponProficiencyInfo) local Proficiency, IsFull = WeaponProficiencyCalculation(WeaponProficiencyInfo) self:SetProficiency(Proficiency, IsFull) local AllDamage = WeaponProficiencyInfo[EWeaponProficiencyType.AllDamage] self.TextBlock_AllDamage:SetText(tostring(math.floor(AllDamage))) end function WB_WeaponProficiencyTop:SetProficiency(InProficiency, IsFull) if IsFull then self.WidgetSwitcher_IsFullProficiency:SetActiveWidgetIndex(1) else self.WidgetSwitcher_IsFullProficiency:SetActiveWidgetIndex(0) self.TextBlock_Proficiency:SetText(tostring(InProficiency)) local Material = self.Image_CD:GetDynamicMaterial(); local Percent = InProficiency / 100 Material:SetScalarParameterValue("Mask_Percent", Percent); end end return WB_WeaponProficiencyTop