65 lines
1.9 KiB
Lua
65 lines
1.9 KiB
Lua
|
---@class WB_PlayerInfo_C:UUserWidget
|
||
|
---@field HorizontalBox_Title UHorizontalBox
|
||
|
---@field Overlay_MVP UOverlay
|
||
|
---@field Overlay_Tile_AddFriend UOverlay
|
||
|
---@field ScrollBox_Items UScrollBox
|
||
|
---@field TextBlock_0 UTextBlock
|
||
|
---@field TextBlock_Damage UTextBlock
|
||
|
---@field TextBlock_KDA UTextBlock
|
||
|
---@field TextBlock_Kill UTextBlock
|
||
|
---@field TextBlock_PlayerName UTextBlock
|
||
|
--Edit Below--
|
||
|
---@type WB_PlayerInfo_C
|
||
|
local WB_PlayerInfo = { bInitDoOnce = false; };
|
||
|
|
||
|
function WB_PlayerInfo:Construct()
|
||
|
self:LuaInit();
|
||
|
end
|
||
|
|
||
|
WB_PlayerInfo.HeadIcons = {};
|
||
|
|
||
|
function WB_PlayerInfo:LuaInit()
|
||
|
if self.bInitDoOnce then return; end
|
||
|
UITool.ForeachAllChildren(self.ScrollBox_Items, function(index, Widget)
|
||
|
Widget:LuaInit();
|
||
|
end)
|
||
|
self.bInitDoOnce = true;
|
||
|
end
|
||
|
|
||
|
---@param InInfo table<int32, PlayerKDA_DamageItem> 支持排序功能
|
||
|
function WB_PlayerInfo:SetInfos(InInfo)
|
||
|
local Num = table.getCount(InInfo);
|
||
|
UITool.AdaptChildren(self.ScrollBox_Items, Num, ObjectPath.WB_PlayerInfoItem);
|
||
|
for i = 1, Num do
|
||
|
local Item = self.ScrollBox_Items:GetChildAt(i - 1);
|
||
|
Item:SetPlayerInfo(InInfo[i], self);
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function WB_PlayerInfo:Adapt()
|
||
|
local Total = 0;
|
||
|
for c, d in pairs(GameState.PlayerList) do Total = Total + table.getCount(d); end
|
||
|
UITool.AdaptChildren(self.ScrollBox_Items, Total, ObjectPath.WB_PlayerInfoItem);
|
||
|
-- 开始加载头像保存一下
|
||
|
|
||
|
for i, v in pairs(GameState.PlayerKDA_Damages) do
|
||
|
---@type PlayerAccountInfo
|
||
|
local AccountInfo = GameState.PlayerDatas.AccountInfo[v.PlayerKey]
|
||
|
if AccountInfo then
|
||
|
UITool.DownloadImage(AccountInfo.IconURL, function(TextDynamic)
|
||
|
self.HeadIcons[v.PlayerKey] = TextDynamic;
|
||
|
UGCLogSystem.LogTree(string.format("[WB_PlayerInfo:Adapt] self.HeadIcons ="), self.HeadIcons);
|
||
|
end);
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
-- function WB_PlayerInfo:Tick(MyGeometry, InDeltaTime)
|
||
|
|
||
|
-- end
|
||
|
|
||
|
-- function WB_PlayerInfo:Destruct()
|
||
|
|
||
|
-- end
|
||
|
|
||
|
return WB_PlayerInfo;
|