diff --git a/lua/app/common/event_manager.lua b/lua/app/common/event_manager.lua index 65fee41a..5cca3762 100644 --- a/lua/app/common/event_manager.lua +++ b/lua/app/common/event_manager.lua @@ -60,6 +60,7 @@ EventManager.CUSTOM_EVENT = { -- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER" DUNGEON_ARMOR_TO_TARGET_ID = "DUNGEON_ARMOR_TO_TARGET_ID", ACTIVITY_SUMMER_END = "ACTIVITY_SUMMER_END", + FORMATION_CHANGE = "FORMATION_CHANGE", } -- 此方法不能直接在外部调用,请使用例如BaseUI,BaseModule等封装好的接口 diff --git a/lua/app/module/dungeon_armor/dungeon_armor_manager.lua b/lua/app/module/dungeon_armor/dungeon_armor_manager.lua index 795e5ced..ee6b44ed 100644 --- a/lua/app/module/dungeon_armor/dungeon_armor_manager.lua +++ b/lua/app/module/dungeon_armor/dungeon_armor_manager.lua @@ -208,4 +208,23 @@ function DungeonArmorManager:respFundReward(result) end end +function DungeonArmorManager:reqFormation(formation) + 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.ChapterArmorChallengeHeroesReq, params, {}, self.rspFormation) +end + +function DungeonArmorManager:rspFormation(result) + if result.err_code == GConst.ERROR_STR.SUCCESS then + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORMATION_CHANGE, {type = GConst.BattleConst.FORMATION_TYPE.DUNGEON_ARMOR}) + end +end + return DungeonArmorManager \ No newline at end of file diff --git a/lua/app/module/dungeon_weapon/dungeon_weapon_manager.lua b/lua/app/module/dungeon_weapon/dungeon_weapon_manager.lua index 2fe8963e..23704689 100644 --- a/lua/app/module/dungeon_weapon/dungeon_weapon_manager.lua +++ b/lua/app/module/dungeon_weapon/dungeon_weapon_manager.lua @@ -178,4 +178,23 @@ function DungeonWeaponManager:rspPassInfo(result) end end +function DungeonWeaponManager:reqFormation(formation) + 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.ChapterWeaponChallengeHeroesReq, params, {}, self.rspFormation) +end + +function DungeonWeaponManager:rspFormation(result) + if result.err_code == GConst.ERROR_STR.SUCCESS then + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORMATION_CHANGE, {type = GConst.BattleConst.FORMATION_TYPE.DUNGEON_WEAPON}) + end +end + return DungeonWeaponManager \ 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 16694bd4..62732c4b 100644 --- a/lua/app/proto/proto_msg_type.lua +++ b/lua/app/proto/proto_msg_type.lua @@ -22,6 +22,8 @@ local ProtoMsgType = { [349009610] = "TriggerGrowUpGiftNtf", [433807827] = "LevelUpReq", [433809660] = "LevelUpRsp", + [448795573] = "ChapterArmorChallengeHeroesReq", + [448797406] = "ChapterArmorChallengeHeroesRsp", [516281556] = "GuideFundMarkReq", [516283389] = "GuideFundMarkRsp", [531558517] = "PigPlayUpdateNtf", @@ -59,6 +61,8 @@ local ProtoMsgType = { [1435949623] = "AppStorePaidRsp", [1471116409] = "BindReq", [1471118242] = "BindRsp", + [1502684232] = "ChapterWeaponChallengeHeroesReq", + [1502686065] = "ChapterWeaponChallengeHeroesRsp", [1571167683] = "ChapterArmorChallengeFarmReq", [1571169516] = "ChapterArmorChallengeFarmRsp", [1571184475] = "ChapterShardsChallengeFarmReq", @@ -228,6 +232,8 @@ local ProtoMsgType = { TriggerGrowUpGiftNtf = 349009610, LevelUpReq = 433807827, LevelUpRsp = 433809660, + ChapterArmorChallengeHeroesReq = 448795573, + ChapterArmorChallengeHeroesRsp = 448797406, GuideFundMarkReq = 516281556, GuideFundMarkRsp = 516283389, PigPlayUpdateNtf = 531558517, @@ -265,6 +271,8 @@ local ProtoMsgType = { AppStorePaidRsp = 1435949623, BindReq = 1471116409, BindRsp = 1471118242, + ChapterWeaponChallengeHeroesReq = 1502684232, + ChapterWeaponChallengeHeroesRsp = 1502686065, ChapterArmorChallengeFarmReq = 1571167683, ChapterArmorChallengeFarmRsp = 1571169516, ChapterShardsChallengeFarmReq = 1571184475, @@ -434,6 +442,8 @@ local ProtoMsgType = { TriggerGrowUpGiftNtf = "TriggerGrowUpGiftNtf", LevelUpReq = "LevelUpReq", LevelUpRsp = "LevelUpRsp", + ChapterArmorChallengeHeroesReq = "ChapterArmorChallengeHeroesReq", + ChapterArmorChallengeHeroesRsp = "ChapterArmorChallengeHeroesRsp", GuideFundMarkReq = "GuideFundMarkReq", GuideFundMarkRsp = "GuideFundMarkRsp", PigPlayUpdateNtf = "PigPlayUpdateNtf", @@ -471,6 +481,8 @@ local ProtoMsgType = { AppStorePaidRsp = "AppStorePaidRsp", BindReq = "BindReq", BindRsp = "BindRsp", + ChapterWeaponChallengeHeroesReq = "ChapterWeaponChallengeHeroesReq", + ChapterWeaponChallengeHeroesRsp = "ChapterWeaponChallengeHeroesRsp", ChapterArmorChallengeFarmReq = "ChapterArmorChallengeFarmReq", ChapterArmorChallengeFarmRsp = "ChapterArmorChallengeFarmRsp", ChapterShardsChallengeFarmReq = "ChapterShardsChallengeFarmReq", diff --git a/lua/app/ui/common/common_formation_ui.lua b/lua/app/ui/common/common_formation_ui.lua index 75a87217..52e229c5 100644 --- a/lua/app/ui/common/common_formation_ui.lua +++ b/lua/app/ui/common/common_formation_ui.lua @@ -30,7 +30,18 @@ function CommonFormationUI:onLoadRootComplete() uiMap["common_formation_ui.banner.btn_ok.tx_ok"]:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_24)) uiMap["common_formation_ui.banner.btn_ok"]:addClickListener(function() - self:closeUI() + local formation = DataManager.FormationData:getFormation(self.formationType) + if not formation then + self:closeUI() + return + end + if self.formationType == GConst.BattleConst.FORMATION_TYPE.DUNGEON_WEAPON then -- 武器副本 + ModuleManager.DungeonWeaponManager:reqFormation(formation) + elseif self.formationType == GConst.BattleConst.FORMATION_TYPE.DUNGEON_ARMOR then + ModuleManager.DungeonArmorManager:reqFormation(formation) + else + self:closeUI() + end end) local heroUI = uiMap["common_formation_ui.hero_ui"] @@ -47,6 +58,10 @@ function CommonFormationUI:onLoadRootComplete() self:addEventListener(EventManager.CUSTOM_EVENT.GO_SHOP, function() self:closeUI() end) + + self:addEventListener(EventManager.CUSTOM_EVENT.FORMATION_CHANGE, function() + self:closeUI() + end) end function CommonFormationUI:onRefresh() diff --git a/lua/app/userdata/chapter/chapter_data.lua b/lua/app/userdata/chapter/chapter_data.lua index 8bf51a80..561848f4 100644 --- a/lua/app/userdata/chapter/chapter_data.lua +++ b/lua/app/userdata/chapter/chapter_data.lua @@ -22,6 +22,18 @@ function ChapterData:init(data, notChangeChapterId) return end + local cfg = self:getChapterCfg()[data.max_chapter_id] + if not cfg then + local maxChapterId = 0 + for id, info in pairs(self:getChapterCfg()) do + if maxChapterId < id then + maxChapterId = id + end + end + data.max_chapter_id = maxChapterId + data.max_wave = self:getChapterCfgMaxWave(data.max_chapter_id) + end + self.maxWave = data.max_wave or 0 if self.maxWave >= self:getChapterCfgMaxWave(data.max_chapter_id) then self.data.maxChapterId = data.max_chapter_id