关卡修改
This commit is contained in:
parent
8801943ae3
commit
2c341db47c
@ -14,10 +14,11 @@ end
|
|||||||
|
|
||||||
function ChapterManager:openBoxFinish(result)
|
function ChapterManager:openBoxFinish(result)
|
||||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||||
|
local reqData = result.reqData
|
||||||
GFunc.showRewardBox(result.rewards)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -36,10 +37,9 @@ function ChapterManager:startFight()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local parmas = {
|
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:sendMessage(ProtoMsgType.FromMsgEnum.ChapterStartReq, parmas, {}, self.startFightFinish, BIReport.ITEM_GET_TYPE.CHAPTER_FIGHT_START)
|
||||||
self:startFightFinish({err_code = "SUCCESS"})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterManager:startFightFinish(result)
|
function ChapterManager:startFightFinish(result)
|
||||||
@ -63,16 +63,12 @@ function ChapterManager:endFightFinish(result)
|
|||||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||||
local reqData = result.reqData
|
local reqData = result.reqData
|
||||||
local maxChapter = DataManager.ChapterData:getNewChapterId()
|
local maxChapter = DataManager.ChapterData:getNewChapterId()
|
||||||
if reqData.combatReport.victory and DataManager.ChapterData:getChapterId() == DataManager.ChapterData:getMaxChapterId() + 1 then
|
|
||||||
DataManager.ChapterData:goNextChapter()
|
|
||||||
end
|
|
||||||
local newRewards = {}
|
local newRewards = {}
|
||||||
if result.rewards then
|
if result.rewards then
|
||||||
GFunc.mergeRewards2(result.rewards, newRewards)
|
GFunc.mergeRewards2(result.rewards, newRewards)
|
||||||
end
|
end
|
||||||
ModuleManager.BattleManager:showBattleResultUI(newRewards, reqData.combatReport)
|
ModuleManager.BattleManager:showBattleResultUI(newRewards, reqData.combatReport)
|
||||||
-- DataManager.ChapterData:init(result.chapterData, true)
|
DataManager.ChapterData:fightChapter(reqData.chapter_id, result.current_chapter_id, result.max_wave)
|
||||||
-- DataManager.ChapterData:setDirty()
|
|
||||||
-- 处理金猪
|
-- 处理金猪
|
||||||
DataManager.GodPigData:addGoldPigCount()
|
DataManager.GodPigData:addGoldPigCount()
|
||||||
|
|
||||||
|
|||||||
@ -295,4 +295,28 @@ function ChapterData:openBox(chapterId, index)
|
|||||||
self:setDirty()
|
self:setDirty()
|
||||||
end
|
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
|
return ChapterData
|
||||||
Loading…
x
Reference in New Issue
Block a user