Files
StellaSora_DataLua/lua/game/ui/mainlineex/mainlinechapterpage1.lua
T
SL1900 5e0d58cfad Initial version - 1.2.0.60
EN: 1.2.0.60
CN: 1.2.0.61
JP: 1.2.0.63
KR: 1.2.0.67
2025-12-03 01:00:00 +09:00

69 lines
1.9 KiB
Lua

local MainlineChapterPage1 = class("MainlineChapterPage1", BaseCtrl)
local tbAllChapter = {
1,
2,
3,
4,
5
}
local mapColor = {
[true] = Color()
}
MainlineChapterPage1._mapNodeConfig = {
Chapter = {
nCount = 5,
sCtrlName = "Game.UI.MainlineEx.MainlineChapter"
},
Trail_ = {nCount = 5},
Zs = {nCount = 5}
}
MainlineChapterPage1._mapEventConfig = {
SelectChapter = "OnEvent_SelectChapter"
}
function MainlineChapterPage1:Awake()
end
function MainlineChapterPage1:FadeOut(callback)
if type(callback) == "function" then
callback()
end
end
function MainlineChapterPage1:OnEnable()
end
function MainlineChapterPage1:OnDisable()
end
function MainlineChapterPage1:OnDestroy()
end
function MainlineChapterPage1:OnRelease()
end
function MainlineChapterPage1:Init(tbChapter, curChapter)
self.tbChapter = tbChapter
for i, ChapterIdx in ipairs(tbAllChapter) do
if self.tbChapter[ChapterIdx] == nil then
self._mapNode.Chapter[i]:Init()
self._mapNode.Zs[i]:SetActive(false)
else
self._mapNode.Chapter[i]:Init(self.tbChapter[ChapterIdx].nId)
self._mapNode.Chapter[i]:SetUnlock(self.tbChapter[ChapterIdx].bUnlock)
self._mapNode.Chapter[i]:SetCur(self.tbChapter[ChapterIdx].nId == curChapter)
self._mapNode.Chapter[i]:SetSelect(self.tbChapter[ChapterIdx].nId == curChapter)
self._mapNode.Chapter[i]:SetComplete(self.tbChapter[ChapterIdx].bComplete)
self._mapNode.Zs[i]:SetActive(self.tbChapter[ChapterIdx].bUnlock)
if self.tbChapter[ChapterIdx].nId == curChapter then
self.curIdx = i
end
end
end
end
function MainlineChapterPage1:OnEvent_SelectChapter(nChapter)
for i, ChapterIdx in ipairs(tbAllChapter) do
if self.tbChapter[ChapterIdx] ~= nil and self.tbChapter[ChapterIdx].nId == nChapter then
if self.curIdx ~= 0 then
self._mapNode.Chapter[self.curIdx]:SetSelect(false)
end
self._mapNode.Chapter[i]:SetSelect(true)
self.curIdx = i
end
end
end
return MainlineChapterPage1