From c0a3356cfda4272650e2be6ad46d01698ab18ff3 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Thu, 7 Sep 2023 19:14:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=A6=E6=96=87=E5=89=AF=E6=9C=AC=E4=B8=BB?= =?UTF-8?q?=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 1 + lua/app/common/module_manager.lua | 3 + lua/app/global/global_const.lua | 1 + lua/app/module/battle/battle_const.lua | 2 + lua/app/module/battle/battle_manager.lua | 1 + .../battle_controller_dungeon_rune.lua | 108 +++++++++++++ .../battle_controller_dungeon_rune.lua.meta | 10 ++ lua/app/module/dungeon_rune.meta | 8 + .../dungeon_rune/dungeon_rune_manager.lua | 14 ++ .../dungeon_rune_manager.lua.meta | 10 ++ lua/app/module/item/item_const.lua | 2 + .../ui/currency_bar/cell/currency_cell.lua | 5 + lua/app/ui/dungeon/dungeon_board_cell.lua | 9 +- lua/app/ui/dungeon_rune.meta | 8 + lua/app/ui/dungeon_rune/cell.meta | 8 + .../dungeon_rune/cell/rune_chapter_cell.lua | 89 +++++++++++ .../cell/rune_chapter_cell.lua.meta | 10 ++ .../ui/dungeon_rune/cell/rune_task_cell.lua | 0 .../dungeon_rune/cell/rune_task_cell.lua.meta | 10 ++ .../ui/dungeon_rune/dungeon_rune_main_ui.lua | 143 +++++++++++++++++ .../dungeon_rune_main_ui.lua.meta | 10 ++ .../userdata/dungeon/dungeon_armor_entity.lua | 2 +- lua/app/userdata/dungeon/dungeon_data.lua | 2 + .../userdata/dungeon/dungeon_rune_entity.lua | 151 ++++++++++++++++++ .../dungeon/dungeon_rune_entity.lua.meta | 10 ++ .../dungeon/dungeon_weapon_entity.lua | 2 +- lua/app/userdata/formation/formation_data.lua | 9 ++ 27 files changed, 624 insertions(+), 4 deletions(-) create mode 100644 lua/app/module/battle/controller/battle_controller_dungeon_rune.lua create mode 100644 lua/app/module/battle/controller/battle_controller_dungeon_rune.lua.meta create mode 100644 lua/app/module/dungeon_rune.meta create mode 100644 lua/app/module/dungeon_rune/dungeon_rune_manager.lua create mode 100644 lua/app/module/dungeon_rune/dungeon_rune_manager.lua.meta create mode 100644 lua/app/ui/dungeon_rune.meta create mode 100644 lua/app/ui/dungeon_rune/cell.meta create mode 100644 lua/app/ui/dungeon_rune/cell/rune_chapter_cell.lua create mode 100644 lua/app/ui/dungeon_rune/cell/rune_chapter_cell.lua.meta create mode 100644 lua/app/ui/dungeon_rune/cell/rune_task_cell.lua create mode 100644 lua/app/ui/dungeon_rune/cell/rune_task_cell.lua.meta create mode 100644 lua/app/ui/dungeon_rune/dungeon_rune_main_ui.lua create mode 100644 lua/app/ui/dungeon_rune/dungeon_rune_main_ui.lua.meta create mode 100644 lua/app/userdata/dungeon/dungeon_rune_entity.lua create mode 100644 lua/app/userdata/dungeon/dungeon_rune_entity.lua.meta diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index 3a6117fe..e596d8a2 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -199,6 +199,7 @@ BIReport.BATTLE_TYPE = { ["6"] = "DungeonWeapon", ["7"] = "DungeonArmor", ["8"] = "ActBossRush", + ["9"] = "DungeonRune", } BIReport.GIFT_TYPE = { diff --git a/lua/app/common/module_manager.lua b/lua/app/common/module_manager.lua index d2dcadbb..684868be 100644 --- a/lua/app/common/module_manager.lua +++ b/lua/app/common/module_manager.lua @@ -75,6 +75,8 @@ local MODULE_PATHS = { ActBossRushManager = "app/module/activity/act_boss_rush/act_boss_rush_manager", -- 新手14天乐 FourteenDayManager = "app/module/activity/fourteen_day/fourteen_day_manager", + -- 符文副本 + DungeonRuneManager = "app/module/dungeon_rune/dungeon_rune_manager", } -- 这里的key对应func_open里的id @@ -106,6 +108,7 @@ ModuleManager.MODULE_KEY = { EQUIP_WEAPON = "equip_weapon_open", -- 武器 EQUIP_ARMOR = "equip_armor_open", -- 防具 SKIN = "skin_open", -- 皮肤 + RUNES_OPEN = "runes_open", -- 符文 } local _moduleMgrs = {} diff --git a/lua/app/global/global_const.lua b/lua/app/global/global_const.lua index 36ebca08..f646aa3f 100644 --- a/lua/app/global/global_const.lua +++ b/lua/app/global/global_const.lua @@ -230,6 +230,7 @@ GConst.ATLAS_PATH = { ACT_HEROFUND = "assets/arts/atlas/ui/act_herofund.asset", ACT_BOSS_RUSH = "assets/arts/atlas/ui/act_bossrush.asset", ACT_COMMON = "assets/arts/atlas/ui/act_common.asset", + UI_DUNGEON_RUNE = "assets/arts/atlas/ui/dungeon_rune.asset", } GConst.TOUCH_EVENT = { diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index 3bdf538e..3ce09bb7 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -89,6 +89,7 @@ BattleConst.BATTLE_TYPE = { DUNGEON_WEAPON = "6", DUNGEON_ARMOR = "7", ACT_BOSS_RUSH = "8", + DUNGEON_RUNE = "9", } BattleConst.IS_PVP_BATTLE = { @@ -103,6 +104,7 @@ BattleConst.FORMATION_TYPE = { DUNGEON_WEAPON = "4", -- 武器副本 DUNGEON_ARMOR = "5", -- 支线副本 BOSS_RUSH = "6", -- boss rush + DUNGEON_RUNE = "7", -- 符文副本 } BattleConst.TYPEOF_LUA_COMP = { diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index 319571fe..2288dc30 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -15,6 +15,7 @@ local BATTLE_CONTROLLER = { [BattleConst.BATTLE_TYPE.DUNGEON_WEAPON] = "app/module/battle/controller/battle_controller_dungeon_weapon", [BattleConst.BATTLE_TYPE.DUNGEON_ARMOR] = "app/module/battle/controller/battle_controller_dungeon_armor", [BattleConst.BATTLE_TYPE.ACT_BOSS_RUSH] = "app/module/battle/controller/battle_controller_boss_rush", + [BattleConst.BATTLE_TYPE.DUNGEON_RUNE] = "app/module/battle/controller/battle_controller_dungeon_rune", } function BattleManager:showPauseUI(battleType, battleController) diff --git a/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua b/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua new file mode 100644 index 00000000..0528c560 --- /dev/null +++ b/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua @@ -0,0 +1,108 @@ +local BattleController = require "app/module/battle/controller/battle_controller" +local BattleControllerDungeonRune = class("BattleControllerDungeonRune", BattleController) +local BattleConst = GConst.BattleConst +local SIDE_ATK = BattleConst.SIDE_ATK +local SIDE_DEF = BattleConst.SIDE_DEF + +function BattleControllerDungeonRune:getBoardConfig() + return ConfigManager:getConfig("chapter_board_dungeon_rune") +end + +function BattleControllerDungeonRune:getChapterConfig() + return ConfigManager:getConfig("chapter_dungeon_rune") +end + +function BattleControllerDungeonRune:getChapterId() + local runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) + return runeData:getCurFightChapterId() +end + +function BattleControllerDungeonRune:onLoadComplete(...) + -- 处理技能 + local unlockAllSkill = function(side) + local skillPool = self.battleData:getSkillPool(side) + if skillPool then + for elementType, list in pairs(skillPool) do -- 先遍历一下未解锁的技能 + if not self.battleData:isUnlockedSkillElementType(elementType, side) then + local skillEntity = self.battleData:getSkillEntityByElement(elementType, side) + if skillEntity then + local skillId = skillEntity:getUnlockId() + if skillId then + self:dealSelectSkill(skillId, nil, side) + end + end + for _, skillId in ipairs(list) do + self:dealSelectSkill(skillId, nil, side) + end + end + end + self.battleUI:refreshSkill(nil, nil, side) + end + end + unlockAllSkill(SIDE_ATK) + unlockAllSkill(SIDE_DEF) + + BattleController.onLoadComplete(self, ...) +end + +function BattleControllerDungeonRune:controllBattleEnd() + self.combatReport = { + battleType = GConst.BattleConst.BATTLE_TYPE.DUNGEON_RUNE, + wave = self:getWaveIndex(), + victory = self.victory, + } + local atkReport = {} + local teamEntity = self.battleData:getAtkTeam() + local members = teamEntity:getAllMembers() + for k, v in pairs(members) do + local report = { + heroId = v:getId(), + dmg = v:getDamageCount(), + } + table.insert(atkReport, report) + end + self.combatReport.atkReport = atkReport + if not self.victory then + self.combatReport.wave = self.combatReport.wave - 1 + end + ModuleManager.DungeonArmorManager:reqEndChallenge(self.chapterId, self.combatReport, self.taskProgress) +end + +function BattleControllerDungeonRune:postWaveOver(atkDead, isQuit) + local deathType = BIReport.FIGHT_DEATH_TYPE.SURVIVE + local waveEndType = BIReport.FIGHT_WAVE_END_TYPE.WIN + if atkDead then + if self.isBossWave then + deathType = BIReport.FIGHT_DEATH_TYPE.BOSS_FAIL + else + deathType = BIReport.FIGHT_DEATH_TYPE.NORMAL_FAIL + end + waveEndType = BIReport.FIGHT_WAVE_END_TYPE.FAIL + end + + if isQuit then + waveEndType = BIReport.FIGHT_WAVE_END_TYPE.QUIT + end + + local duration = self.waveDurationTime + local totalTime = self.totalDurationTime + local runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) + local startTimes = runeData:getChapterFightCount(self.chapterId) + local isFirstWin = false + if runeData:getPassedMaxId() < self.chapterId and self.victory then + isFirstWin = true + end + + local isFianlStep = self:getWaveIndex() >= self.maxWaveIndex + + BIReport:postFightEnd(GConst.BattleConst.BATTLE_TYPE.DUNGEON_RUNE, self.battleData, self.chapterId, self:getWaveIndex(), duration, totalTime, self.eliminateCount, self.eliminateTotalCount, waveEndType, deathType, startTimes, isFirstWin, isFianlStep, self.maxLinkCount) +end + +function BattleControllerDungeonRune:postFightStart() + local runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) + local startTimes = runeData:getChapterFightCount(self.chapterId) + local unlockMaxChapter = runeData:getPassedMaxId() + 1 + BIReport:postFightBegin(GConst.BattleConst.BATTLE_TYPE.DUNGEON_RUNE, self:getWaveIndex(), self.chapterId, unlockMaxChapter, startTimes) +end + +return BattleControllerDungeonRune \ No newline at end of file diff --git a/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua.meta b/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua.meta new file mode 100644 index 00000000..6c29cb7b --- /dev/null +++ b/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: aa826860d0ee7514cb97e9987cc81970 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/module/dungeon_rune.meta b/lua/app/module/dungeon_rune.meta new file mode 100644 index 00000000..91257a63 --- /dev/null +++ b/lua/app/module/dungeon_rune.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 653e48d52b890da40841ac8132ae8139 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/lua/app/module/dungeon_rune/dungeon_rune_manager.lua b/lua/app/module/dungeon_rune/dungeon_rune_manager.lua new file mode 100644 index 00000000..2e3f3bac --- /dev/null +++ b/lua/app/module/dungeon_rune/dungeon_rune_manager.lua @@ -0,0 +1,14 @@ +local DungeonRuneManager = class("DungeonRuneManager", BaseModule) + +function DungeonRuneManager:showMainUI() + UIManager:showUI("app/ui/dungeon_rune/dungeon_rune_main_ui") +end + +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)) + end +end + +return DungeonRuneManager \ No newline at end of file diff --git a/lua/app/module/dungeon_rune/dungeon_rune_manager.lua.meta b/lua/app/module/dungeon_rune/dungeon_rune_manager.lua.meta new file mode 100644 index 00000000..80c93687 --- /dev/null +++ b/lua/app/module/dungeon_rune/dungeon_rune_manager.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 76e45e325e924d2479fff20458daeea3 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/module/item/item_const.lua b/lua/app/module/item/item_const.lua index 560531a4..7a87a188 100644 --- a/lua/app/module/item/item_const.lua +++ b/lua/app/module/item/item_const.lua @@ -17,6 +17,8 @@ ItemConst.ITEM_ID_RANDOM_FRAGMENT = 19 ItemConst.ITEM_ID_ARENA_BOUNTY_EXP = 21 ItemConst.ITEM_ID_ARENA_TICKET = 22 ItemConst.ITEM_ID_FOURTEEN_DAY_EXCHANGE = 51 +ItemConst.ITEM_ID_GLOD_WING = 49 +ItemConst.ITEM_ID_SLIVER_WING = 50 ItemConst.ITEM_TYPE = { RES = 1, diff --git a/lua/app/ui/currency_bar/cell/currency_cell.lua b/lua/app/ui/currency_bar/cell/currency_cell.lua index 1edccdd7..80d2d117 100644 --- a/lua/app/ui/currency_bar/cell/currency_cell.lua +++ b/lua/app/ui/currency_bar/cell/currency_cell.lua @@ -52,6 +52,11 @@ function ResourceCell:show(itemId, hideAddImg) ModuleManager.CommerceManager:showBuyArenaTicketUI() end) self.addImg:setVisible(true) + elseif itemId == GConst.ItemConst.ITEM_ID_SLIVER_WING then + self.baseObject:addClickListener(function() + -- ModuleManager.CommerceManager:showBuyArenaTicketUI() + end) + self.addImg:setVisible(true) else self.baseObject:removeClickListener() self.addImg:setVisible(false) diff --git a/lua/app/ui/dungeon/dungeon_board_cell.lua b/lua/app/ui/dungeon/dungeon_board_cell.lua index a8b672e6..158ba427 100644 --- a/lua/app/ui/dungeon/dungeon_board_cell.lua +++ b/lua/app/ui/dungeon/dungeon_board_cell.lua @@ -1,5 +1,11 @@ local DungeonBoardCell = class("DungeonBoardCell", BaseCell) +local HIDE_REWARD_MODULE = { + [ModuleManager.MODULE_KEY.DUNGEON_WEAPON] = true, + [ModuleManager.MODULE_KEY.DUNGEON_ARMOR] = true, + [ModuleManager.MODULE_KEY.RUNES_OPEN] = true, +} + function DungeonBoardCell:init() self.uiMap = self:getUIMap() @@ -95,8 +101,7 @@ function DungeonBoardCell:refreshInfo() end function DungeonBoardCell:refreshRewards() - if self.moduleKey == ModuleManager.MODULE_KEY.DUNGEON_WEAPON or - self.moduleKey == ModuleManager.MODULE_KEY.DUNGEON_ARMOR then + if HIDE_REWARD_MODULE[self.moduleKey] then self.itemReward:getBaseObject():setActive(false) else self.itemReward:getBaseObject():setActive(true) diff --git a/lua/app/ui/dungeon_rune.meta b/lua/app/ui/dungeon_rune.meta new file mode 100644 index 00000000..1ee663b1 --- /dev/null +++ b/lua/app/ui/dungeon_rune.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2e72a01d8b6402048b886bf2c7cacf3d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/lua/app/ui/dungeon_rune/cell.meta b/lua/app/ui/dungeon_rune/cell.meta new file mode 100644 index 00000000..574520f1 --- /dev/null +++ b/lua/app/ui/dungeon_rune/cell.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e148733f22b59274a82b62d49cd69ef0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/lua/app/ui/dungeon_rune/cell/rune_chapter_cell.lua b/lua/app/ui/dungeon_rune/cell/rune_chapter_cell.lua new file mode 100644 index 00000000..e692539e --- /dev/null +++ b/lua/app/ui/dungeon_rune/cell/rune_chapter_cell.lua @@ -0,0 +1,89 @@ +local RuneChapterCell = class("RuneChapterCell", BaseCell) + +local BG = { + "assets/arts/textures/background/dungeon_rune/dungeon_equip_bg_3.png", + "assets/arts/textures/background/dungeon_rune/dungeon_equip_bg_2.png", + "assets/arts/textures/background/dungeon_rune/dungeon_equip_bg_5.png", +} + +function RuneChapterCell:refresh(id, index, isFinal, chapterListCount) + local uiMap = self:getUIMap() + local bg = uiMap["chapter_cell.bg"] + local touchNode = uiMap["chapter_cell.touch_node"] + if not isFinal then + local bgAsset = BG[2] + local isLeft = index % 2 ~= 0 + if isLeft then + bgAsset = BG[1] + touchNode:setAnchoredPositionX(-190) + else + touchNode:setAnchoredPositionX(190) + end + if chapterListCount - 1 == index then + bgAsset = BG[3] + end + bg:setTexture(bgAsset) + bg:setVisible(chapterListCount ~= index) + end + + local runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) + local maxPassedId = runeData:getPassedMaxId() + local fightBg = uiMap["chapter_cell.touch_node.bg"] + 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"] + lightImg:setVisible(false) + sweep:setVisible(false) + local passed = false + if runeData:curFight(id) then -- 正在可打的 + curBg:setVisible(true) + fightBg:setVisible(false) + + local layer = uiMap["chapter_cell.touch_node.bg_cur.desc"] + layer:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_6, id)) + else + 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"] + if maxPassedId >= id then -- 已通关的 + passed = true + local canSweep = runeData:canSweep(id) + sweep:setVisible(canSweep) + if canSweep then + uiMap["chapter_cell.touch_node.sweep_bg.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SMASH)) + end + lock:setVisible(false) + layer:setAnchoredPositionX(0) + lightImg:setVisible(true) + descMinRound:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_MIN, runeData:getChapterPassRound(id))) + else + lock:setVisible(true) + GFunc.centerImgAndTx(lock, layer, 5) + end + end + + if not self.rewardCells then + self.rewardCells = {} + for i = 1, 2 do + self.rewardCells[i] = CellManager:addCellComp(uiMap["chapter_cell.touch_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL) + end + end + + local rewards = runeData:getChapterRewards(id) + for i, cell in ipairs(self.rewardCells) do + if rewards[i] then + cell:refreshByConfig(rewards[i], passed, passed) + end + end +end + +function RuneChapterCell:addClickListener(func) + local uiMap = self:getUIMap() + uiMap["chapter_cell.touch_node"]:addClickListener(func) +end + +return RuneChapterCell \ No newline at end of file diff --git a/lua/app/ui/dungeon_rune/cell/rune_chapter_cell.lua.meta b/lua/app/ui/dungeon_rune/cell/rune_chapter_cell.lua.meta new file mode 100644 index 00000000..3a4c5f67 --- /dev/null +++ b/lua/app/ui/dungeon_rune/cell/rune_chapter_cell.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: c088d6f33138d9f408a31d192f2ece9e +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/ui/dungeon_rune/cell/rune_task_cell.lua b/lua/app/ui/dungeon_rune/cell/rune_task_cell.lua new file mode 100644 index 00000000..e69de29b diff --git a/lua/app/ui/dungeon_rune/cell/rune_task_cell.lua.meta b/lua/app/ui/dungeon_rune/cell/rune_task_cell.lua.meta new file mode 100644 index 00000000..d5dfbc25 --- /dev/null +++ b/lua/app/ui/dungeon_rune/cell/rune_task_cell.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: da93c46173e2d15498c62350462e5213 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/ui/dungeon_rune/dungeon_rune_main_ui.lua b/lua/app/ui/dungeon_rune/dungeon_rune_main_ui.lua new file mode 100644 index 00000000..da988362 --- /dev/null +++ b/lua/app/ui/dungeon_rune/dungeon_rune_main_ui.lua @@ -0,0 +1,143 @@ +local DungeonRuneMainUI = class("DungeonRuneMainUI", BaseUI) + +local RUNE_CHAPTER_CELL = "app/ui/dungeon_rune/cell/rune_chapter_cell" + +function DungeonRuneMainUI:getCurrencyParams() + if self.currencyParams == nil then + self.currencyParams = { + itemIds = { + GConst.ItemConst.ITEM_ID_SLIVER_WING, + GConst.ItemConst.ITEM_ID_GLOD_WING, + }, + showType = GConst.CURRENCY_TYPE.HORIZONTAL + } + end + return self.currencyParams +end + +function DungeonRuneMainUI:onPressBackspace() + self:closeUI() +end + +function DungeonRuneMainUI:getPrefabPath() + return "assets/prefabs/ui/dungeon_rune/dungeon_rune_main_ui.prefab" +end + +function DungeonRuneMainUI:ctor() + self.runeData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.RUNES_OPEN) + self.chapterList = {} + self.chapterListCount = 0 + for id, info in ipairs(ConfigManager:getConfig(self.runeData:getConfigName())) do + table.insert(self.chapterList, id) + self.chapterListCount = self.chapterListCount + 1 + end + self.chapterListCount = self.chapterListCount - 1 + self.lastChapterId = table.remove(self.chapterList) + self.targetId = self.runeData:getPassedMaxId() + if self.targetId <= 0 then + self.targetId = 1 + end +end + +function DungeonRuneMainUI:onLoadRootComplete() + self:_display() + self:_addListeners() + self:_bind() +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() + local uiMap = self.root:genAllChildren() + uiMap["dungeon_rune_main_ui.banner.btn_formation"]:addClickListener(function() + ModuleManager.CommonManager:showFormationUI(GConst.BattleConst.FORMATION_TYPE.DUNGEON_RUNE) + end) + + uiMap["dungeon_rune_main_ui.banner.btn_back"]:addClickListener(function() + self:closeUI() + end) +end + +function DungeonRuneMainUI:_bind() + self:bind(self.runeData, "isDirty", function() + self:refreshFormation() + -- self:refreshAllCells() + self:refreshRankBtn() + end) + + self:bind(DataManager.FormationData, "dirty", function() + self:refreshFormation() + end) + + self:bind(DataManager.HeroData, "isDirty", function() + self:refreshFormation() + end) +end + +function DungeonRuneMainUI:refreshFormation() + if not self.formationComp then + local uiMap = self.root:genAllChildren() + self.formationComp = uiMap["dungeon_rune_main_ui.hero_formation_comp"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_FORMATION_COMP) + end + 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 + self.scrollRect = uiMap["dungeon_rune_main_ui.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) + self.scrollRect:addInitCallback(function() + return RUNE_CHAPTER_CELL + end) + self.scrollRect:addRefreshCallback(function(index, cell) + cell:refresh(self.chapterList[index], index, false, self.chapterListCount) + end) + self.scrollRect:addInitFinishCallback(function(cell) + cell:addClickListener(function() + self:onClickCell(self.chapterList[cell:getIndex()]) + end) + end) + end + self.scrollRect:refillCells(self.chapterListCount, nil, self.targetId) + + local content = uiMap["dungeon_rune_main_ui.scrollrect.viewport.content"] + content:setSizeDeltaY(279 * (self.chapterListCount - 1) + 966) + if not self.lastChapterCell then + self.lastChapterCell = CellManager:addCellComp(uiMap["dungeon_rune_main_ui.scrollrect.viewport.content.last_cell"], RUNE_CHAPTER_CELL) + end + self.lastChapterCell:refresh(self.lastChapterId, nil, true) + self.lastChapterCell:addClickListener(function() + self:onClickCell(self.lastChapterId) + end) +end + +function DungeonRuneMainUI:refreshAllCells() + if not self.scrollRect then + return + end + + self.scrollRect:refreshAll() +end + +function DungeonRuneMainUI:onClickCell(id) + ModuleManager.DungeonRuneManager:showFightUI(id) +end + +return DungeonRuneMainUI \ No newline at end of file diff --git a/lua/app/ui/dungeon_rune/dungeon_rune_main_ui.lua.meta b/lua/app/ui/dungeon_rune/dungeon_rune_main_ui.lua.meta new file mode 100644 index 00000000..d0e4b095 --- /dev/null +++ b/lua/app/ui/dungeon_rune/dungeon_rune_main_ui.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 8354d453e6a43954b9411e730327a55e +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/userdata/dungeon/dungeon_armor_entity.lua b/lua/app/userdata/dungeon/dungeon_armor_entity.lua index 49afb2a5..476d4933 100644 --- a/lua/app/userdata/dungeon/dungeon_armor_entity.lua +++ b/lua/app/userdata/dungeon/dungeon_armor_entity.lua @@ -127,7 +127,7 @@ function DungeonArmorEntity:isNoTotalLimit() return true end -function DungeonBaseEntity:isNotShowLimitCount() +function DungeonArmorEntity:isNotShowLimitCount() return true end diff --git a/lua/app/userdata/dungeon/dungeon_data.lua b/lua/app/userdata/dungeon/dungeon_data.lua index fe5888b1..d9aec2c3 100644 --- a/lua/app/userdata/dungeon/dungeon_data.lua +++ b/lua/app/userdata/dungeon/dungeon_data.lua @@ -5,6 +5,7 @@ local SORT_ORDER = { [ModuleManager.MODULE_KEY.DUNGEON_SHARDS] = 2, [ModuleManager.MODULE_KEY.DUNGEON_WEAPON] = 3, [ModuleManager.MODULE_KEY.DUNGEON_ARMOR] = 4, + [ModuleManager.MODULE_KEY.RUNES_OPEN] = 5, } -- 所有活动副本数据 @@ -98,6 +99,7 @@ function DungeonData:initAllDataClass() self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_SHARDS] = require "app/userdata/dungeon/dungeon_shards_entity":create() self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_ARMOR] = require "app/userdata/dungeon/dungeon_armor_entity":create() self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_WEAPON] = require "app/userdata/dungeon/dungeon_weapon_entity":create() + self.dataDungeons[ModuleManager.MODULE_KEY.RUNES_OPEN] = require "app/userdata/dungeon/dungeon_rune_entity":create() if EDITOR_MODE then Logger.logHighlight("星期".. tostring(Time:getWeekByTimeStamp())) diff --git a/lua/app/userdata/dungeon/dungeon_rune_entity.lua b/lua/app/userdata/dungeon/dungeon_rune_entity.lua new file mode 100644 index 00000000..64031e9d --- /dev/null +++ b/lua/app/userdata/dungeon/dungeon_rune_entity.lua @@ -0,0 +1,151 @@ +local DungeonBaseEntity = require "app/userdata/dungeon/dungeon_base_entity" +local DungeonRuneEntity = class("DungeonRuneEntity", DungeonBaseEntity) + +local FUND_AD_REWARD_ID = 1 + +function DungeonRuneEntity:ctor() + self.data.isDirty = false + self.maxPassedId = 0 + self.curday = 1 + self.runeInfo = {} +end + +function DungeonRuneEntity:clear() + self.data.isDirty = false + DataManager:unregisterCrossDayFunc("DungeonRuneEntity") +end + +function DungeonRuneEntity:init(data) + if EDITOR_MODE then + Logger.logHighlight("-----DungeonRuneEntity------") + 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.heroes = data.heroes or {} + self.rankInfo = {} + self.selfRankInfo = {} + self.lastRankInfo = {} + self.needGetRankReward = false + + 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:setDirty() + end) +end + +function DungeonRuneEntity:setDirty() + self.data.isDirty = not self.data.isDirty +end + +function DungeonRuneEntity:getModuleKey() + return ModuleManager.MODULE_KEY.RUNES_OPEN +end + +function DungeonRuneEntity:getConfig(chapterId) + return ConfigManager:getConfig(self:getConfigName())[chapterId] +end + +function DungeonRuneEntity:getConfigName() + return "chapter_dungeon_rune" +end + +function DungeonRuneEntity:getTitleString() + return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_TITLE) +end + +function DungeonRuneEntity:getRuleString() + return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_HELP) +end + +function DungeonRuneEntity:getOpenWeekString() + return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_DESC) +end + +function DungeonRuneEntity:getBanner() + return "assets/arts/textures/background/dungeon/dungeon_bg_4.png" +end + +function DungeonRuneEntity:getOpenTextColor() + return "#FFFFFF" +end + +function DungeonRuneEntity:isNoTotalLimit() + return true +end + +function DungeonRuneEntity:isNotShowLimitCount() + return true +end + +function DungeonRuneEntity:getIsAllTimeOpen() + return true +end + +function DungeonRuneEntity:onClickFight() + ModuleManager.DungeonRuneManager:showMainUI() +end + +function DungeonRuneEntity:getTodayRemainLimitCount() + return DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_GLOD_WING) +end + +function DungeonRuneEntity:getBuySliverWingCost() + if not self.buySliverWingCost then + self.buySliverWingCost = GFunc.getConstReward("dungeon_rune_cost") + end + return self.buySliverWingCost +end + +function DungeonRuneEntity:getPassedMaxId() + return self.maxPassedId +end + +function DungeonRuneEntity:getRankRp() + return true +end + +function DungeonRuneEntity:canSweep(id) + if id > self.maxPassedId then + return false + end + return DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_SLIVER_WING) > 0 +end + +function DungeonRuneEntity:canFight(id) + if self.maxPassedId + 1 >= id then + return true + end + return false +end + +function DungeonRuneEntity:curFight(id) + return id == self.maxPassedId + 1 +end + +function DungeonRuneEntity:getChapterPassRound(id) + if not self.runeInfo[id] then + return 0 + end + return self.runeInfo[id].round or 0 +end + +function DungeonRuneEntity:getChapterRewards(id) + return self:getConfig(id).first_reward +end + +return DungeonRuneEntity \ No newline at end of file diff --git a/lua/app/userdata/dungeon/dungeon_rune_entity.lua.meta b/lua/app/userdata/dungeon/dungeon_rune_entity.lua.meta new file mode 100644 index 00000000..4c1bbac3 --- /dev/null +++ b/lua/app/userdata/dungeon/dungeon_rune_entity.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: b4d7cf896fcc1cd4dbe9ac46426cc9f8 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/userdata/dungeon/dungeon_weapon_entity.lua b/lua/app/userdata/dungeon/dungeon_weapon_entity.lua index 4db7637e..9e77c742 100644 --- a/lua/app/userdata/dungeon/dungeon_weapon_entity.lua +++ b/lua/app/userdata/dungeon/dungeon_weapon_entity.lua @@ -182,7 +182,7 @@ function DungeonWeaponEntity:doCachePassInfo(chapterId, info) self:setDirty() end -function DungeonBaseEntity:getCachePassInfo(chapterId) +function DungeonWeaponEntity:getCachePassInfo(chapterId) if not self.cachePassInfo then self.cachePassInfo = {} end diff --git a/lua/app/userdata/formation/formation_data.lua b/lua/app/userdata/formation/formation_data.lua index 6628b3d7..37cb1a49 100644 --- a/lua/app/userdata/formation/formation_data.lua +++ b/lua/app/userdata/formation/formation_data.lua @@ -127,6 +127,15 @@ function FormationData:getBossRushFormation() return formation end +function FormationData:getDungeonRuneFormation() + local formation = self:getFormation(GConst.BattleConst.FORMATION_TYPE.DUNGEON_RUNE) + if table.nums(formation) <= 0 then + self:setFormation(GConst.BattleConst.FORMATION_TYPE.DUNGEON_RUNE, self:getFormation(GConst.BattleConst.FORMATION_TYPE.STAGE)) -- 如果没有,则用默认关卡 + formation = self:getFormation(GConst.BattleConst.FORMATION_TYPE.DUNGEON_RUNE) + end + return formation +end + function FormationData:getFormation(formationType) local formation = self.formations[formationType] if formation == nil then