diff --git a/lua/app/ui/common/cell/reward_cell.lua b/lua/app/ui/common/cell/reward_cell.lua index c423dfd5..28862b3d 100644 --- a/lua/app/ui/common/cell/reward_cell.lua +++ b/lua/app/ui/common/cell/reward_cell.lua @@ -96,6 +96,18 @@ function RewardCell:_refreshItem(info, count) end end +function RewardCell:setVisibleFragment(isShow) + self.fragment:setVisible(isShow) +end + +function RewardCell:setVisibleS(isShow) + self.sImg:setVisible(isShow) +end + +function RewardCell:setRewardIcon(atlas, name) + self.icon:setSprite(atlas, name) +end + function RewardCell:setNumTx(str) self.numTx:setText(str) end diff --git a/lua/app/ui/dungeon/dungeon_board_cell.lua b/lua/app/ui/dungeon/dungeon_board_cell.lua index f283681c..df732427 100644 --- a/lua/app/ui/dungeon/dungeon_board_cell.lua +++ b/lua/app/ui/dungeon/dungeon_board_cell.lua @@ -37,6 +37,9 @@ end function DungeonBoardCell:refreshInfo() self.txTitle:setText(DataManager.DungeonData:getTitle(self.moduleKey)) self.txOpen:setText(DataManager.DungeonData:getOpenTimeDesc(self.moduleKey)) + self.icon:setSprite(DataManager.DungeonData:getIcon(self.moduleKey)) + -- self.baseObject:setTexture("assets/arts/textures/background/fund/fund_bg_1.png") + -- self.iconBuff:setSprite(GConst.ATLAS_PATH.ICON_BUFF, "") if DataManager.DungeonData:isActive(self.moduleKey) then self.btnStart:setVisible(true) @@ -66,21 +69,30 @@ function DungeonBoardCell:refreshInfo() end function DungeonBoardCell:refreshRewards() - -- self.rewards = DataManager.DungeonData:getBoardShowRewards() - -- if self.rewards == nil then - -- return - -- end - self.scrollRect = self.uiMap["dungeon_board_cell.rewards"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) self.scrollRect:addInitCallback(function() return GConst.TYPEOF_LUA_CLASS.REWARD_CELL end) - self.scrollRect:addRefreshCallback(function(index, cell) - cell:refreshItemById(1, 0) - cell:setTouchEnable(false) - end) self.scrollRect:clearCells() - self.scrollRect:setTotalCount(2) + + local rewards = DataManager.DungeonData:getBoardShowRewardId(self.moduleKey) + if rewards ~= nil then + -- 展示实际item + self.scrollRect:addRefreshCallback(function(index, cell) + cell:refreshItemById(rewards[index], 0) + end) + self.scrollRect:setTotalCount(#rewards) + else + rewards = DataManager.DungeonData:getBoardShowRewardIcon(self.moduleKey) + -- 展示icon图片 + self.scrollRect:addRefreshCallback(function(index, cell) + cell:setRewardIcon(rewards[index][1], rewards[index][2]) + cell:setVisibleS(false) + cell:setVisibleFragment(false) + cell:setTouchEnable(false) + end) + self.scrollRect:setTotalCount(#rewards) + end end function DungeonBoardCell:refreshCountdown(txCountdown) diff --git a/lua/app/ui/dungeon/dungeon_difficulty_ui.lua b/lua/app/ui/dungeon/dungeon_difficulty_ui.lua index 9f2055cb..49bb1de7 100644 --- a/lua/app/ui/dungeon/dungeon_difficulty_ui.lua +++ b/lua/app/ui/dungeon/dungeon_difficulty_ui.lua @@ -10,7 +10,7 @@ end function DungeonDifficultyUI:ctor(params) self.module = params.module - self.curId = DataManager.DungeonData:getPassedMaxId(self.module) + 1 + self.curId = DataManager.DungeonData:getUnlockMaxId(self.module) end function DungeonDifficultyUI:onCover() @@ -100,12 +100,12 @@ end -- 是否是可扫荡关卡 function DungeonDifficultyUI:isCanSweepId() - return self.curId <= DataManager.DungeonData:getPassedMaxId(self.module) + return self.curId < DataManager.DungeonData:getUnlockMaxId(self.module) end --是否是能挑战的最大关卡 function DungeonDifficultyUI:isCanChallengeMaxId() - return self.curId == DataManager.DungeonData:getPassedMaxId(self.module) + 1 + return self.curId == DataManager.DungeonData:getUnlockMaxId(self.module) end --是否是能挑战的最小关卡 diff --git a/lua/app/userdata/dungeon/dungeon_data.lua b/lua/app/userdata/dungeon/dungeon_data.lua index 133269b7..41e633a6 100644 --- a/lua/app/userdata/dungeon/dungeon_data.lua +++ b/lua/app/userdata/dungeon/dungeon_data.lua @@ -173,6 +173,11 @@ function DungeonData:isCanSweep(moduleKey, id) return true end +-- 获取副本挑战总次数 +function DungeonData:getTotalCount(moduleKey) + return self.dataDungeons[moduleKey]:getTotalChallengeCount() +end + -- 获取副本今日剩余次数 function DungeonData:getRemainTimes(moduleKey) if not self:isActive(moduleKey) then @@ -252,6 +257,16 @@ function DungeonData:getBoardShowRewards(moduleKey) return nil end +-- 获取看板展示的副本奖励(返回icon) +function DungeonData:getBoardShowRewardIcon(moduleKey) + return self.dataDungeons[moduleKey]:getBoardShowRewardIcon() +end + +-- 获取看板展示的副本奖励(返回item id list) +function DungeonData:getBoardShowRewardId(moduleKey) + return self.dataDungeons[moduleKey]:getBoardShowRewardId() +end + -- 获取展示副本首通奖励 function DungeonData:getFirstReward(moduleKey, id) -- 通关后,不展示首通奖励 @@ -264,6 +279,15 @@ function DungeonData:getPassReward(moduleKey, id) return self.dataDungeons[moduleKey]:getPassReward(id) end +--获取副本已解锁最大id +function DungeonData:getUnlockMaxId(moduleKey) + local id = self.dataDungeons[moduleKey]:getPassedMaxId() + 1 + if id > #self.dataDungeons[moduleKey]:getConfig() then + id = id - 1 + end + return id +end + --获取副本已通关的最高关卡id function DungeonData:getPassedMaxId(moduleKey) return self.dataDungeons[moduleKey]:getPassedMaxId() diff --git a/lua/app/userdata/dungeon/dungeon_data_base_comp.lua b/lua/app/userdata/dungeon/dungeon_data_base_comp.lua index d4e568e1..12bc448d 100644 --- a/lua/app/userdata/dungeon/dungeon_data_base_comp.lua +++ b/lua/app/userdata/dungeon/dungeon_data_base_comp.lua @@ -8,57 +8,72 @@ end -- 获取副本模块名,对应ModuleManager.MODULE_KEY function DungeonDataBaseComp:getModuleKey() - return "" + return nil end -- 获取副本开启周期(星期几) function DungeonDataBaseComp:getOpenWeekCycle() - return {} + return nil +end + +-- 获取副本配置名称 +function DungeonDataBaseComp:getConfigName() + return nil end -- 获取副本标题文案 function DungeonDataBaseComp:getTitleString() - return "" + return nil end --- 获取副本规则描述 +-- 获取副本规则描述(金币副本) function DungeonDataBaseComp:getRuleString() - return "" + return nil +end + +-- 获取副本boss抗性描述(碎片副本) +function DungeonDataBaseComp:getBossBuffString() + return nil end -- 获取开始时间描述 function DungeonDataBaseComp:getOpenWeekString() - return "" + return nil end -- 获取副本角标图 function DungeonDataBaseComp:getIcon() - return "" + return nil end -- 获取副本banner图 function DungeonDataBaseComp:getBanner() - return "" + return nil +end + +-- 获取总挑战次数 +function DungeonDataBaseComp:getTotalChallengeCount() + return nil end -- 获取今日已挑战次数 function DungeonDataBaseComp:getTodayChallengeCount() - return 0 + return nil end -- 获取已通关的最大副本id function DungeonDataBaseComp:getPassedMaxId() - return 0 + return nil end -- 获取挑战体力消耗 function DungeonDataBaseComp:getChallengeHpCost() - return 0 + return nil end -- 获取每日最大挑战次数 function DungeonDataBaseComp:getTodayMaxCount() - return 0 + return nil end -- 获取看板展示的副本奖励(返回icon) @@ -66,7 +81,7 @@ function DungeonDataBaseComp:getBoardShowRewardIcon() return nil end --- 获取看板展示的副本奖励(返回id) +-- 获取看板展示的副本奖励(返回id list) function DungeonDataBaseComp:getBoardShowRewardId() return nil end @@ -89,4 +104,9 @@ function DungeonDataBaseComp:getTodayRemainLimitCount() return self:getTodayMaxCount() - self:getTodayChallengeCount() end +-- 获取副本配置 +function DungeonDataBaseComp:getConfig() + return ConfigManager:getConfig(self:getConfigName()) +end + return DungeonDataBaseComp \ No newline at end of file diff --git a/lua/app/userdata/dungeon/dungeon_gold_data_comp.lua b/lua/app/userdata/dungeon/dungeon_gold_data_comp.lua index 4381a039..0225dce5 100644 --- a/lua/app/userdata/dungeon/dungeon_gold_data_comp.lua +++ b/lua/app/userdata/dungeon/dungeon_gold_data_comp.lua @@ -4,15 +4,20 @@ local DungeonGoldDataComp = class("DungeonGoldDataComp", DungeonDataBaseComp) -- 金币副本数据 function DungeonGoldDataComp:init(data) + self.totalChallengeCount = data.total_challenge_count self.todayChallengeCount = data.today_challenge_count self.maxPassedId = data.max_chapter_gold_id end -function DungeonDataBaseComp:getTodayChallengeCount() +function DungeonGoldDataComp:getTotalChallengeCount() + return self.totalChallengeCount +end + +function DungeonGoldDataComp:getTodayChallengeCount() return self.todayChallengeCount end -function DungeonDataBaseComp:getPassedMaxId() +function DungeonGoldDataComp:getPassedMaxId() return self.maxPassedId end @@ -24,6 +29,10 @@ function DungeonGoldDataComp:getOpenWeekCycle() return {2,4,6,7} end +function DungeonGoldDataComp:getConfigName() + return "chapter_dungeon_gold" +end + function DungeonGoldDataComp:getTitleString() return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_GOLD_TITLE) end @@ -37,7 +46,7 @@ function DungeonGoldDataComp:getOpenWeekString() end function DungeonGoldDataComp:getIcon() - return "" + return GConst.ATLAS_PATH.COMMON,"common_chest_1" end function DungeonGoldDataComp:getBanner() @@ -52,8 +61,8 @@ function DungeonGoldDataComp:getTodayMaxCount() return GFunc.getConstIntValue("dungeon_gold_limit") end -function DungeonDataBaseComp:getBoardShowRewardId() - return 1 +function DungeonGoldDataComp:getBoardShowRewardId() + return {1} end function DungeonGoldDataComp:getFirstReward(id) diff --git a/lua/app/userdata/dungeon/dungeon_shards_data_comp.lua b/lua/app/userdata/dungeon/dungeon_shards_data_comp.lua index 427473f9..06c5b925 100644 --- a/lua/app/userdata/dungeon/dungeon_shards_data_comp.lua +++ b/lua/app/userdata/dungeon/dungeon_shards_data_comp.lua @@ -4,15 +4,20 @@ local DungeonShardsDataComp = class("DungeonShardsDataComp", DungeonDataBaseComp -- 碎片副本数据 function DungeonShardsDataComp:init(data) + self.totalChallengeCount = data.total_challenge_count self.todayChallengeCount = data.today_challenge_count self.maxPassedId = data.max_chapter_shards_id end -function DungeonDataBaseComp:getTodayChallengeCount() +function DungeonShardsDataComp:getTotalChallengeCount() + return self.totalChallengeCount +end + +function DungeonShardsDataComp:getTodayChallengeCount() return self.todayChallengeCount end -function DungeonDataBaseComp:getPassedMaxId() +function DungeonShardsDataComp:getPassedMaxId() return self.maxPassedId end @@ -24,12 +29,16 @@ function DungeonShardsDataComp:getOpenWeekCycle() return {1,3,5,7} end +function DungeonShardsDataComp:getConfigName() + return "chapter_dungeon_shards" +end + function DungeonShardsDataComp:getTitleString() return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_TITLE) end -function DungeonShardsDataComp:getRuleString() - return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_HELP) +function DungeonShardsDataComp:getBossBuffString() + return I18N:getText("buff", buffId, "desc") end function DungeonShardsDataComp:getOpenWeekString() @@ -37,7 +46,7 @@ function DungeonShardsDataComp:getOpenWeekString() end function DungeonShardsDataComp:getIcon() - return "" + return GConst.ATLAS_PATH.COMMON,"common_dec_3" end function DungeonShardsDataComp:getBanner() @@ -52,7 +61,7 @@ function DungeonShardsDataComp:getTodayMaxCount() return GFunc.getConstIntValue("dungeon_shards_limit") end -function DungeonDataBaseComp:getBoardShowRewardIcon() +function DungeonShardsDataComp:getBoardShowRewardIcon() return { [1]={ GConst.ATLAS_PATH.ICON_ITEM,"4"