diff --git a/lua/app/ui/battle/battle_ui_pvp.lua b/lua/app/ui/battle/battle_ui_pvp.lua index b5ba8801..dabfe4ba 100644 --- a/lua/app/ui/battle/battle_ui_pvp.lua +++ b/lua/app/ui/battle/battle_ui_pvp.lua @@ -231,25 +231,22 @@ function BattleUIPVP:enterShowBoardAni(callback) self.boardNode:setVisible(true) self.boardNode:setAnchoredPositionX(0) self.enterShowBoardSeq = self.root:createBindTweenSequence() - if not self.root.tag then - self.root.tag = true - self.enterShowBoardSeq:AppendCallback(function() - for posId, entity in pairs(self.battleController.battleData:getGridEnties()) do - if entity:getCell() then - local inCurRange = self.battleController:getPosIdInCurActionBoardRowRange(posId) - local parent - if isAtkAction then - parent = inCurRange and self.atkBoard or self.defBoard - else - parent = inCurRange and self.defBoard or self.atkBoard - end - if parent then - entity:getCell():getBaseObject():setParent(parent, true) - end + self.enterShowBoardSeq:AppendCallback(function() + for posId, entity in pairs(self.battleController.battleData:getGridEnties()) do + if entity:getCell() then + local inCurRange = self.battleController:getPosIdInCurActionBoardRowRange(posId) + local parent + if isAtkAction then + parent = inCurRange and self.atkBoard or self.defBoard + else + parent = inCurRange and self.defBoard or self.atkBoard + end + if parent then + entity:getCell():getBaseObject():setParent(parent, true) end end - end) - end + end + end) self.enterShowBoardSeq:Join(self.defBoardImg:getTransform():DOAnchorPosX(0, 0.5)) self.enterShowBoardSeq:Join(self.atkBoardImg:getTransform():DOAnchorPosX(0, 0.5)) @@ -275,26 +272,26 @@ end function BattleUIPVP:enterHideBoardAni(callback) self:dealBoardMaskOnShowAni() - - local isAtkAction = self.battleController.curActionSide == GConst.BattleConst.SIDE_ATK - for posId, entity in pairs(self.battleController.battleData:getGridEnties()) do - if entity:getCell() then - local inCurRange = self.battleController:getPosIdInCurActionBoardRowRange(posId) - local parent - if isAtkAction then - parent = inCurRange and self.atkBoard or self.defBoard - else - parent = inCurRange and self.defBoard or self.atkBoard - end - if parent then - entity:getCell():getBaseObject():setParent(parent, true) - end - end - end - self:clearEnterShowBoardSeq() self.enterShowBoardSeq = self.root:createBindTweenSequence() - self.enterShowBoardSeq:AppendInterval(1) + self.enterShowBoardSeq:AppendInterval(0.5) + self.enterShowBoardSeq:AppendCallback(function() + local isAtkAction = self.battleController.curActionSide == GConst.BattleConst.SIDE_ATK + for posId, entity in pairs(self.battleController.battleData:getGridEnties()) do + if entity:getCell() then + local inCurRange = self.battleController:getPosIdInCurActionBoardRowRange(posId) + local parent + if isAtkAction then + parent = inCurRange and self.atkBoard or self.defBoard + else + parent = inCurRange and self.defBoard or self.atkBoard + end + if parent then + entity:getCell():getBaseObject():setParent(parent, true) + end + end + end + end) local w, h = GFunc.getUIExpandScreenSize() self.enterShowBoardSeq:Join(self.defBoardImg:getTransform():DOAnchorPosX(w + 360, 0.5)) self.enterShowBoardSeq:Join(self.atkBoardImg:getTransform():DOAnchorPosX(-(w + 360), 0.5))