From 1c46acc4256a25e143ef0f4876d3156c67ffb8f7 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Mon, 12 Jun 2023 15:30:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E7=89=88=E6=88=98?= =?UTF-8?q?=E6=96=97=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../battle/controller/battle_controller.lua | 8 ----- .../controller/battle_controller_stage.lua | 30 +++++++++++++++++-- lua/app/ui/dungeon/dungeon_difficulty_ui.lua | 1 - 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 1686077b..52912c29 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -46,14 +46,6 @@ function BattleController:getInitBoard() table.insert(self.fixedRandomGrid, GFunc.getTable(cfg.control_element)) end end - - if config.mystery_box and config.mystery_box_reward then - for i, index in ipairs(config.mystery_box) do - if not DataManager.ChapterData:getChapterMysteryBoxIsGot(self.chapterId, i) then - self.mysteryBoxIndexMap[index] = config.mystery_box_reward[i] - end - end - end end return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap diff --git a/lua/app/module/battle/controller/battle_controller_stage.lua b/lua/app/module/battle/controller/battle_controller_stage.lua index fb4a15b2..928b61e3 100644 --- a/lua/app/module/battle/controller/battle_controller_stage.lua +++ b/lua/app/module/battle/controller/battle_controller_stage.lua @@ -1,5 +1,3 @@ -local BattleHelper = require "app/module/battle/helper/battle_helper" - local BattleController = require "app/module/battle/controller/battle_controller" local BattleControllerStage = class("BattleControllerStage", BattleController) @@ -15,6 +13,34 @@ function BattleControllerStage:getChapterId() return DataManager.ChapterData:getChapterId() end +function BattleControllerStage:getInitBoard() + if not self.boradList then + self.boradList = {} + self.fixedRandomGrid = {} + self.mysteryBoxIndexMap = {} + + local config = self:getChapterConfig()[self.chapterId] + local boardCfg = self:getBoardConfig() + for _, boardId in ipairs(config.board) do + local cfg = boardCfg[boardId] + if cfg then + table.insert(self.boradList, {board = GFunc.getTable(cfg.board), mysteryBoard = GFunc.getTable(cfg.mystery_box_board)}) + table.insert(self.fixedRandomGrid, GFunc.getTable(cfg.control_element)) + end + end + + if config.mystery_box and config.mystery_box_reward then + for i, index in ipairs(config.mystery_box) do + if not DataManager.ChapterData:getChapterMysteryBoxIsGot(self.chapterId, i) then + self.mysteryBoxIndexMap[index] = config.mystery_box_reward[i] + end + end + end + end + + return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap +end + function BattleControllerStage:getFixedRogueSkill() if not self.fixedRogueSkill then local config = ConfigManager:getConfig("chapter")[self.chapterId] diff --git a/lua/app/ui/dungeon/dungeon_difficulty_ui.lua b/lua/app/ui/dungeon/dungeon_difficulty_ui.lua index 8950cbb7..1bd7422f 100644 --- a/lua/app/ui/dungeon/dungeon_difficulty_ui.lua +++ b/lua/app/ui/dungeon/dungeon_difficulty_ui.lua @@ -58,7 +58,6 @@ function DungeonDifficultyUI:onLoadRootComplete() end) self.btnStart:addClickListener(function() -- 开始挑战 - ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD) end) self.btnSweep:addClickListener(function() -- 开始扫荡