local DungeonBoardCell = class("DungeonBoardCell", BaseCell) function DungeonBoardCell:init() self.uiMap = self:getUIMap() self.icon = self.uiMap["dungeon_board_cell.info.icon"] self.txTitle = self.uiMap["dungeon_board_cell.info.icon.tx_title"] self.countdown = self.uiMap["dungeon_board_cell.info.countdown"] self.txCountdown = self.uiMap["dungeon_board_cell.info.countdown.tx_countdown"] self.txOpen = self.uiMap["dungeon_board_cell.info.tx_open"] self.lock = self.uiMap["dungeon_board_cell.lock"] self.lockTxLock = self.uiMap["dungeon_board_cell.lock.desc.tx_lock"] self.lockTxCountdown = self.uiMap["dungeon_board_cell.lock.countdown.tx_countdown"] self.btnStart = self.uiMap["dungeon_board_cell.btn_start"] self.txStart = self.uiMap["dungeon_board_cell.btn_start.tx_btn"] self.txTimes = self.uiMap["dungeon_board_cell.btn_start.tx_times"] self.btnHelp = self.uiMap["dungeon_board_cell.btn_help"] self.btnStart:addClickListener(function() -- 打开副本关卡选择界面 UIManager:showUI("app/ui/dungeon/dungeon_difficulty_ui", {module = self.moduleKey}) end) self.btnHelp:addClickListener(function() -- 展示提示 ModuleManager.TipsManager:showDescTips(DataManager.DungeonData:getRule(self.moduleKey), self.btnHelp) end) end function DungeonBoardCell:refresh(moduleKey) self.moduleKey = moduleKey self:refreshInfo() self:refreshRewards() end function DungeonBoardCell:refreshInfo() self.txTitle:setText(DataManager.DungeonData:getTitle(self.moduleKey)) self.txOpen:setText(DataManager.DungeonData:getOpenTimeDesc(self.moduleKey)) if DataManager.DungeonData:isActive(self.moduleKey) then self.btnStart:setVisible(true) self.countdown:setVisible(true) self.lock:setVisible(false) self.txOpen:setAnchoredPositionY(-115) self.txStart:setText(I18N:getGlobalText(I18N.GlobalConst.START_DESC)) self.txTimes:setText(I18N:getGlobalText(I18N.GlobalConst.TODAY_REMAIN_TIMES, DataManager.DungeonData:getRemainTimes(self.moduleKey))) self:refreshCountdown(self.txCountdown) else self.btnStart:setVisible(false) self.countdown:setVisible(false) self.lock:setVisible(true) self.txOpen:setAnchoredPositionY(-75) self.lockTxLock:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_OPEN)) self:refreshCountdown(self.lockTxCountdown) end end function DungeonBoardCell:refreshRewards() self.rewards = DataManager.DungeonData:getBoardShowRewards() if self.rewards == nil then return end self.scrollRect = self.uiMap[""]: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:refreshByConfig(self.itemList[index]) end) self.scrollRect:clearCells() self.scrollRect:setTotalCount(0) end function DungeonBoardCell:refreshCountdown(txCountdown) if not self.countdownSid then self.countdownSid = txCountdown:scheduleGlobal(function() self:updateTime(txCountdown) end, 1) end self:updateTime(txCountdown) end function DungeonBoardCell:updateTime(txCountdown) local remainTime = Time:getTodaySurplusTime() txCountdown:setText(GFunc.getTimeStrWithHMS(remainTime)) end return DungeonBoardCell