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
This commit is contained in:
@@ -0,0 +1,232 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local AvgData = PlayerData.Avg
|
||||
local StoryEntranceCtrl = class("StoryEntranceCtrl", BaseCtrl)
|
||||
StoryEntranceCtrl._mapNodeConfig = {
|
||||
btnMainline = {
|
||||
sNodeName = "btnMainline",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickMainline"
|
||||
},
|
||||
btnNovaStory = {
|
||||
sNodeName = "btnNovaStory",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickNovaStory"
|
||||
},
|
||||
btnActivity = {
|
||||
sNodeName = "btnActivity",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivity"
|
||||
},
|
||||
txtMainlineTilte = {
|
||||
sNodeName = "txtMainlineTilte",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldMap_MainLine_Avg"
|
||||
},
|
||||
txtCurMainline = {
|
||||
sNodeName = "txtCurMainline",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Continue_MainlineStory"
|
||||
},
|
||||
txtNovaStoryTilte = {
|
||||
sNodeName = "txtNovaStoryTilte",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Nova_Story"
|
||||
},
|
||||
txtCurNovaStory = {
|
||||
sNodeName = "txtCurNovaStory",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Nova_Story_Desc"
|
||||
},
|
||||
txtActivityTilte = {
|
||||
sNodeName = "txtActivityTilte",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Review"
|
||||
},
|
||||
txtActivity = {
|
||||
sNodeName = "txtActivity",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Previous_Activity_Plot"
|
||||
},
|
||||
btnMainlineQuickEntrance = {
|
||||
sNodeName = "btnMainlineQuickEntrance",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickMainlineQuickEntrance"
|
||||
},
|
||||
txtMainlineQuickTitle = {
|
||||
sNodeName = "txtMainlineQuickTitle",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainLine_Progress"
|
||||
},
|
||||
imgMainlinceChapterBg = {
|
||||
sNodeName = "imgMainlinceChapterBg",
|
||||
sComponentName = "Image"
|
||||
},
|
||||
txtMainlineChapter = {
|
||||
sNodeName = "txtMainlineChapter",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtRecentStoryQuickTitle = {
|
||||
sNodeName = "txtRecentStoryQuickTitle",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Continue_Reading"
|
||||
},
|
||||
btnRecentStoryQuickEntrance = {
|
||||
sNodeName = "btnRecentStoryQuickEntrance",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickRecentStoryQuickEntrance"
|
||||
},
|
||||
goRecentStory = {
|
||||
sNodeName = "goRecentStory",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
goNoStory = {sNodeName = "goNoStory", sComponentName = "GameObject"},
|
||||
imgRecentStoryBg = {
|
||||
sNodeName = "imgRecentStoryBg",
|
||||
sComponentName = "Image"
|
||||
},
|
||||
txtRecentStoryTitle = {
|
||||
sNodeName = "txtRecentStoryTitle",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtNoProgress = {
|
||||
sNodeName = "txtNoProgress",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "No_Progress_Yet"
|
||||
},
|
||||
txtActivityQuickTitle = {
|
||||
sNodeName = "txtActivityQuickTitle",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Latest_Release"
|
||||
},
|
||||
btnActivityQuickEntrance = {
|
||||
sNodeName = "btnActivityQuickEntrance",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivityQuickEntrance"
|
||||
},
|
||||
goActivityStory = {
|
||||
sNodeName = "goActivityStory",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
goNoActivity = {
|
||||
sNodeName = "goNoActivity",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
imgActivityStoryBg = {
|
||||
sNodeName = "imgActivityStoryBg",
|
||||
sComponentName = "Image"
|
||||
},
|
||||
txtActivityStoryTitle = {
|
||||
sNodeName = "txtActivityStoryTitle",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtComingSoon = {
|
||||
sNodeName = "txtComingSoon",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RegusBoss_NotOpenItem"
|
||||
},
|
||||
btnBack = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickBack"
|
||||
},
|
||||
btnHome = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickHome"
|
||||
},
|
||||
redDotNovaStory = {},
|
||||
redDotMainline = {}
|
||||
}
|
||||
StoryEntranceCtrl._mapEventConfig = {}
|
||||
StoryEntranceCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.Story_Set] = {
|
||||
sNodeName = "redDotNovaStory"
|
||||
},
|
||||
[RedDotDefine.Map_MainLine_Entrance] = {
|
||||
sNodeName = "redDotMainline"
|
||||
}
|
||||
}
|
||||
function StoryEntranceCtrl:Awake()
|
||||
local callback = function()
|
||||
self.bHasAchievementData = true
|
||||
end
|
||||
PlayerData.Achievement:SendAchievementInfoReq(callback)
|
||||
end
|
||||
function StoryEntranceCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function StoryEntranceCtrl:OnEnable()
|
||||
self.bHasActivityStorys = false
|
||||
self.bHasNovaStorys = false
|
||||
self:RefreshMainlineQuickEntranceState()
|
||||
self:RefreshRecentStoryQuickEntranceState()
|
||||
self:RefreshComingSoonState()
|
||||
end
|
||||
function StoryEntranceCtrl:OnDisable()
|
||||
end
|
||||
function StoryEntranceCtrl:RefreshMainlineQuickEntranceState()
|
||||
local curChapter = AvgData:GetRecentChapterId()
|
||||
local curStoryId = AvgData:GetRecentStoryId(curChapter)
|
||||
local storConfig = ConfigTable.GetData_Story(curStoryId)
|
||||
if storConfig.IsLast == true and AvgData:IsStoryReaded(curStoryId) == true then
|
||||
curChapter = curChapter + 1
|
||||
if ConfigTable.GetData("StoryChapter", curChapter, "") ~= nil then
|
||||
curStoryId = AvgData:GetRecentStoryId(curChapter)
|
||||
else
|
||||
curChapter = curChapter - 1
|
||||
end
|
||||
end
|
||||
local chapterConfig = ConfigTable.GetData("StoryChapter", curChapter, "")
|
||||
local storyConfig = ConfigTable.GetData_Story(curStoryId)
|
||||
local title = chapterConfig.Name .. " " .. storyConfig.Index
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMainlineChapter, title)
|
||||
self:SetPngSprite(self._mapNode.imgMainlinceChapterBg, "UI/big_sprites/banner_avg_chapter" .. curChapter)
|
||||
self.curChapter = curChapter
|
||||
self.curStoryId = curStoryId
|
||||
end
|
||||
function StoryEntranceCtrl:RefreshRecentStoryQuickEntranceState()
|
||||
local bHasRecentStory = false
|
||||
self._mapNode.goRecentStory:SetActive(bHasRecentStory)
|
||||
self._mapNode.goNoStory:SetActive(not bHasRecentStory)
|
||||
end
|
||||
function StoryEntranceCtrl:RefreshComingSoonState()
|
||||
local bHasActivity = false
|
||||
self._mapNode.goActivityStory:SetActive(bHasActivity)
|
||||
self._mapNode.goNoActivity:SetActive(not bHasActivity)
|
||||
end
|
||||
function StoryEntranceCtrl:OnBtn_ClickMainline()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StoryChapter)
|
||||
end
|
||||
function StoryEntranceCtrl:OnBtn_ClickNovaStory()
|
||||
PlayerData.StorySet:TryOpenStorySetPanel(function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StorySet)
|
||||
end)
|
||||
end
|
||||
function StoryEntranceCtrl:OnBtn_ClickActivity()
|
||||
if not self.bHasActivityStorys then
|
||||
local data = {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("NotHave_Story_WaitUpdate"),
|
||||
sContentSub = ""
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, data)
|
||||
return
|
||||
end
|
||||
end
|
||||
function StoryEntranceCtrl:OnBtn_ClickMainlineQuickEntrance()
|
||||
local isUnlock, lockText = PlayerData.Avg:IsStoryChapterUnlock(self.curChapter)
|
||||
if not isUnlock then
|
||||
EventManager.Hit(EventId.OpenMessageBox, lockText)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MainlineEx, self.curChapter)
|
||||
end
|
||||
end
|
||||
function StoryEntranceCtrl:OnBtn_ClickRecentStoryQuickEntrance()
|
||||
end
|
||||
function StoryEntranceCtrl:OnBtn_ClickActivityQuickEntrance()
|
||||
end
|
||||
function StoryEntranceCtrl:OnBtn_ClickHome()
|
||||
PanelManager.Home()
|
||||
end
|
||||
function StoryEntranceCtrl:OnBtn_ClickBack()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.StoryEntrance)
|
||||
end
|
||||
return StoryEntranceCtrl
|
||||
Reference in New Issue
Block a user