local DungeonCell = class("DungeonCell", BaseCell) function DungeonCell:init() local uiMap = self:getUIMap() self.contentNode = uiMap["dungeon_cell.content"] self.txTitle = uiMap["dungeon_cell.content.tx_title"] self.infoNode = uiMap["dungeon_cell.content.info"] self.btnHelp = uiMap["dungeon_cell.content.info.btn_help"] self.timesTx = uiMap["dungeon_cell.content.info.tx_time"] self.lockNode = uiMap["dungeon_cell.content.lock"] self.lockTx = uiMap["dungeon_cell.content.lock.text"] self.rewardCells = {} for i = 1, 3 do table.insert(self.rewardCells, uiMap["dungeon_cell.content.info.rewards.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)) end self.txEmpty = uiMap["dungeon_cell.tx_empty"] -- 敬请期待 self.bgComingSoon = uiMap["dungeon_cell.bg_coming_soon"] self.bgComingSoonTx = uiMap["dungeon_cell.bg_coming_soon.text"] self.bgComingSoonTx:setText(I18N:getGlobalText(I18N.GlobalConst.COLLECTION_DESC_8)) self.btnHelp:addClickListener(function() local params = { desc = I18N:getGlobalText(GConst.DungeonConst.STR_HELP[self.moduleKey]) } ModuleManager.TipsManager:showHelpTips(params) end) self.baseObject:addClickListener(function() self:onClickGo() end) end function DungeonCell:refresh(moduleKey) self.bgComingSoon:setVisible(false) self.contentNode:setVisible(true) self.moduleKey = moduleKey self:getBaseObject():getGameObject().name = self.moduleKey self.txTitle:setText(I18N:getGlobalText(GConst.DungeonConst.STR_TITLE[self.moduleKey])) local rewards = DataManager.DungeonData:getShowRewards(self.moduleKey) for i, cell in ipairs(self.rewardCells) do if rewards and rewards[i] then cell:setActive(true) cell:refreshByConfig(rewards[i]) cell:hideCountTx() else cell:setActive(false) end end self.baseObject:setSprite(GConst.ATLAS_PATH.UI_SUPPLY, GConst.DungeonConst.IMG_BANNER[self.moduleKey]) if DataManager.DungeonData:isOpen(self.moduleKey) then self.infoNode:setVisible(true) self.lockNode:setVisible(false) self.timesTx:setText(GConst.EMPTY_STRING) else self.timesTx:setText(GConst.EMPTY_STRING) self.infoNode:setVisible(false) self.lockNode:setVisible(true) self.lockTx:setText(DataManager.DungeonData:getNotOpenStr(self.moduleKey)) end if DataManager.DungeonData:hasRedPoint(self.moduleKey) then self.baseObject:addRedPoint(334, 90, 1) else self.baseObject:removeRedPoint() end self.remainTime = nil self:updateTime() end function DungeonCell:showComingSoon() self.bgComingSoon:setVisible(true) self.contentNode:setVisible(false) end function DungeonCell:onClickGo() if not DataManager.DungeonData:isOpen(self.moduleKey, true) then return end if self.moduleKey == GConst.DungeonConst.MODULE_KEY_DUNGEON_DAILY then ModuleManager.DungeonManager:showDungeonDaylyMainUI() end end function DungeonCell:updateTime() if self.moduleKey == GConst.DungeonConst.MODULE_KEY_DUNGEON_DAILY then local remainTime = Time:getTodaySurplusTime() if self.remainTime ~= remainTime then self.remainTime = remainTime self.timesTx:setText(I18N:getGlobalText(I18N.GlobalConst.GIFT_ROUTINE_DESC_9, Time:formatNumTime(remainTime))) end end end return DungeonCell