54 lines
1.7 KiB
Lua
54 lines
1.7 KiB
Lua
---@class WB_RoundReadyState_C:UUserWidget
|
|
---@field Overlay_WaitTime UOverlay
|
|
---@field TextBlock_WaitTime UTextBlock
|
|
--Edit Below--
|
|
local WB_RoundReadyState = {
|
|
bInitDoOnce = false;
|
|
NowRound = -1;
|
|
}
|
|
|
|
|
|
function WB_RoundReadyState:Construct()
|
|
UGCEventSystem.AddListener(EventEnum.NewRound, self.UpdateShowRoundTime, self)
|
|
end
|
|
|
|
|
|
function WB_RoundReadyState:UpdateShowRoundTime(InRound)
|
|
self.NowRound = InRound
|
|
if self.NowRound > 0 then
|
|
WidgetManager:ShowPanel(WidgetConfig.EUIType.RoundReady, false)
|
|
self:UpdateShowGameTime()
|
|
if self.ClockHandle == nil then
|
|
self.ClockHandle = UGCEventSystem.SetTimerLoop(self, function()
|
|
if not self:UpdateShowGameTime() then
|
|
UGCEventSystem.StopTimer(self.ClockHandle)
|
|
self.ClockHandle = nil
|
|
WidgetManager:ClosePanel(WidgetConfig.EUIType.RoundReady)
|
|
WidgetManager:ShowPanel(WidgetConfig.EUIType.RoundStartTip, false)
|
|
end
|
|
end, 1)
|
|
end
|
|
end
|
|
end
|
|
|
|
function WB_RoundReadyState:UpdateShowGameTime()
|
|
local NowGameTime = UGCGameSystem.GameState:GetGameTime()
|
|
local ShowTime = NowGameTime - GlobalConfigs.GameSetting.RoundTime
|
|
UGCLogSystem.Log("[WB_RoundReadyState_UpdateShowGameTime] ShowTime:%s", tostring(ShowTime))
|
|
if ShowTime >= 0 then
|
|
self.TextBlock_WaitTime:SetText(ShowTime)
|
|
return true
|
|
end
|
|
self.TextBlock_WaitTime:SetText(GlobalConfigs.GameSetting.RoundReadyTime)
|
|
return false
|
|
end
|
|
|
|
-- function WB_RoundReadyState:Tick(MyGeometry, InDeltaTime)
|
|
|
|
-- end
|
|
|
|
-- function WB_RoundReadyState:Destruct()
|
|
|
|
-- end
|
|
|
|
return WB_RoundReadyState |