四元阵动画播两遍修改

dev_chengFeng
jiaoyangna 2021-07-30 10:00:26 +08:00
parent f5584b0fbe
commit 8c0060a835
2 changed files with 17 additions and 9 deletions

View File

@ -1,4 +1,5 @@
ElementDrawCardPanelNew = {} ElementDrawCardPanelNew = {}
local isPlayAnim = true
function ElementDrawCardPanelNew:New(gameObject) function ElementDrawCardPanelNew:New(gameObject)
local b = {} local b = {}
b.gameObject = gameObject b.gameObject = gameObject
@ -142,6 +143,7 @@ end
function ElementDrawCardPanelNew:OnOpen(_Config,_index, parent) function ElementDrawCardPanelNew:OnOpen(_Config,_index, parent)
self.config = _Config self.config = _Config
self.parent = parent self.parent = parent
isPlayAnim = true
end end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写) --界面打开或者重新打开后,界面刷新时调用(用于子类重写)
@ -157,14 +159,17 @@ function ElementDrawCardPanelNew:OnShow(orginLayer)
Util.SetParticleSortLayer(self.UI_effect_RecruitPanel_particle, self.sortingOrder + 1) Util.SetParticleSortLayer(self.UI_effect_RecruitPanel_particle, self.sortingOrder + 1)
Util.SetParticleSortLayer(self.qianghua, self.sortingOrder + 1) Util.SetParticleSortLayer(self.qianghua, self.sortingOrder + 1)
self.itemPosCom.enabled = false self.itemPosCom.enabled = false
local anims = self.gameObject:GetComponentsInChildren(typeof(PlayFlyAnim)) if isPlayAnim then
if anims.Length > 0 then isPlayAnim = false
for i = 0, anims.Length - 1 do local anims = self.gameObject:GetComponentsInChildren(typeof(PlayFlyAnim))
local anim = anims[i] if anims.Length > 0 then
if anim.isPlayOnOpen then for i = 0, anims.Length - 1 do
anim:PlayAnim(false,function() local anim = anims[i]
self.itemPosCom.enabled = true if anim.isPlayOnOpen then
end) anim:PlayAnim(false,function()
self.itemPosCom.enabled = true
end)
end
end end
end end
end end
@ -176,6 +181,7 @@ end
--界面关闭时调用(用于子类重写) --界面关闭时调用(用于子类重写)
function ElementDrawCardPanelNew:OnClose() function ElementDrawCardPanelNew:OnClose()
isPlayAnim = true
self.gameObject:SetActive(false) self.gameObject:SetActive(false)
end end

View File

@ -439,7 +439,9 @@ function this:PageOnChange(isShow)
end end
end end
for k,v in pairs(subViewList) do for k,v in pairs(subViewList) do
v.sub:OnClose() if k ~= self.curPage then
v.sub:OnClose()
end
end end
if subViewList[self.curPage] and subViewList[self.curPage].config and subViewList[self.curPage].sub then if subViewList[self.curPage] and subViewList[self.curPage].config and subViewList[self.curPage].sub then
subViewList[self.curPage].sub:OnShow(orginLayer) subViewList[self.curPage].sub:OnShow(orginLayer)