local DungeonDifficultyUI = class("DungeonDifficultyUI", BaseUI) function DungeonDifficultyUI:isFullScreen() return false end function DungeonDifficultyUI:getPrefabPath() return "assets/prefabs/ui/dungeon/dungeon_difficulty_ui.prefab" end function DungeonDifficultyUI:ctor(params) self.module = params.module self.curId = DataManager.DungeonData:getPassedMaxId(self.module) + 1 end function DungeonDifficultyUI:onCover() end function DungeonDifficultyUI:onReshow() end function DungeonDifficultyUI:onClose() end function DungeonDifficultyUI:onLoadRootComplete() self.uiMap = self.root:genAllChildren() self.btnClose = self.uiMap["dungeon_difficulty_ui.bg.close_btn"] self.btnStart = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_start"] self.txStart = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_start.tx_start"] self.txStartCost = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_start.cost.tx_cost"] self.btnSweep = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_sweep"] self.txSweep = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_sweep.tx_sweep"] self.txSweepCost = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_sweep.cost.tx_cost"] self.txTime = self.uiMap["dungeon_difficulty_ui.bg.btns.tx_time"] self.txDifficulty = self.uiMap["dungeon_difficulty_ui.bg.select.chapter.tx_difficulty"] self.txLevel = self.uiMap["dungeon_difficulty_ui.bg.select.chapter.tx_level"] self.arrowLeft = self.uiMap["dungeon_difficulty_ui.bg.select.chapter.arrow_left"] self.arrowRight = self.uiMap["dungeon_difficulty_ui.bg.select.chapter.arrow_right"] self.txDesc = self.uiMap["dungeon_difficulty_ui.bg.tx_desc"] self.txTitle = self.uiMap["dungeon_difficulty_ui.bg.title.title_text"] self.txTitle:setText(DataManager.DungeonData:getTitle(self.module)) self.txDesc:setText(DataManager.DungeonData:getRule(self.module)) self.txDifficulty:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_STAGE)) self.txStart:setText(I18N:getGlobalText(I18N.GlobalConst.START_DESC)) self.txSweep:setText(I18N:getGlobalText(I18N.GlobalConst.SMASH)) local cost = DataManager.DungeonData:getChallengeHpCost(self.module) self.txStartCost:setText("-"..GFunc.getRewardNum(cost)) self.txSweepCost:setText("-"..GFunc.getRewardNum(cost)) self.txTime:setText(I18N:getGlobalText(I18N.GlobalConst.TODAY_REMAIN_TIMES, DataManager.DungeonData:getRemainTimes(self.module))) -- todo 奖励 self:refreshDifficulty() self.btnClose:addClickListener(function() self:closeUI() end) self.btnStart:addClickListener(function() -- 开始挑战 end) self.btnSweep:addClickListener(function() -- 开始扫荡 end) self.arrowLeft:addClickListener(function() if self:isCanChallengeMinId() then return end self.curId = self.curId - 1 self:refreshDifficulty() end) self.arrowRight:addClickListener(function() if self:isCanChallengeMaxId() then return end self.curId = self.curId + 1 self:refreshDifficulty() end) end function DungeonDifficultyUI:refreshDifficulty() self.arrowLeft:setActive(not self:isCanChallengeMinId()) self.arrowRight:setActive(not self:isCanChallengeMaxId()) self.btnSweep:setActive(self:isCanSweepId()) self.txLevel:setText(tostring(self.curId)) end -- 是否是可扫荡关卡 function DungeonDifficultyUI:isCanSweepId() return self.curId <= DataManager.DungeonData:getPassedMaxId(self.module) end --是否是能挑战的最大关卡 function DungeonDifficultyUI:isCanChallengeMaxId() return self.curId == DataManager.DungeonData:getPassedMaxId(self.module) + 1 end --是否是能挑战的最小关卡 function DungeonDifficultyUI:isCanChallengeMinId() return self.curId == 1 end return DungeonDifficultyUI