From 2c4cc0ef237426b06bb3e1394ea1825d00935021 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Wed, 19 Apr 2023 17:44:23 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=88=98=E6=96=97=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 --- .../battle/controller/battle_controller.lua | 17 ++++++++++++++--- .../controller/battle_controller_stage.lua | 14 +++++++------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index c638eb34..bd751783 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -68,6 +68,9 @@ function BattleController:findNextDefUnit() self:enterRefreshBoard() end +function BattleController:onDefDead() +end + function BattleController:tick(dt) end @@ -356,6 +359,7 @@ function BattleController:enterAtkStepOver() if self.waveIndex >= self.maxWaveIndex then self:enterRoundEnd() else + self:onDefDead() self:enterRefreshBoard() end return @@ -391,8 +395,11 @@ function BattleController:enterDefStepOver() if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑 if self.waveIndex >= self.maxWaveIndex then self:enterRoundEnd() - return + else + self:onDefDead() + self:enterRefreshBoard() end + return end self:enterRefreshBoard() @@ -424,11 +431,15 @@ function BattleController:enterRoundEnd() self:onRoundEnd() end -function BattleController:onRoundEnd() +function BattleController:onRoundEnd(toNextWave) if self.battleData:useAddlvCount() then ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList()) else - self:enterRoundBegin() + if toNextWave then + self:enterNextWave() + else + self:enterRoundBegin() + end end end diff --git a/lua/app/module/battle/controller/battle_controller_stage.lua b/lua/app/module/battle/controller/battle_controller_stage.lua index 62fe933b..45917ba7 100644 --- a/lua/app/module/battle/controller/battle_controller_stage.lua +++ b/lua/app/module/battle/controller/battle_controller_stage.lua @@ -49,13 +49,11 @@ function BattleControllerStage:_stageGenerateNextMonster() self.atkTeam:playRunAction() monsterComp:playEnterBattlefield(true, function() self.atkTeam:stopRunAction() - self:enterNextWave() - self:onRoundEnd() + self:onRoundEnd(true) end) else monsterComp:playEnterBattlefield(false, function() - self:enterNextWave() - self:onRoundEnd() + self:onRoundEnd(true) end) end end) @@ -108,9 +106,11 @@ function BattleControllerStage:getNotInvolvedSkills() end function BattleControllerStage:findNextDefUnit() - self.defTeam:getMainUnit():playDead(function() - self:_stageGenerateNextMonster() - end) + self:_stageGenerateNextMonster() +end + +function BattleControllerStage:onDefDead() + self.defTeam:getMainUnit():playDead() end function BattleControllerStage:controllBattleEnd() From a43068daf4e3864a1908d11b1e6a01dd7d234578 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Wed, 19 Apr 2023 18:02:32 +0800 Subject: [PATCH 2/3] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/controller/battle_controller.lua | 2 +- lua/app/userdata/battle/battle_data.lua | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index bd751783..f08a6aa1 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -558,7 +558,7 @@ function BattleController:onTouchEvent(eventType, posId) return end - local snapshot = self.battleData:removeGridSequence(sequence[1].posId) + local snapshot = self.battleData:getFirstSequenceSnapshot() if snapshot then -- 如果有快照,则恢复一次 for posId, info in pairs(snapshot) do local entity = self.battleData:getGridEntity(posId) diff --git a/lua/app/userdata/battle/battle_data.lua b/lua/app/userdata/battle/battle_data.lua index 8adacf26..a35ccf24 100644 --- a/lua/app/userdata/battle/battle_data.lua +++ b/lua/app/userdata/battle/battle_data.lua @@ -213,6 +213,15 @@ function BattleData:removeGridSequence(posId) return snapshot end +function BattleData:getFirstSequenceSnapshot(posId) + if not self.gridSequence[1] then + return + end + + local snapshot = self.gridSequence[1].snapshot + return snapshot +end + function BattleData:cacheSkillInfluenceGrids(grids) if not self.skillInfluenceGrids then self.skillInfluenceGrids = {} From 32b9deba6de314ca95f50f1979ebf2af26709677 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Wed, 19 Apr 2023 18:38:09 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=88=98=E6=96=97=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 --- .../module/battle/controller/battle_controller.lua | 10 ++++------ lua/app/ui/battle/battle_skill_select_ui.lua | 4 ++++ lua/app/ui/battle/battle_ui.lua | 13 ++++++++++++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index f08a6aa1..a49ac45e 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -298,9 +298,7 @@ function BattleController:enterNextWave() self.battleUI:refreshWave(self.waveIndex) end if self.waveIndex == 1 then -- 第一波 - self.isBossWave = self.defTeam:getMainUnit().unitEntity:getIsBoss() - self:generateBoard() - return + self:generateBoard(true) end self.defTeam:prepare() @@ -880,7 +878,7 @@ function BattleController:exeInstructions(callback) end end -function BattleController:generateBoard() +function BattleController:generateBoard(isFirst) local boardList, _ = self:getInitBoard() if self.curBoardIndex and self.curBoardIndex >= #boardList then return @@ -896,8 +894,8 @@ function BattleController:generateBoard() self.battleData:refreshBoard(board) self.battleUI:initGridCell() end, function() - self:enterRoundBegin() - end) + -- self:enterRoundBegin() + end, isFirst) end function BattleController:putBoardCacheSkill(callback) diff --git a/lua/app/ui/battle/battle_skill_select_ui.lua b/lua/app/ui/battle/battle_skill_select_ui.lua index 00da2f4d..c4cd10cb 100644 --- a/lua/app/ui/battle/battle_skill_select_ui.lua +++ b/lua/app/ui/battle/battle_skill_select_ui.lua @@ -26,6 +26,7 @@ end function BattleSkillSelectUI:_display() local uiMap = self.root:genAllChildren() uiMap["battle_skill_select_ui.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3)) + uiMap["battle_skill_select_ui.bg_1"]:setVisible(true) self:refreshRogueSkill() end @@ -43,11 +44,14 @@ function BattleSkillSelectUI:_addListeners() end) self.canvasGroup = uiMap["battle_skill_select_ui.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP) + self.bg = uiMap["battle_skill_select_ui.bg_1"] uiMap["battle_skill_select_ui.look_btn"]:addTouchListener(function(eventType, x, y) if eventType == GConst.TOUCH_EVENT.DOWN or eventType == GConst.TOUCH_EVENT.DRAG then self.canvasGroup.alpha = 0.3 + self.bg:setVisible(false) else self.canvasGroup.alpha = 1 + self.bg:setVisible(true) end end) end diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 3e234c5d..42e5649d 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -309,12 +309,23 @@ function BattleUI:onInitGridCellOver() end end -function BattleUI:switchBoard(downCallback, callback) +function BattleUI:switchBoard(downCallback, callback, isFirst) if self.switchBoardSeq then self.switchBoardSeq:Kill() self.switchBoardSeq = nil end + if isFirst then + if downCallback then + downCallback() + end + if callback then + callback() + end + self.boardNode:setAnchoredPositionY(BOARD_POS_UP.y) + return + end + self.switchBoardSeq = self.root:createBindTweenSequence() self.switchBoardSeq:Append(self.boardNode:getTransform():DOAnchorPos(BOARD_POS_DOWN, 0.5)) self.switchBoardSeq:AppendCallback(function()