开宝箱

This commit is contained in:
xiekaidong 2023-04-15 14:57:34 +08:00
parent f74a7f6080
commit 328515c82a
6 changed files with 10 additions and 4 deletions

View File

@ -47,7 +47,7 @@ function ChapterManager:endFight(id, combatReport)
ServerDataManager:dataOperate(GConst.ServerDataConst.DATA_OP_BEHAVIOR.END_FIGHT, parmas, function(result) ServerDataManager:dataOperate(GConst.ServerDataConst.DATA_OP_BEHAVIOR.END_FIGHT, parmas, function(result)
if result.status == 0 then if result.status == 0 then
GFunc.addRewards(result.rewards, BIReport.ITEM_GET_TYPE.FIGHT_END) GFunc.addRewards(result.rewards, BIReport.ITEM_GET_TYPE.FIGHT_END)
ModuleManager.BattleManager:showBattleResultUI(parmas.rewards, combatReport) ModuleManager.BattleManager:showBattleResultUI(result.rewards, combatReport)
DataManager.ChapterData:init(result.chapterData) DataManager.ChapterData:init(result.chapterData)
DataManager.ChapterData:setDirty() DataManager.ChapterData:setDirty()
end end

View File

@ -6,7 +6,7 @@ function ServerChapterData:init(data)
self.data.chapterId = data and data.chapterId or MIN_CHAPTER_ID self.data.chapterId = data and data.chapterId or MIN_CHAPTER_ID
self.data.maxChapterId = data and data.maxChapterId or (self.data.chapterId - 1) self.data.maxChapterId = data and data.maxChapterId or (self.data.chapterId - 1)
self.data.chapterBoxInfo = data and data.chapterBoxInfo or {} self.data.chapterBoxInfo = data and data.chapterBoxInfo or {}
self.data.chapterFightInfo = data and data.chapterBoxInfo or {} self.data.chapterFightInfo = data and data.chapterFightInfo or {}
end end
function ServerChapterData:fightChapter(id, victory, wave) function ServerChapterData:fightChapter(id, victory, wave)

View File

@ -121,6 +121,8 @@ function ServerGameData:addRewards(cfgRewards, getType)
local cfg = ConfigManager:getItemConfig()[rewardId] local cfg = ConfigManager:getItemConfig()[rewardId]
if cfg.box_drop then if cfg.box_drop then
self:openRewardBox(TempRewards, cfg.box_drop, rewardNum, rewardId) self:openRewardBox(TempRewards, cfg.box_drop, rewardNum, rewardId)
elseif cfg.hero_drop then
self:openRewardBox(TempRewards, cfg.hero_drop, rewardNum, rewardId)
else else
table.insert(TempRewards, reward) table.insert(TempRewards, reward)
end end

View File

@ -93,7 +93,7 @@ function BattleResultUI:refreshRewards()
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
end) end)
self.scrollRect:addRefreshCallback(function(index, cell) self.scrollRect:addRefreshCallback(function(index, cell)
cell:refreshByConfig(self.rewards[index]) cell:refresh(self.rewards[index])
end) end)
self.scrollRect:clearCells() self.scrollRect:clearCells()
self.scrollRect:refillCells(#self.rewards) self.scrollRect:refillCells(#self.rewards)

View File

@ -93,7 +93,7 @@ end
function MainCityUI:_bind() function MainCityUI:_bind()
self:bind(DataManager.ChapterData, "isDirty", function() self:bind(DataManager.ChapterData, "isDirty", function()
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
self.subComps[self.selectedIndex]:refreshChapter() self.subComps[self.selectedIndex]:refreshChapter(true)
end end
end) end)
self:bind(DataManager.PlayerData, "dirty", function(binder, value) self:bind(DataManager.PlayerData, "dirty", function(binder, value)

View File

@ -24,6 +24,10 @@ function ChapterData:init(data)
self.data.chapterFightInfo = data and data.chapterFightInfo or {} self.data.chapterFightInfo = data and data.chapterFightInfo or {}
end end
function ChapterData:setDirty()
self.data.isDirty = not self.data.isDirty
end
function ChapterData:getChapterId() function ChapterData:getChapterId()
return self.data.chapterId return self.data.chapterId
end end