Update - 1.4.0.73
EN: 1.4.0.73 CN: 1.4.0.74 JP: 1.4.0.77 KR: 1.4.0.80
This commit is contained in:
@@ -0,0 +1,174 @@
|
||||
local QuestNewbieCtrl = class("QuestNewbieCtrl", BaseCtrl)
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local ConfigData = require("GameCore.Data.ConfigData")
|
||||
QuestNewbieCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
rtTeamFormation = {
|
||||
sCtrlName = "Game.UI.QuestNewbie.TeamFormation.QuestNewbieFormationCtrl"
|
||||
},
|
||||
rtTutorial = {
|
||||
sCtrlName = "Game.UI.QuestNewbie.Tutorial.TutorialLevelCtrl"
|
||||
},
|
||||
goTutorialBg = {},
|
||||
btnTab = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Tab"
|
||||
},
|
||||
imgLock = {nCount = 2},
|
||||
tabUnlock = {nCount = 2},
|
||||
cvTabLayout = {
|
||||
nCount = 2,
|
||||
sNodeName = "layoutOff",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
imgOn = {nCount = 2},
|
||||
trTabOff = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
trTabOn = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtTabOn = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
txtTabOff = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
rtImgMoveBar = {
|
||||
sNodeName = "imgMoveBar",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
layoutOff = {nCount = 2},
|
||||
redDot = {nCount = 2}
|
||||
}
|
||||
QuestNewbieCtrl._mapEventConfig = {
|
||||
QuestNewbiePanelChangeTab = "OnEvent_ChangeTab"
|
||||
}
|
||||
QuestNewbieCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.TaskNewbie_TeamFormation] = {sNodeName = "redDot", nNodeIndex = 1},
|
||||
[RedDotDefine.TaskNewbie_Tutorial] = {sNodeName = "redDot", nNodeIndex = 2}
|
||||
}
|
||||
local MoveBarPos = {
|
||||
[1] = 0,
|
||||
[2] = 120
|
||||
}
|
||||
local functionType = {
|
||||
[1] = GameEnum.OpenFuncType.DailyQuest,
|
||||
[2] = GameEnum.OpenFuncType.TutorialLevel
|
||||
}
|
||||
function QuestNewbieCtrl:RefreshContent()
|
||||
self._mapNode.rtTeamFormation.gameObject:SetActive(self._panel.nCurTab == AllEnum.QuestNewbieTab.TeamFormation)
|
||||
self._mapNode.rtTutorial.gameObject:SetActive(self._panel.nCurTab == AllEnum.QuestNewbieTab.Tutorial)
|
||||
self._mapNode.goTutorialBg.gameObject:SetActive(self._panel.nCurTab == AllEnum.QuestNewbieTab.Tutorial)
|
||||
if self._panel.nCurTab == AllEnum.QuestNewbieTab.Tutorial then
|
||||
PlayerData.TutorialData:RefreshRedDot(false)
|
||||
self._mapNode.rtTutorial:Refresh()
|
||||
elseif self._panel.nCurTab == AllEnum.QuestNewbieTab.TeamFormation then
|
||||
self._mapNode.rtTeamFormation:Refresh()
|
||||
end
|
||||
self.nLastTab = self._panel.nCurTab
|
||||
end
|
||||
function QuestNewbieCtrl:InitTab()
|
||||
self._mapNode.rtImgMoveBar.localPosition = Vector3(MoveBarPos[self._panel.nCurTab], 4.5, 0)
|
||||
for i = 1, #self._mapNode.txtTabOn do
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTabOn[i], ConfigTable.GetUIText("QuestNewbiePanel_Tab_" .. i))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTabOff[i], ConfigTable.GetUIText("QuestNewbiePanel_Tab_" .. i))
|
||||
self._mapNode.imgOn[i]:SetActive(self._panel.nCurTab == i)
|
||||
self._mapNode.txtTabOn[i].gameObject:SetActive(self._panel.nCurTab == i)
|
||||
self._mapNode.layoutOff[i].gameObject:SetActive(self._panel.nCurTab ~= i)
|
||||
end
|
||||
end
|
||||
function QuestNewbieCtrl:InitMoveBarPos()
|
||||
MoveBarPos = {}
|
||||
for i = 1, #self._mapNode.txtTabOn do
|
||||
local tab = self._mapNode.trTabOn:Find("tab" .. i)
|
||||
if tab.gameObject.activeSelf then
|
||||
local pos = tab.localPosition.x
|
||||
table.insert(MoveBarPos, pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
function QuestNewbieCtrl:RefreshTabUnlock()
|
||||
for i = 1, #self._mapNode.txtTabOn do
|
||||
local nFuncType = functionType[i]
|
||||
local bUnlock = false
|
||||
if nFuncType == 0 then
|
||||
bUnlock = true
|
||||
else
|
||||
bUnlock = PlayerData.Base:CheckFunctionUnlock(nFuncType, false)
|
||||
end
|
||||
self._mapNode.imgLock[i].gameObject:SetActive(not bUnlock)
|
||||
self._mapNode.tabUnlock[i].gameObject:SetActive(bUnlock)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cvTabLayout[i], bUnlock and 1 or 0.5)
|
||||
end
|
||||
end
|
||||
function QuestNewbieCtrl:OnBtnClick_Tab(btn, nIndex)
|
||||
if self._panel.nCurTab == nIndex then
|
||||
return
|
||||
end
|
||||
local nFuncType = functionType[nIndex]
|
||||
if nFuncType ~= 0 then
|
||||
local bFuncUnlock = PlayerData.Base:CheckFunctionUnlock(nFuncType, true)
|
||||
if not bFuncUnlock then
|
||||
return
|
||||
end
|
||||
end
|
||||
self._mapNode.imgOn[self._panel.nCurTab]:SetActive(false)
|
||||
self._mapNode.rtImgMoveBar:DOLocalMoveX(MoveBarPos[nIndex], 0.1):SetUpdate(true)
|
||||
self._mapNode.txtTabOn[self._panel.nCurTab].gameObject:SetActive(false)
|
||||
self._mapNode.layoutOff[self._panel.nCurTab].gameObject:SetActive(true)
|
||||
self._mapNode.imgOn[nIndex]:SetActive(true)
|
||||
self._mapNode.txtTabOn[nIndex].gameObject:SetActive(true)
|
||||
self._mapNode.layoutOff[nIndex].gameObject:SetActive(false)
|
||||
self._panel.nCurTab = nIndex
|
||||
self:RefreshContent()
|
||||
end
|
||||
function QuestNewbieCtrl:OnEvent_ChangeTab(nJumpTab)
|
||||
self._panel.nCurTab = nJumpTab
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self:InitMoveBarPos()
|
||||
self:InitTab()
|
||||
self:RefreshTabUnlock()
|
||||
self:RefreshContent()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function QuestNewbieCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
local nJumpTab = 0
|
||||
if nil ~= next(tbParam) then
|
||||
nJumpTab = tbParam[1]
|
||||
end
|
||||
if self._panel.nCurTab == nil then
|
||||
local nTotalCount, nReceivedCount = PlayerData.TutorialData:GetProgress()
|
||||
local bTutorialComplete = nTotalCount <= nReceivedCount
|
||||
local bTeamFormationComplete = PlayerData.Quest:CheckTeamFormationAllCompleted()
|
||||
self._panel.nCurTab = AllEnum.QuestNewbieTab.TeamFormation
|
||||
if bTeamFormationComplete and not bTutorialComplete then
|
||||
self._panel.nCurTab = AllEnum.QuestNewbieTab.Tutorial
|
||||
end
|
||||
end
|
||||
self.nLastTab = 0
|
||||
if nJumpTab ~= 0 then
|
||||
self._panel.nCurTab = nJumpTab
|
||||
end
|
||||
local sAnimName = "QuestNewbiePanel_in"
|
||||
local nAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {sAnimName})
|
||||
self.animRoot:Play(sAnimName, 0, 0)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLen)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self:InitMoveBarPos()
|
||||
self:InitTab()
|
||||
self:RefreshTabUnlock()
|
||||
self:RefreshContent()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function QuestNewbieCtrl:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
return QuestNewbieCtrl
|
||||
@@ -0,0 +1,19 @@
|
||||
local QuestNewbiePanel = class("QuestNewbiePanel", BasePanel)
|
||||
QuestNewbiePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "QuestNewbie/QuestNewbiePanel.prefab",
|
||||
sCtrlName = "Game.UI.QuestNewbie.QuestNewbieCtrl"
|
||||
}
|
||||
}
|
||||
function QuestNewbiePanel:Awake()
|
||||
self.nCurTab = nil
|
||||
end
|
||||
function QuestNewbiePanel:OnEnable()
|
||||
end
|
||||
function QuestNewbiePanel:OnDisable()
|
||||
end
|
||||
function QuestNewbiePanel:OnDestroy()
|
||||
end
|
||||
function QuestNewbiePanel:OnRelease()
|
||||
end
|
||||
return QuestNewbiePanel
|
||||
@@ -0,0 +1,109 @@
|
||||
local FormationQuestGridCtrl = class("FormationQuestGridCtrl", BaseCtrl)
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
local totalLength = 517
|
||||
local totalHeight = 37
|
||||
FormationQuestGridCtrl._mapNodeConfig = {
|
||||
btnGrid = {},
|
||||
txtQuestDesc = {sComponentName = "TMP_Text"},
|
||||
txtUnComplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_undone"
|
||||
},
|
||||
txtBtnReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Receive"
|
||||
},
|
||||
txtBtnJump = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_JumpTo_Text"
|
||||
},
|
||||
rtProgressFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtProgress = {sComponentName = "TMP_Text"},
|
||||
btnReceive = {sComponentName = "UIButton"},
|
||||
btnJump = {sComponentName = "UIButton"},
|
||||
goRewardItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
|
||||
nCount = 2
|
||||
},
|
||||
imgRewardEmpty = {nCount = 2},
|
||||
imgReceived = {},
|
||||
imgCompleteMask = {},
|
||||
btnItem = {
|
||||
sComponentName = "UIButton",
|
||||
nCount = 2,
|
||||
callback = "OnBtnClick_Reward"
|
||||
}
|
||||
}
|
||||
FormationQuestGridCtrl._mapEventConfig = {}
|
||||
function FormationQuestGridCtrl:Refresh(mapGuideQuest)
|
||||
self.mapGuideQuestCfgData = nil
|
||||
self.mapGuideQuest = nil
|
||||
if mapGuideQuest == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local mapGuideQuestCfgData = ConfigTable.GetData("AssistQuest", mapGuideQuest.nTid)
|
||||
if mapGuideQuestCfgData == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self.mapGuideQuestCfgData = mapGuideQuestCfgData
|
||||
self.mapGuideQuest = mapGuideQuest
|
||||
NovaAPI.SetTMPText(self._mapNode.txtQuestDesc, mapGuideQuestCfgData.Title)
|
||||
self.tbRewardId = {
|
||||
mapGuideQuestCfgData.Item1,
|
||||
mapGuideQuestCfgData.Item2
|
||||
}
|
||||
for i = 1, 2 do
|
||||
self._mapNode.goRewardItem[i].gameObject:SetActive(mapGuideQuestCfgData["Item" .. i] ~= 0)
|
||||
self._mapNode.imgRewardEmpty[i].gameObject:SetActive(mapGuideQuestCfgData["Item" .. i] == 0)
|
||||
if mapGuideQuestCfgData["Item" .. i] ~= 0 then
|
||||
self._mapNode.goRewardItem[i]:SetItem(mapGuideQuestCfgData["Item" .. i], nil, mapGuideQuestCfgData["Qty" .. i], nil, nil, nil, nil, true)
|
||||
end
|
||||
end
|
||||
if mapGuideQuest.nStatus ~= 2 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProgress, string.format("%d/%d", mapGuideQuest.nCurProgress, mapGuideQuest.nGoal))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProgress, ConfigTable.GetUIText("Quest_Complete"))
|
||||
end
|
||||
self._mapNode.rtProgressFill.sizeDelta = Vector2(mapGuideQuest.nCurProgress / mapGuideQuest.nGoal * totalLength, totalHeight)
|
||||
self._mapNode.imgReceived:SetActive(mapGuideQuest.nStatus == 2)
|
||||
self._mapNode.imgCompleteMask:SetActive(mapGuideQuest.nStatus == 2)
|
||||
self._mapNode.txtUnComplete.gameObject:SetActive(mapGuideQuest.nStatus == 0 and mapGuideQuestCfgData.JumpTo == 0)
|
||||
self._mapNode.btnJump.gameObject:SetActive(mapGuideQuest.nStatus == 0 and mapGuideQuestCfgData.JumpTo ~= 0)
|
||||
self._mapNode.btnReceive.gameObject:SetActive(mapGuideQuest.nStatus == 1)
|
||||
self._mapNode.btnReceive.onClick:RemoveAllListeners()
|
||||
self._mapNode.btnReceive.onClick:AddListener(function()
|
||||
self:OnBtnClick_Receive()
|
||||
end)
|
||||
self._mapNode.btnJump.onClick:RemoveAllListeners()
|
||||
self._mapNode.btnJump.onClick:AddListener(function()
|
||||
self:OnBtnClick_JumpTo()
|
||||
end)
|
||||
end
|
||||
function FormationQuestGridCtrl:ShowItemDetail(id, rtIcon)
|
||||
UTILS.ClickItemGridWithTips(id, rtIcon.transform, true, true, false)
|
||||
end
|
||||
function FormationQuestGridCtrl:OnEnable()
|
||||
self._mapNode.btnGrid:SetActive(false)
|
||||
local waitOpen = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.btnGrid:SetActive(true)
|
||||
end
|
||||
cs_coroutine.start(waitOpen)
|
||||
end
|
||||
function FormationQuestGridCtrl:OnBtnClick_Receive()
|
||||
PlayerData.Quest:ReceiveTeamFormationReward(self.mapGuideQuest.nTid, 0, nil)
|
||||
end
|
||||
function FormationQuestGridCtrl:OnBtnClick_JumpTo()
|
||||
local nJumptoId = self.mapGuideQuestCfgData.JumpTo
|
||||
JumpUtil.JumpTo(nJumptoId)
|
||||
end
|
||||
function FormationQuestGridCtrl:OnBtnClick_Reward(btn, nIdx)
|
||||
if self.tbRewardId[nIdx] ~= 0 then
|
||||
self:ShowItemDetail(self.tbRewardId[nIdx], btn)
|
||||
end
|
||||
end
|
||||
return FormationQuestGridCtrl
|
||||
@@ -0,0 +1,567 @@
|
||||
local QuestNewbieFormationCtrl = class("QuestNewbieFormationCtrl", BaseCtrl)
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local Event = require("GameCore.Event.Event")
|
||||
QuestNewbieFormationCtrl._mapNodeConfig = {
|
||||
goTeamSelect = {},
|
||||
ctrlTeam = {
|
||||
sNodeName = "btnTeam",
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.QuestNewbie.TeamFormation.QuestNewbieTeamCtrl"
|
||||
},
|
||||
btnTeam = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TeamFormation"
|
||||
},
|
||||
goFixTeams = {},
|
||||
LSVTeams = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
goQuestList = {},
|
||||
imgEFF = {sComponentName = "Image"},
|
||||
txtTeamTitle = {sComponentName = "TMP_Text"},
|
||||
txtTeamFormationQuestDesc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TeamFormation_Quest_Desc"
|
||||
},
|
||||
animMaskRoot = {sNodeName = "MaskRoot", sComponentName = "Animator"},
|
||||
btnCharList = {nCount = 3, sComponentName = "UIButton"},
|
||||
imgCharHead = {nCount = 3, sComponentName = "Image"},
|
||||
txtCharName = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
goCharStar = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
txtCharDesc = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
imgClassBg = {nCount = 3, sComponentName = "Image"},
|
||||
txtCharClass = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
imgAttackTypeBg = {nCount = 3, sComponentName = "Image"},
|
||||
imgAttackType = {nCount = 3, sComponentName = "Image"},
|
||||
txtChapter = {sComponentName = "TMP_Text"},
|
||||
btnRewardItem = {
|
||||
nCount = 5,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_RewardItem"
|
||||
},
|
||||
rewardItem = {
|
||||
nCount = 5,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
imgEmpty = {nCount = 5},
|
||||
btnReceiveChapter = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ReceiveChapter"
|
||||
},
|
||||
txtBtnReceiveChapter = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Receive"
|
||||
},
|
||||
txtActComplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Daily_Quest_All_Received"
|
||||
},
|
||||
btnReceiveChapterGray = {sComponentName = "UIButton"},
|
||||
txtBtnReceiveChapterGray = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Receive"
|
||||
},
|
||||
BtnLeft = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Left"
|
||||
},
|
||||
BtnRight = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Right"
|
||||
},
|
||||
formationQuestLSV = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
btnFastReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_FastReceive"
|
||||
},
|
||||
txtBtnFastReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Fast_Receive_Btn_Text"
|
||||
},
|
||||
btnFastReceiveGray = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_FastReceiveGray"
|
||||
},
|
||||
txtBtnFastReceiveGray = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Fast_Receive_Btn_Text"
|
||||
},
|
||||
btnBackToTeamSelect = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_BackToTeamSelect"
|
||||
},
|
||||
txtBtnBackToTeamSelect = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Back_To_Team_Select"
|
||||
}
|
||||
}
|
||||
QuestNewbieFormationCtrl._mapEventConfig = {
|
||||
UpdateTeamFormationGroup = "OnEvent_UpdateTeamFormationGroup",
|
||||
Guide_GetNewQuestTaskIndex = "OnEvent_Guide_GetNewQuestTaskIndex"
|
||||
}
|
||||
QuestNewbieFormationCtrl._mapRedDotConfig = {}
|
||||
local statusOrder = {
|
||||
[0] = 1,
|
||||
[1] = 2,
|
||||
[2] = 0
|
||||
}
|
||||
function QuestNewbieFormationCtrl:Refresh(bClick)
|
||||
self:InitData()
|
||||
local nTeamSelected = tonumber(LocalData.GetPlayerLocalData("TeamFormationQuestSelected"))
|
||||
if nTeamSelected ~= nil and PlayerData.Quest:CheckTeamFormationAttributeCompleted(nTeamSelected) then
|
||||
if bClick ~= true then
|
||||
nTeamSelected = nil
|
||||
end
|
||||
LocalData.SetPlayerLocalData("TeamFormationQuestSelected", nil)
|
||||
end
|
||||
if nTeamSelected ~= nil and PlayerData.Quest:CheckTeamFormationAttributeUnlocked(nTeamSelected) == true then
|
||||
self.nCurGroup = PlayerData.Quest:GetCurTeamFormationQuestGroup(nTeamSelected)
|
||||
self._mapNode.goQuestList:SetActive(true)
|
||||
self._mapNode.goTeamSelect:SetActive(false)
|
||||
self:RefreshQuestList(self.mapAllTeamFormationQuest[self.nCurGroup], self.nCurGroup)
|
||||
self:RefreshCharInfo(self.tbAttr[nTeamSelected])
|
||||
self._mapNode.animMaskRoot:Play("MaskRoot_in", 0, 0)
|
||||
else
|
||||
self:RefreshTeamSelect()
|
||||
end
|
||||
end
|
||||
function QuestNewbieFormationCtrl:RefreshTeamSelect()
|
||||
self._mapNode.goQuestList:SetActive(false)
|
||||
local nAttrCount = #self.tbAttr
|
||||
if nAttrCount == 0 then
|
||||
self._mapNode.goTeamSelect:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.goTeamSelect:SetActive(true)
|
||||
if nAttrCount <= 2 then
|
||||
self._mapNode.goFixTeams:SetActive(true)
|
||||
self._mapNode.LSVTeams.gameObject:SetActive(false)
|
||||
for i = 1, #self._mapNode.ctrlTeam do
|
||||
self._mapNode.ctrlTeam[i].gameObject:SetActive(false)
|
||||
if i <= nAttrCount then
|
||||
local mapData = ConfigTable.GetData("AssistAttribute", i)
|
||||
self._mapNode.ctrlTeam[i].gameObject:SetActive(mapData ~= nil)
|
||||
if mapData ~= nil then
|
||||
self._mapNode.ctrlTeam[i]:Init(mapData)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
self._mapNode.goFixTeams:SetActive(false)
|
||||
self._mapNode.LSVTeams.gameObject:SetActive(true)
|
||||
if self.tbAttrGridCtrl == nil then
|
||||
self.tbAttrGridCtrl = {}
|
||||
else
|
||||
for insId, objCtrl in pairs(self.tbAttrGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbAttrGridCtrl[insId] = nil
|
||||
end
|
||||
end
|
||||
self._mapNode.LSVTeams:Init(nAttrCount, self, self.OnGridRefresh, self.OnGridBtnClick)
|
||||
end
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local mapData = self.tbAttr[nIndex]
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
if not self.tbAttrGridCtrl[nInstanceId] then
|
||||
self.tbAttrGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.QuestNewbie.TeamFormation.QuestNewbieTeamCtrl")
|
||||
end
|
||||
self.tbAttrGridCtrl[nInstanceId]:Init(mapData)
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnGridBtnClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
LocalData.SetPlayerLocalData("TeamFormationQuestSelected", tostring(nIndex))
|
||||
PlayerData.Quest:UpdateTeamFormationRedDot()
|
||||
self.nCurGroup = PlayerData.Quest:GetCurTeamFormationQuestGroup(nIndex)
|
||||
self:Refresh(true)
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnBtnClick_TeamFormation(btn, nTeamIndex)
|
||||
if nTeamIndex == nil then
|
||||
return
|
||||
end
|
||||
LocalData.SetPlayerLocalData("TeamFormationQuestSelected", tostring(nTeamIndex))
|
||||
PlayerData.Quest:UpdateTeamFormationRedDot()
|
||||
self.nCurGroup = PlayerData.Quest:GetCurTeamFormationQuestGroup(nTeamIndex)
|
||||
self:Refresh(true)
|
||||
end
|
||||
function QuestNewbieFormationCtrl:RefreshCharInfo(mapData)
|
||||
if mapData == nil then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTeamTitle, mapData.TeamTitle)
|
||||
self:SetAtlasSprite(self._mapNode.imgEFF, "12_rare", AllEnum.ElementIconType.Icon .. mapData.EET)
|
||||
for i = 1, 3 do
|
||||
local nChar = mapData["Char" .. i]
|
||||
if nChar ~= nil and 0 < nChar then
|
||||
do
|
||||
local mapCharacter = ConfigTable.GetData_Character(nChar)
|
||||
local sIconPath = "Icon/Head/head_" .. nChar .. "01"
|
||||
self:SetPngSprite(self._mapNode.imgCharHead[i], sIconPath, AllEnum.CharHeadIconSurfix.S)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCharName[i], mapCharacter.Name)
|
||||
self._mapNode.goCharStar[i]:SetStar(0, 6 - mapCharacter.Grade)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCharDesc[i], mapData["CharDesc" .. i])
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCharClass[i], ConfigTable.GetUIText("Char_JobClass_" .. mapCharacter.Class))
|
||||
if mapCharacter.CharacterAttackType == GameEnum.characterAttackType.MELEE then
|
||||
self:SetAtlasSprite(self._mapNode.imgAttackType[i], "10_ico", "zs_list_near")
|
||||
elseif mapCharacter.CharacterAttackType == GameEnum.characterAttackType.RANGED then
|
||||
self:SetAtlasSprite(self._mapNode.imgAttackType[i], "10_ico", "zs_list_far")
|
||||
end
|
||||
if mapCharacter.Class == GameEnum.characterJobClass.Vanguard then
|
||||
self:SetAtlasSprite(self._mapNode.imgClassBg[i], "08_db", "db_list_herald")
|
||||
elseif mapCharacter.Class == GameEnum.characterJobClass.Balance then
|
||||
self:SetAtlasSprite(self._mapNode.imgClassBg[i], "08_db", "db_list_equal")
|
||||
elseif mapCharacter.Class == GameEnum.characterJobClass.Support then
|
||||
self:SetAtlasSprite(self._mapNode.imgClassBg[i], "08_db", "db_list_assist")
|
||||
end
|
||||
local btnChar = self._mapNode.btnCharList[i]
|
||||
btnChar.onClick:RemoveAllListeners()
|
||||
btnChar.onClick:AddListener(function()
|
||||
local mapCharData = PlayerData.Char:GetCharDataByTid(nChar)
|
||||
if mapCharData == nil then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, nChar)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, PanelId.CharInfo, nChar, {nChar})
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function QuestNewbieFormationCtrl:RefreshQuestList(mapGuideQuest, nCurGroup)
|
||||
local tbQuestStatus = {}
|
||||
for _, mapQuestData in pairs(mapGuideQuest) do
|
||||
local mapStatus = self.mapAllTeamFormationQuestStatus[mapQuestData.Id]
|
||||
if mapStatus ~= nil then
|
||||
if mapStatus.nStatus == 1 then
|
||||
mapStatus.nCurProgress = mapStatus.nGoal
|
||||
end
|
||||
table.insert(tbQuestStatus, mapStatus)
|
||||
end
|
||||
end
|
||||
self.mapCurQuests = tbQuestStatus
|
||||
table.sort(self.mapCurQuests, function(a, b)
|
||||
if a.nStatus == b.nStatus then
|
||||
return a.nTid < b.nTid
|
||||
end
|
||||
return statusOrder[a.nStatus] > statusOrder[b.nStatus]
|
||||
end)
|
||||
self.nCurGroup = nCurGroup
|
||||
if self.nCurGroup == 0 then
|
||||
self.nCurGroup = self.tbAllGroup[#self.tbAllGroup].Id
|
||||
end
|
||||
if self.mapCurQuests == nil or #self.mapCurQuests == 0 then
|
||||
self.mapCurQuests = {}
|
||||
for _, mapQuestCfgData in ipairs(self.mapAllTeamFormationQuest[self.nCurGroup]) do
|
||||
table.insert(self.mapCurQuests, {
|
||||
nTid = mapQuestCfgData.Id,
|
||||
nGoal = 1,
|
||||
nCurProgress = 1,
|
||||
nStatus = 2,
|
||||
nExpire = 0
|
||||
})
|
||||
end
|
||||
end
|
||||
self.nCurPage = 0
|
||||
self.mapCurPageQuest = self.mapCurQuests
|
||||
self:RefreshShow(self.nCurGroup)
|
||||
end
|
||||
function QuestNewbieFormationCtrl:RefreshShow(nCurGroup)
|
||||
self.curShowGroup = nCurGroup
|
||||
self.nCurShowGroupIdxInAttr = PlayerData.Quest:GetTeamFormationGroupIndexInAttribute(nCurGroup)
|
||||
self.nAttributeIdx = PlayerData.Quest:GetAttributeIdByGroupId(nCurGroup)
|
||||
local curGroupId = PlayerData.Quest:GetCurTeamFormationQuestGroup(self.nAttributeIdx)
|
||||
local curGroupIdxInAttr = PlayerData.Quest:GetTeamFormationGroupIndexInAttribute(curGroupId)
|
||||
local curShowGroupIdx = 0
|
||||
for idx, mapGroupData in ipairs(self.tbAllGroup) do
|
||||
if self.curShowGroup == mapGroupData.Id then
|
||||
curShowGroupIdx = idx
|
||||
end
|
||||
end
|
||||
local questGroupCfg = self.tbAllGroup[curShowGroupIdx]
|
||||
self.tbChapterReward = {}
|
||||
if questGroupCfg ~= nil then
|
||||
for i = 1, 5 do
|
||||
if questGroupCfg["Item" .. i] ~= 0 then
|
||||
table.insert(self.tbChapterReward, {
|
||||
nTid = questGroupCfg["Item" .. i],
|
||||
nCount = questGroupCfg["Qty" .. i]
|
||||
})
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtChapter, string.format("%02d", self.nCurShowGroupIdxInAttr))
|
||||
end
|
||||
local nStartIdx = 1
|
||||
if questGroupCfg.ShowBuildId ~= 0 then
|
||||
nStartIdx = 2
|
||||
self._mapNode.rewardItem[1].gameObject:SetActive(true)
|
||||
self._mapNode.imgEmpty[1].gameObject:SetActive(false)
|
||||
self._mapNode.rewardItem[1]:SetItem(questGroupCfg.ShowBuildId, nil, 1, nil, nil, nil, nil, true)
|
||||
end
|
||||
local nItemIdx = 1
|
||||
for k = nStartIdx, #self._mapNode.rewardItem do
|
||||
self._mapNode.rewardItem[k].gameObject:SetActive(nItemIdx <= #self.tbChapterReward)
|
||||
if nItemIdx <= #self.tbChapterReward then
|
||||
self._mapNode.rewardItem[k]:SetItem(self.tbChapterReward[nItemIdx].nTid, nil, self.tbChapterReward[nItemIdx].nCount, nil, nil, nil, nil, true)
|
||||
end
|
||||
if self._mapNode.imgEmpty[k] ~= nil then
|
||||
self._mapNode.imgEmpty[k].gameObject:SetActive(nItemIdx > #self.tbChapterReward)
|
||||
end
|
||||
nItemIdx = nItemIdx + 1
|
||||
end
|
||||
local bFastReceive = false
|
||||
local bAllReceive = true
|
||||
if curGroupIdxInAttr == self.nCurShowGroupIdxInAttr then
|
||||
for _, mapData in pairs(self.mapCurPageQuest) do
|
||||
if mapData.nStatus == 1 then
|
||||
bFastReceive = true
|
||||
end
|
||||
if mapData.nStatus ~= 2 then
|
||||
bAllReceive = false
|
||||
end
|
||||
end
|
||||
end
|
||||
local bGroupReceived = PlayerData.Quest:CheckTeamFormationGroupReward(self.nAttributeIdx, self.nCurShowGroupIdxInAttr)
|
||||
local bCanReceive = bAllReceive and not bGroupReceived
|
||||
self._mapNode.btnReceiveChapter.gameObject:SetActive(bCanReceive)
|
||||
self._mapNode.btnReceiveChapterGray.gameObject:SetActive(not bCanReceive and not bGroupReceived)
|
||||
self._mapNode.txtActComplete.gameObject:SetActive(bGroupReceived)
|
||||
self._mapNode.btnFastReceive.gameObject:SetActive(bFastReceive)
|
||||
self._mapNode.btnFastReceiveGray.gameObject:SetActive(not bFastReceive)
|
||||
self._mapNode.BtnLeft.gameObject:SetActive(1 < curShowGroupIdx)
|
||||
self._mapNode.BtnRight.gameObject:SetActive(curGroupIdxInAttr > curShowGroupIdx)
|
||||
if self.nCurPage == 1 then
|
||||
self.nCurPage = 2
|
||||
else
|
||||
self.nCurPage = 1
|
||||
end
|
||||
if self.mapQuestsGrids ~= nil then
|
||||
for nInstanceId, objCtrl in pairs(self.mapQuestsGrids) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.mapQuestsGrids[nInstanceId] = nil
|
||||
end
|
||||
end
|
||||
self.mapQuestsGrids = {}
|
||||
self._mapNode.formationQuestLSV.gameObject:SetActive(true)
|
||||
self._mapNode.formationQuestLSV:SetAnim(0.08)
|
||||
self._mapNode.formationQuestLSV:Init(#self.mapCurPageQuest, self, self.OnQuestGridRefresh)
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnQuestGridRefresh(goGrid, gridIndex)
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
if self.mapQuestsGrids[nInstanceId] == nil then
|
||||
self.mapQuestsGrids[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.QuestNewbie.TeamFormation.FormationQuestGridCtrl")
|
||||
end
|
||||
local nIdx = gridIndex + 1
|
||||
self.mapQuestsGrids[nInstanceId]:Refresh(self.mapCurPageQuest[nIdx])
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnBtnClick_Right()
|
||||
local curShowGroupIdx = 0
|
||||
for idx, mapGroupData in ipairs(self.tbAllGroup) do
|
||||
if self.curShowGroup == mapGroupData.Id then
|
||||
curShowGroupIdx = idx
|
||||
end
|
||||
end
|
||||
local nAfterGroupIdx = curShowGroupIdx + 1
|
||||
local nAfterGroup = self.tbAllGroup[nAfterGroupIdx].Id
|
||||
if nAfterGroup == self.nCurGroup then
|
||||
self.mapCurPageQuest = self.mapCurQuests
|
||||
self:RefreshShow(self.nCurGroup)
|
||||
return
|
||||
end
|
||||
self.mapCurPageQuest = {}
|
||||
for _, mapQuestCfgData in ipairs(self.mapAllTeamFormationQuest[nAfterGroup]) do
|
||||
table.insert(self.mapCurPageQuest, {
|
||||
nTid = mapQuestCfgData.Id,
|
||||
nGoal = 1,
|
||||
nCurProgress = 1,
|
||||
nStatus = 2,
|
||||
nExpire = 0
|
||||
})
|
||||
end
|
||||
self:RefreshShow(nAfterGroup)
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnBtnClick_Left()
|
||||
local curShowGroupIdx = 0
|
||||
for idx, mapGroupData in ipairs(self.tbAllGroup) do
|
||||
if self.curShowGroup == mapGroupData.Id then
|
||||
curShowGroupIdx = idx
|
||||
end
|
||||
end
|
||||
local nAfterGroupIdx = curShowGroupIdx - 1
|
||||
local nAfterGroup = self.tbAllGroup[nAfterGroupIdx].Id
|
||||
self.mapCurPageQuest = {}
|
||||
for _, mapQuestCfgData in ipairs(self.mapAllTeamFormationQuest[nAfterGroup]) do
|
||||
table.insert(self.mapCurPageQuest, {
|
||||
nTid = mapQuestCfgData.Id,
|
||||
nGoal = 1,
|
||||
nCurProgress = 1,
|
||||
nStatus = 2,
|
||||
nExpire = 0
|
||||
})
|
||||
end
|
||||
self:RefreshShow(nAfterGroup)
|
||||
end
|
||||
function QuestNewbieFormationCtrl:InitData()
|
||||
self.mapAllTeamFormationQuestStatus = PlayerData.Quest:GetTeamFormationQuestData()
|
||||
self.mapAllTeamFormationQuest = {}
|
||||
local foreachFormationQuest = function(mapData)
|
||||
if self.mapAllTeamFormationQuest[mapData.QuestGroup] == nil then
|
||||
self.mapAllTeamFormationQuest[mapData.QuestGroup] = {}
|
||||
end
|
||||
table.insert(self.mapAllTeamFormationQuest[mapData.QuestGroup], mapData)
|
||||
end
|
||||
ForEachTableLine(DataTable.AssistQuest, foreachFormationQuest)
|
||||
self.tbAllGroup = {}
|
||||
local foreachFormationQuestGroup = function(mapData)
|
||||
table.insert(self.tbAllGroup, mapData)
|
||||
end
|
||||
ForEachTableLine(DataTable.AssistQuestGroup, foreachFormationQuestGroup)
|
||||
local sortQuestGroup = function(a, b)
|
||||
return a.Id < b.Id
|
||||
end
|
||||
table.sort(self.tbAllGroup, sortQuestGroup)
|
||||
self.tbAttr = {}
|
||||
local foreachFormationQuestAttr = function(mapData)
|
||||
table.insert(self.tbAttr, mapData)
|
||||
end
|
||||
ForEachTableLine(DataTable.AssistAttribute, foreachFormationQuestAttr)
|
||||
self.mapQuestsGrids = {}
|
||||
self.mapCurPageQuest = {}
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnEnable()
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnDisable()
|
||||
if self.mapQuestsGrids ~= nil then
|
||||
for nInstanceId, objCtrl in pairs(self.mapQuestsGrids) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.mapQuestsGrids[nInstanceId] = nil
|
||||
end
|
||||
end
|
||||
if self.tbAttrGridCtrl ~= nil then
|
||||
for insId, objCtrl in pairs(self.tbAttrGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbAttrGridCtrl[insId] = nil
|
||||
end
|
||||
end
|
||||
self.mapQuestsGrids = {}
|
||||
self.mapCurPageQuest = {}
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnBtnClick_ReceiveChapter()
|
||||
local bReceived = PlayerData.Quest:CheckTeamFormationGroupReward(self.nAttributeIdx, self.nCurShowGroupIdxInAttr)
|
||||
if bReceived then
|
||||
return
|
||||
end
|
||||
local curShowGroupIdx = 0
|
||||
for idx, mapGroupData in ipairs(self.tbAllGroup) do
|
||||
if self.curShowGroup == mapGroupData.Id then
|
||||
curShowGroupIdx = idx
|
||||
end
|
||||
end
|
||||
local questGroupCfg = self.tbAllGroup[curShowGroupIdx]
|
||||
local bDropBuild = questGroupCfg.ShowBuildId ~= nil and 0 < questGroupCfg.ShowBuildId
|
||||
if bDropBuild then
|
||||
local CheckBuildCountCallBack = function(nBuildCount)
|
||||
local nMaxBuildCount = ConfigTable.GetConfigNumber("StarTowerBuildNumberMax")
|
||||
local bCanReceive = nBuildCount < nMaxBuildCount
|
||||
if bCanReceive then
|
||||
PlayerData.Quest:ReceiveTeamFormationGroupReward(questGroupCfg.Id, self.nAttributeIdx, nil)
|
||||
else
|
||||
local confirmCallback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerBuildBriefList)
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("BUILD_04"),
|
||||
sConfirm = ConfigTable.GetUIText("RoguelikeBuild_BuildCount_BtnManage"),
|
||||
callbackConfirm = confirmCallback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
end
|
||||
PlayerData.Build:GetBuildCount(CheckBuildCountCallBack)
|
||||
else
|
||||
PlayerData.Quest:ReceiveTeamFormationGroupReward(questGroupCfg.Id, self.nAttributeIdx, nil)
|
||||
end
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnBtnClick_FastReceive()
|
||||
local curShowGroupIdx = 0
|
||||
for idx, mapGroupData in ipairs(self.tbAllGroup) do
|
||||
if self.curShowGroup == mapGroupData.Id then
|
||||
curShowGroupIdx = idx
|
||||
end
|
||||
end
|
||||
PlayerData.Quest:ReceiveTeamFormationReward(0, self.tbAllGroup[curShowGroupIdx].Id, nil)
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnBtnClick_FastReceiveGray()
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnBtnClick_RewardItem(btn, nIndex)
|
||||
local nTid = 0
|
||||
local curShowGroupIdx = 0
|
||||
for idx, mapGroupData in ipairs(self.tbAllGroup) do
|
||||
if self.curShowGroup == mapGroupData.Id then
|
||||
curShowGroupIdx = idx
|
||||
end
|
||||
end
|
||||
local questGroupCfg = self.tbAllGroup[curShowGroupIdx]
|
||||
if questGroupCfg.ShowBuildId ~= 0 then
|
||||
if 1 < nIndex then
|
||||
nIndex = nIndex - 1
|
||||
nTid = self.tbChapterReward[nIndex].nTid
|
||||
else
|
||||
nTid = questGroupCfg.ShowBuildId
|
||||
end
|
||||
else
|
||||
nTid = self.tbChapterReward[nIndex].nTid
|
||||
end
|
||||
UTILS.ClickItemGridWithTips(nTid, btn.transform, true, true, false)
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnBtnClick_BackToTeamSelect()
|
||||
self:RefreshTeamSelect()
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnEvent_SelectTourGuideQuest(nQuestId)
|
||||
for i, v in ipairs(self.mapCurPageQuest) do
|
||||
if v.nTid == nQuestId then
|
||||
self._mapNode.formationQuestLSV:SetScrollGridPos(i - 1, 0, 0)
|
||||
EventManager.Hit("Guide_SelectGuideGroupGrid", nQuestId, i - 1)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnEvent_UpdateTeamFormationGroup(bAttributeComplete, nNextGroup)
|
||||
if bAttributeComplete then
|
||||
LocalData.SetPlayerLocalData("TeamFormationQuestSelected", nil)
|
||||
self:Refresh()
|
||||
return
|
||||
elseif nNextGroup ~= nil then
|
||||
self.nCurGroup = nNextGroup
|
||||
end
|
||||
self._mapNode.goQuestList:SetActive(true)
|
||||
self:RefreshQuestList(self.mapAllTeamFormationQuest[self.nCurGroup], self.nCurGroup)
|
||||
end
|
||||
function QuestNewbieFormationCtrl:OnEvent_Guide_GetNewQuestTaskIndex(nTaskIndex)
|
||||
local nIndex = 0
|
||||
for i = 1, #self.mapCurPageQuest do
|
||||
if self.mapCurPageQuest[i].nTid == nTaskIndex then
|
||||
nIndex = i - 1
|
||||
break
|
||||
end
|
||||
end
|
||||
self._mapNode.formationQuestLSV:SetScrollGridPos(nIndex - 1, 0)
|
||||
local listInUse = self._mapNode.formationQuestLSV:GetInUseGridIndex()
|
||||
local nPosInScreen = 0
|
||||
for i = 0, listInUse.Count - 1 do
|
||||
if listInUse[i] == nIndex then
|
||||
nPosInScreen = i
|
||||
break
|
||||
end
|
||||
end
|
||||
EventManager.Hit("OnEvent_SetNewQuestTaskIndex", nPosInScreen)
|
||||
end
|
||||
return QuestNewbieFormationCtrl
|
||||
@@ -0,0 +1,40 @@
|
||||
local QuestNewbieTeamCtrl = class("QuestNewbieTeamCtrl", BaseCtrl)
|
||||
QuestNewbieTeamCtrl._mapNodeConfig = {
|
||||
goLock = {},
|
||||
txtLock = {sComponentName = "TMP_Text"},
|
||||
imgChar = {nCount = 3, sComponentName = "Image"},
|
||||
goElement = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateElementCtrl"
|
||||
},
|
||||
txtTeamDesc = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
QuestNewbieTeamCtrl._mapEventConfig = {}
|
||||
QuestNewbieTeamCtrl._mapRedDotConfig = {}
|
||||
function QuestNewbieTeamCtrl:Init(mapData)
|
||||
if mapData == nil then
|
||||
return
|
||||
end
|
||||
self._mapNode.goElement:Refresh(mapData.EET)
|
||||
for i = 1, 3 do
|
||||
local nChar = mapData["Char" .. i]
|
||||
if nChar ~= nil and 0 < nChar then
|
||||
local sIconPath = "Icon/Head/head_" .. nChar .. "01" .. AllEnum.CharHeadIconSurfix.XL
|
||||
self:SetPngSprite(self._mapNode.imgChar[i], sIconPath)
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTeamDesc, mapData.Desc)
|
||||
local bFinished = PlayerData.Quest:CheckTeamFormationAttributeCompleted(mapData.Id)
|
||||
local bUnlocked = PlayerData.Quest:CheckTeamFormationAttributeUnlocked(mapData.Id)
|
||||
self.bLocked = bFinished or not bUnlocked
|
||||
self._mapNode.goLock:SetActive(self.bLocked)
|
||||
local sTip = ""
|
||||
if bFinished then
|
||||
sTip = ConfigTable.GetUIText("Quest_Complete")
|
||||
else
|
||||
sTip = ConfigTable.GetUIText("StarTower_Book_Lock")
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLock, sTip)
|
||||
end
|
||||
function QuestNewbieTeamCtrl:OnEnable()
|
||||
end
|
||||
return QuestNewbieTeamCtrl
|
||||
@@ -0,0 +1,180 @@
|
||||
local TutorialLevelCtrl = class("TutorialLevelCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local typeUITextKey = {
|
||||
[1] = "Tutorial_Leveltype_1",
|
||||
[2] = "Tutorial_Leveltype_2",
|
||||
[3] = "Tutorial_Leveltype_3"
|
||||
}
|
||||
local receivedColor = Color(0.0392156862745098, 0.7450980392156863, 0.7725490196078432)
|
||||
local normalColor = Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764)
|
||||
TutorialLevelCtrl._mapNodeConfig = {
|
||||
bg_title = {},
|
||||
txt_title = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "QuestNewbiePanel_Tab_2"
|
||||
},
|
||||
txt_progress = {sComponentName = "TMP_Text"},
|
||||
bg_title_com = {},
|
||||
txt_title_com = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Tutorial_Finish"
|
||||
},
|
||||
Lsv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
}
|
||||
}
|
||||
TutorialLevelCtrl._mapEventConfig = {
|
||||
[EventId.QuestDataRefresh] = "OnEvent_QuestDataRefresh",
|
||||
[EventId.TutorialQuestReceived] = "OnEvent_TutorialQuestReceived",
|
||||
Tutorial_Refesh = "Refresh"
|
||||
}
|
||||
TutorialLevelCtrl._mapRedDotConfig = {}
|
||||
function TutorialLevelCtrl:Awake()
|
||||
self.itemCtrl = {}
|
||||
end
|
||||
function TutorialLevelCtrl:OnEnable()
|
||||
end
|
||||
function TutorialLevelCtrl:OnDisable()
|
||||
self:UnBind()
|
||||
end
|
||||
function TutorialLevelCtrl:OnDestory()
|
||||
self:UnBind()
|
||||
end
|
||||
function TutorialLevelCtrl:UnBind()
|
||||
if self.itemCtrl ~= nil and self.itemCtrl ~= {} then
|
||||
for _, ctrl in pairs(self.itemCtrl) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
self.itemCtrl = {}
|
||||
end
|
||||
function TutorialLevelCtrl:Refresh()
|
||||
self.tbLevels = clone(PlayerData.TutorialData:GetLevelList())
|
||||
local sortFunc = function(a, b)
|
||||
local aData = PlayerData.TutorialData:GetLevelData(a)
|
||||
local bData = PlayerData.TutorialData:GetLevelData(b)
|
||||
if aData.LevelStatus == bData.LevelStatus then
|
||||
return aData.nlevelId < bData.nlevelId
|
||||
end
|
||||
return aData.LevelStatus < bData.LevelStatus
|
||||
end
|
||||
table.sort(self.tbLevels, sortFunc)
|
||||
self._mapNode.Lsv.gameObject:SetActive(true)
|
||||
self._mapNode.Lsv:SetAnim(0.08)
|
||||
self._mapNode.Lsv:Init(#self.tbLevels, self, self.OnGridRefresh)
|
||||
self._mapNode.bg_title_com:SetActive(false)
|
||||
self._mapNode.bg_title:SetActive(false)
|
||||
local nTotalCount, nReceivedCount = PlayerData.TutorialData:GetProgress()
|
||||
if nTotalCount == nReceivedCount then
|
||||
self._mapNode.bg_title_com:SetActive(true)
|
||||
else
|
||||
self._mapNode.bg_title:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_progress, orderedFormat(ConfigTable.GetUIText("Tutorial_LevelCount"), nReceivedCount, nTotalCount))
|
||||
end
|
||||
return 0
|
||||
end
|
||||
function TutorialLevelCtrl:OnGridRefresh(goGrid, nGridIndex)
|
||||
local nIndex = nGridIndex + 1
|
||||
local levelId = self.tbLevels[nIndex]
|
||||
local levelConfig = ConfigTable.GetData("TutorialLevel", levelId)
|
||||
local levelData = PlayerData.TutorialData:GetLevelData(levelId)
|
||||
if levelConfig == nil or levelData == nil then
|
||||
return
|
||||
end
|
||||
local db = goGrid.transform:Find("btnGrid/AnimRoot/imgBg/db/")
|
||||
local txtName = goGrid.transform:Find("btnGrid/AnimRoot/imgBg/name/txtName"):GetComponent("TMP_Text")
|
||||
local txtIndex = goGrid.transform:Find("btnGrid/AnimRoot/imgBg/db/txtIndex"):GetComponent("TMP_Text")
|
||||
local txtType = goGrid.transform:Find("btnGrid/AnimRoot/imgBg/db/txtType"):GetComponent("TMP_Text")
|
||||
local item = goGrid.transform:Find("btnGrid/AnimRoot/imgBg/btnRewardItem/AnimRoot/item").gameObject
|
||||
local btnItem = goGrid.transform:Find("btnGrid/AnimRoot/imgBg/btnRewardItem"):GetComponent("UIButton")
|
||||
local nInstanceId = item:GetInstanceID()
|
||||
if not self.itemCtrl[nInstanceId] then
|
||||
self.itemCtrl[nInstanceId] = self:BindCtrlByNode(item, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
btnItem.onClick:RemoveAllListeners()
|
||||
btnItem.onClick:AddListener(function()
|
||||
local nRewardId = levelConfig.Item1
|
||||
if nRewardId ~= nil then
|
||||
UTILS.ClickItemGridWithTips(nRewardId, btnItem.transform, true, true, false)
|
||||
end
|
||||
end)
|
||||
NovaAPI.SetTMPText(txtName, levelConfig.Title)
|
||||
NovaAPI.SetTMPText(txtIndex, string.format("%02d", levelConfig.Id))
|
||||
NovaAPI.SetTMPText(txtType, ConfigTable.GetUIText(typeUITextKey[levelConfig.TutorialType]))
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(db)
|
||||
local bReceived = false
|
||||
if levelData.LevelStatus == AllEnum.ActQuestStatus.Received then
|
||||
bReceived = true
|
||||
end
|
||||
self.itemCtrl[nInstanceId]:SetItem(levelConfig.Item1, nil, levelConfig.Qty1, nil, bReceived)
|
||||
local imgFinish = goGrid.transform:Find("btnGrid/AnimRoot/imgBg/name/imgFinish")
|
||||
imgFinish.gameObject:SetActive(bReceived)
|
||||
if bReceived then
|
||||
NovaAPI.SetTMPColor(txtName, receivedColor)
|
||||
else
|
||||
NovaAPI.SetTMPColor(txtName, normalColor)
|
||||
end
|
||||
local btnActReceive = goGrid.transform:Find("btnGrid/AnimRoot/imgBg/btnActReceive"):GetComponent("UIButton")
|
||||
local btnActReceiveGray = goGrid.transform:Find("btnGrid/AnimRoot/imgBg/btnActReceiveGray"):GetComponent("UIButton")
|
||||
local txtBtnActReceive = btnActReceive.transform:Find("AnimRoot/txtBtnActReceive"):GetComponent("TMP_Text")
|
||||
local txtBtnActReceiveGray = btnActReceiveGray.transform:Find("AnimRoot/txtBtnActReceiveGray"):GetComponent("TMP_Text")
|
||||
btnActReceive.gameObject:SetActive(levelData.LevelStatus == AllEnum.ActQuestStatus.Complete)
|
||||
btnActReceiveGray.gameObject:SetActive(levelData.LevelStatus ~= AllEnum.ActQuestStatus.Complete)
|
||||
NovaAPI.SetTMPText(txtBtnActReceive, ConfigTable.GetUIText("Tutorial_GetReward"))
|
||||
NovaAPI.SetTMPText(txtBtnActReceiveGray, ConfigTable.GetUIText("Tutorial_Go"))
|
||||
btnActReceive.onClick:RemoveAllListeners()
|
||||
btnActReceiveGray.onClick:RemoveAllListeners()
|
||||
btnActReceive.onClick:AddListener(function()
|
||||
PlayerData.TutorialData:GetLevelReward(levelId)
|
||||
end)
|
||||
btnActReceiveGray.onClick:AddListener(function()
|
||||
local buildData = ConfigTable.GetData("TrialBuild", levelConfig.TutorialBuild)
|
||||
if buildData == nil then
|
||||
return
|
||||
end
|
||||
local charIdList = {}
|
||||
local discIdList = {}
|
||||
for _, id in pairs(buildData.Char) do
|
||||
local charData = ConfigTable.GetData("TrialCharacter", id)
|
||||
if charData ~= nil then
|
||||
table.insert(charIdList, charData.CharId)
|
||||
end
|
||||
end
|
||||
for _, id in pairs(buildData.Disc) do
|
||||
local discData = ConfigTable.GetData("TrialDisc", id)
|
||||
if discData ~= nil then
|
||||
table.insert(discIdList, discData.DiscId)
|
||||
end
|
||||
end
|
||||
local cb = function()
|
||||
CS.AdventureModuleHelper.EnterDynamic(levelConfig.FloorId, charIdList, GameEnum.dynamicLevelType.Tutorial, nil)
|
||||
NovaAPI.EnterModule("AdventureModuleScene", true)
|
||||
end
|
||||
PlayerData.TutorialData:EnterLevel(levelConfig.Id, cb)
|
||||
end)
|
||||
local nLockType = PlayerData.TutorialData:GetLevelLockType(levelId)
|
||||
local mask = goGrid.transform:Find("btnGrid/AnimRoot/mask")
|
||||
mask.gameObject:SetActive(nLockType ~= AllEnum.TutorialLevelLockType.None)
|
||||
if nLockType ~= AllEnum.TutorialLevelLockType.None then
|
||||
local txt_tips = mask.transform:Find("imgLock/lockTips/txt_locktip"):GetComponent("TMP_Text")
|
||||
if nLockType == AllEnum.TutorialLevelLockType.WorldClass then
|
||||
NovaAPI.SetTMPText(txt_tips, orderedFormat(ConfigTable.GetUIText("Tutorial_WorldClassTip"), levelConfig.WorldClass))
|
||||
elseif nLockType == AllEnum.TutorialLevelLockType.PreLevel then
|
||||
NovaAPI.SetTMPText(txt_tips, orderedFormat(ConfigTable.GetUIText("Tutorial_PreLevelsTip"), string.format("%02d", levelConfig.PreLevelId)))
|
||||
end
|
||||
local lockTips = mask.transform:Find("imgLock/lockTips"):GetComponent("RectTransform")
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(lockTips)
|
||||
end
|
||||
end
|
||||
function TutorialLevelCtrl:OnEvent_QuestDataRefresh(questType)
|
||||
if self.gameObject.activeSelf then
|
||||
self:Refresh()
|
||||
end
|
||||
end
|
||||
function TutorialLevelCtrl:OnEvent_TutorialQuestReceived(msgData)
|
||||
local refreshFunc = function()
|
||||
self:Refresh()
|
||||
end
|
||||
UTILS.OpenReceiveByChangeInfo(msgData, refreshFunc)
|
||||
end
|
||||
return TutorialLevelCtrl
|
||||
Reference in New Issue
Block a user