From 2ad12c4b4638e4aa5a0313eba902bdc2e7a04f2f Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Fri, 30 Jun 2023 14:45:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E6=8A=80=E5=9C=BA=E8=8A=82=E5=A5=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/battle/battle_base_ui.lua | 4 ++ lua/app/ui/battle/battle_ui_pvp.lua | 75 ++++++++++++++++++++++++++-- 2 files changed, 75 insertions(+), 4 deletions(-) diff --git a/lua/app/ui/battle/battle_base_ui.lua b/lua/app/ui/battle/battle_base_ui.lua index 78a14a4a..19a3dde9 100644 --- a/lua/app/ui/battle/battle_base_ui.lua +++ b/lua/app/ui/battle/battle_base_ui.lua @@ -1470,6 +1470,7 @@ function BattleBaseUI:generateSkillAni(map, callback, side) local pos = self:getPosInfo(info.posId) self.generateSkillAniSeq:Append(cell:getBaseObject():getTransform():DOAnchorPos(pos, 0.5)) if self.generateSkillSfxs and self.generateSkillSfxs[count] then + self:setGenerateSkillSfxsParent(info.posId, self.generateSkillSfxs[count]) self.generateSkillSfxs[count]:setAnchoredPosition(pos.x, pos.y) self.generateSkillAniSeq:AppendCallback(function() self.generateSkillSfxs[count]:setActive(true) @@ -1486,6 +1487,9 @@ function BattleBaseUI:generateSkillAni(map, callback, side) end) end +function BattleBaseUI:setGenerateSkillSfxsParent(posId, obj) +end + function BattleBaseUI:_hideGenerateSkillGridCells(generateSkillCellPrefix) if not self.generateSkillGridEntities then local uiMap = self.root:genAllChildren() diff --git a/lua/app/ui/battle/battle_ui_pvp.lua b/lua/app/ui/battle/battle_ui_pvp.lua index e2077f9a..6e2327fc 100644 --- a/lua/app/ui/battle/battle_ui_pvp.lua +++ b/lua/app/ui/battle/battle_ui_pvp.lua @@ -21,6 +21,9 @@ function BattleUIPVP:initBaseInfo() self.battleRoot = uiMap["battle_ui_pvp.battle_root"] self.maxLayerNode = uiMap["battle_ui_pvp.battle_root.battle_node.max_layer_show_node"] self.touchMask = uiMap["battle_ui_pvp.board_root_node.touch_mask"] + self.atkBoard = self.uiMap["battle_ui_pvp.board_root_node.board_center_node.board_node_atk.board_atk"] + self.defBoard = self.uiMap["battle_ui_pvp.board_root_node.board_center_node.board_node_atk.board_def"] + self.boardRootNodeMask = self.uiMap["battle_ui_pvp.board_root_node.mask"] end function BattleUIPVP:initBg() @@ -209,15 +212,57 @@ function BattleUIPVP:refreshWave(wave, iconAtlas, iconName) icon:setSprite(iconAtlas, iconName) end -function BattleBaseUI:enterShowBoardAni(callback) +function BattleUIPVP:setGenerateSkillSfxsParent(posId, obj) + local isAtkAction = self.battleController.curActionSide == GConst.BattleConst.SIDE_ATK + if isAtkAction then + obj:setParent(self.atkBoard, true) + else + obj:setParent(self.defBoard, true) + end +end + +function BattleUIPVP:dealBoardMaskOnShowAni(isOver) + local targetX = isOver and 0 or DEFAULT_X + self.boardMask:setAnchoredPositionX(targetX) +end + +function BattleUIPVP:enterShowBoardAni(callback) local isAtkAction = self.battleController.curActionSide == GConst.BattleConst.SIDE_ATK if self.touchMask then self.touchMask:setVisible(not isAtkAction) end + + self:dealBoardMaskOnShowAni() + 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:getBoardRootNode():setVisible(true) + self:getBoardRootNode():setAnchoredPositionX(0) self.enterShowBoardSeq = self.root:createBindTweenSequence() - self.enterShowBoardSeq:Append(self:getBoardRootNode():getTransform():DOLocalMoveX(0, 0.5)) + self.enterShowBoardSeq:Append(self.defBoard:getTransform():DOAnchorPosX(0, 0.5)) + self.enterShowBoardSeq:Join(self.atkBoard:getTransform():DOAnchorPosX(0, 0.5)) + self.enterShowBoardSeq:Join(self.boardRootNodeMask:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):DOFade(0.9, 0.5)) self.enterShowBoardSeq:AppendCallback(function() + self:dealBoardMaskOnShowAni(true) + + for posId, entity in pairs(self.battleController.battleData:getGridEnties()) do + if entity:getCell() then + entity:getCell():getBaseObject():setParent(self.gridNode, true) + end + end local str if isAtkAction then str = I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_1) @@ -231,13 +276,35 @@ function BattleBaseUI:enterShowBoardAni(callback) end) end -function BattleBaseUI:enterHideBoardAni(callback) +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(0.5) local w, h = GFunc.getUIExpandScreenSize() - self.enterShowBoardSeq:Append(self:getBoardRootNode():getTransform():DOLocalMoveX(w / 2 + 360, 0.5)) + self.enterShowBoardSeq:Append(self.defBoard:getTransform():DOAnchorPosX(w + 360, 0.5)) + self.enterShowBoardSeq:Join(self.atkBoard:getTransform():DOAnchorPosX(-(w + 360), 0.5)) + self.enterShowBoardSeq:Join(self.boardRootNodeMask:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):DOFade(0, 0.5)) self.enterShowBoardSeq:AppendCallback(function() + self:dealBoardMaskOnShowAni(true) + self:getBoardRootNode():setVisible(false) if callback then callback() end