---@class WB_Item_KDA_C:UUserWidget ---@field Button_0 UButton ---@field Image_HeadIcon UImage ---@field Image_Self UImage ---@field NewButton_55 UNewButton ---@field NewButton_AddFriend UNewButton ---@field Overlay_Assist UOverlay ---@field Overlay_MVP UOverlay ---@field TextBlock_Assist UTextBlock ---@field TextBlock_Dead UTextBlock ---@field TextBlock_KDA UTextBlock ---@field TextBlock_Kill UTextBlock ---@field TextBlock_No UTextBlock ---@field TextBlock_PlayerName UTextBlock --Edit Below-- ---@type WB_Item_KDA_C local WB_Item_KDA = { bInitDoOnce = false; }; WB_Item_KDA.PlayerKey = 0; function WB_Item_KDA:Construct() self:LuaInit(); end function WB_Item_KDA:LuaInit() if self.bInitDoOnce then return ; end self.NewButton_AddFriend.OnClicked:Add(self.OnClickAddFriend, self) UITool.EnableButtonScroll(self.NewButton_AddFriend) self.bInitDoOnce = true; end function WB_Item_KDA:SetKDAItem(KDAItem) self.TextBlock_KDA:SetText(string.format('%0.1f', KDAItem.KDA)); self.TextBlock_Kill:SetText(tostring(KDAItem.Kill)); self.TextBlock_Dead:SetText(tostring(KDAItem.Dead)); self.TextBlock_Assist:SetText(tostring(KDAItem.Assist)); self.TextBlock_No:SetText(KDAItem.No); self:SetPlayerKey(KDAItem.PlayerKey); end function WB_Item_KDA:SetPlayerKey(InPlayerKey) self:IsSelf(InPlayerKey == LocalPlayerKey); self.PlayerKey = InPlayerKey; self.TextBlock_PlayerName:SetText(UE.GetPlayerName(InPlayerKey)); UITool.DownloadImage(UE.GetPlayerIconURL(InPlayerKey), function(Texture) self.Image_HeadIcon:SetBrushFromTextureDynamic(Texture); end); end function WB_Item_KDA:IsSelf(Self) if Self then self.Image_Self:SetVisibility(ESlateVisibility.SelfHitTestInvisible); self.NewButton_AddFriend:SetVisibility(ESlateVisibility.Hidden); else self.Image_Self:SetVisibility(ESlateVisibility.Collapsed); self.NewButton_AddFriend:SetVisibility(ESlateVisibility.Visible); end end function WB_Item_KDA:OnClickAddFriend() ---@type PlayerAccountInfo local AccountInfo = GameState.PlayerDatas.AccountInfo[self.PlayerKey]; UGCLogSystem.LogTree(string.format("[WB_Item_KDA:OnClickAddFriend] AccountInfo ="), AccountInfo) if AccountInfo then UGCGameSystem.AddFriend(AccountInfo.UID); end end -- function WB_Item_KDA:Tick(MyGeometry, InDeltaTime) -- end -- function WB_Item_KDA:Destruct() -- end return WB_Item_KDA;