local ModuleUnlockUI = class("ModuleUnlockUI", BaseUI) function ModuleUnlockUI:getPrefabPath() return "assets/prefabs/ui/main_city/module_unlock_ui.prefab" end function ModuleUnlockUI:isFullScreen() return false end function ModuleUnlockUI:onClose() if self.unlockAnimationSeq then self.unlockAnimationSeq:Kill() self.unlockAnimationSeq = nil end end function ModuleUnlockUI:ctor(params) self.chapterId = params and params.chapterId self.unlockList = {} local cfg = ConfigManager:getConfig("func_open") for k, v in pairs(cfg) do if v.stage == self.chapterId and v.pop_ups == nil then table.insert(self.unlockList, k) end end end function ModuleUnlockUI:onLoadRootComplete() self.uiMap = self.root:genAllChildren() self.uiMap["module_unlock_ui.bg"]:addClickListener(function() self:showNextModuleUnlockAnimation() end) self.moduleNameTx = self.uiMap["module_unlock_ui.name_tx"] self.moduleIcon = self.uiMap["module_unlock_ui.icon"] self.uiMap["module_unlock_ui.continue"]:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_TO_CONTINUE)) self.uiMap["module_unlock_ui.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.FUNC_UNLOCK)) self:showModuleUnlockAnimation() end function ModuleUnlockUI:showNextModuleUnlockAnimation() if self:showModuleUnlockAnimation() then self:playUnlockAnimation() end end function ModuleUnlockUI:showModuleUnlockAnimation() if #self.unlockList <= 0 then self:closeUI() return false end local moduleKey = table.remove(self.unlockList, 1) local info = ConfigManager:getConfig("func_open")[moduleKey] local i18nInfo = I18N:getConfig("func_open")[moduleKey] if info == nil or i18nInfo == nil then self:closeUI() return false end self.moduleNameTx:setText(i18nInfo.name) return true end function ModuleUnlockUI:playUnlockAnimation() if self.unlockAnimationSeq == nil then local scaleTween1 = self.root:getTransform():DOScale(1.05, 0.15) self.unlockAnimationSeq:Append(scaleTween1) local scaleTween2 = self.root:getTransform():DOScale(1, 0.2) self.unlockAnimationSeq:Append(scaleTween2) self.unlockAnimationSeq:SetAutoKill(false) else self.unlockAnimationSeq:Restart() end end return ModuleUnlockUI