UGCProjects/InfFire/Script/UI/Tool/WB_KDALine.lua
2025-01-04 23:00:19 +08:00

47 lines
1.1 KiB
Lua

---@class WB_KDALine_C:UUserWidget
---@field ScrollBox_Items UScrollBox
---@field TextBlock_Assist UTextBlock
---@field TextBlock_Dead UTextBlock
---@field TextBlock_Kill UTextBlock
---@field TextBlock_PlayerName UTextBlock
--Edit Below--
local WB_KDALine = { bInitDoOnce = false; };
function WB_KDALine:Construct()
self:LuaInit();
end
function WB_KDALine:LuaInit()
if self.bInitDoOnce then return ; end
self.bInitDoOnce = true;
UGCEventSystem.AddListener(EventTypes.AllPlayerKDAChange, self.SetPlayerKDAs, self)
local KDAs = GameState:HandleAllKDAs()
if KDAs then
self:SetPlayerKDAs(KDAs);
end
end
function WB_KDALine:SetPlayerKDAs(InKDAs)
if table.isEmpty(InKDAs) then
UITool.HideAllChildren(self.ScrollBox_Items);
return ;
end
UITool.ForeachAllChildren(self.ScrollBox_Items, function(index, Widget)
if InKDAs[index] then
Widget:SetKDAInfo(InKDAs[index]);
Widget:SetVisibility(ESlateVisibility.SelfHitTestInvisible);
else
Widget:SetVisibility(ESlateVisibility.Collapsed);
end
end)
end
-- function WB_KDALine:Tick(MyGeometry, InDeltaTime)
-- end
-- function WB_KDALine:Destruct()
-- end
return WB_KDALine;