70 lines
1.9 KiB
Lua
70 lines
1.9 KiB
Lua
|
---@class WB_Item_KDA_Small_C:UUserWidget
|
||
|
---@field Image_HeadIcon UImage
|
||
|
---@field Image_Self UImage
|
||
|
---@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_PlayerInfoItem_C
|
||
|
local WB_PlayerInfoItem = { bInitDoOnce = false; };
|
||
|
|
||
|
WB_PlayerInfoItem.PlayerKey = 0;
|
||
|
|
||
|
function WB_PlayerInfoItem:Construct()
|
||
|
self:LuaInit();
|
||
|
end
|
||
|
|
||
|
function WB_PlayerInfoItem:LuaInit()
|
||
|
if self.bInitDoOnce then return ; end
|
||
|
|
||
|
self.bInitDoOnce = true;
|
||
|
end
|
||
|
|
||
|
function WB_PlayerInfoItem:SetKDAItem(KDAItem)
|
||
|
self.TextBlock_KDA:SetText(string.format('%0.1f', KDAItem.KDA));
|
||
|
self.TextBlock_Kill:SetText(KDAItem.Kill);
|
||
|
self.TextBlock_Dead:SetText(KDAItem.Dead);
|
||
|
self.TextBlock_Assist:SetText(KDAItem.Assist);
|
||
|
self.TextBlock_No:SetText(KDAItem.No);
|
||
|
|
||
|
self:SetPlayerKey(KDAItem.PlayerKey);
|
||
|
end
|
||
|
|
||
|
function WB_PlayerInfoItem:SetPlayerKey(InPlayerKey)
|
||
|
self:IsSelf(InPlayerKey == LocalPlayerKey);
|
||
|
local PlayerName = UE.GetPlayerName(InPlayerKey)
|
||
|
self.TextBlock_PlayerName:SetText(PlayerName);
|
||
|
UITool.DownloadImage(UE.GetPlayerIconURL(InPlayerKey), function(Texture)
|
||
|
self.Image_HeadIcon:SetBrushFromTextureDynamic(Texture);
|
||
|
end);
|
||
|
end
|
||
|
|
||
|
function WB_PlayerInfoItem:IsSelf(IsSelf)
|
||
|
if IsSelf then
|
||
|
self.Image_Self:SetVisibility(ESlateVisibility.SelfHitTestInvisible);
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function WB_PlayerInfoItem:OnClickAddFriend()
|
||
|
---@type PlayerAccountInfo
|
||
|
local AccountInfo = GameState.PlayerDatas.AccountInfo[self.PlayerKey];
|
||
|
UGCLogSystem.LogTree(string.format("[WB_PlayerInfoItem:OnClickAddFriend] AccountInfo ="), AccountInfo)
|
||
|
if AccountInfo then
|
||
|
UGCGameSystem.AddFriend(AccountInfo.UID);
|
||
|
end
|
||
|
end
|
||
|
|
||
|
WB_PlayerInfoItem.IsGaming = false;
|
||
|
|
||
|
-- function WB_PlayerInfoItem:Tick(MyGeometry, InDeltaTime)
|
||
|
|
||
|
-- end
|
||
|
|
||
|
-- function WB_PlayerInfoItem:Destruct()
|
||
|
|
||
|
-- end
|
||
|
|
||
|
return WB_PlayerInfoItem;
|