四元阵动画播两遍修改

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

View File

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