chapter
This commit is contained in:
parent
f5ce465420
commit
e7314d9bba
@ -5,7 +5,7 @@ CurrencyBar.cellWidth = 162
|
|||||||
CurrencyBar.cellHeight = 40
|
CurrencyBar.cellHeight = 40
|
||||||
|
|
||||||
local OFFSET_X = -20
|
local OFFSET_X = -20
|
||||||
local OFFSET_Y = -40
|
local OFFSET_Y = -110
|
||||||
|
|
||||||
function CurrencyBar:init()
|
function CurrencyBar:init()
|
||||||
self.currVisible = true
|
self.currVisible = true
|
||||||
|
|||||||
@ -12,42 +12,42 @@ local BOX_ICON = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function MainComp:init()
|
function MainComp:init()
|
||||||
self.uiMap = self:getBaseObject():genAllChildren()
|
local uiMap = self:getBaseObject():genAllChildren()
|
||||||
|
|
||||||
self.chapterImg = self.uiMap["main_comp.img"]
|
self.chapterImg = uiMap["main_comp.img"]
|
||||||
self.chapterNameTx = self.uiMap["main_comp.name_tx"]
|
self.chapterNameTx = uiMap["main_comp.name_tx"]
|
||||||
self.chapterWavetx = self.uiMap["main_comp.record_tx"]
|
self.chapterWavetx = uiMap["main_comp.record_tx"]
|
||||||
self.leftArrow = self.uiMap["main_comp.left_arrow"]
|
self.leftArrow = uiMap["main_comp.middle_bg.left_arrow"]
|
||||||
local leftArrowBtn = self.uiMap["main_comp.left_arrow.btn"]
|
local leftArrowBtn = uiMap["main_comp.middle_bg.left_arrow.btn"]
|
||||||
leftArrowBtn:addClickListener(function()
|
leftArrowBtn:addClickListener(function()
|
||||||
if DataManager.ChapterData:goLastChapter() then
|
if DataManager.ChapterData:goLastChapter() then
|
||||||
self:refresh()
|
self:refresh()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
self.rightArrow = self.uiMap["main_comp.right_arrow"]
|
self.rightArrow = uiMap["main_comp.middle_bg.right_arrow"]
|
||||||
local rightArrowBtn = self.uiMap["main_comp.right_arrow.btn"]
|
local rightArrowBtn = uiMap["main_comp.middle_bg.right_arrow.btn"]
|
||||||
rightArrowBtn:addClickListener(function()
|
rightArrowBtn:addClickListener(function()
|
||||||
if DataManager.ChapterData:goNextChapter() then
|
if DataManager.ChapterData:goNextChapter() then
|
||||||
self:refresh()
|
self:refresh()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self.uiMap["main_comp.effect_node.ui_spine_obj"]:playAnim("idle", true, false)
|
uiMap["main_comp.effect_node.ui_spine_obj"]:playAnim("idle", true, false)
|
||||||
|
|
||||||
self.chapterBg = self.uiMap["main_comp.bg"]
|
self.chapterBg = uiMap["main_comp.bg"]
|
||||||
self.chapterBg:setAnchoredPositionX(-720)
|
self.chapterBg:setAnchoredPositionX(-720)
|
||||||
self.bossSmoke = self.uiMap["main_comp.boss_smoke"]
|
self.bossSmoke = uiMap["main_comp.boss_smoke"]
|
||||||
self.bossSmoke:setAnchoredPositionX(10000)
|
self.bossSmoke:setAnchoredPositionX(10000)
|
||||||
self.smokeNodeTop = self.uiMap["main_comp.smoke_node_1"]
|
self.smokeNodeTop = uiMap["main_comp.smoke_node_1"]
|
||||||
self.monsterNodeTop = self.uiMap["main_comp.monster_node_1"]
|
self.monsterNodeTop = uiMap["main_comp.monster_node_1"]
|
||||||
self.bossNode = self.uiMap["main_comp.boss_node"]
|
self.bossNode = uiMap["main_comp.boss_node"]
|
||||||
self.bossNode:setActive(false)
|
self.bossNode:setActive(false)
|
||||||
self.bossSpine = self.uiMap["main_comp.boss_node.boss"]
|
self.bossSpine = uiMap["main_comp.boss_node.boss"]
|
||||||
self.smokeNodeDown = self.uiMap["main_comp.smoke_node_2"]
|
self.smokeNodeDown = uiMap["main_comp.smoke_node_2"]
|
||||||
self.monsterNodeDown = self.uiMap["main_comp.monster_node_2"]
|
self.monsterNodeDown = uiMap["main_comp.monster_node_2"]
|
||||||
self.dialogueTx = self.uiMap["main_comp.dialogue_node.bg.text"]
|
self.dialogueTx = uiMap["main_comp.dialogue_node.bg.text"]
|
||||||
self.dialogueBg = self.uiMap["main_comp.dialogue_node.bg"]
|
self.dialogueBg = uiMap["main_comp.dialogue_node.bg"]
|
||||||
self.dialogueNode = self.uiMap["main_comp.dialogue_node"]
|
self.dialogueNode = uiMap["main_comp.dialogue_node"]
|
||||||
self.dialogueNode:setAnchoredPositionX(0)
|
self.dialogueNode:setAnchoredPositionX(0)
|
||||||
self.monsterSpineTopPool = {}
|
self.monsterSpineTopPool = {}
|
||||||
self.monsterSpineDownPool = {}
|
self.monsterSpineDownPool = {}
|
||||||
@ -57,21 +57,34 @@ function MainComp:init()
|
|||||||
self.monsterSmokePool = {}
|
self.monsterSmokePool = {}
|
||||||
self.startMonsterAction = true
|
self.startMonsterAction = true
|
||||||
|
|
||||||
self.fightBtn = self.uiMap["main_comp.fight_btn"]
|
self.fightBtn = uiMap["main_comp.fight_btn"]
|
||||||
-- 体力消耗
|
-- 体力消耗
|
||||||
self.fightCost = self.uiMap["main_comp.fight_btn.cost"]
|
self.fightCost = uiMap["main_comp.fight_btn.cost"]
|
||||||
self.costTxDesc = self.uiMap["main_comp.fight_btn.cost.tx_desc"]
|
self.costTxCost = uiMap["main_comp.fight_btn.cost.tx_cost"]
|
||||||
self.costTxCost = self.uiMap["main_comp.fight_btn.cost.tx_cost"]
|
|
||||||
-- 按钮文本
|
-- 按钮文本
|
||||||
self.txFight = self.uiMap["main_comp.fight_btn.tx_desc"]
|
self.txFight = uiMap["main_comp.fight_btn.tx_desc"]
|
||||||
self.fightBtn:addClickListener(function ()
|
self.fightBtn:addClickListener(function ()
|
||||||
ModuleManager.ChapterManager:startFight()
|
ModuleManager.ChapterManager:startFight()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self.uiMap["main_comp.arena_btn"]:addClickListener(function()
|
self.chapterMiddleBg = uiMap["main_comp.middle_bg"]
|
||||||
|
self.chapterTx = uiMap["main_comp.middle_bg.chapter_tx"]
|
||||||
|
self.chapterMaxTx = uiMap["main_comp.middle_bg.max_tx"]
|
||||||
|
self.chapterInfoBtn = uiMap["main_comp.middle_bg.info_btn"]
|
||||||
|
self.chapterBoxBtn = uiMap["main_comp.middle_bg.box_btn"]
|
||||||
|
self.chapterPageBtns = {}
|
||||||
|
self.chapterPageBtnCheckImgs = {}
|
||||||
|
self.chapterPageBtnDescTxs = {}
|
||||||
|
for i = 1, 5 do
|
||||||
|
self.chapterPageBtns[i] = uiMap["main_comp.middle_bg.page_btn_" .. i]
|
||||||
|
self.chapterPageBtnCheckImgs[i] = uiMap["main_comp.middle_bg.page_btn_" .. i .. ".check_img"]
|
||||||
|
self.chapterPageBtnDescTxs[i] = uiMap["main_comp.middle_bg.page_btn_" .. i .. ".desc_tx"]
|
||||||
|
end
|
||||||
|
|
||||||
|
uiMap["main_comp.arena_btn"]:addClickListener(function()
|
||||||
ModuleManager.ArenaManager:reqArenaInfo(true)
|
ModuleManager.ArenaManager:reqArenaInfo(true)
|
||||||
end)
|
end)
|
||||||
self.uiMap["main_comp.daily_challenge_btn"]:addClickListener(function()
|
uiMap["main_comp.daily_challenge_btn"]:addClickListener(function()
|
||||||
ModuleManager.DailyChallengeManager:showDailyChallengeUI()
|
ModuleManager.DailyChallengeManager:showDailyChallengeUI()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@ -83,6 +96,67 @@ end
|
|||||||
function MainComp:refreshChapter(force)
|
function MainComp:refreshChapter(force)
|
||||||
local chapterId = DataManager.ChapterData:getChapterId()
|
local chapterId = DataManager.ChapterData:getChapterId()
|
||||||
if self.currChapterId ~= chapterId or force then
|
if self.currChapterId ~= chapterId or force then
|
||||||
|
self:refreshChapterInfo()
|
||||||
|
self:refreshFightBtn()
|
||||||
|
self:doBossAction()
|
||||||
|
end
|
||||||
|
self:doChapterMove()
|
||||||
|
self:doMonsterAction()
|
||||||
|
end
|
||||||
|
|
||||||
|
function MainComp:onOpen()
|
||||||
|
self.startMonsterAction = true
|
||||||
|
if self.bossNode then
|
||||||
|
self.bossNode:setAnchoredPositionX(0)
|
||||||
|
end
|
||||||
|
-- if self.bossShadow then
|
||||||
|
-- self.bossShadow:setAnchoredPositionX(0)
|
||||||
|
-- end
|
||||||
|
if self.dialogueNode then
|
||||||
|
self.dialogueNode:setAnchoredPositionX(0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function MainComp:onClose()
|
||||||
|
if self.chapterMoveSeq then
|
||||||
|
self.chapterMoveSeq:Kill()
|
||||||
|
self.chapterMoveSeq = nil
|
||||||
|
end
|
||||||
|
if self.chapterMonsterGenerateSeq then
|
||||||
|
self.chapterMonsterGenerateSeq:Kill()
|
||||||
|
self.chapterMonsterGenerateSeq = nil
|
||||||
|
end
|
||||||
|
self.currChapterId = nil
|
||||||
|
self.isTopTurn = nil
|
||||||
|
self.startMonsterAction = false
|
||||||
|
GFunc.killDOTween(GConst.DOTWEEN_IDS.CHAPTER_MONSTER)
|
||||||
|
self.monsterSpineTopPool = {}
|
||||||
|
self.monsterSpineDownPool = {}
|
||||||
|
self.monsterSpineTopList = {}
|
||||||
|
self.monsterSpineDownList = {}
|
||||||
|
-- self.monsterShadowPool = {}
|
||||||
|
self.monsterSmokePool = {}
|
||||||
|
self.monsterNodeTop:removeAllChildren()
|
||||||
|
self.monsterNodeDown:removeAllChildren()
|
||||||
|
-- self.shadowNode:removeAllChildren()
|
||||||
|
self.smokeNodeTop:removeAllChildren()
|
||||||
|
self.smokeNodeDown:removeAllChildren()
|
||||||
|
end
|
||||||
|
|
||||||
|
function MainComp:refreshFightBtn()
|
||||||
|
-- 体力消耗
|
||||||
|
local cost = DataManager.ChapterData:getFightCost()
|
||||||
|
self.fightCost:setActive(true)
|
||||||
|
self.txFight:setText(I18N:getGlobalText(I18N.GlobalConst.START_DESC))
|
||||||
|
self.costTxCost:setText(GFunc.getRewardNum(cost))
|
||||||
|
end
|
||||||
|
|
||||||
|
function MainComp:refreshChapterInfo()
|
||||||
|
local chapterId = DataManager.ChapterData:getChapterId()
|
||||||
|
end
|
||||||
|
|
||||||
|
function MainComp:refreshChapterInfo2()
|
||||||
|
local chapterId = DataManager.ChapterData:getChapterId()
|
||||||
if DataManager.ChapterData:getIsFirstChapter(chapterId) then -- 第一章不需要左箭头
|
if DataManager.ChapterData:getIsFirstChapter(chapterId) then -- 第一章不需要左箭头
|
||||||
self.leftArrow:setVisible(false)
|
self.leftArrow:setVisible(false)
|
||||||
self.rightArrow:setVisible(DataManager.ChapterData:getMaxChapterId() >= 1)
|
self.rightArrow:setVisible(DataManager.ChapterData:getMaxChapterId() >= 1)
|
||||||
@ -118,28 +192,28 @@ function MainComp:refreshChapter(force)
|
|||||||
end
|
end
|
||||||
self.chapterWavetx:setText(I18N:getGlobalText(I18N.GlobalConst.CHAPTER_DESC_1, DataManager.ChapterData:getChapterMaxWave()))
|
self.chapterWavetx:setText(I18N:getGlobalText(I18N.GlobalConst.CHAPTER_DESC_1, DataManager.ChapterData:getChapterMaxWave()))
|
||||||
|
|
||||||
local slider = self.uiMap["main_comp.progress_bg.slider"]
|
local slider = uiMap["main_comp.progress_bg.slider"]
|
||||||
if not self.boxObjs then
|
if not self.boxObjs then
|
||||||
self.boxObjs = {}
|
self.boxObjs = {}
|
||||||
for i = 1, 3 do
|
for i = 1, 3 do
|
||||||
self.boxObjs[i] = {
|
self.boxObjs[i] = {
|
||||||
box = self.uiMap["main_comp.progress_bg.box_" .. i],
|
box = uiMap["main_comp.progress_bg.box_" .. i],
|
||||||
desc = self.uiMap["main_comp.progress_bg.box_desc_" .. i],
|
desc = uiMap["main_comp.progress_bg.box_desc_" .. i],
|
||||||
spineObj = self.uiMap["main_comp.progress_bg.spine_node.ui_spine_obj_" .. i],
|
spineObj = uiMap["main_comp.progress_bg.spine_node.ui_spine_obj_" .. i],
|
||||||
boxIcon = self.uiMap["main_comp.progress_bg.box_" .. i .. ".box_icon"]
|
boxIcon = uiMap["main_comp.progress_bg.box_" .. i .. ".box_icon"]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local mysteryBoxCount = DataManager.ChapterData:getChapterMysteryBoxRewardCount(chapterId)
|
local mysteryBoxCount = DataManager.ChapterData:getChapterMysteryBoxRewardCount(chapterId)
|
||||||
local mysteryBoxBg = self.uiMap["main_comp.img.bg"]
|
local mysteryBoxBg = uiMap["main_comp.img.bg"]
|
||||||
mysteryBoxBg:setVisible(mysteryBoxCount > 0)
|
mysteryBoxBg:setVisible(mysteryBoxCount > 0)
|
||||||
local mysteryBoxIcon = self.uiMap["main_comp.img.mystery_box_icon"]
|
local mysteryBoxIcon = uiMap["main_comp.img.mystery_box_icon"]
|
||||||
mysteryBoxIcon:setVisible(mysteryBoxCount > 0)
|
mysteryBoxIcon:setVisible(mysteryBoxCount > 0)
|
||||||
if mysteryBoxCount > 0 then
|
if mysteryBoxCount > 0 then
|
||||||
local gotCount = DataManager.ChapterData:getChapterMysteryBoxGotCount(chapterId)
|
local gotCount = DataManager.ChapterData:getChapterMysteryBoxGotCount(chapterId)
|
||||||
local desc = I18N:getGlobalText(I18N.GlobalConst.CHAPTER_DESC_2, gotCount, mysteryBoxCount)
|
local desc = I18N:getGlobalText(I18N.GlobalConst.CHAPTER_DESC_2, gotCount, mysteryBoxCount)
|
||||||
self.uiMap["main_comp.img.mystery_box_icon.desc"]:setText(desc)
|
uiMap["main_comp.img.mystery_box_icon.desc"]:setText(desc)
|
||||||
end
|
end
|
||||||
|
|
||||||
local rewardChapterId = DataManager.ChapterData:getIsHaveRewardsMinId()
|
local rewardChapterId = DataManager.ChapterData:getIsHaveRewardsMinId()
|
||||||
@ -207,59 +281,6 @@ function MainComp:refreshChapter(force)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:refreshFightBtn()
|
|
||||||
self:doBossAction()
|
|
||||||
end
|
|
||||||
self:doChapterMove()
|
|
||||||
self:doMonsterAction()
|
|
||||||
end
|
|
||||||
|
|
||||||
function MainComp:onOpen()
|
|
||||||
self.startMonsterAction = true
|
|
||||||
if self.bossNode then
|
|
||||||
self.bossNode:setAnchoredPositionX(0)
|
|
||||||
end
|
|
||||||
-- if self.bossShadow then
|
|
||||||
-- self.bossShadow:setAnchoredPositionX(0)
|
|
||||||
-- end
|
|
||||||
if self.dialogueNode then
|
|
||||||
self.dialogueNode:setAnchoredPositionX(0)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function MainComp:onClose()
|
|
||||||
if self.chapterMoveSeq then
|
|
||||||
self.chapterMoveSeq:Kill()
|
|
||||||
self.chapterMoveSeq = nil
|
|
||||||
end
|
|
||||||
if self.chapterMonsterGenerateSeq then
|
|
||||||
self.chapterMonsterGenerateSeq:Kill()
|
|
||||||
self.chapterMonsterGenerateSeq = nil
|
|
||||||
end
|
|
||||||
self.currChapterId = nil
|
|
||||||
self.isTopTurn = nil
|
|
||||||
self.startMonsterAction = false
|
|
||||||
GFunc.killDOTween(GConst.DOTWEEN_IDS.CHAPTER_MONSTER)
|
|
||||||
self.monsterSpineTopPool = {}
|
|
||||||
self.monsterSpineDownPool = {}
|
|
||||||
self.monsterSpineTopList = {}
|
|
||||||
self.monsterSpineDownList = {}
|
|
||||||
-- self.monsterShadowPool = {}
|
|
||||||
self.monsterSmokePool = {}
|
|
||||||
self.monsterNodeTop:removeAllChildren()
|
|
||||||
self.monsterNodeDown:removeAllChildren()
|
|
||||||
-- self.shadowNode:removeAllChildren()
|
|
||||||
self.smokeNodeTop:removeAllChildren()
|
|
||||||
self.smokeNodeDown:removeAllChildren()
|
|
||||||
end
|
|
||||||
|
|
||||||
function MainComp:refreshFightBtn()
|
|
||||||
-- 体力消耗
|
|
||||||
local cost = DataManager.ChapterData:getFightCost()
|
|
||||||
self.fightCost:setActive(true)
|
|
||||||
self.costTxDesc:setText(I18N:getGlobalText(I18N.GlobalConst.START_DESC))
|
|
||||||
self.costTxCost:setText(GFunc.getRewardNum(cost))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- region 动画
|
-- region 动画
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user