46 lines
1.3 KiB
Lua
46 lines
1.3 KiB
Lua
---@class WB_HoldProcess_C:UUserWidget
|
|
---@field TextBlock_Hold UTextBlock
|
|
---@field WidgetSwitcher_Hold UWidgetSwitcher
|
|
---@field WidgetSwitcher_Team UWidgetSwitcher
|
|
--Edit Below--
|
|
---@type WB_HoldProcess_C
|
|
local WB_HoldProcess = { bInitDoOnce = false; }
|
|
|
|
function WB_HoldProcess:Construct()
|
|
self:LuaInit();
|
|
end
|
|
|
|
WB_HoldProcess.Colors = {
|
|
[1] = { 0, 0.5, 1, },
|
|
[2] = { 1, 0.5, 0, },
|
|
}
|
|
|
|
function WB_HoldProcess:LuaInit()
|
|
if self.bInitDoOnce then return ; end
|
|
UITool.ForeachAllChildren(self.WidgetSwitcher_Hold, function(index, Widget)
|
|
Widget:SetPercent(0);
|
|
end);
|
|
self.bInitDoOnce = true;
|
|
end
|
|
|
|
function WB_HoldProcess:SetHoldTime(InTime, InTotal)
|
|
self.WidgetSwitcher_Hold:SetActiveWidgetIndex(InTime < 0 and 0 or 1);
|
|
self.WidgetSwitcher_Team:SetActiveWidgetIndex(InTime < 0 and 1 or 0);
|
|
UGCLogSystem.Log("[WB_HoldProcess:SetHoldTime] InTime = %f, InTotal = %f", InTime, InTotal);
|
|
InTime = math.abs(InTime);
|
|
local Percent = InTime / InTotal;
|
|
UITool.ForeachAllChildren(self.WidgetSwitcher_Hold, function(index, Widget)
|
|
Widget:SetPercent(Percent);
|
|
end);
|
|
self.TextBlock_Hold:SetText(string.format('%0.1f/%0.f', InTime, InTotal));
|
|
end
|
|
|
|
-- function WB_HoldProcess:Tick(MyGeometry, InDeltaTime)
|
|
|
|
-- end
|
|
|
|
-- function WB_HoldProcess:Destruct()
|
|
|
|
-- end
|
|
|
|
return WB_HoldProcess |