【spLoader】延时2秒再卸载

dev_chengFeng
gaoxin 2021-04-22 14:37:16 +08:00
parent 43afe3d6f1
commit fa533f28df
3 changed files with 7 additions and 4 deletions

View File

@ -52,7 +52,10 @@ end
-- 销毁loader
function SpriteLoader:Destroy()
self:UnLoadSprite()
coroutine.start(function()
coroutine.wait(2)
self:UnLoadSprite()
end)
end
return SpriteLoader

View File

@ -73,6 +73,7 @@ local index=0
function GeneralPopup:InitComponent()
this.spLoader = SpriteLoader.New()
this.contents=Util.GetGameObject(this.gameObject,"Contents")
this.backBtn=Util.GetGameObject(this.contents,"BG/BackBtn")
this.BG=Util.GetGameObject(this.contents,"BG")
@ -81,7 +82,6 @@ function GeneralPopup:InitComponent()
--子模块脚本初始化
for i = 1, #contentScripts do
contentScripts[i].view:InitComponent(Util.GetGameObject(this.contents, contentScripts[i].panelName))
this.spLoader = SpriteLoader.New()
end
--预设赋值
for i=1,#contentScripts do
@ -152,9 +152,9 @@ function GeneralPopup:OnClose()
end
function GeneralPopup:OnDestroy()
this.spLoader:Destroy()
for i = 1, #contentScripts do
contentScripts[i].view:OnDestroy()
this.spLoader:Destroy()
end
end

View File

@ -151,9 +151,9 @@ function ResolvePanel:OnClose()
end
function ResolvePanel:OnDestroy()
this.spLoader:Destroy()
for i = 1, #this.contents do
this.contents[i].view:OnDestroy()
this.spLoader:Destroy()
end
end