解锁新功能弹窗
This commit is contained in:
parent
2f720561f5
commit
5d7771fd87
@ -117,6 +117,8 @@ function ChapterManager:endFightFinish(result)
|
||||
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_PASS_CHAPTER)
|
||||
-- 章节通关 检查是否要弹出英雄解锁界面
|
||||
DataManager.HeroData:checkIfCanShowHeroUnlock(maxChapter)
|
||||
-- 章节通关 检查是否要弹出功能解锁界面
|
||||
DataManager.PlayerData:checkIfCanShowModuleUnlock(maxChapter)
|
||||
end
|
||||
|
||||
ModuleManager.TaskManager:addFightTaskProgress(reqData)
|
||||
|
||||
@ -4,6 +4,15 @@ function MaincityManager:showMainCityUI(isFirstEnter, targetIndex)
|
||||
UIManager:showUI(UIManager.UI_PATH.MAINCITY_UI, {isFirstEnter = isFirstEnter, targetIndex = targetIndex})
|
||||
end
|
||||
|
||||
function MaincityManager:showModuleUnlockUI()
|
||||
local chapterId = DataManager.PlayerData:getModuleUnlockChapter()
|
||||
if chapterId <= 0 then
|
||||
return
|
||||
end
|
||||
DataManager.PlayerData:markShowModuleUnlock()
|
||||
UIManager:showUI("app/ui/main_city/module_unlock_ui", {chapterId = chapterId})
|
||||
end
|
||||
|
||||
-- 从登录界面第一次进入主城
|
||||
function MaincityManager:firstEnterMainCity()
|
||||
if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.START_TUTORIAL, true) then
|
||||
|
||||
@ -817,6 +817,11 @@ function MainCityUI:checkMainPop()
|
||||
ModuleManager.PlayerManager:levelUp()
|
||||
return
|
||||
end
|
||||
-- 检查功能弹窗
|
||||
if DataManager.PlayerData:getIfCanShowModuleUnlock() then
|
||||
ModuleManager.MaincityManager:showModuleUnlockUI()
|
||||
return
|
||||
end
|
||||
-- 是否是否有英雄解锁弹窗
|
||||
if DataManager.HeroData:getIfCanShowHeroUnlock() then
|
||||
local list = DataManager.HeroData:getHeroChapterUnlockList()
|
||||
|
||||
52
lua/app/ui/main_city/module_unlock_ui.lua
Normal file
52
lua/app/ui/main_city/module_unlock_ui.lua
Normal file
@ -0,0 +1,52 @@
|
||||
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: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:showModuleUnlockAnimation()
|
||||
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:showModuleUnlockAnimation()
|
||||
if #self.unlockList <= 0 then
|
||||
self:closeUI()
|
||||
return
|
||||
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
|
||||
end
|
||||
self.moduleNameTx:setText(i18nInfo.name)
|
||||
end
|
||||
|
||||
return ModuleUnlockUI
|
||||
10
lua/app/ui/main_city/module_unlock_ui.lua.meta
Normal file
10
lua/app/ui/main_city/module_unlock_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73423d981f0c1704ba50c8435ac13416
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -25,6 +25,22 @@ function PlayerData:init(data)
|
||||
self:markDirty()
|
||||
end)
|
||||
self.createTime = basicInfo.create_at or 0 -- 创角时间
|
||||
self:initModuleUnlockInfo()
|
||||
end
|
||||
|
||||
function PlayerData:initModuleUnlockInfo()
|
||||
self.showModuleUnlockChapter = 0
|
||||
if self.moduleUnlockChapterMap then
|
||||
return
|
||||
end
|
||||
self.moduleUnlockChapterMap = {}
|
||||
local cfg = ConfigManager:getConfig("func_open")
|
||||
for _, info in pairs(cfg) do
|
||||
if info.pop_ups == nil and info.stage then
|
||||
self.moduleUnlockChapterMap[info.stage] = true
|
||||
end
|
||||
end
|
||||
Logger.printTable(self.moduleUnlockChapterMap)
|
||||
end
|
||||
|
||||
function PlayerData:resetOnCrossDay()
|
||||
@ -138,7 +154,30 @@ end
|
||||
|
||||
-- 获取创角时间
|
||||
function PlayerData:getCreateTime()
|
||||
return self.createTime
|
||||
return self.createTime
|
||||
end
|
||||
|
||||
-- 获取玩家是否可以显示功能解锁
|
||||
function PlayerData:getIfCanShowModuleUnlock()
|
||||
return self.showModuleUnlockChapter > 0
|
||||
end
|
||||
|
||||
function PlayerData:markShowModuleUnlock()
|
||||
self.showModuleUnlockChapter = 0
|
||||
end
|
||||
|
||||
function PlayerData:getModuleUnlockChapter()
|
||||
return self.showModuleUnlockChapter
|
||||
end
|
||||
|
||||
function PlayerData:checkIfCanShowModuleUnlock(chapterId)
|
||||
if self.moduleUnlockChapterMap == nil then
|
||||
return
|
||||
end
|
||||
if not self.moduleUnlockChapterMap[chapterId] then
|
||||
return
|
||||
end
|
||||
self.showModuleUnlockChapter = chapterId
|
||||
end
|
||||
|
||||
return PlayerData
|
||||
Loading…
x
Reference in New Issue
Block a user