主城箭头
This commit is contained in:
parent
f73980c7de
commit
e136291098
@ -17,13 +17,15 @@ function MainComp:initChapter()
|
|||||||
self.chapterImg = self.uiMap["main_comp.chapter.img"]
|
self.chapterImg = self.uiMap["main_comp.chapter.img"]
|
||||||
self.chapterNameTx = self.uiMap["main_comp.chapter.name_tx"]
|
self.chapterNameTx = self.uiMap["main_comp.chapter.name_tx"]
|
||||||
self.leftArrow = self.uiMap["main_comp.chapter.left_arrow"]
|
self.leftArrow = self.uiMap["main_comp.chapter.left_arrow"]
|
||||||
self.leftArrow:addClickListener(function()
|
local leftArrowBtn = self.uiMap["main_comp.chapter.left_arrow.btn"]
|
||||||
|
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.chapter.right_arrow"]
|
self.rightArrow = self.uiMap["main_comp.chapter.right_arrow"]
|
||||||
self.rightArrow:addClickListener(function()
|
local rightArrowBtn = self.uiMap["main_comp.chapter.right_arrow.btn"]
|
||||||
|
rightArrowBtn:addClickListener(function()
|
||||||
if DataManager.ChapterData:goNextChapter() then
|
if DataManager.ChapterData:goNextChapter() then
|
||||||
self:refresh()
|
self:refresh()
|
||||||
end
|
end
|
||||||
@ -64,6 +66,17 @@ 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
|
||||||
|
if DataManager.ChapterData:getIsFirstChapter(chapterId) then
|
||||||
|
self.leftArrow:setVisible(false)
|
||||||
|
self.rightArrow:setVisible(true)
|
||||||
|
elseif DataManager.ChapterData:getIsFinalChapter(chapterId) then
|
||||||
|
self.leftArrow:setVisible(true)
|
||||||
|
self.rightArrow:setVisible(false)
|
||||||
|
else
|
||||||
|
self.leftArrow:setVisible(true)
|
||||||
|
self.rightArrow:setVisible(true)
|
||||||
|
end
|
||||||
|
|
||||||
self.currChapterId = chapterId
|
self.currChapterId = chapterId
|
||||||
local chapterInfo = ConfigManager:getConfig("chapter")[chapterId]
|
local chapterInfo = ConfigManager:getConfig("chapter")[chapterId]
|
||||||
local chapterI18NInfo = I18N:getConfig("chapter")[chapterId]
|
local chapterI18NInfo = I18N:getConfig("chapter")[chapterId]
|
||||||
|
|||||||
@ -26,6 +26,22 @@ function ChapterData:init(data, notChangeChapterId)
|
|||||||
self.data.chapterFightInfo = data and data.chapterFightInfo or {}
|
self.data.chapterFightInfo = data and data.chapterFightInfo or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ChapterData:getIsFirstChapter(chapterId)
|
||||||
|
return chapterId == MIN_CHAPTER_ID
|
||||||
|
end
|
||||||
|
|
||||||
|
function ChapterData:getIsFinalChapter(chapterId)
|
||||||
|
local chapterInfo = self:getChapterCfg()[chapterId]
|
||||||
|
if chapterInfo == nil then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local chapterId = chapterInfo.next_chapter
|
||||||
|
if chapterId == nil then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
function ChapterData:setDirty()
|
function ChapterData:setDirty()
|
||||||
self.data.isDirty = not self.data.isDirty
|
self.data.isDirty = not self.data.isDirty
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user