宝箱
This commit is contained in:
parent
ad0ab2b8ba
commit
2023930d62
@ -14,8 +14,8 @@ function BattleManager:showPauseUI()
|
|||||||
UIManager:showUI("app/ui/battle/battle_pause_ui")
|
UIManager:showUI("app/ui/battle/battle_pause_ui")
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleManager:showBattleResultUI(rewards, combatReport)
|
function BattleManager:showBattleResultUI(rewards, combatReport, mysteryBoxIdx)
|
||||||
UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport = combatReport})
|
UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport = combatReport, mysteryBoxIdx = mysteryBoxIdx})
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleManager:playBattle(battleType, params, returnFunc)
|
function BattleManager:playBattle(battleType, params, returnFunc)
|
||||||
|
|||||||
@ -58,7 +58,7 @@ function ChapterManager:endFight(id, combatReport, gotMysteryBoxIndexs)
|
|||||||
local parmas = {
|
local parmas = {
|
||||||
win = combatReport.victory,
|
win = combatReport.victory,
|
||||||
chapter_id = id,
|
chapter_id = id,
|
||||||
gotMysteryBoxIndexs = gotMysteryBoxIndexs,
|
mystery_box_idx = mystery_box_idx,
|
||||||
pass_wave = combatReport.wave,
|
pass_wave = combatReport.wave,
|
||||||
combatReport = combatReport,
|
combatReport = combatReport,
|
||||||
}
|
}
|
||||||
@ -70,12 +70,22 @@ 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()
|
||||||
|
local rewards = {}
|
||||||
local newRewards = {}
|
local newRewards = {}
|
||||||
if result.rewards then
|
local mysteryBoxIdx = result.mystery
|
||||||
GFunc.mergeRewards2(result.rewards, newRewards)
|
for i, reward in ipairs(result.rewards) do
|
||||||
|
if i <= mysteryBoxIdx then
|
||||||
|
table.insert(newRewards, reward)
|
||||||
|
else
|
||||||
|
table.insert(rewards, reward)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
ModuleManager.BattleManager:showBattleResultUI(newRewards, reqData.combatReport)
|
|
||||||
DataManager.ChapterData:fightChapter(reqData.chapter_id, result.max_chapter_id, result.max_wave)
|
if rewards then
|
||||||
|
GFunc.mergeRewards2(rewards, newRewards)
|
||||||
|
end
|
||||||
|
ModuleManager.BattleManager:showBattleResultUI(newRewards, reqData.combatReport, mysteryBoxIdx)
|
||||||
|
DataManager.ChapterData:fightChapter(reqData.chapter_id, result.max_chapter_id, result.max_wave, reqData.mystery_box_idx)
|
||||||
-- 处理金猪
|
-- 处理金猪
|
||||||
DataManager.GodPigData:addGoldPigCount()
|
DataManager.GodPigData:addGoldPigCount()
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ end
|
|||||||
function BattleResultUI:ctor(params)
|
function BattleResultUI:ctor(params)
|
||||||
self.rewards = params.rewards
|
self.rewards = params.rewards
|
||||||
self.combatReport = params.combatReport
|
self.combatReport = params.combatReport
|
||||||
|
self.mysteryBoxIdx = params.mysteryBoxIdx or 0
|
||||||
self.totalDmg = 0
|
self.totalDmg = 0
|
||||||
if self.combatReport.atkReport then
|
if self.combatReport.atkReport then
|
||||||
for _, info in ipairs(self.combatReport.atkReport) do
|
for _, info in ipairs(self.combatReport.atkReport) do
|
||||||
@ -103,6 +104,7 @@ function BattleResultUI:refreshRewards()
|
|||||||
end)
|
end)
|
||||||
self.scrollRectComp:addRefreshCallback(function(index, cell)
|
self.scrollRectComp:addRefreshCallback(function(index, cell)
|
||||||
cell:refresh(self.rewards[index])
|
cell:refresh(self.rewards[index])
|
||||||
|
cell:showLeftUpIcon(index <= self.mysteryBoxIdx, GConst.ATLAS_PATH.COMMON, "common_chest_1")
|
||||||
end)
|
end)
|
||||||
self.scrollRectComp:setFadeArgs(0.05, 0.3)
|
self.scrollRectComp:setFadeArgs(0.05, 0.3)
|
||||||
self.scrollRectComp:clearCells()
|
self.scrollRectComp:clearCells()
|
||||||
|
|||||||
@ -8,6 +8,7 @@ function RewardCell:init()
|
|||||||
self.check = uiMap["reward_cell.check"]
|
self.check = uiMap["reward_cell.check"]
|
||||||
self.numTx = uiMap["reward_cell.item_bg.num"]
|
self.numTx = uiMap["reward_cell.item_bg.num"]
|
||||||
self.fragment = uiMap["reward_cell.item_bg.fragment"]
|
self.fragment = uiMap["reward_cell.item_bg.fragment"]
|
||||||
|
self.leftUpIcon = uiMap["reward_cell.item_bg.left_up_icon"]
|
||||||
self.frameAni = uiMap["reward_cell.frame_ani"]
|
self.frameAni = uiMap["reward_cell.frame_ani"]
|
||||||
self:hideFrameAnimation()
|
self:hideFrameAnimation()
|
||||||
self.baseObject:addClickListener(function()
|
self.baseObject:addClickListener(function()
|
||||||
@ -131,4 +132,12 @@ function RewardCell:hideFrameAnimation()
|
|||||||
self.frameAni:setVisible(false)
|
self.frameAni:setVisible(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function RewardCell:showLeftUpIcon(show, atlas, iconName)
|
||||||
|
self.leftUpIcon:setVisible(show)
|
||||||
|
if not show then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.leftUpIcon:setSprite(atlas, iconName)
|
||||||
|
end
|
||||||
|
|
||||||
return RewardCell
|
return RewardCell
|
||||||
@ -297,12 +297,12 @@ function ChapterData:openBox(chapterId, index)
|
|||||||
self:setDirty()
|
self:setDirty()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterData:fightChapter(chapterId, maxChapterId, maxWave)
|
function ChapterData:fightChapter(chapterId, maxChapterId, maxWave, mysteryBoxIdx)
|
||||||
if not self.data.chapterInfo[chapterId] then
|
if not self.data.chapterInfo[chapterId] then
|
||||||
self.data.chapterInfo[chapterId] = {
|
self.data.chapterInfo[chapterId] = {
|
||||||
total_count = 0,
|
total_count = 0,
|
||||||
index = {},
|
index = {},
|
||||||
chapterId = {}
|
mystery_box_idx = {}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
self.data.chapterInfo[chapterId].total_count = (self.data.chapterInfo[chapterId].total_count or 0) + 1
|
self.data.chapterInfo[chapterId].total_count = (self.data.chapterInfo[chapterId].total_count or 0) + 1
|
||||||
@ -319,6 +319,12 @@ function ChapterData:fightChapter(chapterId, maxChapterId, maxWave)
|
|||||||
self.data.maxChapterId = maxChapterId - 1
|
self.data.maxChapterId = maxChapterId - 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for _, idx in ipairs(mysteryBoxIdx) do
|
||||||
|
if not self:getChapterMysteryBoxIsGot(chapterId, idx) then
|
||||||
|
table.insert(self.data.chapterInfo[chapterId].mystery_box_idx, idx)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
self:setDirty()
|
self:setDirty()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user