From 10253fbafbed2fb22af797f6a5d3b0917b50b49f Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Mon, 11 Sep 2023 20:01:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=A6=E6=96=87=E5=89=AF=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 2 + lua/app/common/data_manager.lua | 1 + lua/app/module/battle/battle_const.lua | 2 + lua/app/module/battle/battle_manager.lua | 9 + .../battle/component/battle_unit_comp.lua | 3 +- .../controller/battle_base_controller.lua | 57 ++- .../battle_controller_dungeon_rune.lua | 276 ++++++++++++++- .../dungeon_rune/dungeon_rune_const.lua | 50 +-- .../dungeon_rune/dungeon_rune_manager.lua | 106 +++++- lua/app/proto/proto_msg_type.lua | 141 ++++++++ lua/app/ui/battle/battle_rune_result_ui.lua | 333 ++++++++++++++++++ .../ui/battle/battle_rune_result_ui.lua.meta | 10 + lua/app/ui/battle/battle_ui.lua | 11 + lua/app/ui/common/common_formation_ui.lua | 2 + .../ui/currency_bar/cell/currency_cell.lua | 10 +- .../dungeon_rune/cell/rune_chapter_cell.lua | 4 +- .../ui/dungeon_rune/dungeon_rune_main_ui.lua | 15 +- .../dungeon_rune/dungeon_rune_rebirth_ui.lua | 2 +- .../ui/dungeon_rune/dungeon_rune_task_ui.lua | 13 +- lua/app/ui/hero/hero_comp.lua | 15 + lua/app/userdata/battle/battle_base_data.lua | 8 + .../battle/team/battle_team_entity.lua | 4 +- .../battle/team/battle_unit_entity.lua | 4 +- lua/app/userdata/dungeon/dungeon_data.lua | 12 + .../userdata/dungeon/dungeon_rune_entity.lua | 149 +++----- 25 files changed, 1055 insertions(+), 184 deletions(-) create mode 100644 lua/app/ui/battle/battle_rune_result_ui.lua create mode 100644 lua/app/ui/battle/battle_rune_result_ui.lua.meta diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index 6c49c64b..f91aab77 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -151,7 +151,9 @@ BIReport.ITEM_GET_TYPE = { ACT_FOURTEEN_DAY_EXCHANGE = "ActFourteenDayExchange", FOURTEEN_DAY_GIFT = "FourteenDayGift", DUNGEON_RUNE_START = "DungeonRuneStart", + DUNGEON_RUNE_SETTLEMENT = "DungeonRuneSettlement", DUNGEON_RUNE_SWEEP = "DungeonRuneSweep", + DUNGEON_RUNE_BUY_WING = "DungeonRunebuyWing", } BIReport.ADS_CLICK_TYPE = { diff --git a/lua/app/common/data_manager.lua b/lua/app/common/data_manager.lua index e15ad478..d38f5f9a 100644 --- a/lua/app/common/data_manager.lua +++ b/lua/app/common/data_manager.lua @@ -188,6 +188,7 @@ function DataManager:initWithServerData(data) end self.HeroFundData:init(data.hero_fund) self.FourteenDayData:init(data.fourteen_bounty) + self.DungeonData:initDungeonRune(data.chapter_rune_challenge) -- 任务数据最后初始化,依赖其他模块的数据 self.TaskData:init() diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index 3ce09bb7..6d18603a 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -239,6 +239,8 @@ BattleConst.SPECIAL_DAMAGE_OR_CURE_TYPE = { ROUND_BEGIN_HEAL = "round_begin_heal", KILL_MAX_ELEMENT_AND_HEAL = "kill_max_element_and_heal", BE_SUCKED = "be_sucked", + + AD_REBIRTH = "ad_rebirth", } BattleConst.SKILL_RECORD_DATA_NAME = { diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index 2288dc30..2452aff6 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -72,6 +72,15 @@ function BattleManager:showBossRushBattleResultUI(battleType, combatReport, task }) end +function BattleManager:showBattleRuneResultUI(battleType, rewards, combatReport, remainRound) + UIManager:showUI("app/ui/battle/battle_rune_result_ui", { + battleType = battleType, + combatReport = combatReport, + rewards = rewards, + remainRound = remainRound, + }) +end + function BattleManager:showBoxOpenUI(rewards, callback) UIManager:showUI("app/ui/battle/battle_box_open_ui", {rewards = rewards, callback = callback}) end diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index 440946c1..d3c7e39a 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -1659,7 +1659,7 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d end local shieldHpBefore = self.unitEntity:getShieldHp() - local hpRealReduce, shieldWorkOn = self.unitEntity:takeDamageOrCure(num) + local hpRealReduce, shieldWorkOn = self.unitEntity:takeDamageOrCure(num, self) if hpRealReduce < 0 and self.side == BattleConst.SIDE_DEF then -- 实际掉血了 self:addBattleExp(atker, hpRealReduce) end @@ -2224,6 +2224,7 @@ function BattleUnitComp:cancelPassiveSkillEffect(skill) end function BattleUnitComp:rebirth() + self.isClear = false self.currState = UNIT_STATE.INIT self.unitEntity:rebirth() end diff --git a/lua/app/module/battle/controller/battle_base_controller.lua b/lua/app/module/battle/controller/battle_base_controller.lua index 9a38032f..0a5ba17b 100644 --- a/lua/app/module/battle/controller/battle_base_controller.lua +++ b/lua/app/module/battle/controller/battle_base_controller.lua @@ -129,6 +129,16 @@ function BattleBaseController:getMonsterHpAddition() return 0 end +-- 怪物攻击力固定 +function BattleBaseController:getMonsterAtkFixed() + return 0 +end + +-- 怪物血量固定 +function BattleBaseController:getMonsterHpFixed() + return 0 +end + -- 需要额外加载的资源 function BattleBaseController:loadOtherRes(callback) return callback() @@ -494,6 +504,8 @@ function BattleBaseController:init(params, snapshot) self.waitingFillCount = 0 self.needWaitingBoardOver = nil self.curWaveMonsterDead = false + self.totalBreakedGridType = {} + self.totalEliminateCountMap = {} self.curActionSide = SIDE_ATK self:resetSideActionCount() @@ -1150,20 +1162,18 @@ function BattleBaseController:enterNextTeamAction() self:hideCombo() self:hideCounterAttack() - if self:checkTeamIsDead(function() self:enterRoundEnd() end) then - return - end - - if not self.battleTeamActionList or not self.battleTeamActionList[1] then - self:enterRoundEnd() - return - end - - local action = table.remove(self.battleTeamActionList, 1) - action() + self:checkTeamIsDead(function() self:enterRoundEnd() end, function() + if not self.battleTeamActionList or not self.battleTeamActionList[1] then + self:enterRoundEnd() + return + end + + local action = table.remove(self.battleTeamActionList, 1) + action() + end) end -function BattleBaseController:checkTeamIsDead(callback) +function BattleBaseController:checkTeamIsDead(callback, falseCallback) local defTeam = self.battleData:getDefTeam() local atkTeam = self.battleData:getAtkTeam() if atkTeam:getIsDead() and defTeam:getIsDead() then -- 都死了,直接结算 @@ -1197,7 +1207,9 @@ function BattleBaseController:checkTeamIsDead(callback) return true end - return false + if falseCallback then + falseCallback() + end end function BattleBaseController:getIsAtkStep() @@ -1238,11 +1250,9 @@ function BattleBaseController:enterRoundEnd() self.atkTeam:onRoundEnd() self.defTeam:onRoundEnd() - if self:checkTeamIsDead(function() self:enterNextWave() end) then - return - end - - self:onRoundEnd() + self:checkTeamIsDead(function() self:enterNextWave() end, function() + self:onRoundEnd() + end) end function BattleBaseController:onRoundEnd(toNextWave) @@ -1346,6 +1356,10 @@ function BattleBaseController:onLinkOver() end) end, self.curActionSide) + for element, count in pairs(elementTypeMap) do + self.totalEliminateCountMap[element] = (self.totalEliminateCountMap[element] or 0) + count + end + self.eliminateCount = self.eliminateCount + 1 self.eliminateTotalCount = self.eliminateTotalCount + 1 if count > self.maxLinkCount then @@ -1444,7 +1458,9 @@ function BattleBaseController:dealGridBreak(posId, condition, time, breakedMap, aniUnit.breakSfxName = entity:getBreakSfx() aniUnit.callback = function() - self.lastRoundBreakedGridType[entity:getGridType()] = true + local gridType = entity:getGridType() + self.lastRoundBreakedGridType[gridType] = true + self.totalBreakedGridType[gridType] = (self.totalBreakedGridType[gridType] or 0) + 1 entity:tryBreakGrid(condition) if entity:getIsIdle() then self:dealGridEdge(posId) @@ -2185,6 +2201,9 @@ function BattleBaseController:getRandomGridInfo() for typeName, typeNum in pairs(BattleConst.ELEMENT_TYPE) do if not self:getSealElementType()[typeNum] and self:getSkillEntityByElement(typeNum) then local weight = ((map[typeNum] or 0) + 1) * BattleConst.ELEMENT_WIGHT + if self.elementWeightMap and self.elementWeightMap[typeNum] then + weight = weight + self.elementWeightMap[typeNum] + end if weight > BattleConst.MAX_ELEMENT_WIGHT then weight = BattleConst.MAX_ELEMENT_WIGHT end diff --git a/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua b/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua index 0528c560..c79db9c5 100644 --- a/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua +++ b/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua @@ -3,9 +3,11 @@ local BattleControllerDungeonRune = class("BattleControllerDungeonRune", BattleC local BattleConst = GConst.BattleConst local SIDE_ATK = BattleConst.SIDE_ATK local SIDE_DEF = BattleConst.SIDE_DEF +local PASSIVE_EVENT = BattleConst.PASSIVE_EVENT +local UNIT_STATE = BattleConst.UNIT_STATE function BattleControllerDungeonRune:getBoardConfig() - return ConfigManager:getConfig("chapter_board_dungeon_rune") + return ConfigManager:getConfig("chapter_board_rune") end function BattleControllerDungeonRune:getChapterConfig() @@ -17,6 +19,182 @@ function BattleControllerDungeonRune:getChapterId() return runeData:getCurFightChapterId() end +function BattleControllerDungeonRune:initOther() + self.canRebirthTimes = 1 -- 每次只能复活一次 + self.dungeonRuneRemainRoundCount = self:getChapterConfig()[self.chapterId].round or 1 + + if self.battleUI then + self.battleUI:refreshWave(self.dungeonRuneRemainRoundCount, GConst.ATLAS_PATH.COMMON, "common_dec_15") + end +end + +-- 怪物攻击力固定 +function BattleControllerDungeonRune:getMonsterAtkFixed() + if not self.monsterAtkFixed then + self.monsterAtkFixed = self:getChapterConfig()[self.chapterId].atk or 0 + end + return self.monsterAtkFixed +end + +-- 怪物血量固定 +function BattleControllerDungeonRune:getMonsterHpFixed() + if not self.monsterHpFixed then + self.monsterHpFixed = self:getChapterConfig()[self.chapterId].hp or 0 + end + return self.monsterHpFixed +end + +function BattleControllerDungeonRune:getMaxWave() + self:getInitBoard() + if not self.cacheMaxWave then + self.cacheMaxWave = #self.monsterList + if self.cacheMaxWave > 1 then + self.cacheMaxWave = 9999999 -- 无限波次 + end + end + return self.cacheMaxWave +end + +function BattleControllerDungeonRune:enterNextWave() + local waveIndex = self:getWaveIndex() + if waveIndex ~= 0 and self.curWaveMonsterDead then + if self.isBossWave then + self:addTaskProgress(BattleConst.BATTLE_TASK_FIELD.KILL_BOSS, 1) + else + self:addTaskProgress(BattleConst.BATTLE_TASK_FIELD.KILL_NORMAL_MONSTER, 1) + end + self:setTaskProgress(BattleConst.BATTLE_TASK_FIELD.PASS_WAVE, waveIndex) + end + + -- 完成任务 + local taskOver = self:getRuneTaskAllOver() + if self.curWaveMonsterDead and taskOver then + self.victory = true + self:postWaveOver(false) + self:battleEnd() + return + end + + if waveIndex >= self.maxWaveIndex then + self.victory = self.curWaveMonsterDead + self:postWaveOver(not self.curWaveMonsterDead) + self:battleEnd() + return + end + + local atkTeam = self.battleData:getAtkTeam() + if not atkTeam or atkTeam:getIsDead() then + if self:tryShowRebirth(function() self:onEnterNextWave() end) then + return + end + + self.victory = false + self:postWaveOver(true) + self:battleEnd() + return + end + + self:onEnterNextWave() +end + +function BattleControllerDungeonRune:onEnterNextWave() + local waveIndex = self:getWaveIndex() + if waveIndex ~= 0 then -- 第一波 + self:postWaveOver(false) + end + + self.curWaveMonsterDead = false + self:addWaveIndex(1) + waveIndex = self:getWaveIndex() + self:refreshWave(waveIndex) + if waveIndex == 1 then -- 第一波 + self.needWaitingBoardOver = true + self:generateBoard(true) + else + -- 上报关卡结束 + self.defTeam:prepare() + end + + self.waveDurationTime = 0 + self.eliminateCount = 0 + + self:snapshotBattleInfo() + + self.isBossWave = self.defTeam:getMainUnit().unitEntity:getIsBoss() + self:postFightStart() + if not self.needWaitingBoardOver then + self:enterRoundBegin() + end + if not self.isBossWave then + self.battleUI:hideBuffTips() + end +end + +function BattleControllerDungeonRune:enterRoundBegin() + if self.dungeonRuneRemainRoundCount <= 0 then + if self.canRebirthTimes > 0 then + ModuleManager.DungeonRuneManager:showRebirthUI(function() + self.canRebirthTimes = self.canRebirthTimes - 1 + self.dungeonRuneRemainRoundCount = self.dungeonRuneRemainRoundCount + 5 -- 5回合 + self.dungeonRuneRemainRoundCount = self.dungeonRuneRemainRoundCount - 1 + if self.battleUI then + self.battleUI:refreshWave(self.dungeonRuneRemainRoundCount + 1, GConst.ATLAS_PATH.COMMON, "common_dec_15") + end + BattleController.enterRoundBegin(self) + end, function() + self.victory = false + self:postWaveOver(false) + self:battleEnd() + end, false) + else + self.victory = false + self:postWaveOver(false) + self:battleEnd() + end + return + end + + self.dungeonRuneRemainRoundCount = self.dungeonRuneRemainRoundCount - 1 + if self.battleUI then + self.battleUI:refreshWave(self.dungeonRuneRemainRoundCount + 1, GConst.ATLAS_PATH.COMMON, "common_dec_15") + end + BattleController.enterRoundBegin(self) +end + +function BattleControllerDungeonRune:getNextMonsterId(waveIndex) + self:getInitBoard() + waveIndex = waveIndex or self:getWaveIndex() + 1 + local monsterIndex = math.random(1, #self.monsterList) + return self.monsterList[monsterIndex] +end + +function BattleControllerDungeonRune:getInitBoard() + if not self.boradList then + self.boradList = {} + self.fixedRandomGrid = {} + self.mysteryBoxIndexMap = {} + self.monsterList = {} + self.elementWeightMap = {} + + local boardCfg = self:getBoardConfig() + local info = self:getChapterConfig()[self.chapterId] + if info then + self.monsterList = GFunc.getTable(info.monster) + local cfg = boardCfg[info.chapter_board] + if cfg then + table.insert(self.boradList, {board = GFunc.getTable(cfg.board), gridEdge = GFunc.getTable(cfg.grid_edge)}) + end + if info.weights then + for index, v in ipairs(info.weights) do + self.elementWeightMap[v[1]] = v[2] + end + end + end + end + + return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap +end + function BattleControllerDungeonRune:onLoadComplete(...) -- 处理技能 local unlockAllSkill = function(side) @@ -40,11 +218,77 @@ function BattleControllerDungeonRune:onLoadComplete(...) end end unlockAllSkill(SIDE_ATK) - unlockAllSkill(SIDE_DEF) BattleController.onLoadComplete(self, ...) end +function BattleControllerDungeonRune:enterRoundEnd() + self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_END + local defTeam = self.battleData:getDefTeam() + if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑 + self.curWaveMonsterDead = true + self.atkTeam:onRoundEnd() + self:enterNextWave() + return + end + + local atkTeam = self.battleData:getAtkTeam() + if not atkTeam or atkTeam:getIsDead() then -- 英雄死了, 直接结算 + if self:tryShowRebirth(function() self:enterRoundEnd() end) then + return + end + + self.defTeam:onRoundEnd() + self:enterNextWave() + return + end + + self.atkTeam:onRoundEnd() + self.defTeam:onRoundEnd() + + self:checkTeamIsDead(function() self:enterNextWave() end, function() + self:onRoundEnd() + end) +end + +function BattleControllerDungeonRune:checkTeamIsDead(callback, falseCallback) + if self:tryShowRebirth(function() + BattleController.checkTeamIsDead(self, callback, falseCallback) + end) then + return true + end + BattleController.checkTeamIsDead(self, callback, falseCallback) +end + +function BattleControllerDungeonRune:tryShowRebirth(callback) + local atkTeam = self.battleData:getAtkTeam() + if atkTeam:getIsDead() and self.canRebirthTimes > 0 then + ModuleManager.DungeonRuneManager:showRebirthUI(function() + self.canRebirthTimes = self.canRebirthTimes - 1 + local mainUnit = self.atkTeam:getMainUnit() + mainUnit:rebirth() + local hp = mainUnit.unitEntity:getMaxHp() * 5000 // GConst.BattleConst.DEFAULT_FACTOR -- 回血50% + local x = mainUnit:takeDamageOrCure(mainUnit, hp, GConst.BattleConst.EFFECT_TYPE.HEAL, 0, BattleConst.SPECIAL_DAMAGE_OR_CURE_TYPE.AD_REBIRTH) + local hpPercent = mainUnit.unitEntity:getHpPercent() + self:refreshHp(mainUnit:getSide(), mainUnit.unitEntity:getHp(), hpPercent) + self.atkTeam:checkPassiveEvent(PASSIVE_EVENT.HP_LOWER_THAN, mainUnit, hpPercent) + + mainUnit:changeState(UNIT_STATE.IDLE) + mainUnit:initPosition() + + if callback then + callback() + end + end, function() + self.canRebirthTimes = self.canRebirthTimes - 1 + if callback then + callback() + end + end, true) + return true + end +end + function BattleControllerDungeonRune:controllBattleEnd() self.combatReport = { battleType = GConst.BattleConst.BATTLE_TYPE.DUNGEON_RUNE, @@ -65,7 +309,7 @@ function BattleControllerDungeonRune:controllBattleEnd() if not self.victory then self.combatReport.wave = self.combatReport.wave - 1 end - ModuleManager.DungeonArmorManager:reqEndChallenge(self.chapterId, self.combatReport, self.taskProgress) + ModuleManager.DungeonRuneManager:reqFightSettlement(self.chapterId, self.combatReport, self.taskProgress, self.dungeonRuneRemainRoundCount) end function BattleControllerDungeonRune:postWaveOver(atkDead, isQuit) @@ -105,4 +349,30 @@ function BattleControllerDungeonRune:postFightStart() BIReport:postFightBegin(GConst.BattleConst.BATTLE_TYPE.DUNGEON_RUNE, self:getWaveIndex(), self.chapterId, unlockMaxChapter, startTimes) end +function BattleControllerDungeonRune:getRuneTaskNumByType(taskInfo) + local taskType = taskInfo[1] + local taskParams1 = taskInfo[2] + if taskType == GConst.DungeonRuneConst.TASK_TYPE.ELIMINATION_ELEMENT then + return self.totalEliminateCountMap[taskParams1] or 0 + elseif taskType == GConst.DungeonRuneConst.TASK_TYPE.BREAK_GRID_TYPE then + return self.totalBreakedGridType[taskParams1] or 0 + elseif taskType == GConst.DungeonRuneConst.TASK_TYPE.KILL_MONSTER then + return self:getTaskProgress()[GConst.BattleConst.BATTLE_TASK_FIELD.KILL_NORMAL_MONSTER] + end +end + +function BattleControllerDungeonRune:getRuneTaskAllOver() + local runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) + local chapterCondition = runeData:getChapterCondition(self.chapterId) + local taskProgress = ModuleManager.DungeonRuneManager:getTaskStatus(self, chapterCondition) + local taskOver = true + for type, info in pairs(taskProgress) do + if not info.over then + taskOver = false + break + end + end + return taskOver +end + return BattleControllerDungeonRune \ No newline at end of file diff --git a/lua/app/module/dungeon_rune/dungeon_rune_const.lua b/lua/app/module/dungeon_rune/dungeon_rune_const.lua index fc9d17b4..23f29d2b 100644 --- a/lua/app/module/dungeon_rune/dungeon_rune_const.lua +++ b/lua/app/module/dungeon_rune/dungeon_rune_const.lua @@ -20,31 +20,31 @@ DungeonRuneConst.TASK_ICON = { [BattleConst.ELEMENT_TYPE.PURPLE] = "dungeon_rune_task_3", }, [DungeonRuneConst.TASK_TYPE.BREAK_GRID_TYPE] = { - [2] = "battle_obstacle_stone_2", - [3] = "battle_obstacle_stone_1", - [4] = "battle_obstacle_vine", - [5] = "battle_obstacle_ice", - [7] = "battle_obstacle_stone_3", - [12] = "battle_obstacle_leaf", - [13] = "battle_obstacle_jelly", - [18] = "battle_obstacle_stump_1", - [19] = "battle_obstacle_stump_2", - [20] = "battle_obstacle_stump_3", - [21] = "battle_obstacle_blister", - [22] = "battle_obstacle_silt", - [23] = "battle_obstacle_poisonous_mist", - [24] = "battle_obstacle_altar_1", - [25] = "battle_obstacle_altar_2", - [26] = "battle_obstacle_altar_3", - [27] = "battle_obstacle_circle", - [28] = "battle_obstacle_stalactite_1", - [29] = "battle_obstacle_stalactite_2", - [30] = "battle_obstacle_stalactite_3", - [31] = "battle_obstacle_lron_1", - [32] = "battle_obstacle_lron_2", - [33] = "battle_obstacle_lron_3", - [34] = "battle_obstacle_lava", - [35] = "battle_obstacle_leaf", + [2] = "dungeon_rune_task_stone_2", + [3] = "dungeon_rune_task_stone_1", + [4] = "dungeon_rune_task_vine", + [5] = "dungeon_rune_task_ice", + [7] = "dungeon_rune_task_stone_3", + [12] = "dungeon_rune_task_stump_1", + [13] = "dungeon_rune_task_jelly", + [18] = "dungeon_rune_task_stump_1", + [19] = "dungeon_rune_task_stump_2", + [20] = "dungeon_rune_task_stump_3", + [21] = "dungeon_rune_task_blister", + [22] = "dungeon_rune_task_silt", + [23] = "dungeon_rune_task_poisonous_mist", + [24] = "dungeon_rune_task_altar_1", + [25] = "dungeon_rune_task_altar_2", + [26] = "dungeon_rune_task_altar_3", + [27] = "dungeon_rune_task_circle", + [28] = "dungeon_rune_task_stalactite_1", + [29] = "dungeon_rune_task_stalactite_2", + [30] = "dungeon_rune_task_stalactite_3", + [31] = "dungeon_rune_task_iron_1", + [32] = "dungeon_rune_task_iron_2", + [33] = "dungeon_rune_task_iron_3", + [34] = "dungeon_rune_task_lava", + [35] = "dungeon_rune_task_tussock", }, [DungeonRuneConst.TASK_TYPE.KILL_MONSTER] = "dungeon_rune_task_8", } diff --git a/lua/app/module/dungeon_rune/dungeon_rune_manager.lua b/lua/app/module/dungeon_rune/dungeon_rune_manager.lua index 9cc1038a..3cab0e3d 100644 --- a/lua/app/module/dungeon_rune/dungeon_rune_manager.lua +++ b/lua/app/module/dungeon_rune/dungeon_rune_manager.lua @@ -8,6 +8,7 @@ function DungeonRuneManager:showFightUI(id) local runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) if not runeData:canFight(id) then GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.PASS_REQUIRE)) + return end local params = {id = id} @@ -25,7 +26,7 @@ function DungeonRuneManager:showTaskUI(id) end function DungeonRuneManager:showRebirthUI(adCallback, closeCallback, isHpOver) - UIManager:showUI("app/ui/dungeon_rune/dungeon_rune_rebirth_ui",{adCallback = adCallback, closeCallback = closeCallback, isHpOver = isHpOver}) + UIManager:showUI("app/ui/dungeon_rune/dungeon_rune_rebirth_ui",{adCallback = adCallback, refuseCallback = closeCallback, isHpOver = isHpOver}) end function DungeonRuneManager:reqFight(id) @@ -35,23 +36,30 @@ function DungeonRuneManager:reqFight(id) return end - local passed = runeData:passedChapter(id) - if not passed and not GFunc.checkCost(GConst.ItemConst.ITEM_ID_GLOD_WING, 1, true) then - return - end + -- local passed = runeData:passedChapter(id) + -- if not passed and not GFunc.checkCost(GConst.ItemConst.ITEM_ID_GLOD_WING, 1, true) then + -- return + -- end - local heroes = {} - local formation = DataManager.FormationData:getDungeonArmorFormation() - for matchType, heroId in pairs(formation) do - if heroId > 0 then - table.insert(heroes, heroId) - end - end - self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterRuneChallengeStartReq, {id = id, heroes = heroes}, {}, self.rspFight, BIReport.ITEM_GET_TYPE.DUNGEON_RUNE_START) + -- local heroes = {} + -- local formation = DataManager.FormationData:getDungeonRuneFormation() + -- for matchType, heroId in pairs(formation) do + -- if heroId > 0 then + -- table.insert(heroes, heroId) + -- end + -- end + -- self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterRuneChallengeStartReq, {id = id, heroes = heroes}, {}, self.rspFight, BIReport.ITEM_GET_TYPE.DUNGEON_RUNE_START) + self:rspFight({err_code = GConst.ERROR_STR.SUCCESS, reqData = {id = id}}) end function DungeonRuneManager:rspFight(result) if result.err_code == GConst.ERROR_STR.SUCCESS then + if not result.reqData then + return + end + + local runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) + runeData:setCurFightChapterId(result.reqData.id) local params = { atkFormation = {} } @@ -70,14 +78,15 @@ function DungeonRuneManager:rspFight(result) end end -function DungeonRuneManager:reqFightSettlement(chapterId, combatReport, taskProgress) +function DungeonRuneManager:reqFightSettlement(chapterId, combatReport, taskProgress, remainRound) local parmas = { id = chapterId, win = combatReport.victory, task_stat = taskProgress, combatReport = combatReport, + remainRound = remainRound, } - self:sendmessage(ProtoMsgType.FromMsgEnum.ChapterRuneChallengeSettlementReq, parmas, {}, self.rspFightSettlement, BIReport.ITEM_GET_TYPE.DUNGEON_RUNE_SETTLEMENT) + self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterRuneChallengeSettlementReq, parmas, {}, self.rspFightSettlement, BIReport.ITEM_GET_TYPE.DUNGEON_RUNE_SETTLEMENT) end function DungeonRuneManager:rspFightSettlement(result) @@ -85,10 +94,12 @@ function DungeonRuneManager:rspFightSettlement(result) local runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) local passId = runeData:getPassedMaxId() if result.reqData then - runeData:updatePassedMaxId(result.reqData.id, result) + if result.reqData.win then + runeData:updatePassedMaxId(result.reqData.id, result.max_id) + runeData:updatePassRound(result.reqData.id, result.reqData.task_stat[GConst.BattleConst.BATTLE_TASK_FIELD.TOTAL_TURN] or 0) + end + ModuleManager.BattleManager:showBattleRuneResultUI(GConst.BattleConst.BATTLE_TYPE.DUNGEON_RUNE, result.rewards, result.reqData.combatReport, result.reqData.remainRound) end - -- ModuleManager.BattleManager:showBattleArmorResultUI(GConst.BattleConst.BATTLE_TYPE.DUNGEON_ARMOR, result.rewards, result.reqData.combatReport) - if passId ~= runeData:getPassedMaxId() then local data = {} data.dungeon_progress = DataManager.DungeonData:getDungeonBIStr() @@ -126,7 +137,7 @@ function DungeonRuneManager:rspSweep(result) end end -function DungeonRuneManager:reqRebirth() +function DungeonRuneManager:reqRebirth(isHpOver) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterRuneAdReq, {}, {}, self.rspRebirth) end @@ -136,4 +147,61 @@ function DungeonRuneManager:rspRebirth(result) end end +function DungeonRuneManager:reqFormation(formation) + if not DataManager.FormationData:formationIsFull(GConst.BattleConst.FORMATION_TYPE.DUNGEON_RUNE) then + GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_8)) + return + end + + local heroes = {} + for matchType, heroId in pairs(formation) do + if heroId and heroId > 0 then + table.insert(heroes, heroId) + end + end + local params = { + heroes = heroes + } + self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterRuneChallengeHeroesReq, params, {}, self.rspFormation) +end + +function DungeonRuneManager:rspFormation(result) + if result.err_code == GConst.ERROR_STR.SUCCESS then + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORMATION_CHANGE, {type = GConst.BattleConst.FORMATION_TYPE.DUNGEON_RUNE}) + end +end + +function DungeonRuneManager:getTaskStatus(battleControllerRune, taskInfo) + local taskProgress = {} + for index, condition in ipairs(taskInfo) do + local progress = battleControllerRune:getRuneTaskNumByType(condition) + if progress then + taskProgress[condition[1]] = { + progress = progress, + totalProgress = condition[3], + over = progress >= condition[3] + } + end + end + + return taskProgress +end + +function DungeonRuneManager:reqBuySliverWing(count) + if not count then + return + end + self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterRuneBuySliverReq, {buy_count = count}, {}, self.rspBuySliverWing, BIReport.ITEM_GET_TYPE.DUNGEON_RUNE_BUY_WING) +end + +function DungeonRuneManager:rspBuySliverWing(result) + if result.err_code == GConst.ERROR_STR.SUCCESS then + GFunc.showRewardBox(result.rewards) + if result.reqData then + local runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) + runeData:addSliverWingBuyCount(result.reqData.buy_count) + end + end +end + return DungeonRuneManager \ No newline at end of file diff --git a/lua/app/proto/proto_msg_type.lua b/lua/app/proto/proto_msg_type.lua index d785e5ca..b13da0d9 100644 --- a/lua/app/proto/proto_msg_type.lua +++ b/lua/app/proto/proto_msg_type.lua @@ -17,6 +17,8 @@ local ProtoMsgType = { [295350214] = "ChangeAvatarRsp", [317272657] = "IdleQuickReq", [317274490] = "IdleQuickRsp", + [326310937] = "ActivityPVPDataReq", + [326312770] = "ActivityPVPDataRsp", [335671647] = "ChapterWeaponChallengeSettlementReq", [335673480] = "ChapterWeaponChallengeSettlementRsp", [349009610] = "TriggerGrowUpGiftNtf", @@ -39,6 +41,8 @@ local ProtoMsgType = { [697002542] = "FourteenBountyTaskAwardRsp", [737107384] = "BuyMallIdleReq", [737109217] = "BuyMallIdleRsp", + [761068365] = "RuneLockReq", + [761070198] = "RuneLockRsp", [822916593] = "MatchReq", [822918426] = "MatchRsp", [834139466] = "ChapterGoldChallengeStartReq", @@ -57,6 +61,10 @@ local ProtoMsgType = { [1068771132] = "ReconnectRsp", [1070841461] = "LoginReq", [1070843294] = "LoginRsp", + [1163725920] = "ChapterRuneAdReq", + [1163727753] = "ChapterRuneAdRsp", + [1283733956] = "ActivityPVPMatchReq", + [1283735789] = "ActivityPVPMatchRsp", [1312685858] = "BossRushTopReq", [1312687691] = "BossRushTopRsp", [1326064687] = "FourteenBountyExchangeAwardReq", @@ -93,6 +101,8 @@ local ProtoMsgType = { [1746319121] = "IdleInfoRsp", [1751460231] = "PVPHeroesArrayReq", [1751462064] = "PVPHeroesArrayRsp", + [1800420732] = "ChapterRuneChallengeStartReq", + [1800422565] = "ChapterRuneChallengeStartRsp", [1901321540] = "PipedReq", [2017336372] = "BossRushSettlementReq", [2017338205] = "BossRushSettlementRsp", @@ -100,21 +110,32 @@ local ProtoMsgType = { [2060509863] = "ChangeAvatarFrameRsp", [2095612947] = "ChangeNameReq", [2095614780] = "ChangeNameRsp", + [2103189773] = "RuneUpdateNtf", [2105154645] = "CDKeyUseReq", [2105156478] = "CDKeyUseRsp", [2118851896] = "HeroUpgradeReq", [2118853729] = "HeroUpgradeRsp", + [2140118069] = "ActivityPVPDecideHeroReq", + [2140119902] = "ActivityPVPDecideHeroRsp", [2164009445] = "BossRushStartReq", [2164011278] = "BossRushStartRsp", [2198847028] = "BossRushBoughtNtf", + [2224825865] = "ChapterRuneChallengeSettlementReq", + [2224827698] = "ChapterRuneChallengeSettlementRsp", + [2247710148] = "ActivityPVPBountyClaimReq", + [2247711981] = "ActivityPVPBountyClaimRsp", [2285872137] = "ChapterBoxRewardReq", [2285873970] = "ChapterBoxRewardRsp", [2314118791] = "ChapterWeaponLatestPlayerInfoReq", [2314120624] = "ChapterWeaponLatestPlayerInfoRsp", + [2369545247] = "ActivityPVPRankReq", + [2369547080] = "ActivityPVPRankRsp", [2420360424] = "FourteenDayInfoReq", [2420362257] = "FourteenDayInfoRsp", [2429586383] = "MailCycleReq", [2429588216] = "MailCycleRsp", + [2452882757] = "ChapterRuneFarmReq", + [2452884590] = "ChapterRuneFarmRsp", [2467213182] = "ChapterWeaponChallengeFarmReq", [2467215015] = "ChapterWeaponChallengeFarmRsp", [2494225153] = "PVPSettlementADRewardReq", @@ -129,6 +150,8 @@ local ProtoMsgType = { [2524881546] = "PVPRecordHistoryRsp", [2553351971] = "ChapterDailyChallengeStartReq", [2553353804] = "ChapterDailyChallengeStartRsp", + [2566705464] = "ChapterRuneChallengeFarmReq", + [2566707297] = "ChapterRuneChallengeFarmRsp", [2581180989] = "MailListReq", [2581182822] = "MailListRsp", [2620369240] = "SevenDayRewardReq", @@ -138,6 +161,8 @@ local ProtoMsgType = { [2706989220] = "TriggerGrowUpGift2Ntf", [2708281176] = "PVPChallengeSettlementReq", [2708283009] = "PVPChallengeSettlementRsp", + [2723654496] = "ActivityPVPBeginReq", + [2723656329] = "ActivityPVPBeginRsp", [2731281392] = "MailExtractReq", [2731283225] = "MailExtractRsp", [2849800229] = "MailReadReq", @@ -175,13 +200,19 @@ local ProtoMsgType = { [3197501935] = "ArenaBountyBoughtNtf", [3209780877] = "BossRushRankReq", [3209782710] = "BossRushRankRsp", + [3222113774] = "ActivityPVPOverCDReq", + [3222115607] = "ActivityPVPOverCDRsp", [3224230499] = "SevenDayTaskRewardReq", [3224232332] = "SevenDayTaskRewardRsp", [3274332802] = "BossRushBountyUnlockReq", [3274334635] = "BossRushBountyUnlockRsp", + [3289898743] = "ChapterRuneRankReq", + [3289900576] = "ChapterRuneRankRsp", [3309820798] = "HeroPutOnReq", [3309822631] = "HeroPutOnRsp", [3341173994] = "BountyBoughtNtf", + [3353409448] = "ChapterRuneRankRewardReq", + [3353411281] = "ChapterRuneRankRewardRsp", [3359969683] = "ChapterGoldChallengeSettlementReq", [3359971516] = "ChapterGoldChallengeSettlementRsp", [3363939655] = "TaskDailyAdReq", @@ -203,7 +234,11 @@ local ProtoMsgType = { [3607881087] = "AuthRsp", [3613497485] = "ArenaBountyRewardReq", [3613499318] = "ArenaBountyRewardRsp", + [3623429051] = "ActivityPVPBountyClaimByDiamondReq", + [3623430884] = "ActivityPVPBountyClaimByDiamondRsp", [3624439233] = "NewMailNtf", + [3629726454] = "ActivityPVPSettlementReq", + [3629728287] = "ActivityPVPSettlementRsp", [3629950931] = "PVPStageRewardReq", [3629952764] = "PVPStageRewardRsp", [3663247602] = "MallDailyResetNtf", @@ -215,10 +250,16 @@ local ProtoMsgType = { [3739568306] = "SummerDataRsp", [3741702491] = "MallDailyOverDayReq", [3741704324] = "MallDailyOverDayRsp", + [3742313244] = "ChapterRunePlayerInfoReq", + [3742315077] = "ChapterRunePlayerInfoRsp", [3757169544] = "BountyRewardReq", [3757171377] = "BountyRewardRsp", + [3762291611] = "ActivityPVPStartReq", + [3762293444] = "ActivityPVPStartRsp", [3763117270] = "HeartbeatReq", [3763119103] = "HeartbeatRsp", + [3787719122] = "ChapterRuneChallengeHeroesReq", + [3787720955] = "ChapterRuneChallengeHeroesRsp", [3805364358] = "EquipUpgradeReq", [3805366191] = "EquipUpgradeRsp", [3851969243] = "HeroChangeSkinReq", @@ -227,6 +268,12 @@ local ProtoMsgType = { [3904150593] = "GMRsp", [3933875617] = "ChapterStartReq", [3933877450] = "ChapterStartRsp", + [4010728288] = "ChapterRuneBuySliverReq", + [4010730121] = "ChapterRuneBuySliverRsp", + [4015942008] = "RuneQuenchingReq", + [4015943841] = "RuneQuenchingRsp", + [4027379273] = "ActivityPVPFlushHeroesReq", + [4027381106] = "ActivityPVPFlushHeroesRsp", [4099982754] = "BossRushExchangeReq", [4099984587] = "BossRushExchangeRsp", [4106156009] = "BountyLevelUnlockReq", @@ -264,6 +311,8 @@ local ProtoMsgType = { ChangeAvatarRsp = 295350214, IdleQuickReq = 317272657, IdleQuickRsp = 317274490, + ActivityPVPDataReq = 326310937, + ActivityPVPDataRsp = 326312770, ChapterWeaponChallengeSettlementReq = 335671647, ChapterWeaponChallengeSettlementRsp = 335673480, TriggerGrowUpGiftNtf = 349009610, @@ -286,6 +335,8 @@ local ProtoMsgType = { FourteenBountyTaskAwardRsp = 697002542, BuyMallIdleReq = 737107384, BuyMallIdleRsp = 737109217, + RuneLockReq = 761068365, + RuneLockRsp = 761070198, MatchReq = 822916593, MatchRsp = 822918426, ChapterGoldChallengeStartReq = 834139466, @@ -304,6 +355,10 @@ local ProtoMsgType = { ReconnectRsp = 1068771132, LoginReq = 1070841461, LoginRsp = 1070843294, + ChapterRuneAdReq = 1163725920, + ChapterRuneAdRsp = 1163727753, + ActivityPVPMatchReq = 1283733956, + ActivityPVPMatchRsp = 1283735789, BossRushTopReq = 1312685858, BossRushTopRsp = 1312687691, FourteenBountyExchangeAwardReq = 1326064687, @@ -340,6 +395,8 @@ local ProtoMsgType = { IdleInfoRsp = 1746319121, PVPHeroesArrayReq = 1751460231, PVPHeroesArrayRsp = 1751462064, + ChapterRuneChallengeStartReq = 1800420732, + ChapterRuneChallengeStartRsp = 1800422565, PipedReq = 1901321540, BossRushSettlementReq = 2017336372, BossRushSettlementRsp = 2017338205, @@ -347,21 +404,32 @@ local ProtoMsgType = { ChangeAvatarFrameRsp = 2060509863, ChangeNameReq = 2095612947, ChangeNameRsp = 2095614780, + RuneUpdateNtf = 2103189773, CDKeyUseReq = 2105154645, CDKeyUseRsp = 2105156478, HeroUpgradeReq = 2118851896, HeroUpgradeRsp = 2118853729, + ActivityPVPDecideHeroReq = 2140118069, + ActivityPVPDecideHeroRsp = 2140119902, BossRushStartReq = 2164009445, BossRushStartRsp = 2164011278, BossRushBoughtNtf = 2198847028, + ChapterRuneChallengeSettlementReq = 2224825865, + ChapterRuneChallengeSettlementRsp = 2224827698, + ActivityPVPBountyClaimReq = 2247710148, + ActivityPVPBountyClaimRsp = 2247711981, ChapterBoxRewardReq = 2285872137, ChapterBoxRewardRsp = 2285873970, ChapterWeaponLatestPlayerInfoReq = 2314118791, ChapterWeaponLatestPlayerInfoRsp = 2314120624, + ActivityPVPRankReq = 2369545247, + ActivityPVPRankRsp = 2369547080, FourteenDayInfoReq = 2420360424, FourteenDayInfoRsp = 2420362257, MailCycleReq = 2429586383, MailCycleRsp = 2429588216, + ChapterRuneFarmReq = 2452882757, + ChapterRuneFarmRsp = 2452884590, ChapterWeaponChallengeFarmReq = 2467213182, ChapterWeaponChallengeFarmRsp = 2467215015, PVPSettlementADRewardReq = 2494225153, @@ -376,6 +444,8 @@ local ProtoMsgType = { PVPRecordHistoryRsp = 2524881546, ChapterDailyChallengeStartReq = 2553351971, ChapterDailyChallengeStartRsp = 2553353804, + ChapterRuneChallengeFarmReq = 2566705464, + ChapterRuneChallengeFarmRsp = 2566707297, MailListReq = 2581180989, MailListRsp = 2581182822, SevenDayRewardReq = 2620369240, @@ -385,6 +455,8 @@ local ProtoMsgType = { TriggerGrowUpGift2Ntf = 2706989220, PVPChallengeSettlementReq = 2708281176, PVPChallengeSettlementRsp = 2708283009, + ActivityPVPBeginReq = 2723654496, + ActivityPVPBeginRsp = 2723656329, MailExtractReq = 2731281392, MailExtractRsp = 2731283225, MailReadReq = 2849800229, @@ -422,13 +494,19 @@ local ProtoMsgType = { ArenaBountyBoughtNtf = 3197501935, BossRushRankReq = 3209780877, BossRushRankRsp = 3209782710, + ActivityPVPOverCDReq = 3222113774, + ActivityPVPOverCDRsp = 3222115607, SevenDayTaskRewardReq = 3224230499, SevenDayTaskRewardRsp = 3224232332, BossRushBountyUnlockReq = 3274332802, BossRushBountyUnlockRsp = 3274334635, + ChapterRuneRankReq = 3289898743, + ChapterRuneRankRsp = 3289900576, HeroPutOnReq = 3309820798, HeroPutOnRsp = 3309822631, BountyBoughtNtf = 3341173994, + ChapterRuneRankRewardReq = 3353409448, + ChapterRuneRankRewardRsp = 3353411281, ChapterGoldChallengeSettlementReq = 3359969683, ChapterGoldChallengeSettlementRsp = 3359971516, TaskDailyAdReq = 3363939655, @@ -450,7 +528,11 @@ local ProtoMsgType = { AuthRsp = 3607881087, ArenaBountyRewardReq = 3613497485, ArenaBountyRewardRsp = 3613499318, + ActivityPVPBountyClaimByDiamondReq = 3623429051, + ActivityPVPBountyClaimByDiamondRsp = 3623430884, NewMailNtf = 3624439233, + ActivityPVPSettlementReq = 3629726454, + ActivityPVPSettlementRsp = 3629728287, PVPStageRewardReq = 3629950931, PVPStageRewardRsp = 3629952764, MallDailyResetNtf = 3663247602, @@ -462,10 +544,16 @@ local ProtoMsgType = { SummerDataRsp = 3739568306, MallDailyOverDayReq = 3741702491, MallDailyOverDayRsp = 3741704324, + ChapterRunePlayerInfoReq = 3742313244, + ChapterRunePlayerInfoRsp = 3742315077, BountyRewardReq = 3757169544, BountyRewardRsp = 3757171377, + ActivityPVPStartReq = 3762291611, + ActivityPVPStartRsp = 3762293444, HeartbeatReq = 3763117270, HeartbeatRsp = 3763119103, + ChapterRuneChallengeHeroesReq = 3787719122, + ChapterRuneChallengeHeroesRsp = 3787720955, EquipUpgradeReq = 3805364358, EquipUpgradeRsp = 3805366191, HeroChangeSkinReq = 3851969243, @@ -474,6 +562,12 @@ local ProtoMsgType = { GMRsp = 3904150593, ChapterStartReq = 3933875617, ChapterStartRsp = 3933877450, + ChapterRuneBuySliverReq = 4010728288, + ChapterRuneBuySliverRsp = 4010730121, + RuneQuenchingReq = 4015942008, + RuneQuenchingRsp = 4015943841, + ActivityPVPFlushHeroesReq = 4027379273, + ActivityPVPFlushHeroesRsp = 4027381106, BossRushExchangeReq = 4099982754, BossRushExchangeRsp = 4099984587, BountyLevelUnlockReq = 4106156009, @@ -511,6 +605,8 @@ local ProtoMsgType = { ChangeAvatarRsp = "ChangeAvatarRsp", IdleQuickReq = "IdleQuickReq", IdleQuickRsp = "IdleQuickRsp", + ActivityPVPDataReq = "ActivityPVPDataReq", + ActivityPVPDataRsp = "ActivityPVPDataRsp", ChapterWeaponChallengeSettlementReq = "ChapterWeaponChallengeSettlementReq", ChapterWeaponChallengeSettlementRsp = "ChapterWeaponChallengeSettlementRsp", TriggerGrowUpGiftNtf = "TriggerGrowUpGiftNtf", @@ -533,6 +629,8 @@ local ProtoMsgType = { FourteenBountyTaskAwardRsp = "FourteenBountyTaskAwardRsp", BuyMallIdleReq = "BuyMallIdleReq", BuyMallIdleRsp = "BuyMallIdleRsp", + RuneLockReq = "RuneLockReq", + RuneLockRsp = "RuneLockRsp", MatchReq = "MatchReq", MatchRsp = "MatchRsp", ChapterGoldChallengeStartReq = "ChapterGoldChallengeStartReq", @@ -551,6 +649,10 @@ local ProtoMsgType = { ReconnectRsp = "ReconnectRsp", LoginReq = "LoginReq", LoginRsp = "LoginRsp", + ChapterRuneAdReq = "ChapterRuneAdReq", + ChapterRuneAdRsp = "ChapterRuneAdRsp", + ActivityPVPMatchReq = "ActivityPVPMatchReq", + ActivityPVPMatchRsp = "ActivityPVPMatchRsp", BossRushTopReq = "BossRushTopReq", BossRushTopRsp = "BossRushTopRsp", FourteenBountyExchangeAwardReq = "FourteenBountyExchangeAwardReq", @@ -587,6 +689,8 @@ local ProtoMsgType = { IdleInfoRsp = "IdleInfoRsp", PVPHeroesArrayReq = "PVPHeroesArrayReq", PVPHeroesArrayRsp = "PVPHeroesArrayRsp", + ChapterRuneChallengeStartReq = "ChapterRuneChallengeStartReq", + ChapterRuneChallengeStartRsp = "ChapterRuneChallengeStartRsp", PipedReq = "PipedReq", BossRushSettlementReq = "BossRushSettlementReq", BossRushSettlementRsp = "BossRushSettlementRsp", @@ -594,21 +698,32 @@ local ProtoMsgType = { ChangeAvatarFrameRsp = "ChangeAvatarFrameRsp", ChangeNameReq = "ChangeNameReq", ChangeNameRsp = "ChangeNameRsp", + RuneUpdateNtf = "RuneUpdateNtf", CDKeyUseReq = "CDKeyUseReq", CDKeyUseRsp = "CDKeyUseRsp", HeroUpgradeReq = "HeroUpgradeReq", HeroUpgradeRsp = "HeroUpgradeRsp", + ActivityPVPDecideHeroReq = "ActivityPVPDecideHeroReq", + ActivityPVPDecideHeroRsp = "ActivityPVPDecideHeroRsp", BossRushStartReq = "BossRushStartReq", BossRushStartRsp = "BossRushStartRsp", BossRushBoughtNtf = "BossRushBoughtNtf", + ChapterRuneChallengeSettlementReq = "ChapterRuneChallengeSettlementReq", + ChapterRuneChallengeSettlementRsp = "ChapterRuneChallengeSettlementRsp", + ActivityPVPBountyClaimReq = "ActivityPVPBountyClaimReq", + ActivityPVPBountyClaimRsp = "ActivityPVPBountyClaimRsp", ChapterBoxRewardReq = "ChapterBoxRewardReq", ChapterBoxRewardRsp = "ChapterBoxRewardRsp", ChapterWeaponLatestPlayerInfoReq = "ChapterWeaponLatestPlayerInfoReq", ChapterWeaponLatestPlayerInfoRsp = "ChapterWeaponLatestPlayerInfoRsp", + ActivityPVPRankReq = "ActivityPVPRankReq", + ActivityPVPRankRsp = "ActivityPVPRankRsp", FourteenDayInfoReq = "FourteenDayInfoReq", FourteenDayInfoRsp = "FourteenDayInfoRsp", MailCycleReq = "MailCycleReq", MailCycleRsp = "MailCycleRsp", + ChapterRuneFarmReq = "ChapterRuneFarmReq", + ChapterRuneFarmRsp = "ChapterRuneFarmRsp", ChapterWeaponChallengeFarmReq = "ChapterWeaponChallengeFarmReq", ChapterWeaponChallengeFarmRsp = "ChapterWeaponChallengeFarmRsp", PVPSettlementADRewardReq = "PVPSettlementADRewardReq", @@ -623,6 +738,8 @@ local ProtoMsgType = { PVPRecordHistoryRsp = "PVPRecordHistoryRsp", ChapterDailyChallengeStartReq = "ChapterDailyChallengeStartReq", ChapterDailyChallengeStartRsp = "ChapterDailyChallengeStartRsp", + ChapterRuneChallengeFarmReq = "ChapterRuneChallengeFarmReq", + ChapterRuneChallengeFarmRsp = "ChapterRuneChallengeFarmRsp", MailListReq = "MailListReq", MailListRsp = "MailListRsp", SevenDayRewardReq = "SevenDayRewardReq", @@ -632,6 +749,8 @@ local ProtoMsgType = { TriggerGrowUpGift2Ntf = "TriggerGrowUpGift2Ntf", PVPChallengeSettlementReq = "PVPChallengeSettlementReq", PVPChallengeSettlementRsp = "PVPChallengeSettlementRsp", + ActivityPVPBeginReq = "ActivityPVPBeginReq", + ActivityPVPBeginRsp = "ActivityPVPBeginRsp", MailExtractReq = "MailExtractReq", MailExtractRsp = "MailExtractRsp", MailReadReq = "MailReadReq", @@ -669,13 +788,19 @@ local ProtoMsgType = { ArenaBountyBoughtNtf = "ArenaBountyBoughtNtf", BossRushRankReq = "BossRushRankReq", BossRushRankRsp = "BossRushRankRsp", + ActivityPVPOverCDReq = "ActivityPVPOverCDReq", + ActivityPVPOverCDRsp = "ActivityPVPOverCDRsp", SevenDayTaskRewardReq = "SevenDayTaskRewardReq", SevenDayTaskRewardRsp = "SevenDayTaskRewardRsp", BossRushBountyUnlockReq = "BossRushBountyUnlockReq", BossRushBountyUnlockRsp = "BossRushBountyUnlockRsp", + ChapterRuneRankReq = "ChapterRuneRankReq", + ChapterRuneRankRsp = "ChapterRuneRankRsp", HeroPutOnReq = "HeroPutOnReq", HeroPutOnRsp = "HeroPutOnRsp", BountyBoughtNtf = "BountyBoughtNtf", + ChapterRuneRankRewardReq = "ChapterRuneRankRewardReq", + ChapterRuneRankRewardRsp = "ChapterRuneRankRewardRsp", ChapterGoldChallengeSettlementReq = "ChapterGoldChallengeSettlementReq", ChapterGoldChallengeSettlementRsp = "ChapterGoldChallengeSettlementRsp", TaskDailyAdReq = "TaskDailyAdReq", @@ -697,7 +822,11 @@ local ProtoMsgType = { AuthRsp = "AuthRsp", ArenaBountyRewardReq = "ArenaBountyRewardReq", ArenaBountyRewardRsp = "ArenaBountyRewardRsp", + ActivityPVPBountyClaimByDiamondReq = "ActivityPVPBountyClaimByDiamondReq", + ActivityPVPBountyClaimByDiamondRsp = "ActivityPVPBountyClaimByDiamondRsp", NewMailNtf = "NewMailNtf", + ActivityPVPSettlementReq = "ActivityPVPSettlementReq", + ActivityPVPSettlementRsp = "ActivityPVPSettlementRsp", PVPStageRewardReq = "PVPStageRewardReq", PVPStageRewardRsp = "PVPStageRewardRsp", MallDailyResetNtf = "MallDailyResetNtf", @@ -709,10 +838,16 @@ local ProtoMsgType = { SummerDataRsp = "SummerDataRsp", MallDailyOverDayReq = "MallDailyOverDayReq", MallDailyOverDayRsp = "MallDailyOverDayRsp", + ChapterRunePlayerInfoReq = "ChapterRunePlayerInfoReq", + ChapterRunePlayerInfoRsp = "ChapterRunePlayerInfoRsp", BountyRewardReq = "BountyRewardReq", BountyRewardRsp = "BountyRewardRsp", + ActivityPVPStartReq = "ActivityPVPStartReq", + ActivityPVPStartRsp = "ActivityPVPStartRsp", HeartbeatReq = "HeartbeatReq", HeartbeatRsp = "HeartbeatRsp", + ChapterRuneChallengeHeroesReq = "ChapterRuneChallengeHeroesReq", + ChapterRuneChallengeHeroesRsp = "ChapterRuneChallengeHeroesRsp", EquipUpgradeReq = "EquipUpgradeReq", EquipUpgradeRsp = "EquipUpgradeRsp", HeroChangeSkinReq = "HeroChangeSkinReq", @@ -721,6 +856,12 @@ local ProtoMsgType = { GMRsp = "GMRsp", ChapterStartReq = "ChapterStartReq", ChapterStartRsp = "ChapterStartRsp", + ChapterRuneBuySliverReq = "ChapterRuneBuySliverReq", + ChapterRuneBuySliverRsp = "ChapterRuneBuySliverRsp", + RuneQuenchingReq = "RuneQuenchingReq", + RuneQuenchingRsp = "RuneQuenchingRsp", + ActivityPVPFlushHeroesReq = "ActivityPVPFlushHeroesReq", + ActivityPVPFlushHeroesRsp = "ActivityPVPFlushHeroesRsp", BossRushExchangeReq = "BossRushExchangeReq", BossRushExchangeRsp = "BossRushExchangeRsp", BountyLevelUnlockReq = "BountyLevelUnlockReq", diff --git a/lua/app/ui/battle/battle_rune_result_ui.lua b/lua/app/ui/battle/battle_rune_result_ui.lua new file mode 100644 index 00000000..75cf622d --- /dev/null +++ b/lua/app/ui/battle/battle_rune_result_ui.lua @@ -0,0 +1,333 @@ +local BattleRuneResultUI = class("BattleRuneResultUI", BaseUI) + +local RUNE_TASK_CELL = "app/ui/dungeon_rune/cell/rune_task_cell" +local UNIT_RESULT_RERPORT_CELL = "app/ui/battle/cell/unit_result_report_cell" +local MAX_SCROLL_SHOW_COUNT = 10 + +function BattleRuneResultUI:getPrefabPath() + return "assets/prefabs/ui/battle/battle_rune_result_ui.prefab" +end + +function BattleRuneResultUI:ctor(params) + if EDITOR_MODE then + Logger.printTable(params) + end + -- 通用 + self.battleType = params.battleType + self.isWin = params.combatReport.victory + self.rewards = params.rewards + self.remainRound = params.remainRound + + -- pve特有 + self.atkReport = params.combatReport.atkReport + self.wave = params.wave + + self.totalDmg = 0 + if self.atkReport then + for _, info in ipairs(self.atkReport) do + self.totalDmg = self.totalDmg + info.dmg + end + end + + self.runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) + self.chapterId = ModuleManager.BattleManager.battleController.chapterId +end + +function BattleRuneResultUI:onClose() + if self.animNode then + self.animNode:Kill() + self.animNode = nil + end + if self.animRewards then + for idx, anim in pairs(self.animRewards) do + if anim then + anim:Kill() + end + end + end +end + +function BattleRuneResultUI:onLoadRootComplete() + local uiMap = self.root:genAllChildren() + + self.continue = uiMap["battle_rune_result_ui.continue"] + -- 胜利节点 + self.victoryNode = uiMap["battle_rune_result_ui.victory_node"] + self.victoryMask = uiMap["battle_rune_result_ui.victory_node.mask_v"] + self.victoryTxTitle = uiMap["battle_rune_result_ui.victory_node.title_bg.desc"] + self.victorySpine = uiMap["battle_rune_result_ui.victory_node.ui_spine_obj"] + self.victoryUnitNode = uiMap["battle_rune_result_ui.victory_node.unit_node"] + -- 失败节点 + self.defeatNode = uiMap["battle_rune_result_ui.defeat_node"] + self.defeatMask = uiMap["battle_rune_result_ui.defeat_node.mask_d"] + self.defeatTxTitle = uiMap["battle_rune_result_ui.defeat_node.title_bg.desc"] + self.defeatSpine = uiMap["battle_rune_result_ui.defeat_node.ui_spine_obj"] + self.defeatUnitNode = uiMap["battle_rune_result_ui.defeat_node.unit_node"] + -- 战斗信息 + self.unitNode = uiMap["battle_rune_result_ui.unit_node"] + self.unitImgBattleIcon = uiMap["battle_rune_result_ui.unit_node.icon"] + self.unitTxDesc1 = uiMap["battle_rune_result_ui.unit_node.desc_1"] + self.unitTxDesc2 = uiMap["battle_rune_result_ui.unit_node.desc_2"] + self.unitTxDesc3 = uiMap["battle_rune_result_ui.unit_node.desc_3"] + self.unitTxDesc3 = uiMap["battle_rune_result_ui.unit_node.desc_3"] + self.unitImgReportV = uiMap["battle_rune_result_ui.unit_node.report_img_v"] + self.unitImgReportD = uiMap["battle_rune_result_ui.unit_node.report_img_d"] + if not self.unitResultReportCells then + self.unitResultReportCells = {} + for index = 1, 5 do + self.unitResultReportCells[index] = CellManager:addCellComp(uiMap["battle_rune_result_ui.unit_node.unit_result_report_cell_" .. index], UNIT_RESULT_RERPORT_CELL) + end + end + -- 奖励节点 + self.rewardNode = uiMap["battle_rune_result_ui.reward_node"] + self.rewardTxTitle = uiMap["battle_rune_result_ui.reward_title"] + self.rewardScrollRect = uiMap["battle_rune_result_ui.reward_node.scroll_rect"] + self.rewardScrollRectComp = self.rewardScrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) + self.descRoundMin = uiMap["battle_rune_result_ui.reward_node.desc"] + self.imgRoundmIn = uiMap["battle_rune_result_ui.reward_node.icon"] + self.imgRoundNew = uiMap["battle_rune_result_ui.reward_node.icon_new"] + + -- 任务节点 + self.taskNode = uiMap["battle_rune_result_ui.task_node"] + self.runeTaskCells = {} + for index = 1, 3 do + self.runeTaskCells[index] = {} + self.runeTaskCells[index].cell = CellManager:addCellComp(uiMap["battle_rune_result_ui.task_node.rune_task_cell_" .. index], RUNE_TASK_CELL) + self.runeTaskCells[index].desc = uiMap["battle_rune_result_ui.task_node.desc_" .. index] + self.runeTaskCells[index].descUnDone = uiMap["battle_rune_result_ui.task_node.desc_undone_" .. index] + self.runeTaskCells[index].check = uiMap["battle_rune_result_ui.task_node.check_" .. index] + end + + self.victoryMask:addClickListener(function() + self:onClickMask() + end) + self.defeatMask:addClickListener(function() + self:onClickMask() + end) +end + +function BattleRuneResultUI:onClickMask() + if not self.isWin then + ModuleManager.BattleManager:endBattleAndExit() + else + if not self.showRewardInfo then + self.showRewardInfo = true + self:refreshRewards() + else + ModuleManager.BattleManager:endBattleAndExit() + end + end +end + +function BattleRuneResultUI:onRefresh() + if self.isWin then + self:refreshVictoryNode() + AudioManager:playEffect(AudioManager.EFFECT_ID.BATTLE_VICTORY) + else + self:refreshDefeatNode() + AudioManager:playEffect(AudioManager.EFFECT_ID.BATTLE_DEFEAT) + end + self:refreshUnitInfo() + + if self.runeData:isBossChapter(self.chapterId) then + self.showRewardInfo = true + self:refreshRewards() + else + self:refreshTaskNode() + end +end + +function BattleRuneResultUI:refreshVictoryNode() + self.victoryNode:setVisible(true) + self.unitImgReportV:setVisible(true) + self.defeatNode:setVisible(false) + self.unitImgReportD:setVisible(false) + + self.victorySpine:playAnimComplete("born", false, true, function() + self.victorySpine:playAnim("idle", true, true) + end) + + self:showNodeAnim(self.victoryUnitNode, self.unitNode) +end + +function BattleRuneResultUI:refreshDefeatNode() + self.victoryNode:setVisible(false) + self.unitImgReportV:setVisible(false) + self.defeatNode:setVisible(true) + self.unitImgReportD:setVisible(true) + + self.defeatTxTitle:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_6)) + self.defeatSpine:playAnimComplete("born", false, true, function() + self.defeatSpine:playAnim("idle", true, true) + end) + + self:showNodeAnim(self.defeatUnitNode, self.unitNode) +end + +-- 播放节点动画 +function BattleRuneResultUI:showNodeAnim(parent, node) + if not parent then + node:setVisible(false) + return + else + node:setVisible(true) + end + node:setParent(parent, false) + node:setAnchoredPosition(0, 0) + local canvasNode = parent:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP) + + self.animNode = self.root:createBindTweenSequence() + self.animNode:Insert(0, canvasNode:DOFade(0, 0)) + self.animNode:Insert(0.1, canvasNode:DOFade(1, 0)) + self.animNode:Insert(0, parent:getTransform():DOScale(0, 0)) + self.animNode:Insert(0.1, parent:getTransform():DOScale(0.35, 0)) + self.animNode:Insert(0.13, parent:getTransform():DOScale(1.1, 0.16)) + self.animNode:Insert(0.26, parent:getTransform():DOScale(1, 0.14)) + self.animNode:OnComplete(function() + self.animNode = nil + end) +end + +function BattleRuneResultUI:refreshTaskNode() + self.taskNode:setVisible(true) + self.rewardNode:setVisible(false) + + local id = self.chapterId + if not id then + return + end + + local chapterCondition = self.runeData:getChapterCondition(id) + if not chapterCondition then + return + end + + local taskProgress = ModuleManager.DungeonRuneManager:getTaskStatus(ModuleManager.BattleManager.battleController, chapterCondition) + + for index, objs in ipairs(self.runeTaskCells) do + local condition = chapterCondition[index + 1] + if condition then + objs.cell:getBaseObject():setActive(true) + local desc = self.runeData:getConditionDesc(condition) + local over = false + if taskProgress[condition[1]] then + local info = taskProgress[condition[1]] + over = info.over + local color = "#FF4949" + if over then + color = "#49FF49" + end + desc = desc .. string.format("(%s/%s)", color, info.progress, info.totalProgress) + end + objs.cell:refresh(condition) + objs.desc:setText(self.runeData:getConditionDesc(condition)) + if over then + objs.descUnDone:setText(GConst.EMPTY_STRING) + objs.check:setVisible(true) + else + objs.descUnDone:setText(GConst.UNFINISHED) + objs.check:setVisible(false) + end + else + objs.cell:getBaseObject():setActive(false) + objs.desc:setText(GConst.EMPTY_STRING) + objs.descUnDone:setText(GConst.EMPTY_STRING) + objs.check:setVisible(false) + end + end +end + +function BattleRuneResultUI:refreshRewards() + self.animRewards = {} + self.taskNode:setVisible(false) + self.rewardNode:setVisible(true) + + self.rewardTxTitle:setText(I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC)) + self.continue:setText(I18N:getGlobalText(I18N.GlobalConst.CONTINUE_DESC)) + self.rewardScrollRectComp:addInitCallback(function() + return GConst.TYPEOF_LUA_CLASS.REWARD_CELL + end) + self.rewardScrollRectComp:addRefreshCallback(function(index, cell) + cell:refresh(self.rewards[index]) + if index <= MAX_SCROLL_SHOW_COUNT and self.animRewards[index] == nil then + self.animRewards[index] = self:showRewardAppearAnim(index, cell) + end + end) + + self.rewardScrollRectComp:setFadeArgs(0.05, 0.3) + self.rewardScrollRectComp:clearCells() + local rewardCount = #self.rewards + if rewardCount > MAX_SCROLL_SHOW_COUNT then + local comp = self.rewardScrollRect:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_SCROLL_RECT) + comp.movementType = CS.UnityEngine.UI.ScrollRect.MovementType.Elastic + self.rewardScrollRectComp:setPerLineNum(5) + self.rewardScrollRect:setSizeDeltaX(560) + else + local comp = self.rewardScrollRect:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_SCROLL_RECT) + comp.movementType = CS.UnityEngine.UI.ScrollRect.MovementType.Clamped + if rewardCount >= 5 then + self.rewardScrollRectComp:setPerLineNum(5) + self.rewardScrollRect:setSizeDeltaX(560) + elseif rewardCount <= 0 then + self.rewardScrollRectComp:setPerLineNum(1) + self.rewardScrollRect:setSizeDeltaX(560) + else + self.rewardScrollRectComp:setPerLineNum(rewardCount) + self.rewardScrollRect:setSizeDeltaX(112*rewardCount) + end + end + self.rewardScrollRectComp:refillCells(rewardCount) + + local id = self.chapterId + self.descRoundMin:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_MIN, self.runeData:getChapterPassRound(id))) + GFunc.centerImgAndTx(self.imgRoundmIn, self.descRoundMin, 10) + self.imgRoundNew:setVisible(self.runeData:getTagRoundNew() == true) +end + +function BattleRuneResultUI:refreshUnitInfo() + if not self.atkReport then + self.unitNode:setVisible(false) + return + end + + self.unitNode:setVisible(true) + for index, cell in ipairs(self.unitResultReportCells) do + local info = self.atkReport[index] + cell:getBaseObject():setVisible(info ~= nil) + if info then + cell:refresh(info, self.totalDmg) + end + end + + self.unitTxDesc2:setText(self.wave) + self.unitTxDesc3:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_7, GFunc.num2Str(self.totalDmg))) + + local iconName = "common_dec_15" + local round = self.remainRound or 0 + self.unitTxDesc2:setText(round) + self.unitTxDesc1:setText(I18N:getGlobalText(I18N.GlobalConst.ROUND_LEFT)) + self.unitImgBattleIcon:setSprite(GConst.ATLAS_PATH.COMMON, iconName) + + GFunc.centerImgAndTx(self.unitImgBattleIcon, self.unitTxDesc2, 7) +end + +-- 展示结算奖励的出现动画 +function BattleRuneResultUI:showRewardAppearAnim(idx, cell) + local canvasGroup = cell.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP) + local selfObj = cell.baseObject + local delay = (idx - 1) * 0.05 + local scaleX = selfObj:fastGetLocalScale() + + local animRewardAppear = selfObj:createBindTweenSequence() + animRewardAppear:Insert(0, canvasGroup:DOFade(0, 0)) + animRewardAppear:Insert(0, selfObj:getTransform():DOScale(scaleX * 0.6, 0)) + animRewardAppear:Insert(0.3 + delay, selfObj:getTransform():DOScale(scaleX * 1.1, 0.1)) + animRewardAppear:Insert(0.3 + delay, canvasGroup:DOFade(1, 0.1)) + animRewardAppear:Insert(0.4 + delay, selfObj:getTransform():DOScale(scaleX * 1, 0.13)) + animRewardAppear:OnComplete(function() + animRewardAppear = nil + end) + return animRewardAppear +end + +return BattleRuneResultUI \ No newline at end of file diff --git a/lua/app/ui/battle/battle_rune_result_ui.lua.meta b/lua/app/ui/battle/battle_rune_result_ui.lua.meta new file mode 100644 index 00000000..e3676e64 --- /dev/null +++ b/lua/app/ui/battle/battle_rune_result_ui.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: b737376fab2a5a741891d32e7371e8ad +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 7a4e33b5..f4cd4d23 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -479,6 +479,17 @@ function BattleUI:refreshTaskBtn() taskBtn:addClickListener(function() ModuleManager.DungeonArmorManager:showBattleTaskUI() end) + elseif self.battleController.battleType == GConst.BattleConst.BATTLE_TYPE.DUNGEON_RUNE then + local runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) + if runeData:isBossChapter(self.battleController.chapterId) then + taskBtn:setActive(false) + else + taskBtn:setSprite(GConst.ATLAS_PATH.BATTLE, "battle_btn_task_3") + taskBtn:setActive(true) + taskBtn:addClickListener(function() + ModuleManager.DungeonRuneManager:showTaskUI(self.battleController.chapterId) + end) + end else taskBtn:setActive(false) end diff --git a/lua/app/ui/common/common_formation_ui.lua b/lua/app/ui/common/common_formation_ui.lua index 82e854c6..6a7d8b02 100644 --- a/lua/app/ui/common/common_formation_ui.lua +++ b/lua/app/ui/common/common_formation_ui.lua @@ -41,6 +41,8 @@ function CommonFormationUI:onLoadRootComplete() ModuleManager.DungeonArmorManager:reqFormation(formation) elseif self.formationType == GConst.BattleConst.FORMATION_TYPE.BOSS_RUSH then ModuleManager.ActBossRushManager:reqFormation(formation) + elseif self.formationType == GConst.BattleConst.FORMATION_TYPE.DUNGEON_RUNE then + ModuleManager.DungeonRuneManager:reqFormation(formation) else self:closeUI() end diff --git a/lua/app/ui/currency_bar/cell/currency_cell.lua b/lua/app/ui/currency_bar/cell/currency_cell.lua index 80d2d117..52fbf20a 100644 --- a/lua/app/ui/currency_bar/cell/currency_cell.lua +++ b/lua/app/ui/currency_bar/cell/currency_cell.lua @@ -54,7 +54,15 @@ function ResourceCell:show(itemId, hideAddImg) self.addImg:setVisible(true) elseif itemId == GConst.ItemConst.ITEM_ID_SLIVER_WING then self.baseObject:addClickListener(function() - -- ModuleManager.CommerceManager:showBuyArenaTicketUI() + local runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) + local reward = { + type = GConst.REWARD_TYPE.ITEM, + id = GConst.ItemConst.ITEM_ID_SLIVER_WING, + num = 1 + } + ModuleManager.CommonManager:showExchangeUI(1, runeData:getRemainSliverWingCount(), reward, runeData:getBuySliverCost(), function(count) + ModuleManager.DungeonRuneManager:reqBuySliverWing(count) + end) end) self.addImg:setVisible(true) else diff --git a/lua/app/ui/dungeon_rune/cell/rune_chapter_cell.lua b/lua/app/ui/dungeon_rune/cell/rune_chapter_cell.lua index e692539e..cfc794d8 100644 --- a/lua/app/ui/dungeon_rune/cell/rune_chapter_cell.lua +++ b/lua/app/ui/dungeon_rune/cell/rune_chapter_cell.lua @@ -32,6 +32,8 @@ function RuneChapterCell:refresh(id, index, isFinal, chapterListCount) local curBg = uiMap["chapter_cell.touch_node.bg_cur"] local lightImg = uiMap["chapter_cell.touch_node.img_light"] local sweep = uiMap["chapter_cell.touch_node.sweep_bg"] + local descMinRound = uiMap["chapter_cell.touch_node.bg.desc_min_round"] + descMinRound:setVisible(false) lightImg:setVisible(false) sweep:setVisible(false) local passed = false @@ -45,7 +47,6 @@ function RuneChapterCell:refresh(id, index, isFinal, chapterListCount) curBg:setVisible(false) fightBg:setVisible(true) - local descMinRound = uiMap["chapter_cell.touch_node.bg.desc_min_round"] local layer = uiMap["chapter_cell.touch_node.bg.desc"] layer:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_6, id)) local lock = uiMap["chapter_cell.touch_node.bg.lock"] @@ -60,6 +61,7 @@ function RuneChapterCell:refresh(id, index, isFinal, chapterListCount) layer:setAnchoredPositionX(0) lightImg:setVisible(true) descMinRound:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_MIN, runeData:getChapterPassRound(id))) + descMinRound:setVisible(true) else lock:setVisible(true) GFunc.centerImgAndTx(lock, layer, 5) diff --git a/lua/app/ui/dungeon_rune/dungeon_rune_main_ui.lua b/lua/app/ui/dungeon_rune/dungeon_rune_main_ui.lua index da988362..1ef256f2 100644 --- a/lua/app/ui/dungeon_rune/dungeon_rune_main_ui.lua +++ b/lua/app/ui/dungeon_rune/dungeon_rune_main_ui.lua @@ -48,10 +48,8 @@ end function DungeonRuneMainUI:_display() local uiMap = self.root:genAllChildren() uiMap["dungeon_rune_main_ui.banner.btn_formation.tx_ok"]:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_4)) - uiMap["dungeon_rune_main_ui.banner.btn_rank.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_BOSS_RUSH_DESC_10)) self:refreshScrollrect() self:refreshFormation() - self:refreshRankBtn() end function DungeonRuneMainUI:_addListeners() @@ -68,8 +66,7 @@ end function DungeonRuneMainUI:_bind() self:bind(self.runeData, "isDirty", function() self:refreshFormation() - -- self:refreshAllCells() - self:refreshRankBtn() + self:refreshAllCells() end) self:bind(DataManager.FormationData, "dirty", function() @@ -89,16 +86,6 @@ function DungeonRuneMainUI:refreshFormation() self.formationComp:refreshByFormation(DataManager.FormationData:getDungeonRuneFormation()) end -function DungeonRuneMainUI:refreshRankBtn() - local uiMap = self.root:genAllChildren() - local btn = uiMap["dungeon_rune_main_ui.banner.btn_rank"] - if self.runeData:getRankRp() then - btn:addRedPoint(30, 20, 0.8) - else - btn:removeRedPoint() - end -end - function DungeonRuneMainUI:refreshScrollrect() local uiMap = self.root:genAllChildren() if not self.scrollRect then diff --git a/lua/app/ui/dungeon_rune/dungeon_rune_rebirth_ui.lua b/lua/app/ui/dungeon_rune/dungeon_rune_rebirth_ui.lua index 4aa894f9..947dc208 100644 --- a/lua/app/ui/dungeon_rune/dungeon_rune_rebirth_ui.lua +++ b/lua/app/ui/dungeon_rune/dungeon_rune_rebirth_ui.lua @@ -52,7 +52,7 @@ function DungeonRuneRebirthUI:_addListeners() uiMap["dungeon_rune_rebirth_ui.title_bg_img.ok_btn"]:addClickListener(function() SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.DUNGEON_RUNE_REBIRTH, function() - ModuleManager.DungeonRuneManager:reqRebirth() + ModuleManager.DungeonRuneManager:reqRebirth(self.isHpOver) end) end) diff --git a/lua/app/ui/dungeon_rune/dungeon_rune_task_ui.lua b/lua/app/ui/dungeon_rune/dungeon_rune_task_ui.lua index e2977aa1..1ca3764e 100644 --- a/lua/app/ui/dungeon_rune/dungeon_rune_task_ui.lua +++ b/lua/app/ui/dungeon_rune/dungeon_rune_task_ui.lua @@ -32,13 +32,22 @@ function DungeonRuneTaskUI:_display() local chapterCondition = self.runeData:getChapterCondition(self.id) local count = 0 + local taskProgress = ModuleManager.DungeonRuneManager:getTaskStatus(ModuleManager.BattleManager.battleController, chapterCondition) for index, cell in ipairs(self.taskCells) do local condition = chapterCondition[index + 1] if condition then cell:getBaseObject():setActive(true) local desc = self.runeData:getConditionDesc(condition) local over = false - -- todo + if taskProgress[condition[1]] then + local info = taskProgress[condition[1]] + over = info.over + local color = "#FF4949" + if over then + color = "#49FF49" + end + desc = desc .. string.format("(%s/%s)", color, info.progress, info.totalProgress) + end cell:refresh(desc, condition, over) count = count + 1 else @@ -47,7 +56,7 @@ function DungeonRuneTaskUI:_display() end local y = 124 + 152 * count - uiMap:setSizeDeltaY(y) + uiMap["dungeon_rune_task_ui.bg"]:setSizeDeltaY(y) uiMap["dungeon_rune_task_ui.bg.title_desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.TASK_NAME)) end diff --git a/lua/app/ui/hero/hero_comp.lua b/lua/app/ui/hero/hero_comp.lua index ed3b4f52..f8c1d7b7 100644 --- a/lua/app/ui/hero/hero_comp.lua +++ b/lua/app/ui/hero/hero_comp.lua @@ -96,6 +96,8 @@ function HeroComp:refresh(battleType) self:refreshDungeonArmorFormation() elseif self.battleType == GConst.BattleConst.FORMATION_TYPE.BOSS_RUSH then self:refreshBossRushFormation() + elseif self.battleType == GConst.BattleConst.FORMATION_TYPE.DUNGEON_RUNE then + self:refreshDungeonRuneFormation() end end @@ -181,6 +183,19 @@ function HeroComp:refreshBossRushFormation() self:refreshScrollRect() end +function HeroComp:refreshDungeonRuneFormation() + self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_TITLE)) + self.rimgTopBG:setTexture("assets/arts/textures/background/hero/hero_bg_1.png") + self.curFormation = DataManager.FormationData:getDungeonRuneFormation() + + self.onClickUseFunc = function(id, type) + DataManager.FormationData:upHeroToFormation(self.battleType, type, id) + self:refreshDungeonRuneFormation() + end + + self:refreshScrollRect() +end + function HeroComp:refreshScrollRect() self.heroList = DataManager.HeroData:getAllHeroesSort(self.battleType) -- 每次都重新算一次 diff --git a/lua/app/userdata/battle/battle_base_data.lua b/lua/app/userdata/battle/battle_base_data.lua index 381b2fbc..c8e78492 100644 --- a/lua/app/userdata/battle/battle_base_data.lua +++ b/lua/app/userdata/battle/battle_base_data.lua @@ -864,6 +864,14 @@ function BattleBaseData:addMonster(monsterId, newTeam, battleController) if battleController then hp = hp * (DEFAULT_FACTOR + battleController:getMonsterHpAddition()) // DEFAULT_FACTOR atk = atk * (DEFAULT_FACTOR + battleController:getMonsterAtkAddition()) // DEFAULT_FACTOR + local atkFixed = battleController:getMonsterAtkFixed() + local hpFixed = battleController:getMonsterHpFixed() + if atkFixed > 0 then + atk = atkFixed // DEFAULT_FACTOR + end + if hpFixed > 0 then + hp = hpFixed // DEFAULT_FACTOR + end end local unitData = { id = monsterId, diff --git a/lua/app/userdata/battle/team/battle_team_entity.lua b/lua/app/userdata/battle/team/battle_team_entity.lua index 664c4448..67ba561a 100644 --- a/lua/app/userdata/battle/team/battle_team_entity.lua +++ b/lua/app/userdata/battle/team/battle_team_entity.lua @@ -12,6 +12,7 @@ local MATCH_WEAKNESS_NAME = BattleConst.MATCH_WEAKNESS_NAME local DEFAULT_FACTOR = BattleConst.DEFAULT_FACTOR local BUFF_NAME = BattleConst.BUFF_NAME local ATTR_NAME = BattleConst.ATTR_NAME +local PASSIVE_EVENT = BattleConst.PASSIVE_EVENT function BattleTeamEntity:ctor() self.members = {} @@ -367,7 +368,7 @@ function BattleTeamEntity:getCanRebirth() return self:getAttrValue(ATTR_NAME.REBIRTH) > 0 end -function BattleTeamEntity:takeDamageOrCure(num) +function BattleTeamEntity:takeDamageOrCure(num, unitComp) if self.isDead then return 0 end @@ -390,6 +391,7 @@ function BattleTeamEntity:takeDamageOrCure(num) if hp <= 0 then -- 死了 hurtEventNum = -hpBefore self:setAttrValue(ATTR_NAME.HP, 0) + unitComp:checkPassiveEvent(PASSIVE_EVENT.HP_LOWER_THAN, self, 0) self:die() elseif hp < maxhp then hurtEventNum = num diff --git a/lua/app/userdata/battle/team/battle_unit_entity.lua b/lua/app/userdata/battle/team/battle_unit_entity.lua index 24c8af4c..85c4e1c1 100644 --- a/lua/app/userdata/battle/team/battle_unit_entity.lua +++ b/lua/app/userdata/battle/team/battle_unit_entity.lua @@ -284,8 +284,8 @@ function BattleUnitEntity:addActiveSkillReleaseCount(num) self.activeSkillReleaseCount = self.activeSkillReleaseCount + num end -function BattleUnitEntity:takeDamageOrCure(num) - return self.team:takeDamageOrCure(num) +function BattleUnitEntity:takeDamageOrCure(num, unitComp) + return self.team:takeDamageOrCure(num, unitComp) end function BattleUnitEntity:getHp() diff --git a/lua/app/userdata/dungeon/dungeon_data.lua b/lua/app/userdata/dungeon/dungeon_data.lua index db6c8312..c68f58a7 100644 --- a/lua/app/userdata/dungeon/dungeon_data.lua +++ b/lua/app/userdata/dungeon/dungeon_data.lua @@ -90,6 +90,18 @@ function DungeonData:initDungeonWeapon(data) self:setDirty() end +-- 初始化符文副本数据 +function DungeonData:initDungeonRune(data) + if data == nil then + return + end + + self:initAllDataClass() + self.dataDungeons[ModuleManager.MODULE_KEY.RUNES_OPEN]:init(data) + self.data.rune = data + self:setDirty() +end + -- 初始化所有副本数据类 function DungeonData:initAllDataClass() diff --git a/lua/app/userdata/dungeon/dungeon_rune_entity.lua b/lua/app/userdata/dungeon/dungeon_rune_entity.lua index 0030a7b7..8fd67a0a 100644 --- a/lua/app/userdata/dungeon/dungeon_rune_entity.lua +++ b/lua/app/userdata/dungeon/dungeon_rune_entity.lua @@ -6,9 +6,7 @@ local TASK_TYPE = GConst.DungeonRuneConst.TASK_TYPE function DungeonRuneEntity:ctor() self.data.isDirty = false self.maxPassedId = 0 - self.curday = 1 self.runeInfo = {} - self.season = 1 end function DungeonRuneEntity:clear() @@ -22,29 +20,16 @@ function DungeonRuneEntity:init(data) Logger.printTable(data) end - self.totalChallengeCount = data.total_challenge_count - self.maxPassedId = data.max_challenge_id or 0 - self.curday = data.curday - self.runeInfo = data.rune_info or {} + self.totalChallengeCount = data.total_challenge_count or 0 + self.fightCountMap = data.stat_counts or {} + self.maxPassedId = data.max_challenge_id and (data.max_challenge_id - 1) or 0 + self.runeInfo = data.turns or {} self.heroes = data.heroes or {} - self.rankInfo = {} - self.selfRankInfo = {} - self.lastRankInfo = {} - self.needGetRankReward = false + self.buySilverCount = data.buy_silver_count or 0 DataManager.FormationData:initFormationByType(GConst.BattleConst.FORMATION_TYPE.DUNGEON_RUNE, self.heroes) - DataManager:registerCrossDayFunc("DungeonRuneEntity", function() - self.curday = self.curday + 1 - if self.curday > 30 then - self.maxPassedId = 0 - self.curday = 1 - self.runeInfo = {} - self.rankInfo = {} - self.selfRankInfo = {} - self.lastRankInfo = {} - self.needGetRankReward = false - end + self.buySilverCount = 0 self:setDirty() end) end @@ -93,9 +78,9 @@ function DungeonRuneEntity:isNotShowLimitCount() return true end --- function DungeonRuneEntity:getIsAllTimeOpen() --- return true --- end +function DungeonRuneEntity:getIsAllTimeOpen() + return true +end function DungeonRuneEntity:onClickFight() ModuleManager.DungeonRuneManager:showMainUI() @@ -123,14 +108,13 @@ function DungeonRuneEntity:updatePassedMaxId(maxId) self.maxPassedId = maxId end -function DungeonRuneEntity:getRankRp() - return true -end - function DungeonRuneEntity:canSweep(id) if id > self.maxPassedId then return false end + if not self:isBossChapter(id) then + return false + end return DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_SLIVER_WING) > 0 end @@ -153,7 +137,23 @@ function DungeonRuneEntity:getChapterPassRound(id) if not self.runeInfo[id] then return 0 end - return self.runeInfo[id].round or 0 + return self.runeInfo[id] or 0 +end + +function DungeonRuneEntity:updatePassRound(id, round) + local cur = self.runeInfo[id] + if not cur or cur > round then + self.runeInfo[id] = round + self:tagRoundNew() + end +end + +function DungeonRuneEntity:tagRoundNew() + self.tagNew = true +end + +function DungeonRuneEntity:getTagRoundNew() + return self.tagNew end function DungeonRuneEntity:getChapterRewards(id) @@ -164,10 +164,6 @@ function DungeonRuneEntity:getChapterSweepRewards(id) return self:getConfig(id).sweep_reward end -function DungeonRuneEntity:getCloseTime() - return 100 -end - function DungeonRuneEntity:isBossChapter(id) local cfg = self:getConfig(id) return not cfg.monster[2] -- 只有一个怪物的就是boss关卡 @@ -214,9 +210,9 @@ function DungeonRuneEntity:getConditionDesc(taskInfo) local desc = ModuleManager.HeroManager:getMatchTypeName(taskParams1, true) return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_QUEST_2, taskParams2, desc) elseif taskType == TASK_TYPE.BREAK_GRID_TYPE then - return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_QUEST_1, taskParams2) + return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_QUEST_3, taskParams2) elseif taskType == TASK_TYPE.KILL_MONSTER then - return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_QUEST_1, taskParams2) + return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_QUEST_4, taskParams2) end end @@ -235,80 +231,43 @@ function DungeonRuneEntity:getChapterMonsterI18N(id) return I18N:getConfig("monster_base")[monsterBase] end -function DungeonRuneEntity:canGetRankReward() - return true +function DungeonRuneEntity:getCurFightChapterId() + return self.curFightChapterId or 1 end -function DungeonBaseEntity:isGotRankReward() - return false +function DungeonRuneEntity:setCurFightChapterId(chapterId) + self.curFightChapterId = chapterId end -function DungeonRuneEntity:getLastRankInfo() - return self.lastRankList +function DungeonRuneEntity:getChapterFightCount(id) + return self.fightCountMap[id] or 0 end -function DungeonRuneEntity:getCurRankInfo() - return self.rankList +function DungeonRuneEntity:getSliverWingBuyCount() + return self.buySilverCount or 0 end -function DungeonRuneEntity:getLastSelfInfo() - return self.lastSelfRank +function DungeonRuneEntity:addSliverWingBuyCount(count) + self.buySilverCount = self.buySilverCount + count end -function DungeonRuneEntity:getCurRankSelfInfo() - return self.selfRank +function DungeonRuneEntity:getRemainSliverWingCount() + if not self.todayLimitSliverCount then + self.todayLimitSliverCount = GFunc.getConstIntValue("dungeon_rune_buylimit") + end + local count = self.todayLimitSliverCount - self:getSliverWingBuyCount() + if count <= 0 then + count = 0 + end + return count end -function DungeonRuneEntity:getRankConfig() - return ConfigManager:getConfig("dungeon_rune_rank") -end - -function DungeonRuneEntity:getRankRewards(rank) - if not rank or rank <= 0 then -- 没参加就没有 - return - end - if not self.cacheRankRewardsMap then -- 缓存名次对应的配置表ID - self.cacheRankRewardsMap = {} - end - if not self.cacheSeasonRankConfig then - self.cacheSeasonRankConfig = {} - local cfg = self:getRankConfig() - for id, info in pairs(cfg) do - if not self.cacheSeasonRankConfig[info.season] then - self.cacheSeasonRankConfig[info.season] = {} - end - table.insert(self.cacheSeasonRankConfig[info.season], id) - end - end - local cfg = self.cacheSeasonRankConfig[self.season] - if not cfg then - return +function DungeonRuneEntity:getBuySliverCost() + if not self.todayBuySliverCost then + self.todayBuySliverCost = GFunc.getConstReward("dungeon_rune_cost") end - if not self.cacheRankRewardsMap[self.season] then - self.cacheRankRewardsMap[self.season] = {} - end - - if not self.cacheRankRewardsMap[self.season][rank] then - local cfgCfg = self:getRankConfig() - for index, id in ipairs(cfg) do - local info = cfgCfg[id] - if info.ranking[1] and info.ranking[2] then - if info.ranking[1] <= rank and rank <= info.ranking[2] then - self.cacheRankRewardsMap[self.season][rank] = id - end - elseif info.ranking[1] then - if info.ranking[1] <= rank then - self.cacheRankRewardsMap[self.season][rank] = id - end - end - end - end - - local cfg = self:getRankConfig()[self.cacheRankRewardsMap[self.season][rank]] - if cfg then - return cfg.reward - end + return self.todayBuySliverCost end return DungeonRuneEntity \ No newline at end of file