59 lines
1.7 KiB
Lua
59 lines
1.7 KiB
Lua
---@class WB_MiniGameReady_C:UUserWidget
|
|
---@field TextBlock_ReadyTime UTextBlock
|
|
--Edit Below--
|
|
---@type WB_RoundRead_C
|
|
local WB_MiniGameReady = { bInitDoOnce = false; };
|
|
|
|
function WB_MiniGameReady:Construct()
|
|
WidgetLibrary.TextBlockBindingPropertyText(self.TextBlock_ReadyTime, self.UpdateReadyTime, self)
|
|
UGCEventSystem.AddListener(EventEnum.RoundBegining, self.ShowSelf, self)
|
|
UGCEventSystem.AddListener(EventEnum.RoundReadyFinish, self.HideSelf, self)
|
|
end
|
|
|
|
function WB_MiniGameReady:ShowSelf()
|
|
WidgetManager:ShowPanel(WidgetConfig.EUIType.MiniGameReady, false)
|
|
self.ClockTime = GlobalConfigs.GameModeSetting.RoundReadyTime
|
|
self:UpdateReadyTime()
|
|
if self.LoopClockTimeHandle == nil then
|
|
self.LoopClockTimeHandle = UGCEventSystem.SetTimerLoop(self, self.UpdateReadyTime, 1)
|
|
end
|
|
end
|
|
|
|
function WB_MiniGameReady:HideSelf()
|
|
if self.ClockTime > 1 then
|
|
self:GameStart()
|
|
end
|
|
end
|
|
|
|
function WB_MiniGameReady:UpdateReadyTime()
|
|
if self.ClockTime <= 0 then
|
|
self:GameStart()
|
|
else
|
|
SoundSystem.PlaySound(SoundSystem.ESound.Clock)
|
|
end
|
|
self.TextBlock_ReadyTime:SetText(tostring(self.ClockTime))
|
|
self.ClockTime = self.ClockTime - 1
|
|
end
|
|
|
|
function WB_MiniGameReady:GameStart()
|
|
WidgetManager:ClosePanel(WidgetConfig.EUIType.MiniGameReady)
|
|
if self.LoopClockTimeHandle then
|
|
UGCEventSystem.StopTimer(self.LoopClockTimeHandle)
|
|
end
|
|
self.LoopClockTimeHandle = nil
|
|
SoundSystem.PlaySound(SoundSystem.ESound.GameStart)
|
|
end
|
|
|
|
function WB_MiniGameReady:OnClosePanel()
|
|
|
|
end
|
|
|
|
-- function WB_MiniGameReady:Tick(MyGeometry, InDeltaTime)
|
|
|
|
-- end
|
|
|
|
-- function WB_MiniGameReady:Destruct()
|
|
|
|
-- end
|
|
|
|
return WB_MiniGameReady; |