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,689 @@
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ChapterLineCtrl = class("ChapterLineCtrl", BaseCtrl)
|
||||
local AvgData = PlayerData.Avg
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
ChapterLineCtrl._mapNodeConfig = {
|
||||
tranContent = {
|
||||
sNodeName = "Content",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
scrollRect = {
|
||||
sNodeName = "Scroll View",
|
||||
sComponentName = "ScrollRect"
|
||||
},
|
||||
imgMask = {
|
||||
sNodeName = "ImgMask",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goImgMaskRoot = {}
|
||||
}
|
||||
ChapterLineCtrl._mapEventConfig = {
|
||||
Story_RewardClosed = "OnEvent_Story_RewardClosed",
|
||||
Story_Done = "OnEvent_Story_Done"
|
||||
}
|
||||
local UnlockConditionPriority = {
|
||||
[1] = "MustStoryIds",
|
||||
[2] = "OneofStoryIds",
|
||||
[3] = "MustEvIds",
|
||||
[4] = "OneofEvIds",
|
||||
[5] = "WorldLevel",
|
||||
[6] = "MustAchievementIds"
|
||||
}
|
||||
function ChapterLineCtrl:Awake()
|
||||
local callback = function()
|
||||
self.bHasAchievementData = true
|
||||
end
|
||||
PlayerData.Achievement:SendAchievementInfoReq(callback)
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.curChapter = tbParam[1]
|
||||
self.curTimeStamp = 0
|
||||
self.tbImgFocusNode = {}
|
||||
self.tbLockedPlayedAnim = {}
|
||||
self.lineAnimTime = 0.14
|
||||
self.tbBranchGrid = {}
|
||||
self.tbLockedBranchGrid = {}
|
||||
self:CacheCurChapterConfig()
|
||||
self:CacheChapterBranchNode()
|
||||
self:Refresh()
|
||||
self:AddTimer(1, 0.5, function()
|
||||
if self.bNeedPlayUnlockAnim or self.bNeedPlayBranchAnim then
|
||||
if self.bNeedPlayBranchAnim then
|
||||
self.curShouldPlayDepth = self.tbNeedPlayUnlockAnimGird[1].depth
|
||||
end
|
||||
self:DoPlayUnlockAnim(self.curShouldPlayDepth)
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
function ChapterLineCtrl:RefreshFocusNode()
|
||||
self.tbFocusNode = {}
|
||||
self.bFocusLastNode = false
|
||||
local tbNewNodes = AvgData:CheckNewStory(self.curChapter)
|
||||
for k, v in pairs(tbNewNodes) do
|
||||
if v == true then
|
||||
table.insert(self.tbFocusNode, k)
|
||||
end
|
||||
end
|
||||
if #self.tbFocusNode == 0 then
|
||||
local firstNode = self._mapNode.tranContent:GetChild(1):Find("goGrid"):GetChild(0)
|
||||
local avgId = firstNode.name
|
||||
local storyConfig = AvgData:GetStoryCfgData(avgId)
|
||||
if not AvgData:IsStoryReaded(storyConfig.Id) then
|
||||
table.insert(self.tbFocusNode, storyConfig.Id)
|
||||
else
|
||||
self.bFocusLastNode = true
|
||||
table.insert(self.tbFocusNode, AvgData:GetRecentStoryId(self.curChapter))
|
||||
end
|
||||
end
|
||||
self.bNeedPlayUnlockAnim = false
|
||||
self.bNeedPlayBranchAnim = false
|
||||
for k, v in ipairs(self.tbFocusNode) do
|
||||
local storyConfig = ConfigTable.GetData_Story(v)
|
||||
local bHasPlayedAnim = LocalData.GetPlayerLocalData("MainlineUnlock_" .. v)
|
||||
if bHasPlayedAnim == nil or tonumber(bHasPlayedAnim) == 0 then
|
||||
if storyConfig.IsBranch == true then
|
||||
self.bNeedPlayBranchAnim = true
|
||||
break
|
||||
end
|
||||
self.bNeedPlayUnlockAnim = true
|
||||
break
|
||||
end
|
||||
local avgId = storyConfig.StoryId
|
||||
if 0 < table.indexof(self.tbLockedBranchGrid, avgId) and self.tbBranch[avgId] ~= nil then
|
||||
for _, branchGrid in ipairs(self.tbBranch[avgId]) do
|
||||
local bUnlock = AvgData:IsUnlock(branchGrid.ConditionId)
|
||||
if bUnlock then
|
||||
self.bNeedPlayBranchAnim = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ChapterLineCtrl:Refresh()
|
||||
self._mapNode.goImgMaskRoot.transform:SetParent(self._mapNode.tranContent)
|
||||
self._mapNode.goImgMaskRoot.transform:SetAsFirstSibling()
|
||||
self:RefreshFocusNode()
|
||||
self.tbGridList = {}
|
||||
self.tbTimeStampList = {}
|
||||
self.tbDepthLockCount = {}
|
||||
self.maxUnlockDepth = 1
|
||||
self.maxStoryDepth = 1
|
||||
for i = 1, self._mapNode.tranContent.childCount - 1 do
|
||||
local gridRoot = self._mapNode.tranContent:GetChild(i):Find("goGrid")
|
||||
local goTimeStamp = self._mapNode.tranContent:GetChild(i):Find("goTimeStamp")
|
||||
self.tbDepthLockCount[i] = {
|
||||
Node = self._mapNode.tranContent:GetChild(i),
|
||||
ChildCount = gridRoot.childCount,
|
||||
DisableCount = 0
|
||||
}
|
||||
for j = 1, gridRoot.childCount do
|
||||
local goGrid = gridRoot:GetChild(j - 1)
|
||||
local avgId = goGrid.name
|
||||
table.insert(self.tbGridList, {
|
||||
avgId = avgId,
|
||||
grid = goGrid,
|
||||
depth = i
|
||||
})
|
||||
local storyConfig = AvgData:GetStoryCfgData(avgId)
|
||||
local bUnlock = AvgData:IsUnlock(storyConfig.ConditionId)
|
||||
if i > self.maxStoryDepth then
|
||||
self.maxStoryDepth = i
|
||||
end
|
||||
if bUnlock and i > self.maxUnlockDepth then
|
||||
self.maxUnlockDepth = i
|
||||
end
|
||||
end
|
||||
table.insert(self.tbTimeStampList, goTimeStamp)
|
||||
end
|
||||
table.sort(self.tbGridList, function(a, b)
|
||||
return a.depth < b.depth
|
||||
end)
|
||||
self:RefreshUnlockAnimList()
|
||||
for k, v in ipairs(self.tbGridList) do
|
||||
self:RefreshGrid(v.grid, v.depth)
|
||||
end
|
||||
for i = 1, #self.tbTimeStampList do
|
||||
self:RefreshTimeStamp(self.tbTimeStampList[i], i)
|
||||
end
|
||||
self:AddTimer(1, 0.1, function()
|
||||
self._mapNode.scrollRect.horizontalNormalizedPosition = (self.curTimeStamp - 1) * 250
|
||||
end, true, true, true)
|
||||
if 0 > self.curTimeStamp - 1 then
|
||||
self._mapNode.imgMask.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.imgMask.gameObject:SetActive(true)
|
||||
self._mapNode.imgMask.anchoredPosition = Vector2((self.curTimeStamp - 0.5) * 512, -6)
|
||||
end
|
||||
end
|
||||
function ChapterLineCtrl:RefreshGrid(goGrid, gridDepth)
|
||||
local avgId = goGrid.name
|
||||
local storyConfig = AvgData:GetStoryCfgData(avgId)
|
||||
local bUnlock = AvgData:IsUnlock(storyConfig.ConditionId)
|
||||
local goLeftBorder = goGrid:Find("goLeftBorder")
|
||||
local bAllLock = 1 < gridDepth and true or false
|
||||
for i = 1, #storyConfig.ParentStoryId do
|
||||
local parentConfig = AvgData:GetStoryCfgData(storyConfig.ParentStoryId[i])
|
||||
local parentUnlock = AvgData:IsUnlock(parentConfig.ConditionId)
|
||||
if parentUnlock then
|
||||
bAllLock = false
|
||||
end
|
||||
end
|
||||
if bAllLock then
|
||||
self.tbDepthLockCount[gridDepth].DisableCount = self.tbDepthLockCount[gridDepth].DisableCount + 1
|
||||
end
|
||||
self.tbDepthLockCount[gridDepth].Node.gameObject:SetActive(self.tbDepthLockCount[gridDepth].DisableCount < self.tbDepthLockCount[gridDepth].ChildCount)
|
||||
local allParentDepthLock = true
|
||||
if self.tbDepthLockCount[gridDepth - 1] ~= nil and self.tbDepthLockCount[gridDepth - 1] ~= nil then
|
||||
allParentDepthLock = self.tbDepthLockCount[gridDepth - 1].DisableCount == self.tbDepthLockCount[gridDepth - 1].ChildCount
|
||||
end
|
||||
local bNeedPlayUnlockAnim = false
|
||||
for k, v in ipairs(self.tbNeedPlayUnlockAnimGird) do
|
||||
if v.avgId == avgId then
|
||||
bNeedPlayUnlockAnim = true
|
||||
break
|
||||
end
|
||||
end
|
||||
local bPlayedLockAnim = table.indexof(self.tbLockedPlayedAnim, avgId) > 0
|
||||
goGrid.gameObject:SetActive((not bAllLock or not allParentDepthLock) and not bNeedPlayUnlockAnim or bPlayedLockAnim)
|
||||
local bReaded = AvgData:IsStoryReaded(storyConfig.Id)
|
||||
local btnEnter = goGrid:Find("btnEnter"):GetComponent("UIButton")
|
||||
local NormalRoot = btnEnter.transform:Find("AnimRoot/NormalRoot")
|
||||
local BattleRoot = btnEnter.transform:Find("AnimRoot/BattleRoot")
|
||||
local BranchRoot = goGrid:Find("BranchRoot")
|
||||
local LockRoot = btnEnter.transform:Find("AnimRoot/LockRoot")
|
||||
local imgClue = goGrid:Find("imgClue")
|
||||
local lineContinue = goGrid:Find("lineContinue")
|
||||
local goRightBorder = goGrid:Find("goRightBorder")
|
||||
local txtUnlock = LockRoot:Find("txtUnlock"):GetComponent("TMP_Text")
|
||||
local cgComp = storyConfig.IsBattle and NormalRoot:GetComponent("CanvasGroup") or BattleRoot:GetComponent("CanvasGroup")
|
||||
NovaAPI.SetCanvasGroupAlpha(cgComp, bUnlock and 1 or 0.5)
|
||||
LockRoot.gameObject:SetActive(not bUnlock or bPlayedLockAnim)
|
||||
imgClue.gameObject:SetActive(storyConfig.HasEvidence and bUnlock and not bReaded)
|
||||
local bShowLineContinue = not bUnlock and gridDepth > self.maxUnlockDepth
|
||||
lineContinue.gameObject:SetActive(bShowLineContinue)
|
||||
local rootTrans = storyConfig.IsBattle and BattleRoot or NormalRoot
|
||||
rootTrans.gameObject:SetActive(bUnlock)
|
||||
local imgFocus = rootTrans:Find("imgFocus")
|
||||
local RedDot = rootTrans:Find("RedDot")
|
||||
local bFocus = 0 < table.indexof(self.tbFocusNode, storyConfig.Id) and (not bReaded or self.bFocusLastNode)
|
||||
imgFocus.gameObject:SetActive(bFocus and not bPlayedLockAnim)
|
||||
RedDot.gameObject:SetActive(bFocus and not bReaded and not bPlayedLockAnim)
|
||||
if self.tbBranch[avgId] ~= nil then
|
||||
for k, v in ipairs(self.tbBranch[avgId]) do
|
||||
if 0 < table.indexof(self.tbFocusNode, v.Id) then
|
||||
bFocus = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if bFocus then
|
||||
local nodeTimeStampIndex = tonumber(goGrid.transform.parent.parent.name)
|
||||
if nodeTimeStampIndex > self.curTimeStamp then
|
||||
if self.tbImgFocusNode[self.curTimeStamp] ~= nil then
|
||||
for k, v in ipairs(self.tbImgFocusNode[self.curTimeStamp]) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
self.curTimeStamp = nodeTimeStampIndex
|
||||
end
|
||||
if self.tbImgFocusNode[self.curTimeStamp] == nil then
|
||||
self.tbImgFocusNode[self.curTimeStamp] = {}
|
||||
end
|
||||
table.insert(self.tbImgFocusNode[self.curTimeStamp], imgFocus)
|
||||
end
|
||||
if bUnlock then
|
||||
local goReaded = rootTrans:Find("goReaded")
|
||||
local goNotRead = rootTrans:Find("goNotRead")
|
||||
local txtNotRead = goNotRead:Find("txtNotRead"):GetComponent("TMP_Text")
|
||||
local txtLevelName = goReaded:Find("txtLevelName"):GetComponent("TMP_Text")
|
||||
local txtLevelIndex = goReaded:Find("txtLevelIndex"):GetComponent("TMP_Text")
|
||||
local txtNewUnlock = goNotRead:Find("txtNewUnlock"):GetComponent("TMP_Text")
|
||||
goReaded.gameObject:SetActive(bReaded)
|
||||
goNotRead.gameObject:SetActive(not bReaded)
|
||||
NovaAPI.SetTMPText(txtNotRead, storyConfig.Index)
|
||||
NovaAPI.SetTMPText(txtLevelName, storyConfig.Title)
|
||||
NovaAPI.SetTMPText(txtLevelIndex, storyConfig.Index)
|
||||
NovaAPI.SetTMPText(txtNewUnlock, ConfigTable.GetUIText("Story_NewStory_Unlock"))
|
||||
if not storyConfig.IsBattle then
|
||||
local imgClueReaded = goReaded:Find("imgClueReaded")
|
||||
imgClueReaded.gameObject:SetActive(storyConfig.HasEvidence)
|
||||
end
|
||||
self:PlayUnlockAnim(rootTrans, "Empty")
|
||||
end
|
||||
NovaAPI.SetTMPText(txtUnlock, ConfigTable.GetUIText("Story_Unkown_Chapter"))
|
||||
for i = 1, goRightBorder.childCount do
|
||||
goRightBorder:GetChild(i - 1).gameObject:SetActive(not bShowLineContinue)
|
||||
end
|
||||
if self.tbBranch[avgId] ~= nil then
|
||||
if bNeedPlayUnlockAnim == false and 0 < table.indexof(self.tbLockedBranchGrid, avgId) then
|
||||
bNeedPlayUnlockAnim = true
|
||||
end
|
||||
self:RefreshBranchGrid(BranchRoot, avgId, gridDepth, bNeedPlayUnlockAnim)
|
||||
end
|
||||
btnEnter.onClick:RemoveAllListeners()
|
||||
btnEnter.onClick:AddListener(function()
|
||||
self:OnClickGrid(avgId)
|
||||
end)
|
||||
end
|
||||
function ChapterLineCtrl:RefreshBranchGrid(root, avgId, depth, isNeedPlayUnlockAnim)
|
||||
local branchIds = {}
|
||||
local forEachLine_Story = function(mapLineData)
|
||||
for k, v in pairs(mapLineData.ParentStoryId) do
|
||||
if v == avgId and mapLineData.IsBranch == true then
|
||||
table.insert(branchIds, mapLineData.StoryId)
|
||||
end
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.Story, forEachLine_Story)
|
||||
local index = 1
|
||||
for k, v in ipairs(self.tbBranch[avgId]) do
|
||||
local bUnlock = AvgData:IsUnlock(v.ConditionId)
|
||||
local bReaded = AvgData:IsStoryReaded(v.Id)
|
||||
local branchGrid = root:Find("BranchGrid_" .. k)
|
||||
local storyConfig = AvgData:GetStoryCfgData(branchIds[index])
|
||||
root.gameObject:SetActive(bUnlock)
|
||||
if not bUnlock then
|
||||
if table.indexof(self.tbLockedBranchGrid, avgId) <= 0 then
|
||||
table.insert(self.tbLockedBranchGrid, avgId)
|
||||
end
|
||||
elseif table.indexof(self.tbLockedBranchGrid, avgId) > 0 then
|
||||
table.removebyvalue(self.tbLockedBranchGrid, avgId)
|
||||
end
|
||||
if isNeedPlayUnlockAnim and bUnlock then
|
||||
if not bReaded then
|
||||
root.gameObject:SetActive(false)
|
||||
end
|
||||
table.insert(self.tbNeedPlayUnlockAnimGird, {
|
||||
grid = root,
|
||||
avgId = storyConfig.StoryId,
|
||||
depth = depth,
|
||||
index = index,
|
||||
totalCount = #self.tbBranch[avgId]
|
||||
})
|
||||
end
|
||||
if branchGrid ~= nil then
|
||||
local goUnlock = branchGrid:Find("AnimRoot/goUnlock")
|
||||
local goLock = branchGrid:Find("AnimRoot/goLock")
|
||||
local goLevelIndex = branchGrid:Find("AnimRoot/goUnlock/txtLevelIndex")
|
||||
local txtLevelIndex = goLevelIndex:GetComponent("TMP_Text")
|
||||
local txtLevelName = txtLevelIndex.transform:Find("txtLevelName"):GetComponent("TMP_Text")
|
||||
local cgLevelIndex = goLevelIndex:GetComponent("CanvasGroup")
|
||||
local imgNewUnlockBg = branchGrid:Find("AnimRoot/goUnlock/imgNewUnlockBg")
|
||||
local imgNewUnlock = branchGrid:Find("AnimRoot/goUnlock/imgNewUnlock")
|
||||
NovaAPI.SetCanvasGroupAlpha(cgLevelIndex, 1)
|
||||
NovaAPI.SetTMPText(txtLevelIndex, storyConfig.Index)
|
||||
goUnlock.gameObject:SetActive(bUnlock)
|
||||
goLock.gameObject:SetActive(not bUnlock)
|
||||
txtLevelIndex.gameObject:SetActive(bUnlock)
|
||||
if bReaded then
|
||||
NovaAPI.SetTMPText(txtLevelName, storyConfig.Title)
|
||||
else
|
||||
NovaAPI.SetTMPText(txtLevelName, ConfigTable.GetUIText("Story_NewEnd_Unlock"))
|
||||
end
|
||||
if #self.tbBranch[avgId] == 1 then
|
||||
end
|
||||
local imgLockBg = branchGrid:Find("AnimRoot/goLock/imgBranchGridBgLock")
|
||||
imgLockBg.gameObject:SetActive(not bUnlock)
|
||||
local txtUnlock = branchGrid:Find("AnimRoot/goUnlock/txtUnlock"):GetComponent("TMP_Text")
|
||||
txtUnlock.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(txtUnlock, ConfigTable.GetUIText("Story_Unkown_End"))
|
||||
local imgLock = branchGrid:Find("AnimRoot/goLock/imgLock")
|
||||
imgLock.gameObject:SetActive(not bUnlock)
|
||||
local RedDot = branchGrid:Find("AnimRoot/RedDot")
|
||||
local bNew = 0 < table.indexof(self.tbFocusNode, v.Id) and not bReaded
|
||||
RedDot.gameObject:SetActive(bNew)
|
||||
imgNewUnlock.gameObject:SetActive(bNew)
|
||||
imgNewUnlockBg.gameObject:SetActive(bNew)
|
||||
local btnEnter = branchGrid:GetComponent("UIButton")
|
||||
btnEnter.onClick:RemoveAllListeners()
|
||||
btnEnter.onClick:AddListener(function()
|
||||
self:OnClickGrid(v.StoryId)
|
||||
end)
|
||||
end
|
||||
index = index + 1
|
||||
end
|
||||
end
|
||||
function ChapterLineCtrl:RefreshTimeStamp(goTimeStamp, index)
|
||||
local timeStampName
|
||||
local nId = self.curChapter * 100 + index
|
||||
local config = ConfigTable.GetData("StoryChapterTimeStamp", nId)
|
||||
if config == nil then
|
||||
return
|
||||
end
|
||||
timeStampName = config.TimeStamp
|
||||
if timeStampName == nil then
|
||||
goTimeStamp.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local tranTimeStamp = goTimeStamp:GetChild(0)
|
||||
local imgFocus = tranTimeStamp:Find("imgFocus")
|
||||
imgFocus.gameObject:SetActive(index == self.curTimeStamp)
|
||||
local imgBg = tranTimeStamp:Find("imgBg")
|
||||
imgBg.gameObject:SetActive(index ~= self.curTimeStamp)
|
||||
local txtTimeTitle = tranTimeStamp:Find("imgFocus/txtTimeTitle"):GetComponent("TMP_Text")
|
||||
local imgStage = txtTimeTitle.transform:Find("imgStage")
|
||||
imgStage.gameObject:SetActive(index == self.curTimeStamp)
|
||||
if index > self.maxUnlockDepth and 0 < self.curTimeStamp then
|
||||
timeStampName = ConfigTable.GetUIText("No_Arrived_Future")
|
||||
end
|
||||
NovaAPI.SetTMPText(txtTimeTitle, timeStampName)
|
||||
local txtTimeTitle = tranTimeStamp:Find("imgBg/txtTimeTitle"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtTimeTitle, timeStampName)
|
||||
end
|
||||
function ChapterLineCtrl:RefreshUnlockAnimList()
|
||||
self.tbNeedPlayUnlockAnimGird = {}
|
||||
self.curShouldPlayDepth = 9999
|
||||
if not self.bNeedPlayUnlockAnim then
|
||||
return
|
||||
end
|
||||
local cachedGird = {}
|
||||
for k, v in ipairs(self.tbGridList) do
|
||||
local storyConfig = AvgData:GetStoryCfgData(v.avgId)
|
||||
if table.indexof(self.tbFocusNode, storyConfig.Id) > 0 then
|
||||
local bHasPlayedAnim = LocalData.GetPlayerLocalData("MainlineUnlock_" .. storyConfig.Id)
|
||||
if (bHasPlayedAnim == nil or bHasPlayedAnim == 0) and cachedGird[v.avgId] == nil then
|
||||
table.insert(self.tbNeedPlayUnlockAnimGird, v)
|
||||
cachedGird[v.avgId] = v
|
||||
if self.curShouldPlayDepth > v.depth then
|
||||
self.curShouldPlayDepth = v.depth
|
||||
end
|
||||
end
|
||||
else
|
||||
for _, parentNode in pairs(storyConfig.ParentStoryId) do
|
||||
if cachedGird[parentNode] ~= nil then
|
||||
local parentStoryConfig = AvgData:GetStoryCfgData(parentNode)
|
||||
local bHasPlayedAnim = LocalData.GetPlayerLocalData("MainlineUnlock_" .. storyConfig.Id)
|
||||
local parentUnlock = AvgData:IsUnlock(parentStoryConfig.ConditionId)
|
||||
if cachedGird[v.avgId] == nil and (bHasPlayedAnim == nil or bHasPlayedAnim == 0) and parentUnlock then
|
||||
table.insert(self.tbNeedPlayUnlockAnimGird, v)
|
||||
cachedGird[v.avgId] = v
|
||||
if self.curShouldPlayDepth > v.depth then
|
||||
self.curShouldPlayDepth = v.depth
|
||||
end
|
||||
end
|
||||
elseif table.indexof(self.tbFocusNode, parentNode) > 0 then
|
||||
local parentStoryConfig = AvgData:GetStoryCfgData(parentNode)
|
||||
local bHasPlayedAnim = LocalData.GetPlayerLocalData("MainlineUnlock_" .. parentStoryConfig.Id)
|
||||
if bHasPlayedAnim == nil or bHasPlayedAnim == 0 then
|
||||
bHasPlayedAnim = LocalData.GetPlayerLocalData("MainlineUnlock_" .. storyConfig.Id)
|
||||
if cachedGird[v.avgId] == nil and (bHasPlayedAnim == nil or bHasPlayedAnim == 0) then
|
||||
table.insert(self.tbNeedPlayUnlockAnimGird, v)
|
||||
cachedGird[v.avgId] = v
|
||||
if self.curShouldPlayDepth > v.depth then
|
||||
self.curShouldPlayDepth = v.depth
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ChapterLineCtrl:DoPlayUnlockAnim(depth)
|
||||
local nodes = {}
|
||||
for _, node in ipairs(self.tbNeedPlayUnlockAnimGird) do
|
||||
if node.depth == depth then
|
||||
table.insert(nodes, node)
|
||||
end
|
||||
end
|
||||
for _, node in pairs(nodes) do
|
||||
self:PlayGridUnlockAnim(node, depth)
|
||||
end
|
||||
end
|
||||
function ChapterLineCtrl:PlayGridUnlockAnim(nodeInfo, depth)
|
||||
local storyConfig = AvgData:GetStoryCfgData(nodeInfo.avgId)
|
||||
if storyConfig.IsBranch then
|
||||
nodeInfo.grid.gameObject:SetActive(true)
|
||||
self:PlayBranchNodeUnlockAnim(nodeInfo, depth)
|
||||
else
|
||||
self:PlayNormalNodeUnlockAnim(nodeInfo, depth)
|
||||
end
|
||||
end
|
||||
function ChapterLineCtrl:PlayNormalNodeUnlockAnim(nodeInfo, depth)
|
||||
local grid = nodeInfo.grid.transform
|
||||
local storyConfig = AvgData:GetStoryCfgData(nodeInfo.avgId)
|
||||
local imgLeftPoint_1 = grid:Find("imgLeftPoint_1")
|
||||
local imgRightPoint_1 = grid:Find("imgRightPoint_1")
|
||||
local goLeftBorder = grid:Find("goLeftBorder")
|
||||
local goRightBorder = grid:Find("goRightBorder")
|
||||
local allLine = {}
|
||||
for i = 0, goLeftBorder.transform.childCount - 1 do
|
||||
table.insert(allLine, goLeftBorder.transform:GetChild(i))
|
||||
end
|
||||
grid.gameObject:SetActive(true)
|
||||
local bLeftActived = imgLeftPoint_1.gameObject.activeInHierarchy
|
||||
local bRightActived = imgRightPoint_1.gameObject.activeInHierarchy
|
||||
local goLineContinue = grid:Find("lineContinue")
|
||||
imgRightPoint_1.gameObject:SetActive(false)
|
||||
imgLeftPoint_1.gameObject:SetActive(false)
|
||||
goLineContinue.gameObject:SetActive(false)
|
||||
local bUnlock = AvgData:IsUnlock(storyConfig.ConditionId)
|
||||
local batteleNode = grid:Find("btnEnter/AnimRoot/BattleRoot")
|
||||
local normalNode = grid:Find("btnEnter/AnimRoot/NormalRoot")
|
||||
local lockNode = grid:Find("btnEnter/AnimRoot/LockRoot")
|
||||
batteleNode.gameObject:SetActive(false)
|
||||
normalNode.gameObject:SetActive(false)
|
||||
lockNode.gameObject:SetActive(false)
|
||||
local rootNode
|
||||
local bNewUnlock = 0 < table.indexof(self.tbLockedPlayedAnim, nodeInfo.avgId)
|
||||
if bNewUnlock then
|
||||
lockNode.gameObject:SetActive(true)
|
||||
table.removebyvalue(self.tbLockedPlayedAnim, nodeInfo.avgId)
|
||||
end
|
||||
if bUnlock then
|
||||
rootNode = storyConfig.IsBattle == true and batteleNode or normalNode
|
||||
else
|
||||
rootNode = lockNode
|
||||
table.insert(self.tbLockedPlayedAnim, nodeInfo.avgId)
|
||||
end
|
||||
local PlayLineAnimTime = 0.01
|
||||
if 0 < #allLine and not bNewUnlock then
|
||||
PlayLineAnimTime = self.lineAnimTime
|
||||
for k, v in ipairs(allLine) do
|
||||
self:PlayLineAnim(v)
|
||||
end
|
||||
self:AddTimer(1, self.lineAnimTime, function()
|
||||
imgLeftPoint_1.gameObject:SetActive(bLeftActived)
|
||||
end, true, true, true)
|
||||
elseif bNewUnlock then
|
||||
imgLeftPoint_1.gameObject:SetActive(bLeftActived)
|
||||
end
|
||||
local DoAfterAnim = function(time)
|
||||
self:AddTimer(1, time, function()
|
||||
imgRightPoint_1.gameObject:SetActive(bRightActived)
|
||||
if not bUnlock then
|
||||
if bRightActived then
|
||||
goLineContinue.gameObject:SetActive(true)
|
||||
self:PlayLineAnim(goLineContinue)
|
||||
end
|
||||
else
|
||||
local imgFocus = rootNode:Find("imgFocus")
|
||||
local bReaded = AvgData:IsStoryReaded(storyConfig.Id)
|
||||
local RedDot = rootNode:Find("RedDot")
|
||||
local bFocus = table.indexof(self.tbFocusNode, storyConfig.Id) > 0 and (not bReaded or self.bFocusLastNode)
|
||||
imgFocus.gameObject:SetActive(bFocus)
|
||||
RedDot.gameObject:SetActive(bFocus and not bReaded)
|
||||
self:DoPlayUnlockAnim(depth + 1)
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
self:AddTimer(1, PlayLineAnimTime, function()
|
||||
lockNode.gameObject:SetActive(false)
|
||||
rootNode.gameObject:SetActive(true)
|
||||
local animName = bUnlock and "BattleRoot_in" or "LockRoot_in"
|
||||
if bUnlock then
|
||||
LocalData.SetPlayerLocalData("MainlineUnlock_" .. storyConfig.Id, 1)
|
||||
CS.WwiseAudioManager.Instance:PostEvent("ui_mainline_level")
|
||||
end
|
||||
local animTime = self:PlayUnlockAnim(rootNode, animName)
|
||||
DoAfterAnim(animTime)
|
||||
end, true, true, true)
|
||||
end
|
||||
function ChapterLineCtrl:PlayBranchNodeUnlockAnim(nodeInfo, depth)
|
||||
if nodeInfo.totalCount > 1 then
|
||||
self:PlayUnlockAnim(nodeInfo.grid, "BranchRoot_in3")
|
||||
else
|
||||
self:PlayUnlockAnim(nodeInfo.grid, "BranchRoot_in" .. nodeInfo.index)
|
||||
end
|
||||
WwiseAudioMgr:PostEvent("ui_mainline_newending")
|
||||
local storyConfig = AvgData:GetStoryCfgData(nodeInfo.avgId)
|
||||
LocalData.SetPlayerLocalData("MainlineUnlock_" .. storyConfig.Id, 1)
|
||||
end
|
||||
function ChapterLineCtrl:PlayUnlockAnim(go, animName)
|
||||
local animator = go:GetComponent("Animator")
|
||||
animator.enabled = true
|
||||
animator:Play(animName)
|
||||
local nAnimLength = NovaAPI.GetAnimClipLength(animator, {animName})
|
||||
return nAnimLength
|
||||
end
|
||||
function ChapterLineCtrl:PlayLineAnim(goLine)
|
||||
local lineRect = goLine:GetComponent("RectTransform")
|
||||
if lineRect.pivot.x > 0 then
|
||||
lineRect.pivot = Vector2(0, 0.5)
|
||||
local Pos = lineRect.localPosition
|
||||
local angle = math.rad(lineRect.localEulerAngles.z)
|
||||
lineRect.localPosition = Vector3(Pos.x - lineRect.rect.width * math.cos(angle), Pos.y - lineRect.rect.width * math.sin(angle), Pos.z)
|
||||
end
|
||||
lineRect.localScale = Vector3(0, 1, 1)
|
||||
lineRect:DOScaleX(1, self.lineAnimTime)
|
||||
end
|
||||
function ChapterLineCtrl:OnClickGrid(avgId)
|
||||
local storyConfig = AvgData:GetStoryCfgData(avgId)
|
||||
local bUnlock, tbResult = AvgData:IsUnlock(storyConfig.ConditionId)
|
||||
if not bUnlock then
|
||||
WwiseAudioMgr:PostEvent("ui_systerm_locked")
|
||||
if tbResult ~= nil then
|
||||
local lockTxt = ""
|
||||
for i = 1, #tbResult do
|
||||
local value = tbResult[i]
|
||||
if value[1] == false then
|
||||
if UnlockConditionPriority[i] == "MustStoryIds" then
|
||||
do
|
||||
local tbStoryIds = value[2]
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
if v == false then
|
||||
local storyData = ConfigTable.GetData_Story(AvgData.CFG_Story[k])
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "OneofStoryIds" then
|
||||
do
|
||||
local tbStoryIds = value[2]
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
if v == false then
|
||||
local storyData = ConfigTable.GetData_Story(AvgData.CFG_Story[k])
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustEvIds" then
|
||||
lockTxt = ConfigTable.GetUIText("Story_UnlockClueCondition")
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "OneofEvIds" then
|
||||
lockTxt = ConfigTable.GetUIText("Story_UnlockClueCondition")
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "WorldLevel" then
|
||||
do
|
||||
local level = value[2]
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockWorldLv") or "", level)
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustAchievementIds" and self.bHasAchievementData == true then
|
||||
local tbAchievementList = value[2]
|
||||
for k, v in pairs(tbAchievementList) do
|
||||
if v == false then
|
||||
local achievementId = k
|
||||
local achievement = ConfigTable.GetData("Achievement", achievementId)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockAchievement") or "", achievement.Title) .. "\n" .. "(" .. achievement.Desc .. ")"
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = lockTxt
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
return
|
||||
end
|
||||
WwiseAudioMgr:PostEvent("ui_common_menu3")
|
||||
local nRecentStoryId = AvgData:GetRecentStoryId(self.curChapter)
|
||||
local recentStoryAvgId = ConfigTable.GetData_Story(nRecentStoryId).StoryId
|
||||
local findCount = 0
|
||||
local recentStoryDepth = 0
|
||||
local curDepth = 0
|
||||
for k, v in ipairs(self.tbGridList) do
|
||||
local gridName = v.grid.name
|
||||
if gridName == avgId then
|
||||
findCount = findCount + 1
|
||||
curDepth = v.depth
|
||||
end
|
||||
if gridName == recentStoryAvgId then
|
||||
findCount = findCount + 1
|
||||
recentStoryDepth = v.depth
|
||||
end
|
||||
if findCount == 2 then
|
||||
break
|
||||
end
|
||||
end
|
||||
self.curChosenStory = avgId
|
||||
EventManager.Hit(EventId.ChoseMainlineStory, avgId, curDepth >= recentStoryDepth)
|
||||
end
|
||||
function ChapterLineCtrl:OnEvent_Story_RewardClosed()
|
||||
if self.bNeedPlayUnlockAnim or self.bNeedPlayBranchAnim then
|
||||
if self.bNeedPlayBranchAnim then
|
||||
self.curShouldPlayDepth = self.tbNeedPlayUnlockAnimGird[1].depth
|
||||
end
|
||||
self:DoPlayUnlockAnim(self.curShouldPlayDepth)
|
||||
end
|
||||
end
|
||||
function ChapterLineCtrl:OnEvent_Story_Done(bHasReward)
|
||||
if not bHasReward and (self.bNeedPlayUnlockAnim or self.bNeedPlayBranchAnim) then
|
||||
if self.bNeedPlayBranchAnim then
|
||||
self.curShouldPlayDepth = self.tbNeedPlayUnlockAnimGird[1].depth
|
||||
end
|
||||
self:AddTimer(1, 1.5, function()
|
||||
self:DoPlayUnlockAnim(self.curShouldPlayDepth)
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
function ChapterLineCtrl:CacheCurChapterConfig()
|
||||
self.tbChapterStoryNumIds = AvgData:GetChapterStoryNumIds(self.curChapter)
|
||||
end
|
||||
function ChapterLineCtrl:CacheChapterBranchNode()
|
||||
self.tbBranch = {}
|
||||
for i, v in ipairs(self.tbChapterStoryNumIds) do
|
||||
local data = ConfigTable.GetData_Story(v)
|
||||
if data.IsBranch then
|
||||
if self.tbBranch[data.ParentStoryId[1]] == nil then
|
||||
self.tbBranch[data.ParentStoryId[1]] = {}
|
||||
end
|
||||
table.insert(self.tbBranch[data.ParentStoryId[1]], data)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ChapterLineCtrl:IsAllStoryCompleted()
|
||||
for k, v in ipairs(self.tbGridList) do
|
||||
if self.maxStoryDepth == v.depth and self.curChosenStory == v.grid.name then
|
||||
local avgId = v.grid.name
|
||||
local nStoryId = AvgData.CFG_Story[avgId]
|
||||
return AvgData:IsStoryReaded(nStoryId)
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
return ChapterLineCtrl
|
||||
@@ -0,0 +1,178 @@
|
||||
local ChapterRewardCtrl = class("ChapterRewardCtrl", BaseCtrl)
|
||||
local barLength = 228
|
||||
local tbColor = {
|
||||
Color(0.6078431372549019, 0.7176470588235294, 0.8274509803921568, 1),
|
||||
Color(0.9921568627450981, 0.7333333333333333, 0.2823529411764706, 1),
|
||||
Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764, 1)
|
||||
}
|
||||
ChapterRewardCtrl._mapNodeConfig = {
|
||||
imgChapterWindow = {sComponentName = "Image"},
|
||||
imgIconChapterWindow = {sComponentName = "Image"},
|
||||
imgProgressWindowF = {sComponentName = "Transform", nCount = 2},
|
||||
BubbleWindow = {sComponentName = "Transform", nCount = 3},
|
||||
TMPTotalStar = {sComponentName = "TMP_Text"},
|
||||
reward = {sComponentName = "Transform", nCount = 3},
|
||||
rtItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
|
||||
nCount = 3
|
||||
},
|
||||
rtItemBtn = {
|
||||
sNodeName = "rtItem",
|
||||
callback = "OnBtnClick_Item",
|
||||
sComponentName = "Button",
|
||||
nCount = 3
|
||||
},
|
||||
barProgressWindow = {sComponentName = "Image"},
|
||||
btnCloseWindow = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnConfirm2 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GetReward"
|
||||
},
|
||||
btnNoReward = {}
|
||||
}
|
||||
ChapterRewardCtrl._mapEventConfig = {}
|
||||
function ChapterRewardCtrl:Awake()
|
||||
end
|
||||
function ChapterRewardCtrl:FadeOut()
|
||||
end
|
||||
function ChapterRewardCtrl:OnEnable()
|
||||
end
|
||||
function ChapterRewardCtrl:OnDisable()
|
||||
end
|
||||
function ChapterRewardCtrl:OnDestroy()
|
||||
end
|
||||
function ChapterRewardCtrl:OnRelease()
|
||||
end
|
||||
function ChapterRewardCtrl:OpenPanel(mapChapterData, nTotalStar, nCurIdx, tbReward, nMaxStar)
|
||||
self.gameObject:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.imgChapterWindow, mapChapterData.ChapterImg)
|
||||
self:SetPngSprite(self._mapNode.imgIconChapterWindow, mapChapterData.ChapterIcon)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgIconChapterWindow)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTotalStar, nTotalStar)
|
||||
self.tbReward = tbReward
|
||||
self.bReceive = false
|
||||
self.rewardIdx = 0
|
||||
local nCurStar = nTotalStar
|
||||
local nRewardCount = #tbReward
|
||||
local sum = 3 - nRewardCount
|
||||
if sum < 0 then
|
||||
sum = 0
|
||||
end
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.barProgressWindow, nCurStar / nMaxStar)
|
||||
for index = 1, 2 do
|
||||
local rtF = self._mapNode.imgProgressWindowF[index]
|
||||
if index <= sum then
|
||||
rtF.gameObject:SetActive(false)
|
||||
self._mapNode.reward[4 - index].gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.reward[4 - index].gameObject:SetActive(true)
|
||||
rtF.gameObject:SetActive(true)
|
||||
local nStar = tbReward[index].nStar
|
||||
rtF.anchoredPosition = Vector2(barLength * nStar / nMaxStar, 0)
|
||||
end
|
||||
end
|
||||
for idx, mapReward in ipairs(tbReward) do
|
||||
local nStar = mapReward.nStar
|
||||
local rtBubble = self._mapNode.BubbleWindow[sum + idx]
|
||||
local txtOn = rtBubble:Find("On/NumberOn"):GetComponent("TMP_Text")
|
||||
local txtOff = rtBubble:Find("Off/NumberOff"):GetComponent("TMP_Text")
|
||||
rtBubble:Find("On").gameObject:SetActive(nCurStar >= nStar)
|
||||
rtBubble:Find("Off").gameObject:SetActive(nCurStar < nStar)
|
||||
self:SetChapterItem(self._mapNode.reward[idx], nStar, nCurStar, idx <= nCurIdx)
|
||||
if nCurStar >= nStar and nCurIdx < idx then
|
||||
self.bReceive = true
|
||||
self.rewardIdx = idx
|
||||
end
|
||||
self._mapNode.btnNoReward:SetActive(not self.bReceive)
|
||||
self._mapNode.btnConfirm2.gameObject:SetActive(self.bReceive)
|
||||
NovaAPI.SetTMPText(txtOn, tostring(nStar))
|
||||
NovaAPI.SetTMPText(txtOff, tostring(nStar))
|
||||
self._mapNode.rtItem[idx]:SetItem(mapReward.nReward, nil, mapReward.nCount, nil, idx <= nCurIdx, false, false)
|
||||
end
|
||||
end
|
||||
function ChapterRewardCtrl:Refresh(mapChapterData, nTotalStar, nCurIdx, tbReward, nMaxStar)
|
||||
self:SetPngSprite(self._mapNode.imgChapterWindow, mapChapterData.ChapterImg)
|
||||
self:SetPngSprite(self._mapNode.imgIconChapterWindow, mapChapterData.ChapterIcon)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTotalStar, nTotalStar)
|
||||
self.bReceive = false
|
||||
self.rewardIdx = 0
|
||||
local nCurStar = nTotalStar
|
||||
local nRewardCount = #tbReward
|
||||
local sum = 3 - nRewardCount
|
||||
if sum < 0 then
|
||||
sum = 0
|
||||
end
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.barProgressWindow, nCurStar / nMaxStar)
|
||||
for index = 1, 2 do
|
||||
local rtF = self._mapNode.imgProgressWindowF[index]
|
||||
if index <= sum then
|
||||
rtF.gameObject:SetActive(false)
|
||||
self._mapNode.reward[4 - index].gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.reward[4 - index].gameObject:SetActive(true)
|
||||
rtF.gameObject:SetActive(true)
|
||||
local nStar = tbReward[index].nStar
|
||||
rtF.anchoredPosition = Vector2(barLength * nStar / nMaxStar, 0)
|
||||
end
|
||||
end
|
||||
for idx, mapReward in ipairs(tbReward) do
|
||||
local nStar = mapReward.nStar
|
||||
local rtBubble = self._mapNode.BubbleWindow[sum + idx]
|
||||
local txtOn = rtBubble:Find("On/NumberOn"):GetComponent("TMP_Text")
|
||||
local txtOff = rtBubble:Find("Off/NumberOff"):GetComponent("TMP_Text")
|
||||
rtBubble:Find("On").gameObject:SetActive(nCurStar >= nStar)
|
||||
rtBubble:Find("Off").gameObject:SetActive(nCurStar < nStar)
|
||||
self:SetChapterItem(self._mapNode.reward[idx], nStar, nCurStar, idx <= nCurIdx)
|
||||
if nCurStar >= nStar and nCurIdx < idx then
|
||||
self.bReceive = true
|
||||
self.rewardIdx = idx
|
||||
end
|
||||
self._mapNode.btnNoReward:SetActive(not self.bReceive)
|
||||
self._mapNode.btnConfirm2.gameObject:SetActive(self.bReceive)
|
||||
NovaAPI.SetTMPText(txtOn, tostring(nStar))
|
||||
NovaAPI.SetTMPText(txtOff, tostring(nStar))
|
||||
self._mapNode.rtItem[idx]:SetItem(mapReward.nReward, nil, mapReward.nCount, nil, idx <= nCurIdx, false, false)
|
||||
end
|
||||
end
|
||||
function ChapterRewardCtrl:SetChapterItem(rtItem, nCondStar, nCurStar, bHasReceive)
|
||||
local imgStarOn = rtItem:Find("imgStarOn").gameObject
|
||||
local imgStarOff = rtItem:Find("imgStarOff").gameObject
|
||||
local TMPTitle = rtItem:Find("TMPTitle"):GetComponent("TMP_Text")
|
||||
local TMPCond = rtItem:Find("TMPCond"):GetComponent("TMP_Text")
|
||||
local imgReceive = rtItem:Find("imgReceive").gameObject
|
||||
local imgComplete = rtItem:Find("imgComplete").gameObject
|
||||
imgStarOn:SetActive(nCondStar <= nCurStar)
|
||||
imgStarOff:SetActive(nCurStar < nCondStar)
|
||||
NovaAPI.SetTMPText(TMPTitle, orderedFormat(ConfigTable.GetUIText("ChapterRewardCond") or "", nCondStar))
|
||||
if bHasReceive then
|
||||
NovaAPI.SetTMPColor(TMPTitle, tbColor[1])
|
||||
elseif nCondStar <= nCurStar then
|
||||
NovaAPI.SetTMPColor(TMPTitle, tbColor[2])
|
||||
else
|
||||
NovaAPI.SetTMPColor(TMPTitle, tbColor[3])
|
||||
end
|
||||
NovaAPI.SetTMPText(TMPCond, string.format("%d/%d", nCurStar, nCondStar))
|
||||
TMPCond.gameObject:SetActive(not bHasReceive and nCurStar < nCondStar)
|
||||
imgReceive:SetActive(bHasReceive)
|
||||
imgComplete:SetActive(not bHasReceive and nCondStar <= nCurStar)
|
||||
end
|
||||
function ChapterRewardCtrl:OnBtnClick_Close(btn)
|
||||
self.gameObject:SetActive(false)
|
||||
EventManager.Hit("GetChapterReward", true)
|
||||
end
|
||||
function ChapterRewardCtrl:OnBtnClick_GetReward()
|
||||
if not self.bReceive then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("TitleNoChapterReward"))
|
||||
return
|
||||
end
|
||||
print("GetChapterReward")
|
||||
EventManager.Hit("GetChapterReward", false, self.rewardIdx)
|
||||
end
|
||||
function ChapterRewardCtrl:OnBtnClick_Item(btn)
|
||||
local nIdx = table.indexof(self._mapNode.rtItemBtn, btn)
|
||||
UTILS.ClickItemGridWithTips(self.tbReward[nIdx].nReward, btn.transform, true, true, false)
|
||||
end
|
||||
return ChapterRewardCtrl
|
||||
@@ -0,0 +1,115 @@
|
||||
local MainlineAvgInfo = class("MainlineAvgInfo", BaseCtrl)
|
||||
MainlineAvgInfo._mapNodeConfig = {
|
||||
mainLineAvgLvName = {sComponentName = "TMP_Text"},
|
||||
mainLineAvgLvNum = {sComponentName = "TMP_Text"},
|
||||
mainLineAvgLvDes = {sComponentName = "TMP_Text"},
|
||||
imgAVGLevelIcon = {sComponentName = "Image"},
|
||||
txtAvgRewardTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RogueBoss_Reward_Title"
|
||||
},
|
||||
mainLineAvgBtnTex = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldMap_MainLine_Avg_Btn"
|
||||
},
|
||||
mainLineAvgBtn = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_OpenAvg"
|
||||
},
|
||||
avgItemBtn = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reward",
|
||||
nCount = 2
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
tcAvgItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
|
||||
nCount = 2
|
||||
},
|
||||
animator = {sNodeName = "rtWindow", sComponentName = "Animator"}
|
||||
}
|
||||
MainlineAvgInfo._mapEventConfig = {}
|
||||
function MainlineAvgInfo:Awake()
|
||||
end
|
||||
function MainlineAvgInfo:FadeOut(callback)
|
||||
if type(callback) == "function" then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function MainlineAvgInfo:OnEnable()
|
||||
end
|
||||
function MainlineAvgInfo:OnDisable()
|
||||
end
|
||||
function MainlineAvgInfo:OnDestroy()
|
||||
end
|
||||
function MainlineAvgInfo:OnRelease()
|
||||
end
|
||||
function MainlineAvgInfo:OpenLevelInfo(nMainlineId, nStar, tbTarget)
|
||||
self.nMainlineId = nMainlineId
|
||||
local mapMainline = ConfigTable.GetData_Mainline(nMainlineId)
|
||||
if mapMainline == nil then
|
||||
printError("nil mainlineData" .. nMainlineId)
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.mainLineAvgLvNum, mapMainline.Num)
|
||||
NovaAPI.SetTMPText(self._mapNode.mainLineAvgLvName, mapMainline.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.mainLineAvgLvDes, mapMainline.Desc)
|
||||
self:SetPngSprite(self._mapNode.imgAVGLevelIcon, mapMainline.MainlineImg)
|
||||
self.tbReward = decodeJson(mapMainline.RewardPreview)
|
||||
for index = 1, 2 do
|
||||
if self.tbReward[index] ~= nil then
|
||||
local bRecive = false
|
||||
if self.tbReward[index][3] == 1 and 0 < nStar then
|
||||
bRecive = true
|
||||
end
|
||||
self.tbReward[index][4] = bRecive
|
||||
end
|
||||
end
|
||||
self.tbAfterReward = {}
|
||||
for key, value in pairs(self.tbReward) do
|
||||
table.insert(self.tbAfterReward, value)
|
||||
end
|
||||
for index = 1, 2 do
|
||||
if self.tbAfterReward[index] ~= nil then
|
||||
if self.tbReward[index][4] == nil then
|
||||
end
|
||||
local bReceive = self.tbReward[index][4]
|
||||
self._mapNode.tcAvgItem[index]:SetItem(self.tbAfterReward[index][1], nil, nil, nil, bReceive, self.tbAfterReward[index][3] == 1, self.tbAfterReward[index][3] == 2)
|
||||
else
|
||||
self._mapNode.tcAvgItem[index]:SetItem(nil)
|
||||
end
|
||||
end
|
||||
self._mapNode.animator:Play("t_window_04_t_in")
|
||||
end
|
||||
function MainlineAvgInfo:OnBtnClick_Close()
|
||||
self.gameObject:SetActive(false)
|
||||
EventManager.Hit("SelectMainlineBattle", false)
|
||||
end
|
||||
function MainlineAvgInfo:OnBtnClick_Confirm()
|
||||
end
|
||||
function MainlineAvgInfo:OnBtnClick_MonsterInfo(btn)
|
||||
EventManager.Hit("OpenMainlineMonsterInfo", self.nMainlineId)
|
||||
end
|
||||
function MainlineAvgInfo:OnBtnClick_AllReward(btn)
|
||||
EventManager.Hit("OpenAllReward", self.tbReward)
|
||||
end
|
||||
function MainlineAvgInfo:OnBtnClick_Reward(btn)
|
||||
local nIdx = table.indexof(self._mapNode.avgItemBtn, btn)
|
||||
if self.tbAfterReward[nIdx] ~= nil then
|
||||
local nTid = self.tbAfterReward[nIdx][1]
|
||||
UTILS.ClickItemGridWithTips(nTid, btn.transform, false, true, false)
|
||||
end
|
||||
end
|
||||
function MainlineAvgInfo:OnBtnClick_OpenAvg(btn)
|
||||
self.gameObject:SetActive(false)
|
||||
EventManager.Hit("SelectMainlineBattle", false)
|
||||
EventManager.Hit(EventId.SendMsgEnterBattle)
|
||||
end
|
||||
return MainlineAvgInfo
|
||||
@@ -0,0 +1,119 @@
|
||||
local MainlineAvgInfoExCtrl = class("MainlineAvgInfoExCtrl", BaseCtrl)
|
||||
local AvgData = PlayerData.Avg
|
||||
MainlineAvgInfoExCtrl._mapNodeConfig = {
|
||||
mainLineAvgLvName = {sComponentName = "TMP_Text"},
|
||||
mainLineAvgLvNum = {sComponentName = "TMP_Text"},
|
||||
mainLineAvgLvDes = {sComponentName = "TMP_Text"},
|
||||
mainLineBattleLvName = {sComponentName = "TMP_Text"},
|
||||
mainLineBattleLvNum = {sComponentName = "TMP_Text"},
|
||||
txtBattleStoryDesc = {sComponentName = "TMP_Text"},
|
||||
mainLineAvgBtnTex = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldMap_MainLine_Avg_Btn"
|
||||
},
|
||||
mainLineAvgBtn = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_OpenAvg"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
animator = {sNodeName = "rtWindow", sComponentName = "Animator"},
|
||||
btnEnemy = {
|
||||
sNodeName = "btnEnemy",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_MonsterInfo"
|
||||
},
|
||||
imgBattleIcon = {},
|
||||
txtClueNotice = {},
|
||||
imgClueNotice = {},
|
||||
goBattleRoot = {},
|
||||
goAvgRoot = {},
|
||||
goRewardInfo = {},
|
||||
imgReward = {sComponentName = "Image"},
|
||||
txtRewardCount = {sComponentName = "TMP_Text"},
|
||||
txtAvgRewardTitle = {sComponentName = "TMP_Text", sLanguageId = "Level_Info"},
|
||||
txtCancelBtn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainLine_Select_Btn_Cancel"
|
||||
},
|
||||
txtReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "STRanking_Reward_Btn"
|
||||
},
|
||||
txtBtnEnemy = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Rank_Enemy_Info"
|
||||
}
|
||||
}
|
||||
MainlineAvgInfoExCtrl._mapEventConfig = {}
|
||||
function MainlineAvgInfoExCtrl:Awake()
|
||||
end
|
||||
function MainlineAvgInfoExCtrl:FadeOut(callback)
|
||||
if type(callback) == "function" then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function MainlineAvgInfoExCtrl:OnEnable()
|
||||
end
|
||||
function MainlineAvgInfoExCtrl:OnDisable()
|
||||
end
|
||||
function MainlineAvgInfoExCtrl:OnDestroy()
|
||||
end
|
||||
function MainlineAvgInfoExCtrl:OnRelease()
|
||||
end
|
||||
function MainlineAvgInfoExCtrl:OpenLevelInfo(avgId, bNewestStory)
|
||||
self.avgId = avgId
|
||||
self.bNewestStory = bNewestStory
|
||||
local mapMainline = AvgData:GetStoryCfgData(avgId)
|
||||
if mapMainline == nil then
|
||||
printError("nil mainlineData" .. avgId)
|
||||
return
|
||||
end
|
||||
self.IsBattle = mapMainline.IsBattle
|
||||
if self.IsBattle then
|
||||
NovaAPI.SetTMPText(self._mapNode.mainLineBattleLvNum, mapMainline.Index)
|
||||
NovaAPI.SetTMPText(self._mapNode.mainLineBattleLvName, mapMainline.Title)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBattleStoryDesc, mapMainline.Desc)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.mainLineAvgLvNum, mapMainline.Index)
|
||||
NovaAPI.SetTMPText(self._mapNode.mainLineAvgLvName, mapMainline.Title)
|
||||
NovaAPI.SetTMPText(self._mapNode.mainLineAvgLvDes, mapMainline.Desc)
|
||||
end
|
||||
self._mapNode.goAvgRoot:SetActive(not mapMainline.IsBattle)
|
||||
self._mapNode.goBattleRoot:SetActive(mapMainline.IsBattle)
|
||||
self._mapNode.txtClueNotice:SetActive(mapMainline.HasEvidence)
|
||||
self._mapNode.imgClueNotice:SetActive(mapMainline.HasEvidence)
|
||||
self._mapNode.goRewardInfo:SetActive(false)
|
||||
if not AvgData:IsStoryReaded(mapMainline.Id) then
|
||||
local tbReward = decodeJson(mapMainline.RewardDisplay)
|
||||
if 0 < #tbReward then
|
||||
self._mapNode.goRewardInfo:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.imgReward, ConfigTable.GetData_Item(tbReward[1].Tid).Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRewardCount, "×" .. tbReward[1].Qty)
|
||||
end
|
||||
end
|
||||
self._mapNode.animator:Play("t_window_04_t_in")
|
||||
end
|
||||
function MainlineAvgInfoExCtrl:OnBtnClick_Close()
|
||||
self.gameObject:SetActive(false)
|
||||
EventManager.Hit("SelectMainlineBattle", false)
|
||||
end
|
||||
function MainlineAvgInfoExCtrl:OnBtnClick_MonsterInfo(btn)
|
||||
EventManager.Hit("OpenMainlineMonsterInfo", self.avgId)
|
||||
end
|
||||
function MainlineAvgInfoExCtrl:OnBtnClick_OpenAvg(btn)
|
||||
self.gameObject:SetActive(false)
|
||||
if not self.IsBattle then
|
||||
EventManager.Hit("SelectMainlineBattle", false)
|
||||
AvgData:SendMsg_STORY_ENTER(self.avgId, 0, self.bNewestStory)
|
||||
else
|
||||
EventManager.Hit("SelectMainlineBattle", true)
|
||||
end
|
||||
end
|
||||
return MainlineAvgInfoExCtrl
|
||||
@@ -0,0 +1,72 @@
|
||||
local MainlineChapter = class("MainlineChapter", BaseCtrl)
|
||||
MainlineChapter._mapNodeConfig = {
|
||||
rtLock = {},
|
||||
rtUnLock = {},
|
||||
imgDbNow = {},
|
||||
imgComplete = {},
|
||||
imgSelect = {},
|
||||
imgChapterImg = {sComponentName = "Image"},
|
||||
imgTip = {sComponentName = "Image"},
|
||||
rtIButton = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_self"
|
||||
},
|
||||
redDotChapter = {}
|
||||
}
|
||||
MainlineChapter._mapEventConfig = {}
|
||||
function MainlineChapter:Awake()
|
||||
end
|
||||
function MainlineChapter:FadeOut(callback)
|
||||
if type(callback) == "function" then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function MainlineChapter:OnEnable()
|
||||
end
|
||||
function MainlineChapter:OnDisable()
|
||||
end
|
||||
function MainlineChapter:OnDestroy()
|
||||
end
|
||||
function MainlineChapter:OnRelease()
|
||||
end
|
||||
function MainlineChapter:RegisterRedDot()
|
||||
RedDotManager.RegisterNode(RedDotDefine.Map_MainLine_Reward, self.nChapterId, self._mapNode.redDotChapter)
|
||||
end
|
||||
function MainlineChapter:Init(nChapterId)
|
||||
self.nChapterId = nChapterId
|
||||
if nChapterId == nil then
|
||||
self._mapNode.rtLock:SetActive(true)
|
||||
self._mapNode.rtUnLock:SetActive(false)
|
||||
self._mapNode.rtIButton.interactable = false
|
||||
self._mapNode.imgSelect:SetActive(false)
|
||||
self._mapNode.imgDbNow:SetActive(false)
|
||||
self._mapNode.redDotChapter:SetActive(false)
|
||||
return
|
||||
end
|
||||
local mapChapter = ConfigTable.GetData("Chapter", nChapterId)
|
||||
self:SetPngSprite(self._mapNode.imgChapterImg, mapChapter.ChapterImg)
|
||||
self:SetPngSprite(self._mapNode.imgTip, mapChapter.ChapterIcon)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgTip)
|
||||
self:RegisterRedDot()
|
||||
end
|
||||
function MainlineChapter:SetSelect(select)
|
||||
self._mapNode.imgSelect:SetActive(select)
|
||||
end
|
||||
function MainlineChapter:SetCur(bCurChapter)
|
||||
self._mapNode.imgDbNow:SetActive(bCurChapter)
|
||||
end
|
||||
function MainlineChapter:SetUnlock(unlock)
|
||||
self._mapNode.rtLock:SetActive(not unlock)
|
||||
self._mapNode.rtUnLock:SetActive(unlock)
|
||||
self._mapNode.rtIButton.interactable = unlock
|
||||
end
|
||||
function MainlineChapter:SetComplete(bComplete)
|
||||
self._mapNode.imgComplete:SetActive(bComplete)
|
||||
end
|
||||
function MainlineChapter:OnBtnClick_self(btn)
|
||||
if self.nChapterId ~= nil then
|
||||
CS.WwiseAudioManager.Instance:PlaySound("ui_common_click_select")
|
||||
end
|
||||
EventManager.Hit("SelectChapter", self.nChapterId)
|
||||
end
|
||||
return MainlineChapter
|
||||
@@ -0,0 +1,68 @@
|
||||
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
|
||||
@@ -0,0 +1,71 @@
|
||||
local MainlineChapterSelectCtrl = class("MainlineChapterSelectCtrl", BaseCtrl)
|
||||
MainlineChapterSelectCtrl._mapNodeConfig = {
|
||||
Page1 = {
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineChapterPage1"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Cancle"
|
||||
},
|
||||
btnConfirm1 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
txtBtnConfirm1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainLine_Select_Btn_Confirm"
|
||||
},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Cancle"
|
||||
},
|
||||
txtBtnCancel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainLine_Select_Btn_Cancel"
|
||||
},
|
||||
txtTitle = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainLine_Select_Title"
|
||||
}
|
||||
}
|
||||
MainlineChapterSelectCtrl._mapEventConfig = {
|
||||
SelectChapter = "OnEvent_SelectChapter"
|
||||
}
|
||||
function MainlineChapterSelectCtrl:Awake()
|
||||
end
|
||||
function MainlineChapterSelectCtrl:FadeOut(callback)
|
||||
if type(callback) == "function" then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function MainlineChapterSelectCtrl:OnEnable()
|
||||
end
|
||||
function MainlineChapterSelectCtrl:OnDisable()
|
||||
end
|
||||
function MainlineChapterSelectCtrl:OnDestroy()
|
||||
end
|
||||
function MainlineChapterSelectCtrl:OnRelease()
|
||||
end
|
||||
function MainlineChapterSelectCtrl:OpenPanel(nCurChapter)
|
||||
self.tbChapter, self.nCurChapterIdx = PlayerData.Mainline:GetAllMainlineChapter(nCurChapter)
|
||||
self.gameObject:SetActive(true)
|
||||
self._mapNode.Page1:Init(self.tbChapter, nCurChapter)
|
||||
self.nCurChapter = nCurChapter
|
||||
end
|
||||
function MainlineChapterSelectCtrl:OnEvent_SelectChapter(nChapter)
|
||||
self.nCurChapter = nChapter
|
||||
end
|
||||
function MainlineChapterSelectCtrl:OnBtnClick_Confirm(btn)
|
||||
EventManager.Hit("ConfirmChapter", self.nCurChapter)
|
||||
self.gameObject:SetActive(false)
|
||||
self.tbChapter = nil
|
||||
self.nCurChapterIdx = 0
|
||||
end
|
||||
function MainlineChapterSelectCtrl:OnBtnClick_Cancle(btn)
|
||||
EventManager.Hit("ConfirmChapter", 0)
|
||||
self.gameObject:SetActive(false)
|
||||
self.tbChapter = nil
|
||||
self.nCurChapterIdx = 0
|
||||
end
|
||||
return MainlineChapterSelectCtrl
|
||||
@@ -0,0 +1,261 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local MainlineExCtrl = class("MainlineExCtrl", BaseCtrl)
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ResTypeAny = GameResourceLoader.ResType.Any
|
||||
local AvgData = PlayerData.Avg
|
||||
local typeof = typeof
|
||||
MainlineExCtrl._mapNodeConfig = {
|
||||
goChapterLine = {
|
||||
sNodeName = "goChapterLine",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
txtTitle = {
|
||||
sNodeName = "txtChapterTitle",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtChapter = {sNodeName = "txtChapter", sComponentName = "TMP_Text"},
|
||||
btnClue = {
|
||||
sNodeName = "btnClue",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickOpenClue"
|
||||
},
|
||||
imgCharHead = {
|
||||
sNodeName = "imgCharHead",
|
||||
sComponentName = "Image"
|
||||
},
|
||||
txtCharName = {
|
||||
sNodeName = "txtCharName",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtPersonalityPercent1 = {
|
||||
sNodeName = "txtPersonalityPercent1",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtPersonalityPercent2 = {
|
||||
sNodeName = "txtPersonalityPercent2",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtPersonalityPercent3 = {
|
||||
sNodeName = "txtPersonalityPercent3",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
gogoPersonality = {
|
||||
sNodeName = "goPersonality",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
ctlgoMainLineAvgRoot = {
|
||||
sNodeName = "goMainLineAvgRoot",
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineAvgInfoExCtrl"
|
||||
},
|
||||
ctlgoEnemyInfo = {
|
||||
sNodeName = "goEnemyInfo",
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
|
||||
},
|
||||
got_fullscreen_blur_01 = {
|
||||
sNodeName = "t_fullscreen_blur_01",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
btnsnapshot = {
|
||||
sNodeName = "snapshot_main",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_ClickCloseLevelInfoPanel"
|
||||
},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
ctrlClue = {
|
||||
sNodeName = "goClue",
|
||||
sCtrlName = "Game.UI.MainlineEx.StoryClueCtrl"
|
||||
},
|
||||
aniBg = {sNodeName = "----Bg----", sComponentName = "Animator"},
|
||||
aniSafeRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txtChapterTimeStamp = {sComponentName = "TMP_Text"},
|
||||
goChapterComplete = {},
|
||||
redDotClue = {},
|
||||
txtPersonality1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Personality_Instinct"
|
||||
},
|
||||
txtPersonality2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Personality_Analyze"
|
||||
},
|
||||
txtPersonality3 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Personality_Chaos"
|
||||
},
|
||||
txtBtnClue = {sComponentName = "TMP_Text", sLanguageId = "Story_Clue"}
|
||||
}
|
||||
MainlineExCtrl._mapEventConfig = {
|
||||
[EventId.ChoseMainlineStory] = "OnEvent_ChooseMainlineStory",
|
||||
SelectMainlineBattle = "OnEvent_SelectMainlineBattle",
|
||||
Story_Done = "OnEvent_Story_Done",
|
||||
[EventId.UIBackConfirm] = "OnEvent_UIBackConfirm",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_BackHome",
|
||||
Story_RewardClosed = "OnEvent_Story_RewardClosed"
|
||||
}
|
||||
MainlineExCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.MainStoryClue] = {sNodeName = "redDotClue"}
|
||||
}
|
||||
function MainlineExCtrl:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.curChapter = tbParam[1]
|
||||
self.fromPanel = tbParam[2] ~= nil and tbParam[2] or 0
|
||||
self._mapNode.btnClue.gameObject:SetActive(false)
|
||||
end
|
||||
function MainlineExCtrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
end
|
||||
function MainlineExCtrl:OnDisable()
|
||||
if self.curChapterCtrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.curChapterCtrl)
|
||||
self.curChapterCtrl = nil
|
||||
destroy(self.curChapterObj)
|
||||
self.curChapterObj = nil
|
||||
end
|
||||
end
|
||||
function MainlineExCtrl:RefreshPanel()
|
||||
local config = ConfigTable.GetData("StoryChapter", self.curChapter)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitle, config.Desc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtChapter, config.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtChapterTimeStamp, config.ChapterYear)
|
||||
self:RefreshChapterLine()
|
||||
self:RefreshPersonality()
|
||||
self:CheckClueReddot()
|
||||
end
|
||||
function MainlineExCtrl:RefreshChapterLine()
|
||||
if self.curChapterCtrl ~= nil then
|
||||
self.curChapterCtrl:Refresh()
|
||||
return
|
||||
end
|
||||
if self.curChapterObj ~= nil then
|
||||
self.curChapterCtrl = self:BindCtrlByNode(self.curChapterObj, "Game.UI.MainlineEx.ChapterLineCtrl")
|
||||
return
|
||||
end
|
||||
local sPrefabFolder = "UI/MainlineEx/goChapter_%d.prefab"
|
||||
local sPrefabPath = string.format(sPrefabFolder, self.curChapter)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.goChapterLine.transform)
|
||||
if goObj ~= nil then
|
||||
self.curChapterObj = goObj
|
||||
self.curChapterCtrl = self:BindCtrlByNode(goObj, "Game.UI.MainlineEx.ChapterLineCtrl")
|
||||
end
|
||||
end
|
||||
function MainlineExCtrl:RefreshPersonality()
|
||||
local tbPersonality, sTitle, sFace, tbPData, nTotalCount, sHead = AvgData:CalcPersonality(1)
|
||||
NovaAPI.SetPersonalityRing(self._mapNode.gogoPersonality, tbPersonality)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent1, math.floor(tbPersonality[1] * 100) .. "%")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent2, math.floor(tbPersonality[2] * 100) .. "%")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent3, math.floor(tbPersonality[3] * 100) .. "%")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCharName, sTitle)
|
||||
local sIcon = "Icon/PlayerHead/" .. sHead
|
||||
self:SetPngSprite(self._mapNode.imgCharHead, sIcon)
|
||||
end
|
||||
function MainlineExCtrl:PlayAnimOut()
|
||||
self._mapNode.aniBg:Play("MainlineEx_bg_out")
|
||||
self._mapNode.aniSafeRoot:Play("MainlineEx_out")
|
||||
local time1 = NovaAPI.GetAnimClipLength(self._mapNode.aniBg, {
|
||||
"MainlineEx_bg_out"
|
||||
})
|
||||
local time2 = NovaAPI.GetAnimClipLength(self._mapNode.aniSafeRoot, {
|
||||
"MainlineEx_out"
|
||||
})
|
||||
local time = math.min(time1, time2)
|
||||
self:AddTimer(1, time, function()
|
||||
if self.fromPanel ~= 0 and self.fromPanel ~= PanelId.StoryChapter then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StoryChapter, self.fromPanel)
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineEx)
|
||||
end)
|
||||
end
|
||||
function MainlineExCtrl:OnBtn_ClickOpenClue()
|
||||
self._mapNode.ctrlClue:RefreshPanel()
|
||||
end
|
||||
function MainlineExCtrl:OnBtn_ClickCloseLevelInfoPanel()
|
||||
self._mapNode.ctlgoMainLineAvgRoot.gameObject:SetActive(false)
|
||||
self._mapNode.goChapterComplete:SetActive(false)
|
||||
self._mapNode.got_fullscreen_blur_01:SetActive(false)
|
||||
self.bAllCompleted = self.curChapterCtrl:IsAllStoryCompleted()
|
||||
if self.bAllCompleted then
|
||||
AvgData:SetNewLockChapterIndex(self.curChapter)
|
||||
if self.fromPanel ~= 0 and self.fromPanel ~= PanelId.StoryChapter then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StoryChapter, self.fromPanel)
|
||||
else
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineEx)
|
||||
end
|
||||
end
|
||||
end
|
||||
function MainlineExCtrl:OnEvent_ChooseMainlineStory(avgId, bNewestStory)
|
||||
self.avgId = avgId
|
||||
self._mapNode.ctlgoMainLineAvgRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ctlgoMainLineAvgRoot:OpenLevelInfo(avgId, bNewestStory)
|
||||
self._mapNode.got_fullscreen_blur_01:SetActive(true)
|
||||
NovaAPI.UIEffectSnapShotCapture(self._mapNode.btnsnapshot.gameObject)
|
||||
end
|
||||
function MainlineExCtrl:OnEvent_SelectMainlineBattle(bConfirm)
|
||||
self._mapNode.got_fullscreen_blur_01:SetActive(false)
|
||||
local OpenPanel = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.Story, 0, self.avgId)
|
||||
end
|
||||
if bConfirm then
|
||||
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
|
||||
end
|
||||
end
|
||||
function MainlineExCtrl:OnEvent_Story_Done(bHasReward)
|
||||
self:RefreshPanel()
|
||||
end
|
||||
function MainlineExCtrl:OnEvent_UIBackConfirm(nPanelId)
|
||||
if self._panel._nPanelId ~= nPanelId then
|
||||
return
|
||||
end
|
||||
self:PlayAnimOut()
|
||||
end
|
||||
function MainlineExCtrl:OnEvent_BackHome(nPanelId)
|
||||
if self._panel._nPanelId ~= nPanelId then
|
||||
return
|
||||
end
|
||||
PanelManager.Home()
|
||||
end
|
||||
function MainlineExCtrl:OnEvent_Story_RewardClosed()
|
||||
if self.curChapterCtrl ~= nil then
|
||||
self.bAllCompleted = self.curChapterCtrl:IsAllStoryCompleted()
|
||||
if self.bAllCompleted then
|
||||
AvgData:SetNewLockChapterIndex(self.curChapter)
|
||||
self._mapNode.got_fullscreen_blur_01:SetActive(true)
|
||||
self._mapNode.goChapterComplete:SetActive(true)
|
||||
self:AddTimer(1, 2.5, function()
|
||||
if self.fromPanel ~= 0 and self.fromPanel ~= PanelId.StoryChapter then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StoryChapter, self.fromPanel)
|
||||
else
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineEx)
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function MainlineExCtrl:CheckClueReddot()
|
||||
local forEachLine_Ev = function(evConfig)
|
||||
local bUnlock = AvgData:IsEvidenceUnlock(evConfig.EvId)
|
||||
if not bUnlock then
|
||||
return
|
||||
end
|
||||
local tbEvStory = AvgData.tbEvData[evConfig.EvId]
|
||||
if tbEvStory == nil then
|
||||
return
|
||||
end
|
||||
local bUsed = true
|
||||
for i, v in ipairs(tbEvStory) do
|
||||
local nStoryId = AvgData.CFG_Story[v]
|
||||
if not AvgData:IsStoryReaded(nStoryId) then
|
||||
bUsed = false
|
||||
break
|
||||
end
|
||||
end
|
||||
RedDotManager.SetValid(RedDotDefine.MianStoryClue_Use, evConfig.Id, not bUsed)
|
||||
end
|
||||
ForEachTableLine(DataTable.StoryEvidence, forEachLine_Ev)
|
||||
end
|
||||
return MainlineExCtrl
|
||||
@@ -0,0 +1,19 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local MainlineExPanel = class("MainlineExPanel", BasePanel)
|
||||
MainlineExPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "MainlineEx/MainlineExPanel.prefab",
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineExCtrl"
|
||||
}
|
||||
}
|
||||
function MainlineExPanel:Awake()
|
||||
end
|
||||
function MainlineExPanel:OnEnable()
|
||||
end
|
||||
function MainlineExPanel:OnDisable()
|
||||
end
|
||||
function MainlineExPanel:OnDestroy()
|
||||
end
|
||||
function MainlineExPanel:OnRelease()
|
||||
end
|
||||
return MainlineExPanel
|
||||
@@ -0,0 +1,138 @@
|
||||
local MainlineLevelCtrl = class("MainlineLevelCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
MainlineLevelCtrl._mapNodeConfig = {
|
||||
txtLevelIndex = {sComponentName = "TMP_Text"},
|
||||
txtLevelName = {sComponentName = "TMP_Text"},
|
||||
goAvg = {},
|
||||
goNormal = {},
|
||||
imgLevel = {sComponentName = "Image"},
|
||||
imgLevel1 = {sComponentName = "Image"},
|
||||
imgStar = {nCount = 3, sComponentName = "Button"},
|
||||
imgJade = {sComponentName = "Image"},
|
||||
txtCount = {sComponentName = "TMP_Text"},
|
||||
btnSelect = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Select"
|
||||
},
|
||||
btnSelectComplete = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Select"
|
||||
},
|
||||
goJade = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgComplete = {},
|
||||
goMask = {},
|
||||
goMaskBlack = {},
|
||||
TMP_UnlockCount = {sComponentName = "TMP_Text"},
|
||||
imgUnlockIcon = {sComponentName = "Image"},
|
||||
btnUnlock = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Unlock"
|
||||
},
|
||||
unlockAnim = {sComponentName = "Animator", sNodeName = "lockAnim"},
|
||||
TMPGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Maninline_Btn_Go",
|
||||
nCount = 2
|
||||
}
|
||||
}
|
||||
MainlineLevelCtrl._mapEventConfig = {}
|
||||
function MainlineLevelCtrl:Awake()
|
||||
end
|
||||
function MainlineLevelCtrl:FadeOut(callback)
|
||||
if type(callback) == "function" then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function MainlineLevelCtrl:OnEnable()
|
||||
end
|
||||
function MainlineLevelCtrl:OnDisable()
|
||||
end
|
||||
function MainlineLevelCtrl:OnDestroy()
|
||||
end
|
||||
function MainlineLevelCtrl:OnRelease()
|
||||
end
|
||||
function MainlineLevelCtrl:Refresh(mapData, nStar, unLock, nTid, nCount, tbTarget)
|
||||
self.nStar = nStar
|
||||
self.levelData = mapData
|
||||
if not unLock then
|
||||
self.gameObject:SetActive(false)
|
||||
self.gameObject.transform.localScale = Vector3.zero
|
||||
return
|
||||
end
|
||||
self.gameObject.transform.localScale = Vector3.one
|
||||
self.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelIndex, mapData.Num)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelName, mapData.Name)
|
||||
if mapData.AvgId == "" or mapData.AvgId == nil then
|
||||
self._mapNode.goAvg:SetActive(false)
|
||||
self._mapNode.goNormal:SetActive(true)
|
||||
for index = 1, 3 do
|
||||
self._mapNode.imgStar[index].interactable = tbTarget[index]
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgLevel1, mapData.MainlineImg)
|
||||
else
|
||||
self._mapNode.goAvg:SetActive(true)
|
||||
self._mapNode.goNormal:SetActive(false)
|
||||
self:SetPngSprite(self._mapNode.imgLevel, mapData.MainlineImg)
|
||||
end
|
||||
self._mapNode.goJade.gameObject:SetActive(nStar < 1)
|
||||
self._mapNode.imgComplete.gameObject:SetActive(1 <= nStar)
|
||||
if nTid == 0 then
|
||||
self._mapNode.imgJade.gameObject:SetActive(false)
|
||||
self._mapNode.txtCount.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.imgJade.gameObject:SetActive(true)
|
||||
self._mapNode.txtCount.gameObject:SetActive(true)
|
||||
local itemCfgData = ConfigTable.GetData_Item(nTid)
|
||||
self:SetPngSprite(self._mapNode.imgJade, itemCfgData.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, nCount)
|
||||
end
|
||||
local _, unlockCoin = PlayerData.Mainline:IsMainlineLevelUnlock(self.levelData.Id)
|
||||
if not unlockCoin and 0 < self.levelData.UnlockItem then
|
||||
self._mapNode.goMask:SetActive(true)
|
||||
self._mapNode.goMaskBlack:SetActive(true)
|
||||
self._mapNode.btnUnlock.gameObject:SetActive(true)
|
||||
self._mapNode.btnSelect.gameObject:SetActive(false)
|
||||
self._mapNode.btnSelectComplete.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_UnlockCount, self.levelData.UnlockQty)
|
||||
self:SetSprite_Coin(self._mapNode.imgUnlockIcon, self.levelData.UnlockItem)
|
||||
else
|
||||
self._mapNode.goMask:SetActive(false)
|
||||
self._mapNode.btnSelect.gameObject:SetActive(nStar < 1)
|
||||
self._mapNode.btnSelectComplete.gameObject:SetActive(1 <= nStar)
|
||||
end
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.goJade)
|
||||
end
|
||||
function MainlineLevelCtrl:OnBtnClick_Unlock(btn)
|
||||
local callback = function()
|
||||
local wait = function()
|
||||
self._mapNode.goMask:SetActive(false)
|
||||
end
|
||||
local wait1 = function()
|
||||
self._mapNode.goMaskBlack:SetActive(false)
|
||||
end
|
||||
local wait2 = function()
|
||||
self:OnBtnClick_Select()
|
||||
end
|
||||
self._mapNode.unlockAnim:Play("unlock_in")
|
||||
CS.WwiseAudioManager.Instance:PostEvent("ui_mainline_unlock")
|
||||
self._mapNode.btnSelect.gameObject:SetActive(self.nStar < 1)
|
||||
self._mapNode.btnSelectComplete.gameObject:SetActive(self.nStar >= 1)
|
||||
self._mapNode.btnUnlock.gameObject:SetActive(false)
|
||||
self:AddTimer(1, 1.3, wait, true, true, true, nil)
|
||||
self:AddTimer(1, 0.3, wait1, true, true, true, nil)
|
||||
self:AddTimer(1, 0.7, wait2, true, true, true, nil)
|
||||
end
|
||||
local curCount = PlayerData.Item:GetItemCountByID(self.levelData.UnlockItem)
|
||||
if curCount >= self.levelData.UnlockQty then
|
||||
PlayerData.Mainline:NetMsg_UnlockMainline(self.levelData.Id, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenMessageBox, "解锁道具不足")
|
||||
end
|
||||
end
|
||||
function MainlineLevelCtrl:OnBtnClick_Select(btn)
|
||||
EventManager.Hit("SelectLevel", self.levelData.Id)
|
||||
end
|
||||
return MainlineLevelCtrl
|
||||
@@ -0,0 +1,135 @@
|
||||
local MainlineLevelInfoCtrl = class("MainlineLevelInfoCtrl", BaseCtrl)
|
||||
MainlineLevelInfoCtrl._mapNodeConfig = {
|
||||
txtLevelRecommend = {sComponentName = "TMP_Text"},
|
||||
txtNum = {sComponentName = "TMP_Text"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtIntroduce = {sComponentName = "TMP_Text"},
|
||||
Task = {sComponentName = "Transform", nCount = 3},
|
||||
item = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
|
||||
nCount = 5
|
||||
},
|
||||
itemBtn = {
|
||||
sNodeName = "item",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Reward",
|
||||
nCount = 5
|
||||
},
|
||||
btnCloseLevelInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnConfirmInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
txtCountEnergy = {sComponentName = "TMP_Text"},
|
||||
btnCancelInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnEnemy = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_MonsterInfo"
|
||||
},
|
||||
imgIconInfo = {sComponentName = "Image"},
|
||||
btnAllReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_AllReward"
|
||||
}
|
||||
}
|
||||
MainlineLevelInfoCtrl._mapEventConfig = {}
|
||||
function MainlineLevelInfoCtrl:Awake()
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function MainlineLevelInfoCtrl:FadeOut(callback)
|
||||
if type(callback) == "function" then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function MainlineLevelInfoCtrl:OnEnable()
|
||||
end
|
||||
function MainlineLevelInfoCtrl:OnDisable()
|
||||
end
|
||||
function MainlineLevelInfoCtrl:OnDestroy()
|
||||
end
|
||||
function MainlineLevelInfoCtrl:OnRelease()
|
||||
end
|
||||
function MainlineLevelInfoCtrl:OpenLevelInfo(nMainlineId, nStar, tbTarget)
|
||||
self.nMainlineId = nMainlineId
|
||||
local mapMainline = ConfigTable.GetData_Mainline(nMainlineId)
|
||||
if mapMainline == nil then
|
||||
printError("nil mainlineData" .. nMainlineId)
|
||||
return
|
||||
end
|
||||
for index = 1, 3 do
|
||||
local rtTask = self._mapNode.Task[index]
|
||||
local rtDone = rtTask:Find("imgDone").gameObject
|
||||
local rtUnDone = rtTask:Find("imgUnDone").gameObject
|
||||
rtDone:SetActive(tbTarget[index])
|
||||
rtUnDone:SetActive(not tbTarget[index])
|
||||
end
|
||||
self.tbReward = decodeJson(mapMainline.RewardPreview)
|
||||
for index = 1, 5 do
|
||||
if self.tbReward[index] ~= nil then
|
||||
local bRecive = false
|
||||
if self.tbReward[index][3] == 1 and 0 < nStar then
|
||||
bRecive = true
|
||||
end
|
||||
self.tbReward[index][4] = bRecive
|
||||
end
|
||||
end
|
||||
self.tbAfterReward = {}
|
||||
for key, value in pairs(self.tbReward) do
|
||||
table.insert(self.tbAfterReward, value)
|
||||
end
|
||||
for index = 1, 5 do
|
||||
self._mapNode.itemBtn[index].interactable = self.tbAfterReward[index] ~= nil
|
||||
if self.tbAfterReward[index] ~= nil then
|
||||
if self.tbReward[index][4] == nil then
|
||||
end
|
||||
local bReceive = self.tbReward[index][4]
|
||||
self._mapNode.item[index]:SetItem(self.tbAfterReward[index][1], nil, nil, nil, bReceive, self.tbAfterReward[index][3] == 1, self.tbAfterReward[index][3] == 2)
|
||||
else
|
||||
self._mapNode.item[index]:SetItem(nil)
|
||||
end
|
||||
end
|
||||
self.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelRecommend, mapMainline.Recommend)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNum, mapMainline.Num)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapMainline.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtIntroduce, mapMainline.Desc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCountEnergy, mapMainline.EnergyConsume)
|
||||
self.animator:Play("open")
|
||||
end
|
||||
function MainlineLevelInfoCtrl:OnBtnClick_Close()
|
||||
self.gameObject:SetActive(false)
|
||||
EventManager.Hit("SelectMainlineBattle", false)
|
||||
end
|
||||
function MainlineLevelInfoCtrl:OnBtnClick_Confirm()
|
||||
local mapMainline = ConfigTable.GetData_Mainline(self.nMainlineId)
|
||||
if nil ~= mapMainline then
|
||||
local nNeedEnergy = mapMainline.EnergyConsume
|
||||
local nCurEnergy = PlayerData.Base:GetCurEnergy().nEnergy
|
||||
if nNeedEnergy > nCurEnergy then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("MainlineData_Energy"))
|
||||
return
|
||||
end
|
||||
self.gameObject:SetActive(false)
|
||||
EventManager.Hit("SelectMainlineBattle", true)
|
||||
end
|
||||
end
|
||||
function MainlineLevelInfoCtrl:OnBtnClick_MonsterInfo(btn)
|
||||
EventManager.Hit("OpenMainlineMonsterInfo", self.nMainlineId)
|
||||
end
|
||||
function MainlineLevelInfoCtrl:OnBtnClick_AllReward(btn)
|
||||
EventManager.Hit("OpenAllReward", self.tbReward)
|
||||
end
|
||||
function MainlineLevelInfoCtrl:OnBtnClick_Reward(btn)
|
||||
local nIdx = table.indexof(self._mapNode.itemBtn, btn)
|
||||
if self.tbAfterReward[nIdx] ~= nil then
|
||||
local nTid = self.tbAfterReward[nIdx][1]
|
||||
UTILS.ClickItemGridWithTips(nTid, btn.transform, false, true, false)
|
||||
end
|
||||
end
|
||||
return MainlineLevelInfoCtrl
|
||||
@@ -0,0 +1,378 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local MainlineMonsterInfoCtrl = class("MainlineMonsterInfoCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local AvgData = PlayerData.Avg
|
||||
MainlineMonsterInfoCtrl._mapNodeConfig = {
|
||||
goWindow = {sNodeName = "t_window"},
|
||||
anit_window = {sNodeName = "t_window", sComponentName = "Animator"},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "EnemyInfo_Window_Title"
|
||||
},
|
||||
goMonsterHead = {
|
||||
sNodeName = "goMonsterHead",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
txtMonsterName = {
|
||||
sNodeName = "txtMonsterName",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
goMonsterType = {
|
||||
sNodeName = "goMonsterType",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
got_fullscreen_blur_black = {
|
||||
sNodeName = "t_fullscreen_blur_black",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
btnsnapshot = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_ClickClose"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickClose"
|
||||
},
|
||||
btn_Close = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_ClickClose"
|
||||
},
|
||||
goPropertyList = {nCount = 2, sComponentName = "Transform"},
|
||||
txtAttributeTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "EnemyInfo_Window_AttributeTitle"
|
||||
},
|
||||
tc_property = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplatePropertyCtrl"
|
||||
},
|
||||
goAbility = {nCount = 3},
|
||||
txtAbility = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtAbilityTitle = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtStory = {sComponentName = "TMP_Text"},
|
||||
svEnemyList = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
rtContent = {
|
||||
sNodeName = "rtInfoContent",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goStory = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtStoryTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "EnemyInfo_Window_StoryTitle"
|
||||
},
|
||||
txtPropertyNone = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "EnemyInfo_Window_Property_None"
|
||||
},
|
||||
txtProperty1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "EnemyInfo_Window_Property_1"
|
||||
},
|
||||
txtProperty2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "EnemyInfo_Window_Property_2"
|
||||
}
|
||||
}
|
||||
MainlineMonsterInfoCtrl._mapEventConfig = {
|
||||
OpenMainlineMonsterInfo = "OnEvent_OpenMainlineMonsterInfo",
|
||||
OpenFixedRoguelikeMonsterInfo = "OnEvent_OpenFixedRoguelikeMonsterInfo",
|
||||
OpenDailyInstanceMonsterInfo = "OnEvent_OpenDailyInstanceMonsterInfo",
|
||||
OpenEquipmentMonsterInfo = "OnEvent_OpenEquipmentMonsterInfo",
|
||||
OpenTravelerDuelMonsterInfo = "OnEvent_OpenTravelerDuelMonsterInfo",
|
||||
OpenStarTowerMonsterInfo = "OnEvent_OpenStarTowerMonsterInfo",
|
||||
OpenInfinityTowerMonsterInfo = "OnEvent_OpenInfinityTowerMonsterInfo",
|
||||
OpenVampireMonsterInfo = "OnEvent_OpenVampireMonsterInfo",
|
||||
OpenSkillMonsterInfo = "OnEvent_OpenSkillMonsterInfo",
|
||||
OpenActivityLevelsMonsterInfo = "OnEvent_OpenActivityLevelsMonsterInfo"
|
||||
}
|
||||
function MainlineMonsterInfoCtrl:OnEnable()
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:ShowPanel(nPreviewMonsterGroupId, tbOverrideWeakEET)
|
||||
self._mapNode.goWindow:SetActive(false)
|
||||
self._mapNode.got_fullscreen_blur_black:SetActive(true)
|
||||
self.tbOverrideWeakEET = tbOverrideWeakEET
|
||||
self.gameObject:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goWindow:SetActive(true)
|
||||
self._mapNode.anit_window:Play("t_window_04_t_in")
|
||||
local tbMonsterGroup = ConfigTable.GetData("PreviewMonsterGroup", nPreviewMonsterGroupId)
|
||||
if tbMonsterGroup == nil then
|
||||
printError("获取PreviewMonsterGroup配置失败!!!PreviewMonsterGroupId = " .. nPreviewMonsterGroupId)
|
||||
return
|
||||
end
|
||||
self.tbMonster = tbMonsterGroup.MonsterIds
|
||||
self.curSelect = 1
|
||||
if self.tbMonster == nil or #self.tbMonster == 0 then
|
||||
return
|
||||
end
|
||||
local bOpen = true
|
||||
for _, v in ipairs(self.tbMonster) do
|
||||
local monsterCfg = ConfigTable.GetData("Monster", v)
|
||||
if nil == monsterCfg then
|
||||
printError("读取Monster配置失败!!!monsterId = " .. v)
|
||||
bOpen = false
|
||||
end
|
||||
end
|
||||
if not bOpen then
|
||||
return
|
||||
end
|
||||
local comp = function(a, b)
|
||||
local monsterA = ConfigTable.GetData("Monster", a)
|
||||
local monsterB = ConfigTable.GetData("Monster", b)
|
||||
if monsterA == nil or monsterB == nil then
|
||||
return
|
||||
end
|
||||
if monsterA.EpicLv ~= monsterB.EpicLv then
|
||||
return monsterA.EpicLv < monsterB.EpicLv
|
||||
else
|
||||
return a < b
|
||||
end
|
||||
end
|
||||
table.sort(self.tbMonster, comp)
|
||||
local nMonsterId = self.tbMonster[self.curSelect]
|
||||
self:RefreshMonsterInfo(nMonsterId)
|
||||
self._mapNode.svEnemyList:SetAnim(0.03)
|
||||
self._mapNode.svEnemyList:Init(#self.tbMonster, self, self.RefreshMonsterGrid, self.OnBtnClick_Grid)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:RefreshMonsterGrid(goGrid, gridIndex)
|
||||
local index = gridIndex + 1
|
||||
local nMonsterId = self.tbMonster[index]
|
||||
if nMonsterId == 0 then
|
||||
return
|
||||
end
|
||||
if self.curSelect == index then
|
||||
self.curSelectMonster = goGrid
|
||||
end
|
||||
local imgIcon = goGrid.transform:Find("btnGrid/AnimRoot/tc_head_01/--Basic--/imgIcon"):GetComponent("Image")
|
||||
local goSelect = goGrid.transform:Find("btnGrid/AnimRoot/tc_head_01/--Common--").gameObject
|
||||
local goBoss = goGrid.transform:Find("btnGrid/AnimRoot/tc_head_01/--Monster--/goBoss").gameObject
|
||||
local goElite = goGrid.transform:Find("btnGrid/AnimRoot/tc_head_01/--Monster--/goElite").gameObject
|
||||
local goLeader = goGrid.transform:Find("btnGrid/AnimRoot/tc_head_01/--Monster--/goLeader").gameObject
|
||||
local mData = ConfigTable.GetData("Monster", nMonsterId)
|
||||
if nil == mData then
|
||||
printError("读取Monster配置失败!!!monsterId = " .. nMonsterId)
|
||||
return
|
||||
end
|
||||
local mSkin = ConfigTable.GetData("MonsterSkin", mData.FAId)
|
||||
if nil == mSkin then
|
||||
printError("读取MonsterSkin配置失败!!!skinId = " .. mData.FAId)
|
||||
return
|
||||
end
|
||||
local mManual = ConfigTable.GetData("MonsterManual", mSkin.MonsterManual)
|
||||
if nil == mManual then
|
||||
printError("读取MonsterSkin配置失败!!!MonsterManualId = " .. mSkin.MonsterManual)
|
||||
return
|
||||
end
|
||||
self:SetPngSprite(imgIcon, mManual.Icon)
|
||||
goSelect:SetActive(self.curSelect == index)
|
||||
goBoss:SetActive(mData.EpicLv == GameEnum.monsterEpicType.LORD)
|
||||
goLeader:SetActive(mData.EpicLv == GameEnum.monsterEpicType.LEADER)
|
||||
goElite:SetActive(mData.EpicLv == GameEnum.monsterEpicType.ELITE)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:RefreshMonsterInfo(nMonsterId)
|
||||
local monsterData = ConfigTable.GetData("Monster", nMonsterId)
|
||||
if nil == monsterData then
|
||||
printError(string.format("Monster数据为空!!!id = [%s]", nMonsterId))
|
||||
return
|
||||
end
|
||||
local monsterSkin = ConfigTable.GetData("MonsterSkin", monsterData.FAId)
|
||||
if nil == monsterSkin then
|
||||
printError(string.format("MonsterSkin数据为空!!!id = [%s]", monsterData.FAId))
|
||||
return
|
||||
end
|
||||
local monsterAdjust = ConfigTable.GetData("MonsterValueTempleteAdjust", monsterData.Templete)
|
||||
if nil == monsterAdjust then
|
||||
printError(string.format("MonsterValueTempleteAdjust数据为空!!!id = [%s]", monsterData.Templete))
|
||||
return
|
||||
end
|
||||
local monsterManual = ConfigTable.GetData("MonsterManual", monsterSkin.MonsterManual)
|
||||
if nil == monsterManual then
|
||||
printError(string.format("MonsterManual数据为空!!!id = [%s]", monsterSkin.MonsterManual))
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMonsterName, monsterManual.Name)
|
||||
local imgIcon = self._mapNode.goMonsterHead:Find("--Basic--/imgIcon"):GetComponent("Image")
|
||||
self:SetPngSprite(imgIcon, monsterManual.Icon)
|
||||
if monsterData.EpicLv ~= GameEnum.monsterEpicType.NORMAL then
|
||||
self._mapNode.goMonsterType:SetActive(true)
|
||||
local goBoss = self._mapNode.goMonsterType.transform:GetChild(0).gameObject
|
||||
goBoss:SetActive(monsterData.EpicLv == GameEnum.monsterEpicType.LORD)
|
||||
local goElite = self._mapNode.goMonsterType.transform:GetChild(1).gameObject
|
||||
goElite:SetActive(monsterData.EpicLv == GameEnum.monsterEpicType.ELITE)
|
||||
local goLeader = self._mapNode.goMonsterType.transform:GetChild(2).gameObject
|
||||
goLeader:SetActive(monsterData.EpicLv == GameEnum.monsterEpicType.LEADER)
|
||||
else
|
||||
self._mapNode.goMonsterType:SetActive(false)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtStory, monsterManual.Desc)
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.goStory)
|
||||
local eets = {}
|
||||
if monsterAdjust.EET ~= GameEnum.elementType.NONE then
|
||||
table.insert(eets, monsterAdjust.EET)
|
||||
end
|
||||
self:RefreshElement(self._mapNode.goPropertyList[1], self.tbOverrideWeakEET == nil and monsterAdjust.WeakEET or self.tbOverrideWeakEET, 1)
|
||||
self:RefreshElement(self._mapNode.goPropertyList[2], eets, 2)
|
||||
self:RefreshPropertys(monsterManual)
|
||||
self:RefreshAbility(monsterManual)
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtContent)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:RefreshElement(goParent, elementType, index)
|
||||
local bNone = true
|
||||
for i = 1, 3 do
|
||||
local icon = goParent:GetChild(i - 1):GetComponent("Image")
|
||||
if elementType[i] ~= nil then
|
||||
icon.gameObject:SetActive(true)
|
||||
local sName = AllEnum.ElementIconType.Icon .. elementType[i]
|
||||
self:SetAtlasSprite(icon, "12_rare", sName)
|
||||
bNone = false
|
||||
else
|
||||
icon.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
self._mapNode.txtPropertyNone[index].gameObject:SetActive(bNone)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:RefreshPropertys(monsterManual)
|
||||
local data = self._mapNode.tc_property[1]:_GetAttributeDesc("Hp")
|
||||
if data ~= nil and data ~= false then
|
||||
local name = self:GetAttritubeTypeSizeText(monsterManual.HP)
|
||||
self._mapNode.tc_property[1]:_RefreshContent(data.Icon, data.Desc, "", name)
|
||||
end
|
||||
data = self._mapNode.tc_property[2]:_GetAttributeDesc("Def")
|
||||
if data ~= nil and data ~= false then
|
||||
local name = self:GetAttritubeTypeSizeText(monsterManual.DEF)
|
||||
self._mapNode.tc_property[2]:_RefreshContent(data.Icon, data.Desc, "", name)
|
||||
end
|
||||
data = self._mapNode.tc_property[3]:_GetAttributeDesc("Atk")
|
||||
if data ~= nil and data ~= false then
|
||||
local name = self:GetAttritubeTypeSizeText(monsterManual.ATK)
|
||||
self._mapNode.tc_property[3]:_RefreshContent(data.Icon, data.Desc, "", name)
|
||||
end
|
||||
data = self._mapNode.tc_property[4]:_GetAttributeDesc("Toughness")
|
||||
if data ~= nil and data ~= false then
|
||||
local name = self:GetAttritubeTypeSizeText(monsterManual.TOUGHNESS)
|
||||
self._mapNode.tc_property[4]:_RefreshContent(data.Icon, data.Desc, "", name)
|
||||
end
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:RefreshAbility(monsterManual)
|
||||
for i = 1, 3 do
|
||||
if monsterManual["AbilityTitle" .. i] ~= nil and monsterManual["AbilityTitle" .. i] ~= "" then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAbility[i], monsterManual["AbilityDesc" .. i])
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAbilityTitle[i], monsterManual["AbilityTitle" .. i])
|
||||
self._mapNode.goAbility[i]:SetActive(true)
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.goAbility[i]:GetComponent("RectTransform"))
|
||||
else
|
||||
self._mapNode.goAbility[i]:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:OnBtn_ClickClose()
|
||||
self._mapNode.got_fullscreen_blur_black:SetActive(false)
|
||||
self._mapNode.anit_window:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, 0.3, "OnCloseAnimFinish", true, true, true)
|
||||
self.tbMonster = nil
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:OnBtnClick_Grid(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
if nIndex ~= self.curSelect then
|
||||
local curGridName = tostring(self.curSelect - 1)
|
||||
local rtCurItem = self.curSelectMonster
|
||||
if rtCurItem ~= nil then
|
||||
rtCurItem.transform:Find("btnGrid/AnimRoot/tc_head_01/--Common--").gameObject:SetActive(false)
|
||||
end
|
||||
self.curSelect = nIndex
|
||||
self.curSelectMonster = goGrid
|
||||
goGrid.transform:Find("btnGrid/AnimRoot/tc_head_01/--Common--").gameObject:SetActive(true)
|
||||
local nMonsterId = self.tbMonster[nIndex]
|
||||
self:RefreshMonsterInfo(nMonsterId)
|
||||
end
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:OnEvent_OpenMainlineMonsterInfo(avgId)
|
||||
local mapStory = AvgData:GetStoryCfgData(avgId)
|
||||
if mapStory == nil then
|
||||
return
|
||||
end
|
||||
self:ShowPanel(mapStory.PreviewMonsterGroupId)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:OnEvent_OpenFixedRoguelikeMonsterInfo(nRoguelikeId)
|
||||
local mapRoguelike = ConfigTable.GetData("StarTower", nRoguelikeId)
|
||||
if mapRoguelike == nil then
|
||||
return
|
||||
end
|
||||
self:ShowPanel(mapRoguelike.PreviewMonsterGroupId)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:OnEvent_OpenDailyInstanceMonsterInfo(nLevelId)
|
||||
local mapDailyInstance = ConfigTable.GetData("DailyInstance", nLevelId)
|
||||
if mapDailyInstance == nil then
|
||||
return
|
||||
end
|
||||
self:ShowPanel(mapDailyInstance.PreviewMonsterGroupId)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:OnEvent_OpenTravelerDuelMonsterInfo(nLevelId)
|
||||
local mapTravelerDuel = ConfigTable.GetData("TravelerDuelBossLevel", nLevelId)
|
||||
if mapTravelerDuel == nil then
|
||||
return
|
||||
end
|
||||
self:ShowPanel(mapTravelerDuel.PreviewMonsterGroupId)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:OnEvent_OpenEquipmentMonsterInfo(nLevelId)
|
||||
local mapEquipmentIns = ConfigTable.GetData("CharGemInstance", nLevelId)
|
||||
if mapEquipmentIns == nil then
|
||||
return
|
||||
end
|
||||
self:ShowPanel(mapEquipmentIns.PreviewMonsterGroupId)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:OnEvent_OpenSkillMonsterInfo(nLevelId)
|
||||
local mapSkillIns = ConfigTable.GetData("SkillInstance", nLevelId)
|
||||
if mapSkillIns == nil then
|
||||
return
|
||||
end
|
||||
self:ShowPanel(mapSkillIns.PreviewMonsterGroupId)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:OnEvent_OpenStarTowerMonsterInfo(nStarTowerId)
|
||||
local mapStarTower = ConfigTable.GetData("StarTower", nStarTowerId)
|
||||
if mapStarTower == nil then
|
||||
return
|
||||
end
|
||||
self:ShowPanel(mapStarTower.PreviewMonsterGroupId)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:OnEvent_OpenInfinityTowerMonsterInfo(levelId)
|
||||
local lvData = ConfigTable.GetData("InfinityTowerLevel", levelId)
|
||||
if lvData == nil then
|
||||
return
|
||||
end
|
||||
local flData = ConfigTable.GetData("InfinityTowerFloor", lvData.FloorId)
|
||||
if flData == nil then
|
||||
return
|
||||
end
|
||||
self:ShowPanel(flData.PreviewMonsterGroupId)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:OnEvent_OpenVampireMonsterInfo(nPreviewMonsterGroupId, tbOverrideWeakEET)
|
||||
self:ShowPanel(nPreviewMonsterGroupId, tbOverrideWeakEET)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:OnEvent_OpenActivityLevelsMonsterInfo(nPreviewMonsterGroupId)
|
||||
self:ShowPanel(nPreviewMonsterGroupId)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:OnCloseAnimFinish()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
function MainlineMonsterInfoCtrl:GetAttritubeTypeSizeText(sizeType)
|
||||
if sizeType == GameEnum.attributeSizeType.High then
|
||||
return ConfigTable.GetUIText("Attribute_Size_High")
|
||||
elseif sizeType == GameEnum.attributeSizeType.Mid then
|
||||
return ConfigTable.GetUIText("Attribute_Size_Mid")
|
||||
elseif sizeType == GameEnum.attributeSizeType.Low then
|
||||
return ConfigTable.GetUIText("Attribute_Size_Low")
|
||||
else
|
||||
return ConfigTable.GetUIText("Attribute_Size_None")
|
||||
end
|
||||
end
|
||||
return MainlineMonsterInfoCtrl
|
||||
@@ -0,0 +1,128 @@
|
||||
local RewardListCtrl = class("RewardListCtrl", BaseCtrl)
|
||||
RewardListCtrl._mapNodeConfig = {
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Instance_Reward_Preview_Title"
|
||||
},
|
||||
rewardList = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
btnCloseRewardList = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClickClose"
|
||||
},
|
||||
btnBlur = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClickClose"
|
||||
},
|
||||
animWindow = {sNodeName = "t_window", sComponentName = "Animator"},
|
||||
goWindow = {sNodeName = "t_window"}
|
||||
}
|
||||
RewardListCtrl._mapEventConfig = {}
|
||||
function RewardListCtrl:Awake()
|
||||
self._mapNode.goWindow:SetActive(false)
|
||||
end
|
||||
function RewardListCtrl:FadeOut()
|
||||
end
|
||||
function RewardListCtrl:OnEnable()
|
||||
end
|
||||
function RewardListCtrl:OnDisable()
|
||||
end
|
||||
function RewardListCtrl:OnDestroy()
|
||||
end
|
||||
function RewardListCtrl:OnRelease()
|
||||
end
|
||||
function RewardListCtrl:OpenPanel(tbReward, tbExtraDropReward)
|
||||
self._mapNode.goWindow:SetActive(false)
|
||||
self._mapNode.btnBlur.gameObject:SetActive(true)
|
||||
self.gameObject:SetActive(true)
|
||||
self._mapGrid = {}
|
||||
self.tbReward = {}
|
||||
local extraDropRewardCount = 0
|
||||
if tbExtraDropReward ~= nil then
|
||||
for k, v in pairs(tbExtraDropReward) do
|
||||
extraDropRewardCount = extraDropRewardCount + 1
|
||||
end
|
||||
end
|
||||
local needEx = tbExtraDropReward ~= nil and 0 < extraDropRewardCount
|
||||
local bBeforebFirstPass = true
|
||||
for i = 1, #tbReward do
|
||||
local bCurFirstPass = tbReward[i][3] ~= nil and tbReward[i][3] == 1
|
||||
if not bCurFirstPass and bBeforebFirstPass and needEx then
|
||||
tbExtraDropReward[6] = true
|
||||
table.insert(self.tbReward, tbExtraDropReward)
|
||||
needEx = false
|
||||
end
|
||||
bBeforebFirstPass = bCurFirstPass
|
||||
table.insert(self.tbReward, tbReward[i])
|
||||
end
|
||||
if needEx then
|
||||
tbExtraDropReward[6] = true
|
||||
table.insert(self.tbReward, tbExtraDropReward)
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goWindow:SetActive(true)
|
||||
self._mapNode.animWindow:Play("t_window_04_t_in")
|
||||
self._mapNode.rewardList:SetAnim(0.04)
|
||||
self._mapNode.rewardList:Init(#self.tbReward, self, self.OnGridRefresh, self.OnGridBtnClick)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function RewardListCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIdx = gridIndex + 1
|
||||
if self._mapGrid[goGrid] == nil then
|
||||
local goItem = goGrid.transform:Find("btnGrid/AnimRoot/gridRt/Item").gameObject
|
||||
self._mapGrid[goGrid] = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
local tbItem = self.tbReward[nIdx]
|
||||
local nRewardTypeIndex, nReceiveIndex, nShowCountIndex, nExtraDropIndex = 3, 4, 5, 6
|
||||
local bFloatCount = type(tbItem[4]) == "number"
|
||||
if bFloatCount then
|
||||
nRewardTypeIndex = 4
|
||||
nReceiveIndex = 5
|
||||
nShowCountIndex = 6
|
||||
nExtraDropIndex = 7
|
||||
end
|
||||
local bReceived = tbItem[nReceiveIndex] == true
|
||||
local nRewardType = tbItem[nRewardTypeIndex] or 0
|
||||
local bExtraDrop = tbItem[nExtraDropIndex] == true
|
||||
local nCount = -1
|
||||
if tbItem[nShowCountIndex] ~= false then
|
||||
local tbItemCount = bFloatCount and {
|
||||
tbItem[1],
|
||||
tbItem[2],
|
||||
tbItem[3],
|
||||
tbItem[4]
|
||||
} or {
|
||||
tbItem[1],
|
||||
tbItem[2],
|
||||
tbItem[3]
|
||||
}
|
||||
nCount = UTILS.ParseRewardItemCount(tbItemCount)
|
||||
end
|
||||
self._mapGrid[goGrid]:SetItem(tbItem[1], nil, nCount, nil, bReceived, nRewardType == 1, nRewardType == 2, false, false, false, bExtraDrop == true)
|
||||
end
|
||||
function RewardListCtrl:OnGridBtnClick(goGrid, gridIndex)
|
||||
local nIdx = gridIndex + 1
|
||||
local rtItem = goGrid.transform:Find("btnGrid/AnimRoot/gridRt/Item")
|
||||
local nTid = self.tbReward[nIdx][1]
|
||||
UTILS.ClickItemGridWithTips(nTid, rtItem, true, true, false)
|
||||
end
|
||||
function RewardListCtrl:OnBtnClickClose(btn)
|
||||
self._mapNode.btnBlur.gameObject:SetActive(false)
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.animWindow, {
|
||||
"t_window_04_t_out"
|
||||
})
|
||||
self._mapNode.animWindow:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
self.gameObject:SetActive(false)
|
||||
for goGrid, itemCtrl in pairs(self._mapGrid) do
|
||||
self:UnbindCtrlByNode(itemCtrl)
|
||||
end
|
||||
self._mapGrid = {}
|
||||
end)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
end
|
||||
return RewardListCtrl
|
||||
@@ -0,0 +1,261 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local StoryChapterCtrl = class("StoryChapterCtrl", BaseCtrl)
|
||||
local AvgData = PlayerData.Avg
|
||||
StoryChapterCtrl._mapNodeConfig = {
|
||||
loopsvChapterList = {
|
||||
sNodeName = "svChapterList",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtName = {sNodeName = "txtName", sComponentName = "TMP_Text"},
|
||||
goPersonality = {
|
||||
sNodeName = "goPersonality",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
btnChangeInfo = {
|
||||
sNodeName = "btnChangeInfo",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickChangeInfo"
|
||||
},
|
||||
btnLeft = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickStoryChapter"
|
||||
},
|
||||
btnRight = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivity"
|
||||
},
|
||||
Select = {nCount = 2},
|
||||
unSelect = {nCount = 2},
|
||||
rtActor2D = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
animActor2D = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
aniBg = {sNodeName = "----Bg----", sComponentName = "Animator"},
|
||||
TabRedDot = {},
|
||||
txt_Select_1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldMap_MainLine_Avg"
|
||||
},
|
||||
txt_unSelect_1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldMap_MainLine_Avg"
|
||||
},
|
||||
txt_Select_2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Story_Activity"
|
||||
},
|
||||
txt_unSelect_2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Story_Activity"
|
||||
},
|
||||
txtBtnChangeInfo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Change_Role_Character"
|
||||
}
|
||||
}
|
||||
StoryChapterCtrl._mapEventConfig = {
|
||||
[EventId.UIBackConfirm] = "OnEvent_UIBackConfirm",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_BackHome"
|
||||
}
|
||||
StoryChapterCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.Map_MainLine] = {sNodeName = "TabRedDot"}
|
||||
}
|
||||
function StoryChapterCtrl:Awake()
|
||||
self.bInitLoop = true
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.fromPanel = tbParam[1] ~= nil and tbParam[1] or 0
|
||||
self.aniSafeRoot = self.gameObject:GetComponent("Animator")
|
||||
self.constImgTitleBgWidth = 143.5
|
||||
local callback = function()
|
||||
self.bHasAchievementData = true
|
||||
end
|
||||
PlayerData.Achievement:SendAchievementInfoReq(callback)
|
||||
end
|
||||
function StoryChapterCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function StoryChapterCtrl:OnEnable()
|
||||
self:SwitchTog(true)
|
||||
self.tbGridCtrl = {}
|
||||
local count = 0
|
||||
self.nCompletedChapter = AvgData:GetNewLockChapterIndex()
|
||||
count, self.tbAllChapter = PlayerData.Avg:GetChapterCount()
|
||||
self.nRecentChapterId = PlayerData.Avg:GetRecentChapterId()
|
||||
self._mapNode.loopsvChapterList:Init(count, self, self.RefreshChapterList)
|
||||
self._mapNode.loopsvChapterList:SetScrollGridPos(self.nRecentChapterId - 3)
|
||||
if not self.bInitLoop then
|
||||
local index = 0
|
||||
for k, v in pairs(self.tbGridCtrl) do
|
||||
if v.Id ~= self.nCompletedChapter + 1 then
|
||||
v.aniTrans:Play("StoryChapter_chapter_back")
|
||||
end
|
||||
end
|
||||
end
|
||||
self.bInitLoop = false
|
||||
self:RefreshPersonality()
|
||||
self._mapNode.animActor2D:Play("Actor2D_PNG_right_in")
|
||||
end
|
||||
function StoryChapterCtrl:OnDisable()
|
||||
end
|
||||
function StoryChapterCtrl:RefreshChapterList(grid, index)
|
||||
index = index + 1
|
||||
local chapterData = self.tbAllChapter[index]
|
||||
if chapterData == nil then
|
||||
return
|
||||
end
|
||||
local trans = grid.transform:Find("btn/AnimRoot")
|
||||
local imgBg = trans:Find("imgBg"):GetComponent("Image")
|
||||
local txtIndex = trans:Find("txtIndex"):GetComponent("TMP_Text")
|
||||
local txtChapterIndex = trans:Find("imgTitle1/txtChapterIndex"):GetComponent("TMP_Text")
|
||||
local goUnlock = trans:Find("goUnlock")
|
||||
local goLock = trans:Find("goLock")
|
||||
local txtTitle = goUnlock:Find("txtTitle"):GetComponent("TMP_Text")
|
||||
local txtIndexTitle = goUnlock:Find("txtIndexTitle"):GetComponent("TMP_Text")
|
||||
local aniTrans = trans:GetComponent("Animator")
|
||||
local ChapterRedDot = trans:Find("ChapterRedDot")
|
||||
local goFXChapterList = trans:Find("FXChapterList")
|
||||
local nInstanceID = grid:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceID] then
|
||||
self.tbGridCtrl[nInstanceID] = {
|
||||
Id = chapterData.Id,
|
||||
aniTrans = aniTrans
|
||||
}
|
||||
end
|
||||
RedDotManager.RegisterNode(RedDotDefine.Map_MainLine_Chapter, chapterData.Id, ChapterRedDot, nil, nil, true)
|
||||
if self.bInitLoop and self.nCompletedChapter < 0 and self.nRecentChapterId <= 3 then
|
||||
if index <= 5 then
|
||||
if index == 1 then
|
||||
aniTrans:Play("StoryChapter_chapter_in")
|
||||
else
|
||||
self:AddTimer(1, 0.1 * (index - 1), function()
|
||||
aniTrans:Play("StoryChapter_chapter_in")
|
||||
end, true, true, true)
|
||||
end
|
||||
else
|
||||
aniTrans:Play("StoryChapter_chapter_defaut")
|
||||
end
|
||||
else
|
||||
aniTrans:Play("StoryChapter_chapter_defaut")
|
||||
end
|
||||
NovaAPI.SetTMPText(txtIndex, chapterData.Index)
|
||||
NovaAPI.SetTMPText(txtChapterIndex, chapterData.Name)
|
||||
self:SetPngSprite(imgBg, chapterData.ChapterIcon)
|
||||
local isUnlock, lockText = PlayerData.Avg:IsStoryChapterUnlock(chapterData.Id)
|
||||
goFXChapterList.gameObject:SetActive(false)
|
||||
if self.nCompletedChapter + 1 == chapterData.Id and isUnlock then
|
||||
goFXChapterList.gameObject:SetActive(true)
|
||||
aniTrans:Play("StoryChapter_chapter_Unlock")
|
||||
end
|
||||
goUnlock.gameObject:SetActive(true)
|
||||
goLock.gameObject:SetActive(not isUnlock or self.nCompletedChapter + 1 == chapterData.Id)
|
||||
NovaAPI.SetTMPText(txtTitle, chapterData.Desc)
|
||||
local RecentStoryId = PlayerData.Avg:GetRecentStoryId(chapterData.Id)
|
||||
if RecentStoryId ~= nil and isUnlock then
|
||||
local storyData = ConfigTable.GetData_Story(RecentStoryId)
|
||||
NovaAPI.SetTMPText(txtIndexTitle, storyData.Index .. " " .. storyData.Title)
|
||||
elseif not isUnlock then
|
||||
NovaAPI.SetTMPText(txtIndexTitle, ConfigTable.GetUIText("Chapter_Not_Unlock"))
|
||||
end
|
||||
if not isUnlock then
|
||||
local txtLock = goLock:Find("txtLock"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtLock, lockText)
|
||||
end
|
||||
local btn = grid.transform:Find("btn"):GetComponent("UIButton")
|
||||
btn.onClick:RemoveAllListeners()
|
||||
btn.onClick:AddListener(function()
|
||||
if isUnlock then
|
||||
aniTrans:Play("StoryChapter_chapter_setout")
|
||||
self:OnBtn_ClickChapterGrid(chapterData.Id, grid)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenMessageBox, lockText)
|
||||
end
|
||||
end)
|
||||
end
|
||||
function StoryChapterCtrl:RefreshPersonality()
|
||||
local tbPersonality, sTitle = PlayerData.Avg:CalcPersonality(1)
|
||||
NovaAPI.SetPersonalityRing(self._mapNode.goPersonality, tbPersonality)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, sTitle)
|
||||
local charId = AdjustMainRoleAvgCharId()
|
||||
local spBody, spFace, v3OffsetPos, v3OffsetScale, spBlackBody = self:GetAvgPortrait(charId, "a", "002")
|
||||
local trans = self._mapNode.rtActor2D
|
||||
local trPanelOffset = trans:GetChild(0)
|
||||
local trOffset = trPanelOffset:GetChild(0)
|
||||
trOffset.localScale = v3OffsetScale
|
||||
local imgBody = trOffset:GetChild(0):GetComponent("Image")
|
||||
local imgFace = trOffset:GetChild(1):GetComponent("Image")
|
||||
NovaAPI.SetImageSpriteAsset(imgBody, spBody)
|
||||
NovaAPI.SetImageSpriteAsset(imgFace, spFace)
|
||||
NovaAPI.SetImageNativeSize(imgBody)
|
||||
NovaAPI.SetImageNativeSize(imgFace)
|
||||
end
|
||||
function StoryChapterCtrl:SwitchTog(bLeft)
|
||||
self._mapNode.Select[1]:SetActive(bLeft)
|
||||
self._mapNode.unSelect[1]:SetActive(not bLeft)
|
||||
self._mapNode.Select[2]:SetActive(not bLeft)
|
||||
self._mapNode.unSelect[2]:SetActive(bLeft)
|
||||
end
|
||||
function StoryChapterCtrl:PlayAnimOut()
|
||||
self._mapNode.aniBg:Play("StoryChapter_bg_out")
|
||||
self.aniSafeRoot:Play("StoryChapter_out")
|
||||
self._mapNode.animActor2D:Play("Actor2D_PNG_right_out")
|
||||
local time1 = NovaAPI.GetAnimClipLength(self._mapNode.aniBg, {
|
||||
"StoryChapter_bg_out"
|
||||
})
|
||||
local time2 = NovaAPI.GetAnimClipLength(self.aniSafeRoot, {
|
||||
"StoryChapter_out"
|
||||
})
|
||||
local time = math.min(time1, time2)
|
||||
return time
|
||||
end
|
||||
function StoryChapterCtrl:OnBtn_ClickChapterGrid(index, grid)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 1)
|
||||
for k, v in pairs(self.tbGridCtrl) do
|
||||
if k ~= grid:GetInstanceID() then
|
||||
v.aniTrans:Play("StoryChapter_chapter_unsetout")
|
||||
end
|
||||
end
|
||||
local time = self:PlayAnimOut()
|
||||
self:AddTimer(1, time, function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MainlineEx, index, PanelId.StoryChapter)
|
||||
end, true, true, true)
|
||||
end
|
||||
function StoryChapterCtrl:OnBtn_ClickChangeInfo()
|
||||
local time = self:PlayAnimOut()
|
||||
self:AddTimer(1, time, function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ChangeGender)
|
||||
end, true, true, true)
|
||||
end
|
||||
function StoryChapterCtrl:OnBtn_ClickStoryChapter()
|
||||
self:SwitchTog(true)
|
||||
self._mapNode.loopsvChapterList.gameObject:SetActive(true)
|
||||
local count = PlayerData.Avg:GetChapterCount()
|
||||
self._mapNode.loopsvChapterList:Init(count, self, self.RefreshChapterList)
|
||||
end
|
||||
function StoryChapterCtrl:OnBtn_ClickActivity()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Function_NotAvailable"))
|
||||
end
|
||||
function StoryChapterCtrl:OnEvent_UIBackConfirm()
|
||||
if self.fromPanel ~= 0 and self.fromPanel ~= PanelId.StoryChapter then
|
||||
if self.fromPanel == PanelId.MainlineEx then
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineEx)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.LevelMenu)
|
||||
end
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.StoryChapter)
|
||||
end
|
||||
function StoryChapterCtrl:OnEvent_BackHome(nPanelId)
|
||||
if self._panel._nPanelId ~= nPanelId then
|
||||
return
|
||||
end
|
||||
PanelManager.Home()
|
||||
end
|
||||
return StoryChapterCtrl
|
||||
@@ -0,0 +1,19 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local StoryChapterPanel = class("StoryChapterPanel", BasePanel)
|
||||
StoryChapterPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "MainlineEx/StoryChapterPanel.prefab",
|
||||
sCtrlName = "Game.UI.MainlineEx.StoryChapterCtrl"
|
||||
}
|
||||
}
|
||||
function StoryChapterPanel:Awake()
|
||||
end
|
||||
function StoryChapterPanel:OnEnable()
|
||||
end
|
||||
function StoryChapterPanel:OnDisable()
|
||||
end
|
||||
function StoryChapterPanel:OnDestroy()
|
||||
end
|
||||
function StoryChapterPanel:OnRelease()
|
||||
end
|
||||
return StoryChapterPanel
|
||||
@@ -0,0 +1,91 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local StoryClueCtrl = class("StoryClueCtrl", BaseCtrl)
|
||||
local AvgData = PlayerData.Avg
|
||||
StoryClueCtrl._mapNodeConfig = {
|
||||
got_fullscreen = {
|
||||
sNodeName = "t_fullscreen",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
btnsnapshot = {
|
||||
sNodeName = "btnsnapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_ClickClose"
|
||||
},
|
||||
btnClose = {
|
||||
sNodeName = "btnClose",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickClose"
|
||||
},
|
||||
anit_window = {sNodeName = "t_window", sComponentName = "Animator"},
|
||||
loopsvClue = {
|
||||
sNodeName = "svClue",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtWindowTitle = {sComponentName = "TMP_Text", sLanguageId = "Story_Clue"},
|
||||
txtUnkownClueDecs = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Story_Unkown_Clue"
|
||||
}
|
||||
}
|
||||
StoryClueCtrl._mapEventConfig = {}
|
||||
function StoryClueCtrl:Awake()
|
||||
end
|
||||
function StoryClueCtrl:FadeIn()
|
||||
end
|
||||
function StoryClueCtrl:FadeOut()
|
||||
end
|
||||
function StoryClueCtrl:OnEnable()
|
||||
end
|
||||
function StoryClueCtrl:RefreshPanel()
|
||||
self.gameObject:SetActive(true)
|
||||
self._mapNode.anit_window:Play("t_window_04_t_in")
|
||||
self._mapNode.got_fullscreen:SetActive(true)
|
||||
self.tbEvidence = {}
|
||||
for k, v in pairs(AvgData.CFG_StoryEvidence) do
|
||||
if v.visible == 1 then
|
||||
table.insert(self.tbEvidence, v)
|
||||
end
|
||||
end
|
||||
table.sort(self.tbEvidence, function(a, b)
|
||||
return a < b
|
||||
end)
|
||||
local count = #self.tbEvidence
|
||||
self._mapNode.loopsvClue.gameObject:SetActive(true)
|
||||
self._mapNode.loopsvClue:SetAnim(0.07)
|
||||
self._mapNode.loopsvClue:Init(count, self, self.OnRefreshClueList)
|
||||
end
|
||||
function StoryClueCtrl:OnRefreshClueList(grid)
|
||||
local index = tonumber(grid.name) + 1
|
||||
local evidenceId = self.tbEvidence[index]
|
||||
local mapData = ConfigTable.GetData("StoryEvidence", evidenceId)
|
||||
local bUnlock = AvgData:IsEvidenceUnlock(mapData.EvId)
|
||||
local trans = grid.transform:Find("btnGrid/AnimRoot")
|
||||
local goUnlock = trans:Find("goUnlockClue")
|
||||
local goLock = trans:Find("goLockClue")
|
||||
local imgBg = goUnlock:Find("imgChoiceBg"):GetComponent("Image")
|
||||
local imgItem = goUnlock:Find("imgClueItem"):GetComponent("Image")
|
||||
local txtClueTitle = goUnlock:Find("txtClueTitle"):GetComponent("TMP_Text")
|
||||
local txtClueDesc = goUnlock:Find("txtClueDesc"):GetComponent("TMP_Text")
|
||||
local reddot = trans:Find("reddot")
|
||||
goLock.gameObject:SetActive(not bUnlock)
|
||||
goUnlock.gameObject:SetActive(bUnlock)
|
||||
reddot.gameObject:SetActive(false)
|
||||
if bUnlock then
|
||||
if mapData.Icon ~= "" then
|
||||
self:SetPngSprite(imgItem, mapData.Icon)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtClueTitle, mapData.Name)
|
||||
NovaAPI.SetTMPText(txtClueDesc, mapData.Desc)
|
||||
local bReddot = RedDotManager.GetValid(RedDotDefine.MianStoryClue_Use, evidenceId)
|
||||
reddot.gameObject:SetActive(bReddot)
|
||||
end
|
||||
end
|
||||
function StoryClueCtrl:OnBtn_ClickClose()
|
||||
self._mapNode.anit_window:Play("t_window_04_t_out")
|
||||
self._mapNode.got_fullscreen:SetActive(false)
|
||||
self:AddTimer(1, 0.3, "OnCloseAnimFinish", true, true, true)
|
||||
end
|
||||
function StoryClueCtrl:OnCloseAnimFinish()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
return StoryClueCtrl
|
||||
@@ -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
|
||||
@@ -0,0 +1,19 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local StoryEntrancePanel = class("StoryEntrancePanel", BasePanel)
|
||||
StoryEntrancePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "MainlineEx/StoryEntrancePanel.prefab",
|
||||
sCtrlName = "Game.UI.MainlineEx.StoryEntranceCtrl"
|
||||
}
|
||||
}
|
||||
function StoryEntrancePanel:Awake()
|
||||
end
|
||||
function StoryEntrancePanel:OnEnable()
|
||||
end
|
||||
function StoryEntrancePanel:OnDisable()
|
||||
end
|
||||
function StoryEntrancePanel:OnDestroy()
|
||||
end
|
||||
function StoryEntrancePanel:OnRelease()
|
||||
end
|
||||
return StoryEntrancePanel
|
||||
Reference in New Issue
Block a user