c1_lua/lua/app/ui/loading/loading_cloud_ui.lua
2023-06-06 11:59:36 +08:00

42 lines
1.1 KiB
Lua

local LoadingCloudUI = class("LoadingCloudUI", BaseUI)
function LoadingCloudUI:init(parent, callback)
UIPrefabManager:loadUIWidgetAsync("assets/prefabs/ui/loading/loading_cloud_ui.prefab", parent, function(root)
self.root = root
self:showLoading(callback)
end)
end
function LoadingCloudUI:showLoading(callback)
self.root:setActive(true)
local animator = self.root:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR)
animator:Play(623542868, -1, 0)
if self.scheduleShowId then
self:unscheduleGlobal(self.scheduleShowId)
end
if self.scheduleHideId then
self:unscheduleGlobal(self.scheduleHideId)
self.scheduleHideId = nil
end
self.scheduleShowId = self:performWithDelayGlobal(function()
self.scheduleShowId = nil
callback()
end, 0.3)
end
function LoadingCloudUI:hideLoading(callback)
local animator = self.root:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR)
animator:Play(-1942362866, -1, 0)
if self.scheduleHideId then
self:unscheduleGlobal(self.scheduleHideId)
end
self.scheduleHideId = self:performWithDelayGlobal(function()
self.scheduleHideId = nil
self.root:setActive(false)
callback()
end, 0.3)
end
return LoadingCloudUI