From 328515c82a082512f5273b79ede53d3531508bfe Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Sat, 15 Apr 2023 14:57:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=AE=9D=E7=AE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/chapter/chapter_manager.lua | 2 +- lua/app/server/data/server_chapter_data.lua | 2 +- lua/app/server/server_game_data.lua | 2 ++ lua/app/ui/battle/battle_result_ui.lua | 2 +- lua/app/ui/main_city/main_city_ui.lua | 2 +- lua/app/userdata/chapter/chapter_data.lua | 4 ++++ 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lua/app/module/chapter/chapter_manager.lua b/lua/app/module/chapter/chapter_manager.lua index 4e0a8f25..8684906a 100644 --- a/lua/app/module/chapter/chapter_manager.lua +++ b/lua/app/module/chapter/chapter_manager.lua @@ -47,7 +47,7 @@ function ChapterManager:endFight(id, combatReport) ServerDataManager:dataOperate(GConst.ServerDataConst.DATA_OP_BEHAVIOR.END_FIGHT, parmas, function(result) if result.status == 0 then 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:setDirty() end diff --git a/lua/app/server/data/server_chapter_data.lua b/lua/app/server/data/server_chapter_data.lua index 95185529..2a0e8031 100644 --- a/lua/app/server/data/server_chapter_data.lua +++ b/lua/app/server/data/server_chapter_data.lua @@ -6,7 +6,7 @@ function ServerChapterData:init(data) 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.chapterBoxInfo = data and data.chapterBoxInfo or {} - self.data.chapterFightInfo = data and data.chapterBoxInfo or {} + self.data.chapterFightInfo = data and data.chapterFightInfo or {} end function ServerChapterData:fightChapter(id, victory, wave) diff --git a/lua/app/server/server_game_data.lua b/lua/app/server/server_game_data.lua index 23d44a21..135611bc 100644 --- a/lua/app/server/server_game_data.lua +++ b/lua/app/server/server_game_data.lua @@ -121,6 +121,8 @@ function ServerGameData:addRewards(cfgRewards, getType) local cfg = ConfigManager:getItemConfig()[rewardId] if cfg.box_drop then self:openRewardBox(TempRewards, cfg.box_drop, rewardNum, rewardId) + elseif cfg.hero_drop then + self:openRewardBox(TempRewards, cfg.hero_drop, rewardNum, rewardId) else table.insert(TempRewards, reward) end diff --git a/lua/app/ui/battle/battle_result_ui.lua b/lua/app/ui/battle/battle_result_ui.lua index 1d2864c7..75f3e4ea 100644 --- a/lua/app/ui/battle/battle_result_ui.lua +++ b/lua/app/ui/battle/battle_result_ui.lua @@ -93,7 +93,7 @@ function BattleResultUI:refreshRewards() return GConst.TYPEOF_LUA_CLASS.REWARD_CELL end) self.scrollRect:addRefreshCallback(function(index, cell) - cell:refreshByConfig(self.rewards[index]) + cell:refresh(self.rewards[index]) end) self.scrollRect:clearCells() self.scrollRect:refillCells(#self.rewards) diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua index 88e1c717..4b525df8 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -93,7 +93,7 @@ end function MainCityUI:_bind() self:bind(DataManager.ChapterData, "isDirty", function() if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then - self.subComps[self.selectedIndex]:refreshChapter() + self.subComps[self.selectedIndex]:refreshChapter(true) end end) self:bind(DataManager.PlayerData, "dirty", function(binder, value) diff --git a/lua/app/userdata/chapter/chapter_data.lua b/lua/app/userdata/chapter/chapter_data.lua index 10679579..1ba577e0 100644 --- a/lua/app/userdata/chapter/chapter_data.lua +++ b/lua/app/userdata/chapter/chapter_data.lua @@ -24,6 +24,10 @@ function ChapterData:init(data) self.data.chapterFightInfo = data and data.chapterFightInfo or {} end +function ChapterData:setDirty() + self.data.isDirty = not self.data.isDirty +end + function ChapterData:getChapterId() return self.data.chapterId end