Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev
This commit is contained in:
commit
d15e52a41d
@ -104,12 +104,14 @@ function ChapterManager:endFightFinish(result)
|
||||
data.max_chapter = newMaxChapter
|
||||
CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data)
|
||||
-- 标记可弹出新手礼包
|
||||
if newMaxChapter == 2 then
|
||||
if maxChapter == 1 then
|
||||
DataManager.ShopData:markPopUpGiftForBeginnerGift()
|
||||
end
|
||||
-- 章节通关 标记可弹出章节礼包
|
||||
DataManager.ShopData:markPopUpGiftForActChapterStore(newMaxChapter - 1)
|
||||
DataManager.ShopData:markPopUpGiftForActChapterStore(maxChapter)
|
||||
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_PASS_CHAPTER)
|
||||
-- 章节通关 检查是否要弹出英雄解锁界面
|
||||
DataManager.HeroData:checkIfCanShowHeroUnlock(maxChapter)
|
||||
end
|
||||
|
||||
ModuleManager.TaskManager:addFightTaskProgress(reqData)
|
||||
|
||||
@ -4,6 +4,10 @@ function HeroManager:showHeroDetailUI(heroId)
|
||||
UIManager:showUI("app/ui/hero/hero_detail_ui", {heroId = heroId})
|
||||
end
|
||||
|
||||
function HeroManager:showHeroUnlockUI(heroIdList)
|
||||
UIManager:showUI("app/ui/hero/hero_unlock_ui", {heroIdList = heroIdList})
|
||||
end
|
||||
|
||||
function HeroManager:upgradeHero(heroId, heroEntity)
|
||||
local heroEntity = heroEntity or DataManager.HeroData:getHeroById(heroId)
|
||||
if not heroEntity then
|
||||
@ -12,7 +16,6 @@ function HeroManager:upgradeHero(heroId, heroEntity)
|
||||
|
||||
local canLvUp, state = heroEntity:canLvUp(true)
|
||||
if not canLvUp then
|
||||
|
||||
-- 如果是金币不足 尝试触发金币礼包
|
||||
if state == GConst.HeroConst.CHECK_LV_UP_STATE.COIN_NOT_ENOUGH then
|
||||
ModuleManager.ShopManager:tryTriggerCoinGift()
|
||||
@ -37,6 +40,10 @@ function HeroManager:getHeroName(id)
|
||||
return I18N:getConfig("hero")[id].name
|
||||
end
|
||||
|
||||
function HeroManager:getHeroDesc(id)
|
||||
return I18N:getConfig("hero")[id].desc
|
||||
end
|
||||
|
||||
function HeroManager:getHeroIcon(heroId)
|
||||
local cfg = ConfigManager:getConfig("hero")[heroId]
|
||||
return cfg and tostring(cfg.icon)
|
||||
|
||||
63
lua/app/ui/hero/hero_unlock_ui.lua
Normal file
63
lua/app/ui/hero/hero_unlock_ui.lua
Normal file
@ -0,0 +1,63 @@
|
||||
local HeroUnlockUI = class("HeroUnlockUI", BaseUI)
|
||||
|
||||
function HeroUnlockUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/hero/hero_unlock_ui.prefab"
|
||||
end
|
||||
|
||||
function HeroUnlockUI:ctor(params)
|
||||
self.heroIdList = params and params.heroIdList
|
||||
end
|
||||
|
||||
function HeroUnlockUI:onLoadRootComplete()
|
||||
self.uiMap = self.root:genAllChildren()
|
||||
self.uiMap["hero_unlock_ui.bg"]:addClickListener(function()
|
||||
self:closeUI()
|
||||
end)
|
||||
self:initTitleAndDesc()
|
||||
self:initHeroes()
|
||||
end
|
||||
|
||||
function HeroUnlockUI:initTitleAndDesc()
|
||||
self.uiMap["player_level_up_ui.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_UNLOCK))
|
||||
self.uiMap["player_level_up_ui.reward_title"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_UNLOCK_DESC))
|
||||
self.uiMap["player_level_up_ui.continue"]:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_TO_CONTINUE))
|
||||
end
|
||||
|
||||
function HeroUnlockUI:initHeroes()
|
||||
if self.heroIdList then
|
||||
local count = #self.heroIdList
|
||||
if count > 3 then
|
||||
count = 3
|
||||
end
|
||||
if count > 0 then
|
||||
for i = 1, count do
|
||||
local heroEntity = DataManager.HeroData:getHeroById(self.heroIdList[i])
|
||||
self.uiMap["hero_unlock_ui.bg_" .. i]:setVisible(true)
|
||||
local rewardCell = self.uiMap["hero_unlock_ui.bg_" .. i .. ".reward_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
rewardCell:refreshItemById(heroEntity:getFragmentId(), 0)
|
||||
self.uiMap["hero_unlock_ui.bg_" .. i .. ".name_tx"]:setText(heroEntity:getName())
|
||||
self.uiMap["hero_unlock_ui.bg_" .. i .. ".desc_tx"]:setText(heroEntity:getDesc())
|
||||
end
|
||||
for i = count + 1, 3 do
|
||||
self.uiMap["hero_unlock_ui.bg_" .. i]:setVisible(false)
|
||||
end
|
||||
if count == 1 then
|
||||
self.uiMap["hero_unlock_ui.bg_1"]:setAnchoredPositionY(100)
|
||||
else
|
||||
self.uiMap["hero_unlock_ui.bg_1"]:setAnchoredPositionY(180)
|
||||
end
|
||||
else
|
||||
self:hideAllHeroes()
|
||||
end
|
||||
else
|
||||
self:hideAllHeroes()
|
||||
end
|
||||
end
|
||||
|
||||
function HeroUnlockUI:hideAllHeroes()
|
||||
self.uiMap["hero_unlock_ui.bg_1"]:setVisible(false)
|
||||
self.uiMap["hero_unlock_ui.bg_2"]:setVisible(false)
|
||||
self.uiMap["hero_unlock_ui.bg_3"]:setVisible(false)
|
||||
end
|
||||
|
||||
return HeroUnlockUI
|
||||
10
lua/app/ui/hero/hero_unlock_ui.lua.meta
Normal file
10
lua/app/ui/hero/hero_unlock_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51bd98d3fbf493b44b3cbf37ead6a3ad
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -800,12 +800,22 @@ function MainCityUI:checkSideBarOpenStatus()
|
||||
end
|
||||
end
|
||||
|
||||
-- 弹窗优先级: 升级>功能弹窗>英雄解锁弹窗>礼包弹窗>引导
|
||||
function MainCityUI:checkMainPop()
|
||||
-- 检查是否升级
|
||||
if DataManager.PlayerData:getIfCanLevelUp() then
|
||||
ModuleManager.PlayerManager:levelUp()
|
||||
return
|
||||
end
|
||||
-- 是否是否有英雄解锁弹窗
|
||||
if DataManager.HeroData:getIfCanShowHeroUnlock() then
|
||||
local list = DataManager.HeroData:getHeroChapterUnlockList()
|
||||
DataManager.HeroData:markShowHeroUnlock()
|
||||
if list and #list > 0 then
|
||||
ModuleManager.HeroManager:showHeroUnlockUI(list)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- 引导
|
||||
if self:checkTutorial() then
|
||||
|
||||
@ -7,6 +7,8 @@ function HeroData:ctor()
|
||||
self.data.isDirty = false
|
||||
self.matchActiveHeroMap = {}
|
||||
self.maxHeroLvOnInit = 0
|
||||
self.showHeroUnlockChapter = 0
|
||||
self.heroChapterUnlockMap = {}
|
||||
end
|
||||
|
||||
function HeroData:clear()
|
||||
@ -15,6 +17,9 @@ end
|
||||
|
||||
function HeroData:init(data)
|
||||
self.heroes = {}
|
||||
for k, v in pairs(self.heroChapterUnlockMap) do
|
||||
self.heroChapterUnlockMap[k] = false
|
||||
end
|
||||
if data then
|
||||
for id, heroInfo in pairs(data) do
|
||||
self:addHero(heroInfo.id, heroInfo.level)
|
||||
@ -34,8 +39,12 @@ function HeroData:init(data)
|
||||
end
|
||||
self.matchActiveHeroMap[matchType][entity:getCfgId()] = true
|
||||
end
|
||||
if info.unlock_chapter and info.is_show == 1 then
|
||||
self.heroChapterUnlockMap[info.unlock_chapter] = true
|
||||
end
|
||||
end
|
||||
self.showHeroUnlockChapter = 0
|
||||
end
|
||||
|
||||
function HeroData:addHero(cfgId, lv)
|
||||
if self.heroes[cfgId] then
|
||||
@ -132,4 +141,29 @@ function HeroData:getMaxHeroLvOnInit()
|
||||
return self.maxHeroLvOnInit
|
||||
end
|
||||
|
||||
function HeroData:getIfCanShowHeroUnlock()
|
||||
return self.showHeroUnlockChapter > 0
|
||||
end
|
||||
|
||||
function HeroData:markShowHeroUnlock()
|
||||
self.showHeroUnlockChapter = 0
|
||||
end
|
||||
|
||||
function HeroData:checkIfCanShowHeroUnlock(chapterId)
|
||||
if not self.heroChapterUnlockMap[chapterId] then
|
||||
return
|
||||
end
|
||||
self.showHeroUnlockChapter = chapterId
|
||||
end
|
||||
|
||||
function HeroData:getHeroChapterUnlockList()
|
||||
local list = {}
|
||||
for id, entity in pairs(self.heroes) do
|
||||
if not entity:isActived() and entity:getUnlcokChapter() == self.showHeroUnlockChapter then
|
||||
table.insert(list, id)
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
return HeroData
|
||||
@ -225,6 +225,11 @@ function HeroEntity:getName()
|
||||
return ModuleManager.HeroManager:getHeroName(self:getCfgId())
|
||||
end
|
||||
|
||||
function HeroEntity:getDesc()
|
||||
return ModuleManager.HeroManager:getHeroDesc(self:getCfgId())
|
||||
end
|
||||
|
||||
|
||||
function HeroEntity:getActiveRogueCount()
|
||||
local lvInfo = ConfigManager:getConfig("hero_level")[self.data.lv]
|
||||
if not lvInfo then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user