Update - 1.9.0.103
EN: 1.9.0.103 CN: 1.9.0.104 JP: 1.9.0.106 KR: 1.9.0.108
This commit is contained in:
@@ -2,11 +2,12 @@ local KeyNodeListCtrl = class("KeyNodeListCtrl", BaseCtrl)
|
||||
local _, ReadyColor = ColorUtility.TryParseHtmlString("#f1f4f6")
|
||||
local _, LockColor = ColorUtility.TryParseHtmlString("#657eae")
|
||||
KeyNodeListCtrl._mapNodeConfig = {
|
||||
goLine = {nCount = 4},
|
||||
goLine = {nCount = 5},
|
||||
line1_ = {nCount = 2, sComponentName = "Image"},
|
||||
line2_ = {nCount = 2, sComponentName = "Image"},
|
||||
line3_1 = {sComponentName = "Image"},
|
||||
line4_1 = {sComponentName = "Image"},
|
||||
line5_1 = {sComponentName = "Image"},
|
||||
KeyNode = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.StarTowerGrowth.KeyNodeCtrl"
|
||||
@@ -49,9 +50,11 @@ function KeyNodeListCtrl:Refresh(nCloumn, tbNodes, tbId, mapNext)
|
||||
nLineType = nCount + 2
|
||||
elseif #mapNext.tbId == 3 then
|
||||
nLineType = nCount
|
||||
elseif nCount == 1 and #mapNext.tbId == 1 then
|
||||
nLineType = 5
|
||||
end
|
||||
end
|
||||
for i = 1, 4 do
|
||||
for i = 1, 5 do
|
||||
self._mapNode.goLine[i]:SetActive(nLineType == i)
|
||||
end
|
||||
if nLineType == 1 then
|
||||
@@ -75,6 +78,9 @@ function KeyNodeListCtrl:Refresh(nCloumn, tbNodes, tbId, mapNext)
|
||||
elseif nLineType == 4 then
|
||||
NovaAPI.SetImageColor(self._mapNode.line4_1, color)
|
||||
end
|
||||
elseif nLineType == 5 then
|
||||
local color = tbNodes[tbId[1]].bActive and ReadyColor or LockColor
|
||||
NovaAPI.SetImageColor(self._mapNode.line5_1, color)
|
||||
end
|
||||
end
|
||||
function KeyNodeListCtrl:GetType()
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
local StarTowerDifficultyNodeItemCtrl = class("StarTowerDifficultyNodeItemCtrl", BaseCtrl)
|
||||
StarTowerDifficultyNodeItemCtrl._mapNodeConfig = {
|
||||
advanceNodeAnim = {sNodeName = "adNode", sComponentName = "Animator"},
|
||||
btnNode = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_SelectNode"
|
||||
},
|
||||
diffNode_gray = {},
|
||||
txtAD = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
txtDiffNode = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Difficulty"
|
||||
},
|
||||
txtDiffNodeGray = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Difficulty"
|
||||
},
|
||||
Select = {},
|
||||
redDotNode = {}
|
||||
}
|
||||
StarTowerDifficultyNodeItemCtrl._mapEventConfig = {
|
||||
SelectDiffNode = "OnSelectDiffNode"
|
||||
}
|
||||
function StarTowerDifficultyNodeItemCtrl:RefreshNode(nNodeIndex, nCurDifficulty, bSelect, nMaxDifficulty)
|
||||
self.bSelect = false
|
||||
self.nNodeIndex = nNodeIndex
|
||||
self.nMaxDifficulty = nMaxDifficulty or 1
|
||||
self._mapNode.Select.gameObject:SetActive(false)
|
||||
self._mapNode.diffNode_gray.gameObject:SetActive(nMaxDifficulty < nNodeIndex)
|
||||
for _, v in ipairs(self._mapNode.txtAD) do
|
||||
NovaAPI.SetTMPText(v, nNodeIndex)
|
||||
end
|
||||
if bSelect ~= nil and bSelect == true then
|
||||
self.bSelect = true
|
||||
self._mapNode.Select.gameObject:SetActive(true)
|
||||
self:PlayAnim("Node_idle")
|
||||
self.animState = "Node_idle"
|
||||
end
|
||||
end
|
||||
function StarTowerDifficultyNodeItemCtrl:PlayAnim(sAnimName)
|
||||
self._mapNode.advanceNodeAnim:Play(sAnimName)
|
||||
end
|
||||
function StarTowerDifficultyNodeItemCtrl:SetSelect(bSelect)
|
||||
if self.bSelect and not bSelect then
|
||||
self:PlayAnim("Node_out")
|
||||
self.animState = "Node_out"
|
||||
end
|
||||
self.bSelect = bSelect
|
||||
self._mapNode.Select.gameObject:SetActive(bSelect)
|
||||
if bSelect and self.animState ~= "Node_idle" then
|
||||
self:PlayAnim("Node_in")
|
||||
self.animState = "Node_idle"
|
||||
if self.nNodeIndex <= self.nCurSelectDiff then
|
||||
CS.WwiseAudioManager.Instance:PlaySound("ui_charinfo_levelup_select_button")
|
||||
end
|
||||
end
|
||||
end
|
||||
function StarTowerDifficultyNodeItemCtrl:OnSelectDiffNode(nDifficulty)
|
||||
self.nCurSelectDiff = nDifficulty
|
||||
self:SetSelect(nDifficulty == self.nNodeIndex)
|
||||
end
|
||||
function StarTowerDifficultyNodeItemCtrl:OnBtn_SelectNode()
|
||||
if self.bSelect then
|
||||
return
|
||||
end
|
||||
if self.nMaxDifficulty < self.nNodeIndex then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("RegusBoss_Unlock"))
|
||||
return
|
||||
end
|
||||
EventManager.Hit("SelectDiffNode", self.nNodeIndex)
|
||||
end
|
||||
function StarTowerDifficultyNodeItemCtrl:OnDisable()
|
||||
end
|
||||
return StarTowerDifficultyNodeItemCtrl
|
||||
@@ -58,6 +58,17 @@ StarTowerGrowthCtrl._mapNodeConfig = {
|
||||
txtBtnActiveAll = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "STGrowth_Btn_ActiveAll"
|
||||
},
|
||||
txtResearchPreview = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_ResearchPreview"
|
||||
},
|
||||
btnResearchPreview = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ResearchPreview"
|
||||
},
|
||||
StarTowerGrowthPreviewWindow = {
|
||||
sCtrlName = "Game.UI.StarTowerGrowth.StarTowerGrowthPreviewWindowCtrl"
|
||||
}
|
||||
}
|
||||
StarTowerGrowthCtrl._mapEventConfig = {
|
||||
@@ -287,12 +298,14 @@ function StarTowerGrowthCtrl:CloseInfo(callback)
|
||||
end, true, true, true)
|
||||
self._mapNode.btnQuest.gameObject:SetActive(true)
|
||||
self._mapNode.btnActiveAll.gameObject:SetActive(true)
|
||||
self._mapNode.btnResearchPreview.gameObject:SetActive(true)
|
||||
end
|
||||
function StarTowerGrowthCtrl:OpenInfo()
|
||||
self._mapNode.Info.gameObject:SetActive(true)
|
||||
self._mapNode.animInfo:Play("StarTowerGrowth_Info_in")
|
||||
self._mapNode.btnQuest.gameObject:SetActive(false)
|
||||
self._mapNode.btnActiveAll.gameObject:SetActive(false)
|
||||
self._mapNode.btnResearchPreview.gameObject:SetActive(false)
|
||||
end
|
||||
function StarTowerGrowthCtrl:ClearCtrl()
|
||||
for k, v in pairs(self.tbHideKeyNodeList) do
|
||||
@@ -402,6 +415,11 @@ function StarTowerGrowthCtrl:OnBtnClick_ActiveAll(btn)
|
||||
active()
|
||||
end
|
||||
end
|
||||
function StarTowerGrowthCtrl:OnBtnClick_ResearchPreview()
|
||||
local nDifficulty = PlayerData.StarTower:GetGlobalMaxDifficult()
|
||||
local nMaxDifficulty = nDifficulty
|
||||
self._mapNode.StarTowerGrowthPreviewWindow:OpenPanel(nDifficulty, nMaxDifficulty)
|
||||
end
|
||||
function StarTowerGrowthCtrl:OnEvent_Unlock()
|
||||
self:RefreshData()
|
||||
self:RefreshTopBar()
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
local StarTowerGrowthPreviewWindowCtrl = class("StarTowerGrowthPreviewWindowCtrl", BaseCtrl)
|
||||
StarTowerGrowthPreviewWindowCtrl._mapNodeConfig = {
|
||||
lsvEffect = {},
|
||||
AdNodeScrollView = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtGrowthPreviewWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_ResearchPreview"
|
||||
},
|
||||
txtTabTitle = {sComponentName = "TMP_Text"},
|
||||
txtHighestLevelTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "STGrowth_HighestLevelTip"
|
||||
},
|
||||
txtNoEffectTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "STGrowth_NoEffectTip"
|
||||
},
|
||||
rtWindow = {
|
||||
sNodeName = "StarTowerGrowthPreview",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
aniWindow = {
|
||||
sNodeName = "StarTowerGrowthPreview",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
gridFlexable = {},
|
||||
effectContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
snapshot = {},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnCloseBig = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
}
|
||||
}
|
||||
StarTowerGrowthPreviewWindowCtrl._mapEventConfig = {
|
||||
SelectDiffNode = "OnEvent_SelectDiffNode"
|
||||
}
|
||||
function StarTowerGrowthPreviewWindowCtrl:RefreshNodeScrollView()
|
||||
local tbDifficulty = {}
|
||||
local foreachStarTower = function(mapdata)
|
||||
local nDifficulty = mapdata.Difficulty
|
||||
if table.indexof(tbDifficulty, nDifficulty) <= 0 then
|
||||
table.insert(tbDifficulty, nDifficulty)
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.StarTower, foreachStarTower)
|
||||
self.nDifficultyCount = #tbDifficulty
|
||||
self.tbDiffNode = {}
|
||||
self._mapNode.AdNodeScrollView:Init(self.nDifficultyCount, self, self.OnNodeGridRefresh)
|
||||
self._mapNode.AdNodeScrollView:SetScrollGridPos(self.nCurDifficulty - 1, 0.2)
|
||||
end
|
||||
function StarTowerGrowthPreviewWindowCtrl:OnNodeGridRefresh(goGrid, nIdx)
|
||||
local nIndex = tonumber(goGrid.name) + 1
|
||||
if self.tbDiffNode[goGrid] ~= nil then
|
||||
self:UnbindCtrlByNode(self.tbDiffNode[goGrid])
|
||||
self.tbDiffNode[goGrid] = nil
|
||||
end
|
||||
local ctrlItem = self:BindCtrlByNode(goGrid, "Game.UI.StarTowerGrowth.StarTowerDifficultyNodeItemCtrl")
|
||||
self.tbDiffNode[goGrid] = ctrlItem
|
||||
ctrlItem:RefreshNode(nIndex, self.nCurDifficulty, nIndex == self.curSelectDiff, self.nMaxDifficulty)
|
||||
end
|
||||
function StarTowerGrowthPreviewWindowCtrl:RefreshEffectDetail()
|
||||
local sTabTitle = ConfigTable.GetUIText("StarTower_ActiveResearch")
|
||||
local sDifficulty = ConfigTable.GetUIText("Diffculty_" .. self.curSelectDiff)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTabTitle, sDifficulty .. " " .. sTabTitle)
|
||||
self.tbCurNodes = {}
|
||||
local foreachGrowthGroup = function(mapdata)
|
||||
local tbNodes = PlayerData.StarTower:GetGrowthNodesByGroup(mapdata.Id)
|
||||
if tbNodes ~= nil then
|
||||
for k, v in pairs(tbNodes) do
|
||||
local mapNodeData = ConfigTable.GetData("StarTowerGrowthNode", v.nId)
|
||||
if mapNodeData ~= nil and v.bActive and mapNodeData.Clientlvl <= self.curSelectDiff then
|
||||
if self.tbCurNodes[mapNodeData.EffectClient] == nil then
|
||||
self.tbCurNodes[mapNodeData.EffectClient] = mapNodeData
|
||||
elseif mapNodeData.Priority > self.tbCurNodes[mapNodeData.EffectClient].Priority then
|
||||
self.tbCurNodes[mapNodeData.EffectClient] = mapNodeData
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.StarTowerGrowthGroup, foreachGrowthGroup)
|
||||
local bHasEff = self.tbCurNodes ~= nil and next(self.tbCurNodes) ~= nil
|
||||
self._mapNode.txtNoEffectTip.gameObject:SetActive(not bHasEff)
|
||||
self._mapNode.lsvEffect.gameObject:SetActive(bHasEff)
|
||||
self._mapNode.txtHighestLevelTip.gameObject:SetActive(bHasEff)
|
||||
if not bHasEff then
|
||||
return
|
||||
end
|
||||
self.tbCurNodeSorted = {}
|
||||
for k, v in pairs(self.tbCurNodes) do
|
||||
table.insert(self.tbCurNodeSorted, v)
|
||||
end
|
||||
table.sort(self.tbCurNodeSorted, function(a, b)
|
||||
return a.Priority > b.Priority
|
||||
end)
|
||||
self:RefreshEffectContent()
|
||||
end
|
||||
local highlightNumbers = function(text, colorTag)
|
||||
local sResult = ""
|
||||
local nLastEnd = 1
|
||||
for nStart, sTag, nEnd in string.gmatch(text, "()(<[^>]+>)()") do
|
||||
local sPlain = string.sub(text, nLastEnd, nStart - 1)
|
||||
sPlain = string.gsub(sPlain, "%d+%.?%d*%%?", "<color=#" .. colorTag .. ">%0</color>")
|
||||
sResult = sResult .. sPlain .. sTag
|
||||
nLastEnd = nEnd
|
||||
end
|
||||
local sTail = string.sub(text, nLastEnd)
|
||||
sTail = string.gsub(sTail, "%d+%.?%d*%%?", "<color=#" .. colorTag .. ">%0</color>")
|
||||
sResult = sResult .. sTail
|
||||
return sResult
|
||||
end
|
||||
function StarTowerGrowthPreviewWindowCtrl:RefreshEffectContent()
|
||||
while self._mapNode.effectContent.transform.childCount > 0 do
|
||||
local goChild = self._mapNode.effectContent.transform:GetChild(0)
|
||||
goChild.gameObject:SetActive(false)
|
||||
destroyImmediate(goChild.gameObject)
|
||||
end
|
||||
for k, v in pairs(self.tbCurNodeSorted) do
|
||||
local mapData = v
|
||||
local goGrid = instantiate(self._mapNode.gridFlexable, self._mapNode.effectContent)
|
||||
local txtNodeTitle = goGrid.transform:Find("imgBarBg1"):Find("txtNodeTitle"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtNodeTitle, mapData.Name)
|
||||
local txtNodeDesc = goGrid.transform:Find("imgBarBg2"):Find("txtNodeDesc"):GetComponent("TMP_Text")
|
||||
local sDesc = mapData.Desc
|
||||
sDesc = highlightNumbers(sDesc, "0abec5")
|
||||
NovaAPI.SetTMPText(txtNodeDesc, sDesc)
|
||||
goGrid.gameObject:SetActive(true)
|
||||
end
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.effectContent)
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.effectContent)
|
||||
self._mapNode.lsvEffect:GetComponent("ScrollRect").verticalNormalizedPosition = 1
|
||||
end
|
||||
function StarTowerGrowthPreviewWindowCtrl:UnbindAllGrids()
|
||||
if self.tbDiffNode == nil then
|
||||
return
|
||||
end
|
||||
for go, ctrl in pairs(self.tbDiffNode) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
self.tbDiffNode = {}
|
||||
end
|
||||
function StarTowerGrowthPreviewWindowCtrl:OpenPanel(nDifficulty, nMaxDifficulty)
|
||||
self.nCurDifficulty = nDifficulty or 1
|
||||
self.nMaxDifficulty = nMaxDifficulty or 1
|
||||
self.curSelectDiff = self.nCurDifficulty
|
||||
local wait = function()
|
||||
NovaAPI.UIEffectSnapShotCapture(self._mapNode.snapshot)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self.gameObject:SetActive(true)
|
||||
self._mapNode.rtWindow.gameObject:SetActive(true)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_in")
|
||||
self:RefreshNodeScrollView()
|
||||
self:RefreshEffectDetail()
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function StarTowerGrowthPreviewWindowCtrl:ClosePanel()
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
self:AddTimer(1, 0.3, function()
|
||||
self.gameObject:SetActive(false)
|
||||
self._mapNode.rtWindow.gameObject:SetActive(false)
|
||||
self:UnbindAllGrids()
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function StarTowerGrowthPreviewWindowCtrl:Awake()
|
||||
end
|
||||
function StarTowerGrowthPreviewWindowCtrl:OnEnable()
|
||||
end
|
||||
function StarTowerGrowthPreviewWindowCtrl:OnDisable()
|
||||
end
|
||||
function StarTowerGrowthPreviewWindowCtrl:OnDestroy()
|
||||
end
|
||||
function StarTowerGrowthPreviewWindowCtrl:OnEvent_SelectDiffNode(nDiff)
|
||||
self.curSelectDiff = nDiff
|
||||
self:RefreshEffectDetail()
|
||||
end
|
||||
function StarTowerGrowthPreviewWindowCtrl:OnBtnClick_Close()
|
||||
self:ClosePanel()
|
||||
end
|
||||
return StarTowerGrowthPreviewWindowCtrl
|
||||
Reference in New Issue
Block a user