关卡修改

This commit is contained in:
xiekaidong 2023-05-06 10:37:02 +08:00
parent 8801943ae3
commit 2c341db47c
2 changed files with 30 additions and 10 deletions

View File

@ -14,10 +14,11 @@ end
function ChapterManager:openBoxFinish(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then
local reqData = result.reqData
GFunc.showRewardBox(result.rewards)
DataManager.ChapterData:openBox(result.reqData.chapter_id, result.reqData.wave)
DataManager.ChapterData:openBox(reqData.chapter_id, reqData.wave)
BIReport:postChapterOpenBox(result.reqData.chapter_id, DataManager.ChapterData:getChapterBoxNum(chapterId, index), result.rewards)
BIReport:postChapterOpenBox(reqData.chapter_id, DataManager.ChapterData:getChapterBoxNum(reqData.chapter_id, reqData.wave), result.rewards)
end
end
@ -36,10 +37,9 @@ function ChapterManager:startFight()
return
end
local parmas = {
id = DataManager.ChapterData:getChapterId()
chapter_id = DataManager.ChapterData:getChapterId()
}
-- self:sendMessage(ProtoMsgType.FromMsgEnum., parmas, {}, self.startFightFinish, BIReport.ITEM_GET_TYPE.CHAPTER_FIGHT_START)
self:startFightFinish({err_code = "SUCCESS"})
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterStartReq, parmas, {}, self.startFightFinish, BIReport.ITEM_GET_TYPE.CHAPTER_FIGHT_START)
end
function ChapterManager:startFightFinish(result)
@ -63,16 +63,12 @@ function ChapterManager:endFightFinish(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then
local reqData = result.reqData
local maxChapter = DataManager.ChapterData:getNewChapterId()
if reqData.combatReport.victory and DataManager.ChapterData:getChapterId() == DataManager.ChapterData:getMaxChapterId() + 1 then
DataManager.ChapterData:goNextChapter()
end
local newRewards = {}
if result.rewards then
GFunc.mergeRewards2(result.rewards, newRewards)
end
ModuleManager.BattleManager:showBattleResultUI(newRewards, reqData.combatReport)
-- DataManager.ChapterData:init(result.chapterData, true)
-- DataManager.ChapterData:setDirty()
DataManager.ChapterData:fightChapter(reqData.chapter_id, result.current_chapter_id, result.max_wave)
-- 处理金猪
DataManager.GodPigData:addGoldPigCount()

View File

@ -295,4 +295,28 @@ function ChapterData:openBox(chapterId, index)
self:setDirty()
end
function ChapterData:fightChapter(chapterId, maxChapterId, maxWave)
if not self.data.chapterInfo[chapterId] then
self.data.chapterInfo[chapterId] = {
total_count = 0,
index = {}
}
end
self.data.chapterInfo[chapterId].total_count = (self.data.chapterInfo[chapterId].total_count or 0) + 1
if maxChapterId <= self.maxChapterId then
return
end
self.data.chapterId = maxChapterId
self.maxWave = maxWave
if self.maxWave >= self:getChapterCfgMaxWave(maxChapterId) then
self.data.maxChapterId = maxChapterId
else
self.data.maxChapterId = maxChapterId - 1
end
self:setDirty()
end
return ChapterData