UGCProjects/SoloKing/Script/UI/Tool/WB_PlayerInfo.lua
2025-01-21 11:29:14 +08:00

54 lines
1.5 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_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
self.bInitDoOnce = true;
UGCEventSystem.AddListener(EventTypes.UpdateRoundWinners, self.OnUpdateRoundWinners, self);
UITool.ForeachAllChildren(self.ScrollBox_Items, function(index, Widget)
Widget:LuaInit();
end)
UITool.HideAllChildren(self.ScrollBox_Items);
end
function WB_PlayerInfo:OnUpdateRoundWinners(Rounds)
-- 先清空
if table.isEmpty(Rounds) then return ; end
UGCLogSystem.LogTree(string.format("[WB_PlayerInfo:OnUpdateRoundWinners] RoundInfo ="), Rounds)
UITool.ForeachAllChildren(self.ScrollBox_Items, function(index, Widget)
local Item = Rounds[index]
if Item ~= nil then
Widget:SetItemInfo(index, Item);
Widget:SetVisibility(ESlateVisibility.SelfHitTestInvisible);
else
Widget:SetVisibility(ESlateVisibility.Collapsed);
end
end);
end
-- function WB_PlayerInfo:Tick(MyGeometry, InDeltaTime)
-- end
-- function WB_PlayerInfo:Destruct()
-- end
return WB_PlayerInfo;