源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

53 lines
1.2 KiB

--加载loading
Loading = Loading or BaseClass(BaseComponent)
local Loading = Loading
function Loading:__init(handle_wnd, callback)
self:InitData(callback)
self:CreateGameObject(UIType.Loading)
end
function Loading:InitData(callback)
self.callback = callback
end
function Loading:LoadSuccess()
self.mask = self:GetChild("mask"):GetComponent("Image")
self.circle = self:GetChild("circle")
self:InitEvent()
end
function Loading:InitEvent()
self:Play()
end
function Loading:Play()
self:RemoveTimer()
local time = 0
local function onTimer()
if not self._use_delete_method then
if self.circle then
self.circle:Rotate(Vector3(0, 0, -12))
end
time = time + 0.1
if time - 15 >= 0.001 then --15秒超时自动关闭
self:RemoveTimer()
GlobalEventSystem:Fire(EventName.HIDE_LOADING_VIEW)
GlobalEventSystem:Fire(EventName.RECONNECT_TIMEOUT)
end
end
end
self.period_timer = GlobalTimerQuest:AddPeriodQuest(onTimer,0.1,-1)
onTimer()
end
function Loading:RemoveTimer()
if self.period_timer then
GlobalTimerQuest:CancelQuest(self.period_timer)
self.period_timer = nil
end
end
function Loading:__delete( )
self:RemoveTimer()
end