2025-01-04 23:00:19 +08:00

48 lines
1.2 KiB
Lua

---@class WB_HoldTime_C:UUserWidget
---@field ProgressBar_Hold UProgressBar
--Edit Below--
---@type WB_HoldTime_C
local WB_HoldTime = { bInitDoOnce = false }
WB_HoldTime.LastTeamId = 0;
WB_HoldTime.HoldOwner = nil;
WB_HoldTime.HoldComponent = nil;
function WB_HoldTime:Construct()
self.ProgressBar_Hold:SetPercent(0.);
end
-- function WB_HoldTime:Tick(MyGeometry, InDeltaTime)
-- end
-- function WB_HoldTime:Destruct()
-- end
function WB_HoldTime:SetHoldOwner(InHold, InWidget)
self.HoldOwner = InHold;
self.HoldComponent = InWidget;
end
function WB_HoldTime:SetHoldTime(Curr, Total)
UGCLogSystem.Log("[WB_HoldTime:SetHoldTime] Curr = %f, Total = %f", Curr, Total);
-- 判断当前是什么
for TeamId, Symbol in pairs(TeamScoreSymbol) do
if Curr / Symbol > 0 then
if self.LastTeamId ~= TeamId then
self.ProgressBar_Hold:SetFillColorAndOpacity(VectorHelper.ArrToColor(TeamColor[TeamId]));
self.LastTeamId = TeamId;
end
local Percent = math.abs(Curr) / Total;
UGCLogSystem.Log("[WB_HoldTime:SetHoldTime] Percent = %f", Percent)
self.ProgressBar_Hold:SetPercent(Percent);
if self.HoldComponent then
self.HoldComponent:RequestRedraw();
end
break;
end
end
end
return WB_HoldTime