一些优化和容错

This commit is contained in:
xiekaidong 2023-08-18 10:55:51 +08:00
parent 0c1a32e322
commit dd3d4d812a
6 changed files with 79 additions and 1 deletions

View File

@ -60,6 +60,7 @@ EventManager.CUSTOM_EVENT = {
-- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER" -- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER"
DUNGEON_ARMOR_TO_TARGET_ID = "DUNGEON_ARMOR_TO_TARGET_ID", DUNGEON_ARMOR_TO_TARGET_ID = "DUNGEON_ARMOR_TO_TARGET_ID",
ACTIVITY_SUMMER_END = "ACTIVITY_SUMMER_END", ACTIVITY_SUMMER_END = "ACTIVITY_SUMMER_END",
FORMATION_CHANGE = "FORMATION_CHANGE",
} }
-- 此方法不能直接在外部调用请使用例如BaseUIBaseModule等封装好的接口 -- 此方法不能直接在外部调用请使用例如BaseUIBaseModule等封装好的接口

View File

@ -208,4 +208,23 @@ function DungeonArmorManager:respFundReward(result)
end end
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 return DungeonArmorManager

View File

@ -178,4 +178,23 @@ function DungeonWeaponManager:rspPassInfo(result)
end end
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 return DungeonWeaponManager

View File

@ -22,6 +22,8 @@ local ProtoMsgType = {
[349009610] = "TriggerGrowUpGiftNtf", [349009610] = "TriggerGrowUpGiftNtf",
[433807827] = "LevelUpReq", [433807827] = "LevelUpReq",
[433809660] = "LevelUpRsp", [433809660] = "LevelUpRsp",
[448795573] = "ChapterArmorChallengeHeroesReq",
[448797406] = "ChapterArmorChallengeHeroesRsp",
[516281556] = "GuideFundMarkReq", [516281556] = "GuideFundMarkReq",
[516283389] = "GuideFundMarkRsp", [516283389] = "GuideFundMarkRsp",
[531558517] = "PigPlayUpdateNtf", [531558517] = "PigPlayUpdateNtf",
@ -59,6 +61,8 @@ local ProtoMsgType = {
[1435949623] = "AppStorePaidRsp", [1435949623] = "AppStorePaidRsp",
[1471116409] = "BindReq", [1471116409] = "BindReq",
[1471118242] = "BindRsp", [1471118242] = "BindRsp",
[1502684232] = "ChapterWeaponChallengeHeroesReq",
[1502686065] = "ChapterWeaponChallengeHeroesRsp",
[1571167683] = "ChapterArmorChallengeFarmReq", [1571167683] = "ChapterArmorChallengeFarmReq",
[1571169516] = "ChapterArmorChallengeFarmRsp", [1571169516] = "ChapterArmorChallengeFarmRsp",
[1571184475] = "ChapterShardsChallengeFarmReq", [1571184475] = "ChapterShardsChallengeFarmReq",
@ -228,6 +232,8 @@ local ProtoMsgType = {
TriggerGrowUpGiftNtf = 349009610, TriggerGrowUpGiftNtf = 349009610,
LevelUpReq = 433807827, LevelUpReq = 433807827,
LevelUpRsp = 433809660, LevelUpRsp = 433809660,
ChapterArmorChallengeHeroesReq = 448795573,
ChapterArmorChallengeHeroesRsp = 448797406,
GuideFundMarkReq = 516281556, GuideFundMarkReq = 516281556,
GuideFundMarkRsp = 516283389, GuideFundMarkRsp = 516283389,
PigPlayUpdateNtf = 531558517, PigPlayUpdateNtf = 531558517,
@ -265,6 +271,8 @@ local ProtoMsgType = {
AppStorePaidRsp = 1435949623, AppStorePaidRsp = 1435949623,
BindReq = 1471116409, BindReq = 1471116409,
BindRsp = 1471118242, BindRsp = 1471118242,
ChapterWeaponChallengeHeroesReq = 1502684232,
ChapterWeaponChallengeHeroesRsp = 1502686065,
ChapterArmorChallengeFarmReq = 1571167683, ChapterArmorChallengeFarmReq = 1571167683,
ChapterArmorChallengeFarmRsp = 1571169516, ChapterArmorChallengeFarmRsp = 1571169516,
ChapterShardsChallengeFarmReq = 1571184475, ChapterShardsChallengeFarmReq = 1571184475,
@ -434,6 +442,8 @@ local ProtoMsgType = {
TriggerGrowUpGiftNtf = "TriggerGrowUpGiftNtf", TriggerGrowUpGiftNtf = "TriggerGrowUpGiftNtf",
LevelUpReq = "LevelUpReq", LevelUpReq = "LevelUpReq",
LevelUpRsp = "LevelUpRsp", LevelUpRsp = "LevelUpRsp",
ChapterArmorChallengeHeroesReq = "ChapterArmorChallengeHeroesReq",
ChapterArmorChallengeHeroesRsp = "ChapterArmorChallengeHeroesRsp",
GuideFundMarkReq = "GuideFundMarkReq", GuideFundMarkReq = "GuideFundMarkReq",
GuideFundMarkRsp = "GuideFundMarkRsp", GuideFundMarkRsp = "GuideFundMarkRsp",
PigPlayUpdateNtf = "PigPlayUpdateNtf", PigPlayUpdateNtf = "PigPlayUpdateNtf",
@ -471,6 +481,8 @@ local ProtoMsgType = {
AppStorePaidRsp = "AppStorePaidRsp", AppStorePaidRsp = "AppStorePaidRsp",
BindReq = "BindReq", BindReq = "BindReq",
BindRsp = "BindRsp", BindRsp = "BindRsp",
ChapterWeaponChallengeHeroesReq = "ChapterWeaponChallengeHeroesReq",
ChapterWeaponChallengeHeroesRsp = "ChapterWeaponChallengeHeroesRsp",
ChapterArmorChallengeFarmReq = "ChapterArmorChallengeFarmReq", ChapterArmorChallengeFarmReq = "ChapterArmorChallengeFarmReq",
ChapterArmorChallengeFarmRsp = "ChapterArmorChallengeFarmRsp", ChapterArmorChallengeFarmRsp = "ChapterArmorChallengeFarmRsp",
ChapterShardsChallengeFarmReq = "ChapterShardsChallengeFarmReq", ChapterShardsChallengeFarmReq = "ChapterShardsChallengeFarmReq",

View File

@ -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.tx_ok"]:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_24))
uiMap["common_formation_ui.banner.btn_ok"]:addClickListener(function() 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) end)
local heroUI = uiMap["common_formation_ui.hero_ui"] local heroUI = uiMap["common_formation_ui.hero_ui"]
@ -47,6 +58,10 @@ function CommonFormationUI:onLoadRootComplete()
self:addEventListener(EventManager.CUSTOM_EVENT.GO_SHOP, function() self:addEventListener(EventManager.CUSTOM_EVENT.GO_SHOP, function()
self:closeUI() self:closeUI()
end) end)
self:addEventListener(EventManager.CUSTOM_EVENT.FORMATION_CHANGE, function()
self:closeUI()
end)
end end
function CommonFormationUI:onRefresh() function CommonFormationUI:onRefresh()

View File

@ -22,6 +22,18 @@ function ChapterData:init(data, notChangeChapterId)
return return
end 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 self.maxWave = data.max_wave or 0
if self.maxWave >= self:getChapterCfgMaxWave(data.max_chapter_id) then if self.maxWave >= self:getChapterCfgMaxWave(data.max_chapter_id) then
self.data.maxChapterId = data.max_chapter_id self.data.maxChapterId = data.max_chapter_id