UGCProjects/SoloKing/Script/UI/WB_PlayerInfo_Small.lua
2025-01-04 23:00:19 +08:00

68 lines
2.0 KiB
Lua

---@class WB_PlayerInfo_Small_C:UUserWidget
---@field HorizontalBox_Title UHorizontalBox
---@field Overlay_MVP UOverlay
---@field Overlay_Tile_AddFriend UOverlay
---@field ScrollBox_Items UScrollBox
---@field Spacer_Button USpacer
---@field TextBlock_0 UTextBlock
---@field TextBlock_BodySize UTextBlock
---@field TextBlock_Damage UTextBlock
---@field TextBlock_KDA UTextBlock
---@field TextBlock_PlayerName UTextBlock
--Edit Below--
---@type WB_PlayerInfo_Small_C
local WB_PlayerInfo_Small = { bInitDoOnce = false; };
function WB_PlayerInfo_Small:Construct()
self:LuaInit();
end
WB_PlayerInfo_Small.HeadIcons = {};
function WB_PlayerInfo_Small:LuaInit()
if self.bInitDoOnce then return ; end
self.bInitDoOnce = true;
UITool.ForeachAllChildren(self.ScrollBox_Items, function(index, Widget)
Widget:LuaInit();
Widget:SetVisibility(ESlateVisibility.Collapsed);
end)
UGCEventSystem.AddListener(EventTypes.UpdateRoundWinners, self.OnUpdateRoundWinners, self);
self.bInitDoOnce = true;
end
function WB_PlayerInfo_Small:SetInGaming()
self:LuaInit();
self.Spacer_Button:SetVisibility(ESlateVisibility.Collapsed);
self.Overlay_MVP:SetVisibility(ESlateVisibility.Collapsed);
--self.Overlay_Tile_AddFriend:SetVisibility(ESlateVisibility.Collapsed);
for i = 1, self.ScrollBox_Items:GetChildrenCount() do
local Item = self.ScrollBox_Items:GetChildAt(i - 1);
Item:SetInGaming();
end
end
-- function WB_PlayerInfo_Small:Tick(MyGeometry, InDeltaTime)
-- end
-- function WB_PlayerInfo_Small:Destruct()
-- end
function WB_PlayerInfo_Small:OnUpdateRoundWinners(Rounds)
UGCLogSystem.LogTree(string.format("[WB_PlayerInfo_Small:OnUpdateRoundWinners] Rounds ="), Rounds)
local RoundCount = table.getCount(Rounds);
UITool.ForeachAllChildren(self.ScrollBox_Items, function(index, Widget)
local RoundInfo = Rounds[index];
if RoundInfo ~= nil then
Widget:SetRoundInfo(index, RoundInfo);
Widget:SetVisibility(ESlateVisibility.SelfHitTestInvisible);
else
Widget:SetVisibility(ESlateVisibility.Collapsed);
end
end);
end
return WB_PlayerInfo_Small;