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,19 @@
|
||||
local AssistantCtrl = class("AssistantCtrl", BaseCtrl)
|
||||
AssistantCtrl._mapNodeConfig = {
|
||||
imgBg = {},
|
||||
txtAssistant = {sComponentName = "TMP_Text"},
|
||||
imgLight = {}
|
||||
}
|
||||
AssistantCtrl._mapEventConfig = {}
|
||||
AssistantCtrl._mapRedDotConfig = {}
|
||||
function AssistantCtrl:Awake()
|
||||
end
|
||||
function AssistantCtrl:OnEnable()
|
||||
end
|
||||
function AssistantCtrl:OnDisable()
|
||||
end
|
||||
function AssistantCtrl:OnDestroy()
|
||||
end
|
||||
function AssistantCtrl:OnRelease()
|
||||
end
|
||||
return AssistantCtrl
|
||||
@@ -0,0 +1,215 @@
|
||||
local DailyQuestCtrl = class("DailyQuestCtrl", BaseCtrl)
|
||||
DailyQuestCtrl._mapNodeConfig = {
|
||||
txtActValue = {sComponentName = "TMP_Text"},
|
||||
imgActive = {sComponentName = "Image"},
|
||||
rtImgActProgress = {
|
||||
sNodeName = "imgActProgress",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
rtActProgressFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnNodeItem = {
|
||||
nCount = 5,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NodeItem"
|
||||
},
|
||||
btnActReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ActReceive"
|
||||
},
|
||||
txtBtnActReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Receive_Btn_Text"
|
||||
},
|
||||
btnActReceiveGray = {sComponentName = "UIButton"},
|
||||
txtBtnActReceiveGray = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Receive_Btn_Text"
|
||||
},
|
||||
txtActComplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Daily_Quest_All_Received"
|
||||
},
|
||||
dailyQuestLSV = {
|
||||
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"
|
||||
}
|
||||
}
|
||||
DailyQuestCtrl._mapEventConfig = {
|
||||
ChooseDailyGridByQuestId = "OnEvent_ChooseDailyGridByQuestId"
|
||||
}
|
||||
DailyQuestCtrl._mapRedDotConfig = {}
|
||||
local totalLength = 617
|
||||
local totalNodeLength = 610
|
||||
local totalHeight = 37
|
||||
local actNodeItemHeight = -22.3
|
||||
function DailyQuestCtrl:RefreshActivityNode()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActValue, self.nActiveCount)
|
||||
local bAllComplete = self.nActiveCount >= self.nTotalActiveCount
|
||||
self.tbQuestActive = {}
|
||||
local ForeachActivity = function(mapData)
|
||||
table.insert(self.tbQuestActive, mapData)
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("DailyQuestActive"), ForeachActivity)
|
||||
table.sort(self.tbQuestActive, function(a, b)
|
||||
return a.Active < b.Active
|
||||
end)
|
||||
local nMaxAct = self.tbQuestActive[#self.tbQuestActive].Active
|
||||
self.tbCanReceiveAct = {}
|
||||
for k, v in ipairs(self.tbQuestActive) do
|
||||
if self._mapNode.btnNodeItem[k] ~= nil then
|
||||
local node = self._mapNode.btnNodeItem[k]
|
||||
local nPosX = math.min(k / #self.tbQuestActive * totalNodeLength, totalNodeLength)
|
||||
node.transform:GetComponent("RectTransform").anchoredPosition = Vector2(nPosX, actNodeItemHeight)
|
||||
node.gameObject:SetActive(true)
|
||||
local txtNodeAct = node.transform:Find("AnimRoot/goNodeItem/txtNodeAct"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtNodeAct, v.Active)
|
||||
local anim = node.transform:Find("AnimRoot"):GetComponent("Animator")
|
||||
local imgGift = node.transform:Find("AnimRoot/goNodeItem/imgGift")
|
||||
local imgComplete = node.transform:Find("AnimRoot/goNodeItem/imgComplete")
|
||||
local goParticle1 = node.transform:Find("AnimRoot/goNodeItem/UIParticle1")
|
||||
local goParticle2 = node.transform:Find("AnimRoot/goNodeItem/UIParticle2")
|
||||
local bReceived = PlayerData.Quest:CheckDailyActiveReceive(v.Id)
|
||||
local bComplete = v.Active <= self.nActiveCount
|
||||
imgGift.gameObject:SetActive(not bReceived)
|
||||
imgComplete.gameObject:SetActive(bReceived)
|
||||
goParticle1.gameObject:SetActive(not bReceived and bComplete)
|
||||
goParticle2.gameObject:SetActive(not bReceived and bComplete)
|
||||
if bComplete and not bReceived then
|
||||
table.insert(self.tbCanReceiveAct, k)
|
||||
end
|
||||
if not bReceived and bComplete then
|
||||
anim:Play("Quest_btnNodeComplete_loop", 0, 0)
|
||||
else
|
||||
anim:Play("Empty")
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mapNode.btnActReceive.gameObject:SetActive(#self.tbCanReceiveAct > 0)
|
||||
self._mapNode.txtActComplete.gameObject:SetActive(bAllComplete and not (#self.tbCanReceiveAct > 0))
|
||||
self._mapNode.btnActReceiveGray.gameObject:SetActive(not bAllComplete and not (#self.tbCanReceiveAct > 0))
|
||||
local nWidth = math.min(self.nActiveCount / nMaxAct * totalLength, totalLength)
|
||||
self._mapNode.rtActProgressFill.sizeDelta = Vector2(nWidth, totalHeight)
|
||||
end
|
||||
function DailyQuestCtrl:Refresh(tbDailyQuest)
|
||||
self.tbDailyQuest = tbDailyQuest
|
||||
self.nActiveCount = 0
|
||||
self.nTotalActiveCount = 0
|
||||
for _, mapDailyQuest in ipairs(tbDailyQuest) do
|
||||
local mapQuestData = ConfigTable.GetData("DailyQuest", mapDailyQuest.nTid)
|
||||
if mapQuestData ~= nil then
|
||||
if mapDailyQuest.nStatus == 2 then
|
||||
self.nActiveCount = self.nActiveCount + mapQuestData.Active
|
||||
end
|
||||
self.nTotalActiveCount = self.nTotalActiveCount + mapQuestData.Active
|
||||
end
|
||||
end
|
||||
local mapItemCfg = ConfigTable.GetData_Item(AllEnum.CoinItemId.DailyQuestActive)
|
||||
if mapItemCfg ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgActive, mapItemCfg.Icon)
|
||||
end
|
||||
self:RefreshActivityNode()
|
||||
local bFastReceive = false
|
||||
for _, mapData in ipairs(self.tbDailyQuest) do
|
||||
if mapData.nStatus == 1 then
|
||||
bFastReceive = true
|
||||
break
|
||||
end
|
||||
end
|
||||
self._mapNode.dailyQuestLSV.gameObject:SetActive(true)
|
||||
self._mapNode.btnFastReceive.gameObject:SetActive(bFastReceive)
|
||||
self._mapNode.btnFastReceiveGray.gameObject:SetActive(not bFastReceive)
|
||||
self._mapNode.dailyQuestLSV:SetAnim(0.08)
|
||||
self._mapNode.dailyQuestLSV:Init(#self.tbDailyQuest, self, self.OnGridQuestRefresh, nil, false)
|
||||
end
|
||||
function DailyQuestCtrl:OnGridQuestRefresh(goGrid, gridIndex)
|
||||
if self.mapDailyGrid[goGrid] == nil then
|
||||
self.mapDailyGrid[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.Quest.DailyQuest.DailyQuestGridCtrl")
|
||||
end
|
||||
local nIdx = gridIndex + 1
|
||||
local mapQuest = self.tbDailyQuest[nIdx]
|
||||
self.mapDailyGrid[goGrid]:Refresh(mapQuest.nTid, mapQuest.nStatus, mapQuest.nCurProgress, mapQuest.nGoal)
|
||||
end
|
||||
function DailyQuestCtrl:Awake()
|
||||
self.mapDailyGrid = {}
|
||||
end
|
||||
function DailyQuestCtrl:OnEnable()
|
||||
end
|
||||
function DailyQuestCtrl:OnDisable()
|
||||
for go, mapCtrl in ipairs(self.mapDailyGrid) do
|
||||
self:UnbindCtrlByNode(mapCtrl)
|
||||
end
|
||||
self.mapDailyGrid = {}
|
||||
end
|
||||
function DailyQuestCtrl:OnDestroy()
|
||||
end
|
||||
function DailyQuestCtrl:OnBtnClick_ActReceive()
|
||||
PlayerData.Quest:ReceiveDailyActiveReward()
|
||||
end
|
||||
function DailyQuestCtrl:OnBtnClick_FastReceive()
|
||||
PlayerData.Quest:ReceiveDailyReward(0)
|
||||
local tab = {}
|
||||
table.insert(tab, {
|
||||
"role_id",
|
||||
tostring(PlayerData.Base._nPlayerId)
|
||||
})
|
||||
NovaAPI.UserEventUpload("daily_mission_complete", tab)
|
||||
end
|
||||
function DailyQuestCtrl:OnBtnClick_FastReceiveGray()
|
||||
end
|
||||
function DailyQuestCtrl:OnBtnClick_NodeItem(btn, nIndex)
|
||||
local bCanReceive = false
|
||||
for _, v in ipairs(self.tbCanReceiveAct) do
|
||||
if v == nIndex then
|
||||
bCanReceive = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if #self.tbCanReceiveAct > 0 and bCanReceive then
|
||||
PlayerData.Quest:ReceiveDailyActiveReward()
|
||||
elseif self.tbQuestActive[nIndex] ~= nil then
|
||||
local sTip = orderedFormat(ConfigTable.GetUIText("Daily_Quest_Reward_Tip"), self.tbQuestActive[nIndex].Active)
|
||||
local tbItem = {}
|
||||
for i = 1, 2 do
|
||||
if self.tbQuestActive[nIndex]["ItemTid" .. i] ~= 0 then
|
||||
table.insert(tbItem, {
|
||||
nTid = self.tbQuestActive[nIndex]["ItemTid" .. i],
|
||||
nCount = self.tbQuestActive[nIndex]["Number" .. i],
|
||||
bFullShow = true
|
||||
})
|
||||
end
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Item,
|
||||
sTitle = ConfigTable.GetUIText("Daily_Quest_Reward_Tip_Title"),
|
||||
sContent = sTip,
|
||||
tbItem = tbItem
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
end
|
||||
function DailyQuestCtrl:OnEvent_ChooseDailyGridByQuestId(questId)
|
||||
for i, v in pairs(self.mapDailyGrid) do
|
||||
if v.nQuestId == questId then
|
||||
EventManager.Hit("Guide_ChooseDailyGridObj", i.gameObject.name)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
return DailyQuestCtrl
|
||||
@@ -0,0 +1,100 @@
|
||||
local DailyQuestGridCtrl = class("DailyQuestGridCtrl", BaseCtrl)
|
||||
local totalLength = 517
|
||||
local totalHeight = 37
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
DailyQuestGridCtrl._mapNodeConfig = {
|
||||
imgDb = {nCount = 2},
|
||||
btnGrid = {},
|
||||
txtQuestDesc = {sComponentName = "TMP_Text"},
|
||||
txtProgress = {sComponentName = "TMP_Text"},
|
||||
rtProgressFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
txtBtnReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Receive"
|
||||
},
|
||||
btnJump = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_JumpTo"
|
||||
},
|
||||
txtBtnJump = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_JumpTo_Text"
|
||||
},
|
||||
txtUnComplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_undone"
|
||||
},
|
||||
imgReceived = {},
|
||||
imgCompleteMask = {},
|
||||
btnRewardItem = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_RewardItem"
|
||||
},
|
||||
goRewardItem = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
}
|
||||
}
|
||||
DailyQuestGridCtrl._mapEventConfig = {}
|
||||
function DailyQuestGridCtrl: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 DailyQuestGridCtrl:Refresh(nQuestId, nState, nCur, nTotal, bAllComplete)
|
||||
self.nQuestId = nQuestId
|
||||
local mapQuest = ConfigTable.GetData("DailyQuest", nQuestId)
|
||||
if mapQuest == nil then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtQuestDesc, mapQuest.Title)
|
||||
if nState ~= 2 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProgress, string.format("%d/%d", nCur, nTotal))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProgress, ConfigTable.GetUIText("Quest_Complete"))
|
||||
end
|
||||
self.mapQuest = mapQuest
|
||||
self._mapNode.rtProgressFill.sizeDelta = Vector2(nCur / nTotal * totalLength, totalHeight)
|
||||
self._mapNode.btnReceive.gameObject:SetActive(nState == 1 and not bAllComplete)
|
||||
self._mapNode.btnJump.gameObject:SetActive(nState == 0 and 0 < mapQuest.JumpTo)
|
||||
self._mapNode.txtUnComplete.gameObject:SetActive(nState == 0 and mapQuest.JumpTo == 0)
|
||||
self._mapNode.imgReceived:SetActive(nState == 2)
|
||||
self._mapNode.imgCompleteMask:SetActive(nState == 2)
|
||||
local bApear = mapQuest.Apear
|
||||
self._mapNode.imgDb[1].gameObject:SetActive(bApear)
|
||||
self._mapNode.imgDb[2].gameObject:SetActive(not bApear)
|
||||
self.tbRewardId = {
|
||||
AllEnum.CoinItemId.DailyQuestActive,
|
||||
mapQuest.ItemTid
|
||||
}
|
||||
self._mapNode.goRewardItem[1]:SetItem(AllEnum.CoinItemId.DailyQuestActive, nil, mapQuest.Active, nil, nil, nil, nil, true)
|
||||
self._mapNode.goRewardItem[2]:SetItem(mapQuest.ItemTid, nil, mapQuest.ItemQty, nil, nil, nil, nil, true)
|
||||
end
|
||||
function DailyQuestGridCtrl:OnBtnClick_Receive()
|
||||
PlayerData.Quest:ReceiveDailyReward(self.nQuestId)
|
||||
end
|
||||
function DailyQuestGridCtrl:OnBtnClick_JumpTo()
|
||||
local nJumptoId = self.mapQuest.JumpTo
|
||||
JumpUtil.JumpTo(nJumptoId)
|
||||
end
|
||||
function DailyQuestGridCtrl:OnBtnClick_RewardItem(btn, nIndex)
|
||||
local nRewardId = self.tbRewardId[nIndex]
|
||||
if nRewardId ~= nil then
|
||||
local bShowDepot = true
|
||||
if nRewardId == AllEnum.CoinItemId.DailyQuestActive then
|
||||
bShowDepot = false
|
||||
end
|
||||
UTILS.ClickItemGridWithTips(nRewardId, btn.transform, true, bShowDepot, false)
|
||||
end
|
||||
end
|
||||
return DailyQuestGridCtrl
|
||||
@@ -0,0 +1,280 @@
|
||||
local GuideQuestCtrl = class("GuideQuestCtrl", BaseCtrl)
|
||||
GuideQuestCtrl._mapNodeConfig = {
|
||||
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"
|
||||
},
|
||||
guideQuestLSV = {
|
||||
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"
|
||||
}
|
||||
}
|
||||
GuideQuestCtrl._mapEventConfig = {
|
||||
Guide_SelectTourGuideQuest = "OnEvent_SelectTourGuideQuest"
|
||||
}
|
||||
GuideQuestCtrl._mapRedDotConfig = {}
|
||||
local statusOrder = {
|
||||
[0] = 1,
|
||||
[1] = 2,
|
||||
[2] = 0
|
||||
}
|
||||
function GuideQuestCtrl:Refresh(mapGuideQuest, nCurGroup)
|
||||
self.mapCurQuests = mapGuideQuest
|
||||
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 then
|
||||
self.mapCurQuests = {}
|
||||
for _, mapQuestCfgData in ipairs(self.mapAllGuideQuest[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 GuideQuestCtrl:RefreshShow(nCurGroup)
|
||||
self.curShowGroup = nCurGroup
|
||||
local curShowGroupIdx = 0
|
||||
local curGroupIdx = 0
|
||||
for idx, mapGroupData in ipairs(self.tbAllGroup) do
|
||||
if nCurGroup == mapGroupData.Id then
|
||||
curShowGroupIdx = idx
|
||||
end
|
||||
if self.nCurGroup == mapGroupData.Id then
|
||||
curGroupIdx = idx
|
||||
end
|
||||
end
|
||||
local questGroupCfg = self.tbAllGroup[curShowGroupIdx]
|
||||
self.tbChapterReward = {}
|
||||
if questGroupCfg ~= nil then
|
||||
self.nCurOrder = questGroupCfg.Order
|
||||
for i = 1, 6 do
|
||||
if questGroupCfg["Reward" .. i] ~= 0 then
|
||||
table.insert(self.tbChapterReward, {
|
||||
nTid = questGroupCfg["Reward" .. i],
|
||||
nCount = questGroupCfg["RewardQty" .. i]
|
||||
})
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtChapter, string.format("%02d", questGroupCfg.Order))
|
||||
end
|
||||
for k, v in ipairs(self._mapNode.rewardItem) do
|
||||
v.gameObject:SetActive(k <= #self.tbChapterReward)
|
||||
if k <= #self.tbChapterReward then
|
||||
v:SetItem(self.tbChapterReward[k].nTid, nil, self.tbChapterReward[k].nCount, nil, nil, nil, nil, true)
|
||||
end
|
||||
if self._mapNode.imgEmpty[k] ~= nil then
|
||||
self._mapNode.imgEmpty[k].gameObject:SetActive(k > #self.tbChapterReward)
|
||||
end
|
||||
end
|
||||
local bFastReceive = false
|
||||
local bAllReceive = true
|
||||
if curGroupIdx == curShowGroupIdx 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:CheckTourGroupReward(questGroupCfg.Order)
|
||||
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(curShowGroupIdx < curGroupIdx)
|
||||
if self.nCurPage == 1 then
|
||||
self.nCurPage = 2
|
||||
else
|
||||
self.nCurPage = 1
|
||||
end
|
||||
self._mapNode.guideQuestLSV:SetAnim(0.08)
|
||||
self._mapNode.guideQuestLSV:Init(#self.mapCurPageQuest, self, self.OnQuestGridRefresh)
|
||||
end
|
||||
function GuideQuestCtrl:OnQuestGridRefresh(goGrid, gridIndex)
|
||||
if self.mapQuestsGrids[goGrid] == nil then
|
||||
self.mapQuestsGrids[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.Quest.GuideQuest.GuideQuestGridCtrl")
|
||||
end
|
||||
local nIdx = gridIndex + 1
|
||||
self.mapQuestsGrids[goGrid]:Refresh(self.mapCurPageQuest[nIdx])
|
||||
end
|
||||
function GuideQuestCtrl: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.mapAllGuideQuest[nAfterGroup]) do
|
||||
table.insert(self.mapCurPageQuest, {
|
||||
nTid = mapQuestCfgData.Id,
|
||||
nGoal = 1,
|
||||
nCurProgress = 1,
|
||||
nStatus = 2,
|
||||
nExpire = 0
|
||||
})
|
||||
end
|
||||
self:RefreshShow(nAfterGroup)
|
||||
end
|
||||
function GuideQuestCtrl: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.mapAllGuideQuest[nAfterGroup]) do
|
||||
table.insert(self.mapCurPageQuest, {
|
||||
nTid = mapQuestCfgData.Id,
|
||||
nGoal = 1,
|
||||
nCurProgress = 1,
|
||||
nStatus = 2,
|
||||
nExpire = 0
|
||||
})
|
||||
end
|
||||
self:RefreshShow(nAfterGroup)
|
||||
end
|
||||
function GuideQuestCtrl:Awake()
|
||||
self.mapAllGuideQuest = {}
|
||||
local foreachGuideQuest = function(mapData)
|
||||
if self.mapAllGuideQuest[mapData.Order] == nil then
|
||||
self.mapAllGuideQuest[mapData.Order] = {}
|
||||
end
|
||||
table.insert(self.mapAllGuideQuest[mapData.Order], mapData)
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("TourGuideQuest"), foreachGuideQuest)
|
||||
local sortQuest = function(a, b)
|
||||
return a.Id < b.Id
|
||||
end
|
||||
for _, tbGuideQuests in pairs(self.mapAllGuideQuest) do
|
||||
table.sort(tbGuideQuests, sortQuest)
|
||||
end
|
||||
self.tbAllGroup = {}
|
||||
local foreachGuideGroup = function(mapData)
|
||||
table.insert(self.tbAllGroup, mapData)
|
||||
end
|
||||
ForEachTableLine(DataTable.TourGuideQuestGroup, foreachGuideGroup)
|
||||
local sortQuestGroup = function(a, b)
|
||||
return a.Order < b.Order
|
||||
end
|
||||
table.sort(self.tbAllGroup, sortQuestGroup)
|
||||
self.mapQuestsGrids = {}
|
||||
self.mapCurPageQuest = {}
|
||||
end
|
||||
function GuideQuestCtrl:OnEnable()
|
||||
end
|
||||
function GuideQuestCtrl:OnDisable()
|
||||
for nInstanceId, objCtrl in pairs(self.mapQuestsGrids) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.mapQuestsGrids[nInstanceId] = nil
|
||||
end
|
||||
self.mapQuestsGrids = {}
|
||||
self.mapCurPageQuest = {}
|
||||
end
|
||||
function GuideQuestCtrl:OnDestroy()
|
||||
end
|
||||
function GuideQuestCtrl:OnBtnClick_ReceiveChapter()
|
||||
local bReceived = PlayerData.Quest:CheckTourGroupReward(self.nCurOrder)
|
||||
if bReceived then
|
||||
return
|
||||
end
|
||||
PlayerData.Quest:ReceiveTourGroupReward()
|
||||
end
|
||||
function GuideQuestCtrl:OnBtnClick_FastReceive()
|
||||
PlayerData.Quest:ReceiveTourReward(0, nil)
|
||||
end
|
||||
function GuideQuestCtrl:OnBtnClick_FastReceiveGray()
|
||||
end
|
||||
function GuideQuestCtrl:OnBtnClick_RewardItem(btn, nIndex)
|
||||
if self.tbChapterReward[nIndex] ~= nil then
|
||||
local nTid = self.tbChapterReward[nIndex].nTid
|
||||
UTILS.ClickItemGridWithTips(nTid, btn.transform, true, true, false)
|
||||
end
|
||||
end
|
||||
function GuideQuestCtrl:OnEvent_SelectTourGuideQuest(nQuestId)
|
||||
for i, v in ipairs(self.mapCurPageQuest) do
|
||||
if v.nTid == nQuestId then
|
||||
self._mapNode.guideQuestLSV:SetScrollGridPos(i - 1, 0, 0)
|
||||
EventManager.Hit("Guide_SelectGuideGroupGrid", nQuestId, i - 1)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
return GuideQuestCtrl
|
||||
@@ -0,0 +1,105 @@
|
||||
local GuideQuestGridCtrl = class("GuideQuestGridCtrl", BaseCtrl)
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
local totalLength = 517
|
||||
local totalHeight = 37
|
||||
GuideQuestGridCtrl._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",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
btnJump = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_JumpTo"
|
||||
},
|
||||
goRewardItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
|
||||
nCount = 2
|
||||
},
|
||||
imgRewardEmpty = {nCount = 2},
|
||||
imgReceived = {},
|
||||
imgCompleteMask = {},
|
||||
btnItem = {
|
||||
sComponentName = "UIButton",
|
||||
nCount = 2,
|
||||
callback = "OnBtnClick_Reward"
|
||||
}
|
||||
}
|
||||
GuideQuestGridCtrl._mapEventConfig = {}
|
||||
function GuideQuestGridCtrl:Refresh(mapGuideQuest)
|
||||
if mapGuideQuest == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local mapGuideQuestCfgData = ConfigTable.GetData("TourGuideQuest", 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.Reward1,
|
||||
mapGuideQuestCfgData.Reward2
|
||||
}
|
||||
for i = 1, 2 do
|
||||
self._mapNode.goRewardItem[i].gameObject:SetActive(mapGuideQuestCfgData["Reward" .. i] ~= 0)
|
||||
self._mapNode.imgRewardEmpty[i].gameObject:SetActive(mapGuideQuestCfgData["Reward" .. i] == 0)
|
||||
if mapGuideQuestCfgData["Reward" .. i] ~= 0 then
|
||||
self._mapNode.goRewardItem[i]:SetItem(mapGuideQuestCfgData["Reward" .. i], nil, mapGuideQuestCfgData["RewardQty" .. 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)
|
||||
end
|
||||
function GuideQuestGridCtrl:ShowItemDetail(id, rtIcon)
|
||||
UTILS.ClickItemGridWithTips(id, rtIcon.transform, true, true, false)
|
||||
end
|
||||
function GuideQuestGridCtrl: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 GuideQuestGridCtrl:OnBtnClick_Receive()
|
||||
PlayerData.Quest:ReceiveTourReward(self.mapGuideQuest.nTid, nil)
|
||||
end
|
||||
function GuideQuestGridCtrl:OnBtnClick_JumpTo()
|
||||
local nJumptoId = self.mapGuideQuestCfgData.JumpTo
|
||||
JumpUtil.JumpTo(nJumptoId)
|
||||
end
|
||||
function GuideQuestGridCtrl:OnBtnClick_Reward(btn, nIdx)
|
||||
if self.tbRewardId[nIdx] ~= 0 then
|
||||
self:ShowItemDetail(self.tbRewardId[nIdx], btn)
|
||||
end
|
||||
end
|
||||
return GuideQuestGridCtrl
|
||||
@@ -0,0 +1,537 @@
|
||||
local QuestCtrl = class("QuestCtrl", BaseCtrl)
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
QuestCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
imgQuestBg = {},
|
||||
role_offset01 = {sComponentName = "Transform"},
|
||||
role_offset02 = {sComponentName = "Transform"},
|
||||
animImgQuestBg = {sNodeName = "imgQuestBg", sComponentName = "Animator"},
|
||||
animActor = {sNodeName = "Actor", sComponentName = "Animator"},
|
||||
animMaskRoot = {sNodeName = "MaskRoot", sComponentName = "Animator"},
|
||||
goWorldClassBg = {},
|
||||
bgChess = {},
|
||||
bgChessUpMask = {},
|
||||
bgLock = {},
|
||||
btnTab = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Tab"
|
||||
},
|
||||
imgLock = {nCount = 4},
|
||||
tabUnlock = {nCount = 4},
|
||||
cvTabLayout = {
|
||||
nCount = 4,
|
||||
sNodeName = "layoutOff",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
imgOn = {nCount = 4},
|
||||
trTabOff = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
trTabOn = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtTabOn = {nCount = 4, sComponentName = "TMP_Text"},
|
||||
txtTabOff = {nCount = 4, sComponentName = "TMP_Text"},
|
||||
rtImgMoveBar = {
|
||||
sNodeName = "imgMoveBar",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
layoutOff = {nCount = 4},
|
||||
redDot = {nCount = 4},
|
||||
rtLevel = {},
|
||||
imgExpBar = {sComponentName = "Image"},
|
||||
txtExp = {sComponentName = "TMP_Text"},
|
||||
txtLevelCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_WorldClass_Level"
|
||||
},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
rtGuideQuest = {
|
||||
sCtrlName = "Game.UI.Quest.GuideQuest.GuideQuestCtrl"
|
||||
},
|
||||
rtDailyQuest = {
|
||||
sCtrlName = "Game.UI.Quest.DailyQuest.DailyQuestCtrl"
|
||||
},
|
||||
rtWorldClass = {
|
||||
sCtrlName = "Game.UI.Quest.WorldClass.QuestWorldClassCtrl"
|
||||
},
|
||||
rtTutorial = {
|
||||
sCtrlName = "Game.UI.Quest.Tutorial.TutorialLevelCtrl"
|
||||
},
|
||||
animWorldClass = {
|
||||
sNodeName = "rtWorldClass",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
goAssistant = {
|
||||
sCtrlName = "Game.UI.Quest.Assistant.AssistantCtrl"
|
||||
},
|
||||
openTabTra = {
|
||||
sNodeName = "btn_openTab",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btn_openTab = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_OpenTab"
|
||||
},
|
||||
closeTabTra = {
|
||||
sNodeName = "btn_closeTab",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btn_closeTab = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CloseTab"
|
||||
}
|
||||
}
|
||||
QuestCtrl._mapEventConfig = {
|
||||
[EventId.UIBackConfirm] = "OnEvent_Back",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_BackHome",
|
||||
[EventId.TourQuestReceived] = "OnEvent_TourQuestReceived",
|
||||
[EventId.TourGroupReceived] = "OnEvent_TourGroupReceived",
|
||||
[EventId.DailyQuestReceived] = "OnEvent_DailyQuestReceived",
|
||||
[EventId.DailyQuestActiveReceived] = "OnEvent_DailyQuestActiveReceived",
|
||||
[EventId.UpdateWorldClass] = "OnEvent_UpdateWorldClass",
|
||||
[EventId.QuestDataRefresh] = "OnEvent_QuestDataRefresh",
|
||||
[EventId.TutorialQuestReceived] = "OnEvent_TutorialQuestReceived",
|
||||
RefreshWorldClassBg = "OnEvent_RefreshWorldClassBg",
|
||||
DemonAdvanceSuccess = "OnEvent_DemonAdvanceSuccess",
|
||||
Guide_SelectQuestPage = "OnEvent_SelectQuestPage"
|
||||
}
|
||||
QuestCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.Task_Guide] = {sNodeName = "redDot", nNodeIndex = 1},
|
||||
[RedDotDefine.WorldClass] = {sNodeName = "redDot", nNodeIndex = 2},
|
||||
[RedDotDefine.Task_Daily] = {sNodeName = "redDot", nNodeIndex = 3},
|
||||
[RedDotDefine.Task_Tutorial] = {sNodeName = "redDot", nNodeIndex = 4}
|
||||
}
|
||||
local MoveBarPos = {}
|
||||
local functionType = {
|
||||
[1] = 0,
|
||||
[2] = 0,
|
||||
[3] = GameEnum.OpenFuncType.DailyQuest,
|
||||
[4] = GameEnum.OpenFuncType.TutorialLevel
|
||||
}
|
||||
local l2dCfg = {
|
||||
[1] = {
|
||||
male = {
|
||||
path = "UI/Quest/L2D_Tour_Male.prefab",
|
||||
anim = {
|
||||
animIn = "tourguide_m_in",
|
||||
animIdle = "tourguide_m_idle"
|
||||
}
|
||||
},
|
||||
female = {
|
||||
path = "UI/Quest/L2D_Tour_Female.prefab",
|
||||
anim = {
|
||||
animIn = "tourguide_f_in",
|
||||
animIdle = "tourguide_f_idle"
|
||||
}
|
||||
}
|
||||
},
|
||||
[2] = {
|
||||
male = {
|
||||
path = "UI/Quest/L2D_Daily_Male.prefab",
|
||||
anim = {
|
||||
animIn = "dailyquest_m_in",
|
||||
animIdle = "dailyquest_m_idle"
|
||||
}
|
||||
},
|
||||
female = {
|
||||
path = "UI/Quest/L2D_Daily_Female.prefab",
|
||||
anim = {
|
||||
animIn = "dailyquest_f_in",
|
||||
animIdle = "dailyquest_f_idle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function QuestCtrl:InitTab()
|
||||
self._mapNode.rtImgMoveBar.localPosition = Vector3(MoveBarPos[self._panel.nCurTab], 4.5, 0)
|
||||
for i = 1, 4 do
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTabOn[i], ConfigTable.GetUIText("QuestPanel_Tab_" .. i))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTabOff[i], ConfigTable.GetUIText("QuestPanel_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 QuestCtrl:InitTabButton()
|
||||
self._mapNode.btn_openTab.gameObject:SetActive(false)
|
||||
self._mapNode.btn_closeTab.gameObject:SetActive(false)
|
||||
local nTotalCount, nReceivedCount = PlayerData.TutorialData:GetProgress()
|
||||
if nReceivedCount < nTotalCount then
|
||||
return
|
||||
end
|
||||
self._mapNode.btn_openTab.gameObject:SetActive(not self.bOpenTab)
|
||||
self._mapNode.btn_closeTab.gameObject:SetActive(self.bOpenTab)
|
||||
local tab4_off = self._mapNode.trTabOn:Find("tab4")
|
||||
local tab4_on = self._mapNode.trTabOff:Find("tab4")
|
||||
tab4_off.gameObject:SetActive(self.bOpenTab)
|
||||
tab4_on.gameObject:SetActive(self.bOpenTab)
|
||||
local wait = function()
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.trTabOff)
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.trTabOn)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local x = self._mapNode.trTabOn.localPosition.x + self._mapNode.trTabOn.sizeDelta.x / 2 + 80
|
||||
self._mapNode.openTabTra:DOLocalMoveX(x, 0.1):SetUpdate(true)
|
||||
self._mapNode.closeTabTra:DOLocalMoveX(x, 0.1):SetUpdate(true)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function QuestCtrl:InitMoveBarPos()
|
||||
MoveBarPos = {}
|
||||
for i = 1, 4 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 QuestCtrl:RefreshTabUnlock()
|
||||
for i = 1, 4 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 QuestCtrl:LoadL2d()
|
||||
if not self.bLoadL2d then
|
||||
self.bIsMale = PlayerData.Base:GetPlayerSex() == true
|
||||
self.tbL2DAnim = {}
|
||||
if self.bIsMale then
|
||||
self.role01 = self:CreatePrefabInstance(l2dCfg[1].male.path, self._mapNode.role_offset01)
|
||||
self.role02 = self:CreatePrefabInstance(l2dCfg[2].male.path, self._mapNode.role_offset02)
|
||||
self.tbL2DAnim[1] = l2dCfg[1].male.anim
|
||||
self.tbL2DAnim[2] = l2dCfg[2].male.anim
|
||||
else
|
||||
self.role01 = self:CreatePrefabInstance(l2dCfg[1].female.path, self._mapNode.role_offset01)
|
||||
self.role02 = self:CreatePrefabInstance(l2dCfg[2].female.path, self._mapNode.role_offset02)
|
||||
self.tbL2DAnim[1] = l2dCfg[1].female.anim
|
||||
self.tbL2DAnim[2] = l2dCfg[2].female.anim
|
||||
end
|
||||
if self.role01 and self.role02 then
|
||||
self.roleModle01 = self.role01.transform:Find("root/----live2d_modle----").transform:GetChild(0)
|
||||
self.roleModle02 = self.role02.transform:Find("root/----live2d_modle----").transform:GetChild(0)
|
||||
end
|
||||
end
|
||||
self.bLoadL2d = true
|
||||
end
|
||||
function QuestCtrl:RefreshWorldClass()
|
||||
local nWorldClass = PlayerData.Base:GetWorldClass()
|
||||
local nCurExp = PlayerData.Base:GetWorldExp()
|
||||
local mapCfg = ConfigTable.GetData("WorldClass", nWorldClass + 1, true)
|
||||
local nFullExp = 0
|
||||
if mapCfg then
|
||||
nFullExp = mapCfg.Exp
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, nWorldClass)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtExp, string.format("%d/%d", nCurExp, nFullExp))
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgExpBar, nCurExp / nFullExp)
|
||||
local tbWorldClass = CacheTable.Get("_DemonAdvance")
|
||||
local mapData = tbWorldClass[#tbWorldClass]
|
||||
local bMax = mapData.nMaxLevel == nWorldClass
|
||||
self._mapNode.txtExp.gameObject:SetActive(not bMax)
|
||||
end
|
||||
function QuestCtrl:RefreshContent()
|
||||
self._mapNode.rtGuideQuest.gameObject:SetActive(self._panel.nCurTab == AllEnum.QuestPanelTab.GuideQuest)
|
||||
self._mapNode.rtDailyQuest.gameObject:SetActive(self._panel.nCurTab == AllEnum.QuestPanelTab.DailyQuest)
|
||||
self._mapNode.rtWorldClass.gameObject:SetActive(self._panel.nCurTab == AllEnum.QuestPanelTab.WorldClass)
|
||||
self._mapNode.rtTutorial.gameObject:SetActive(self._panel.nCurTab == AllEnum.QuestPanelTab.Tutorial)
|
||||
self._mapNode.goWorldClassBg.gameObject:SetActive(self._panel.nCurTab == AllEnum.QuestPanelTab.WorldClass or self._panel.nCurTab == AllEnum.QuestPanelTab.Tutorial)
|
||||
self._mapNode.rtLevel.gameObject:SetActive(self._panel.nCurTab ~= AllEnum.QuestPanelTab.WorldClass and self._panel.nCurTab ~= AllEnum.QuestPanelTab.Tutorial)
|
||||
self._mapNode.goAssistant.gameObject:SetActive(self._panel.nCurTab ~= AllEnum.QuestPanelTab.WorldClass and self._panel.nCurTab ~= AllEnum.QuestPanelTab.Tutorial)
|
||||
self.role01.gameObject:SetActive(self._panel.nCurTab == AllEnum.QuestPanelTab.GuideQuest)
|
||||
self.role02.gameObject:SetActive(self._panel.nCurTab == AllEnum.QuestPanelTab.DailyQuest)
|
||||
if self._panel.nCurTab == AllEnum.QuestPanelTab.GuideQuest then
|
||||
self._mapNode.rtGuideQuest:Refresh(self.mapGuideQuest, self.nCurGuideGroup)
|
||||
if self.nLastTab == AllEnum.QuestPanelTab.WorldClass then
|
||||
self.animRoot:Play("QuestPanel_switch2", 0, 0)
|
||||
end
|
||||
self._mapNode.animImgQuestBg:Play("imgQuestBg_in", 0, 0)
|
||||
self._mapNode.animActor:Play("Actor_in", 0, 0)
|
||||
self._mapNode.animMaskRoot:Play("MaskRoot_in", 0, 0)
|
||||
Actor2DManager.PlayL2DAnim(self.roleModle01.transform, self.tbL2DAnim[1].animIn, false, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
|
||||
elseif self._panel.nCurTab == AllEnum.QuestPanelTab.DailyQuest then
|
||||
self._mapNode.rtDailyQuest:Refresh(self.tbDailyQuest)
|
||||
if self.nLastTab == AllEnum.QuestPanelTab.WorldClass then
|
||||
self.animRoot:Play("QuestPanel_switch2", 0, 0)
|
||||
end
|
||||
self._mapNode.animImgQuestBg:Play("imgQuestBg_in", 0, 0)
|
||||
self._mapNode.animActor:Play("Actor_in", 0, 0)
|
||||
self._mapNode.animMaskRoot:Play("MaskRoot_in", 0, 0)
|
||||
Actor2DManager.PlayL2DAnim(self.roleModle02.transform, self.tbL2DAnim[2].animIn, false, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
|
||||
elseif self._panel.nCurTab == AllEnum.QuestPanelTab.WorldClass then
|
||||
local curType = self._mapNode.rtWorldClass:Refresh() or 0
|
||||
if self.nLastTab == AllEnum.QuestPanelTab.Tutorial then
|
||||
self._mapNode.goWorldClassBg.gameObject:SetActive(false)
|
||||
self._mapNode.goWorldClassBg.gameObject:SetActive(true)
|
||||
end
|
||||
local sAnimName = curType == AllEnum.WorldClassType.Advance and "rtWorldClass_switch1" or "rtWorldClass_in"
|
||||
self._mapNode.animWorldClass:Play(sAnimName, 0, 0)
|
||||
local nAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"QuestPanel_switch1"
|
||||
})
|
||||
self.animRoot:Play("QuestPanel_switch1", 0, 0)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLen)
|
||||
elseif self._panel.nCurTab == AllEnum.QuestPanelTab.Tutorial then
|
||||
if self.nLastTab == AllEnum.QuestPanelTab.WorldClass then
|
||||
self._mapNode.goWorldClassBg.gameObject:SetActive(false)
|
||||
self._mapNode.goWorldClassBg.gameObject:SetActive(true)
|
||||
end
|
||||
self._mapNode.rtTutorial:Refresh()
|
||||
PlayerData.TutorialData:RefreshRedDot(false)
|
||||
end
|
||||
self.nLastTab = self._panel.nCurTab
|
||||
end
|
||||
function QuestCtrl:RefreshQuestList()
|
||||
local tbDaily, mapGuide = PlayerData.Quest:GetAllQuestData()
|
||||
self.mapGuideQuest = {}
|
||||
self.tbDailyQuest = tbDaily
|
||||
local curGuideGroup = PlayerData.Quest:GetCurTourGroup()
|
||||
if curGuideGroup == 0 then
|
||||
print("无当前任务组 手册任务可能已全部完成")
|
||||
end
|
||||
self.nCurGuideGroup = curGuideGroup
|
||||
for _, v in pairs(mapGuide) do
|
||||
local mapCfg = ConfigTable.GetData("TourGuideQuest", v.nTid)
|
||||
if mapCfg ~= nil and mapCfg.Order == curGuideGroup then
|
||||
table.insert(self.mapGuideQuest, v)
|
||||
end
|
||||
end
|
||||
if self._panel.nCurTab == AllEnum.QuestPanelTab.GuideQuest then
|
||||
self._mapNode.rtGuideQuest:Refresh(self.mapGuideQuest, curGuideGroup)
|
||||
elseif self._panel.nCurTab == AllEnum.QuestPanelTab.DailyQuest then
|
||||
self._mapNode.rtDailyQuest:Refresh(self.tbDailyQuest)
|
||||
end
|
||||
end
|
||||
function QuestCtrl:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function QuestCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function QuestCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
local nJumpTab = 0
|
||||
if nil ~= next(tbParam) then
|
||||
nJumpTab = tbParam[1]
|
||||
end
|
||||
local tbDaily, mapGuide = PlayerData.Quest:GetAllQuestData()
|
||||
self.tbDailyQuest = tbDaily
|
||||
self.mapGuideQuest = {}
|
||||
local curGuideGroup = PlayerData.Quest:GetCurTourGroup()
|
||||
if curGuideGroup == 0 then
|
||||
print("无当前任务组 手册任务可能已全部完成")
|
||||
end
|
||||
self.nCurGuideGroup = curGuideGroup
|
||||
local nMaxGuideGroup = PlayerData.Quest:GetMaxTourGroup()
|
||||
if mapGuide ~= nil then
|
||||
for _, v in pairs(mapGuide) do
|
||||
local mapCfg = ConfigTable.GetData("TourGuideQuest", v.nTid)
|
||||
if mapCfg ~= nil and mapCfg.Order == curGuideGroup then
|
||||
table.insert(self.mapGuideQuest, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
local bAllGuideReward = false
|
||||
if self.nCurGuideGroup == nMaxGuideGroup then
|
||||
bAllGuideReward = true
|
||||
for _, v in ipairs(self.mapGuideQuest) do
|
||||
if v.nStatus ~= 2 then
|
||||
bAllGuideReward = false
|
||||
break
|
||||
end
|
||||
end
|
||||
local mapGroupCfg = ConfigTable.GetData("TourGuideQuestGroup", nMaxGuideGroup)
|
||||
if mapGroupCfg ~= nil then
|
||||
local bGroupReward = PlayerData.Quest:CheckTourGroupReward(mapGroupCfg.Order)
|
||||
bAllGuideReward = bAllGuideReward and bGroupReward
|
||||
end
|
||||
end
|
||||
if self._panel.nCurTab == nil then
|
||||
if PlayerData.Base:CheckFunctionUnlock(GameEnum.OpenFuncType.DailyQuest) then
|
||||
self._panel.nCurTab = AllEnum.QuestPanelTab.DailyQuest
|
||||
else
|
||||
self._panel.nCurTab = AllEnum.QuestPanelTab.GuideQuest
|
||||
end
|
||||
end
|
||||
self.nLastTab = 0
|
||||
if nJumpTab ~= 0 then
|
||||
self._panel.nCurTab = nJumpTab
|
||||
end
|
||||
local sAnimName = ""
|
||||
if self._panel.nCurTab == AllEnum.QuestPanelTab.GuideQuest or self._panel.nCurTab == AllEnum.QuestPanelTab.DailyQuest then
|
||||
sAnimName = "QuestPanel_in1"
|
||||
else
|
||||
sAnimName = "QuestPanel_in2"
|
||||
end
|
||||
local nAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {sAnimName})
|
||||
self.animRoot:Play(sAnimName, 0, 0)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLen)
|
||||
self:LoadL2d()
|
||||
self:InitTabButton()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self:InitMoveBarPos()
|
||||
self:InitTab()
|
||||
self:RefreshTabUnlock()
|
||||
self:RefreshWorldClass()
|
||||
self:RefreshContent()
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function QuestCtrl:OnDisable()
|
||||
local sPath1 = self.bIsMale and l2dCfg[1].male.path or l2dCfg[1].female.path
|
||||
local sPath2 = self.bIsMale and l2dCfg[2].male.path or l2dCfg[2].female.path
|
||||
self:DestroyPrefabInstance(sPath1)
|
||||
self:DestroyPrefabInstance(sPath2)
|
||||
self.bLoadL2d = false
|
||||
end
|
||||
function QuestCtrl:OnDestroy()
|
||||
end
|
||||
function QuestCtrl: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 QuestCtrl:OnBtnClick_OpenTab()
|
||||
self.bOpenTab = true
|
||||
self:InitTabButton()
|
||||
self:InitMoveBarPos()
|
||||
self._mapNode.rtImgMoveBar.localPosition = Vector3(MoveBarPos[1], self._mapNode.rtImgMoveBar.localPosition.y, 0)
|
||||
self:OnBtnClick_Tab(_, 1)
|
||||
end
|
||||
function QuestCtrl:OnBtnClick_CloseTab()
|
||||
self.bOpenTab = false
|
||||
self:InitTabButton()
|
||||
self:InitMoveBarPos()
|
||||
self._mapNode.rtImgMoveBar.localPosition = Vector3(MoveBarPos[1], self._mapNode.rtImgMoveBar.localPosition.y, 0)
|
||||
self:OnBtnClick_Tab(_, 1)
|
||||
end
|
||||
function QuestCtrl:OnEvent_Back(nPanelId)
|
||||
if self._panel._nPanelId ~= nPanelId then
|
||||
return
|
||||
end
|
||||
self._panel._tbParam[1] = nil
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
end
|
||||
function QuestCtrl:OnEvent_BackHome(nPanelId)
|
||||
if self._panel._nPanelId ~= nPanelId then
|
||||
return
|
||||
end
|
||||
self._panel._tbParam[1] = nil
|
||||
PanelManager.Home()
|
||||
end
|
||||
function QuestCtrl:OnEvent_TourQuestReceived(mapRewardInfo, mapChangeInfo)
|
||||
local refreshFunc = function()
|
||||
self:RefreshQuestList()
|
||||
end
|
||||
local openWorldClassTip = function()
|
||||
local bOpenUpgrade = PlayerData.Base:TryOpenWorldClassUpgrade(refreshFunc)
|
||||
if not bOpenUpgrade then
|
||||
refreshFunc()
|
||||
end
|
||||
EventManager.Hit("Guide_CloseGuideQuestReward")
|
||||
end
|
||||
local mapTrans = PlayerData.Item:ProcessTransChangeInfo(mapChangeInfo)
|
||||
local tbQuestReward, tbQuestSpReward = PlayerData.Item:ProcessRewardDisplayItem(mapRewardInfo, mapTrans)
|
||||
local mapQuestReward = {tbReward = tbQuestReward, tbSpReward = tbQuestSpReward}
|
||||
UTILS.OpenReceiveByReward(mapQuestReward, openWorldClassTip)
|
||||
end
|
||||
function QuestCtrl:OnEvent_TourGroupReceived(mapRewardInfo, mapChangeInfo)
|
||||
local refreshFunc = function()
|
||||
self:RefreshQuestList()
|
||||
end
|
||||
local openWorldClassTip = function()
|
||||
local bOpenUpgrade = PlayerData.Base:TryOpenWorldClassUpgrade(refreshFunc)
|
||||
if not bOpenUpgrade then
|
||||
refreshFunc()
|
||||
end
|
||||
end
|
||||
local mapTrans = PlayerData.Item:ProcessTransChangeInfo(mapChangeInfo)
|
||||
local tbQuestReward, tbQuestSpReward = PlayerData.Item:ProcessRewardDisplayItem(mapRewardInfo, mapTrans)
|
||||
local mapQuestReward = {tbReward = tbQuestReward, tbSpReward = tbQuestSpReward}
|
||||
UTILS.OpenReceiveByReward(mapQuestReward, openWorldClassTip)
|
||||
end
|
||||
function QuestCtrl:OnEvent_DailyQuestReceived(mapChangeInfo)
|
||||
local refreshFunc = function()
|
||||
self:RefreshQuestList()
|
||||
end
|
||||
local tipCallback = function()
|
||||
local bOpen = PlayerData.Base:TryOpenWorldClassUpgrade(refreshFunc)
|
||||
if not bOpen then
|
||||
refreshFunc()
|
||||
end
|
||||
end
|
||||
UTILS.OpenReceiveByChangeInfo(mapChangeInfo, tipCallback)
|
||||
end
|
||||
function QuestCtrl:OnEvent_DailyQuestActiveReceived(tbReward)
|
||||
local refreshFunc = function()
|
||||
self:RefreshQuestList()
|
||||
end
|
||||
local tipCallback = function()
|
||||
local bOpen = PlayerData.Base:TryOpenWorldClassUpgrade(refreshFunc)
|
||||
if not bOpen then
|
||||
refreshFunc()
|
||||
end
|
||||
end
|
||||
local mapReward = {tbReward = tbReward}
|
||||
UTILS.OpenReceiveByReward(mapReward, tipCallback)
|
||||
end
|
||||
function QuestCtrl:OnEvent_UpdateWorldClass()
|
||||
self:RefreshWorldClass()
|
||||
self:RefreshTabUnlock()
|
||||
end
|
||||
function QuestCtrl:OnEvent_QuestDataRefresh(questType)
|
||||
if questType == "TourGuide" or questType == "Daily" then
|
||||
self:RefreshQuestList()
|
||||
end
|
||||
end
|
||||
function QuestCtrl:OnEvent_RefreshWorldClassBg(bLevelUp)
|
||||
self._mapNode.bgChess.gameObject:SetActive(bLevelUp)
|
||||
self._mapNode.bgChessUpMask.gameObject:SetActive(bLevelUp)
|
||||
self._mapNode.bgLock.gameObject:SetActive(not bLevelUp)
|
||||
end
|
||||
function QuestCtrl:OnEvent_DemonAdvanceSuccess()
|
||||
self._mapNode.goWorldClassBg.gameObject:SetActive(false)
|
||||
self._mapNode.goWorldClassBg.gameObject:SetActive(true)
|
||||
self._mapNode.animWorldClass:Play("rtWorldClass_switch2", 0, 0)
|
||||
end
|
||||
function QuestCtrl:OnEvent_SelectQuestPage(nIndex)
|
||||
self:OnBtnClick_Tab(nil, nIndex)
|
||||
end
|
||||
function QuestCtrl:OnEvent_TutorialQuestReceived(msgData)
|
||||
local refreshFunc = function()
|
||||
self._mapNode.rtTutorial:Refresh()
|
||||
end
|
||||
UTILS.OpenReceiveByChangeInfo(msgData, refreshFunc)
|
||||
end
|
||||
return QuestCtrl
|
||||
@@ -0,0 +1,19 @@
|
||||
local QuestPanel = class("QuestPanel", BasePanel)
|
||||
QuestPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Quest/QuestPanel.prefab",
|
||||
sCtrlName = "Game.UI.Quest.QuestCtrl"
|
||||
}
|
||||
}
|
||||
function QuestPanel:Awake()
|
||||
self.nCurTab = nil
|
||||
end
|
||||
function QuestPanel:OnEnable()
|
||||
end
|
||||
function QuestPanel:OnDisable()
|
||||
end
|
||||
function QuestPanel:OnDestroy()
|
||||
end
|
||||
function QuestPanel:OnRelease()
|
||||
end
|
||||
return QuestPanel
|
||||
@@ -0,0 +1,162 @@
|
||||
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 = "QuestPanel_Tab_4"
|
||||
},
|
||||
txt_progress = {sComponentName = "TMP_Text"},
|
||||
bg_title_com = {},
|
||||
txt_title_com = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Tutorial_Finish"
|
||||
},
|
||||
Lsv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
}
|
||||
}
|
||||
TutorialLevelCtrl._mapEventConfig = {Tutorial_Refesh = "Refresh"}
|
||||
TutorialLevelCtrl._mapRedDotConfig = {}
|
||||
function TutorialLevelCtrl:Awake()
|
||||
self.itemCtrl = {}
|
||||
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: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
|
||||
return TutorialLevelCtrl
|
||||
@@ -0,0 +1,347 @@
|
||||
local QuestWorldClassCtrl = class("QuestWorldClassCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
QuestWorldClassCtrl._mapNodeConfig = {
|
||||
rtLevel = {},
|
||||
bgLevelUp = {},
|
||||
bgAdvance = {},
|
||||
txtTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_Advance_Tip"
|
||||
},
|
||||
txtLevel = {sComponentName = "TMP_Text", nCount = 2},
|
||||
txtLevelCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
nCount = 2,
|
||||
sLanguageId = "WorldClass_Level_Title"
|
||||
},
|
||||
imgExpBar = {sComponentName = "Image"},
|
||||
txtExp = {sComponentName = "TMP_Text"},
|
||||
goAssistant = {
|
||||
sCtrlName = "Game.UI.Quest.Assistant.AssistantCtrl"
|
||||
},
|
||||
txtAssistant = {sComponentName = "TMP_Text"},
|
||||
imgHeadBg = {sComponentName = "Image"},
|
||||
rtWorldClassList = {},
|
||||
animWorldClassList = {
|
||||
sNodeName = "rtWorldClassList",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
worldClassLsv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
rtWorldClassLsv = {
|
||||
sNodeName = "worldClassLsv",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgAllReceive = {},
|
||||
txtAllReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_AllReceive_Tip"
|
||||
},
|
||||
rtLevelInfo = {},
|
||||
btnLevelItem = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_LevelItem"
|
||||
},
|
||||
goLevelItem = {
|
||||
sCtrlName = "Game.UI.Quest.WorldClass.WorldClassItemCtrl"
|
||||
},
|
||||
rtLevelLsv = {},
|
||||
levelLsv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
rtQuestLsv = {},
|
||||
questLsv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtContentSize = {sComponentName = "TMP_Text"},
|
||||
rectContentSize = {
|
||||
sNodeName = "txtContentSize",
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
QuestWorldClassCtrl._mapEventConfig = {
|
||||
ReceiveWorldClassLevelReward = "OnEvent_ReceiveWorldClassLevelReward",
|
||||
[EventId.UpdateWorldClass] = "OnEvent_UpdateWorldClass",
|
||||
DemonAdvanceSuccess = "OnEvent_DemonAdvanceSuccess",
|
||||
Guide_DisableScrollView = "OnEvent_DisableScrollView"
|
||||
}
|
||||
QuestWorldClassCtrl._mapRedDotConfig = {}
|
||||
local levelInfoGridHeight = {
|
||||
FuncOpen = 59.13,
|
||||
FuncChange = 20,
|
||||
LevelReward = 165,
|
||||
InfoTopBottom = 14,
|
||||
InfoSpacing = 6
|
||||
}
|
||||
local worldClassLsvPosY_1 = 118
|
||||
local worldClassLsvPosY_2 = 65
|
||||
function QuestWorldClassCtrl:Refresh()
|
||||
self.nCurWorldClass = PlayerData.Base:GetWorldClass()
|
||||
self:RefreshDemonList()
|
||||
self._mapNode.animWorldClassList:Play("rtGuideQuest_in", 0, 0)
|
||||
local curType = self:RefreshWorldClass()
|
||||
local mapData = self.tbWorldClass[#self.tbWorldClass]
|
||||
local bMax = mapData.nMaxLevel == self.nCurWorldClass
|
||||
self:RefreshLevelInfo(self.nCurIndex)
|
||||
return curType
|
||||
end
|
||||
function QuestWorldClassCtrl:RefreshWorldClass()
|
||||
local nCurExp = PlayerData.Base:GetWorldExp()
|
||||
local mapCfg = ConfigTable.GetData("WorldClass", self.nCurWorldClass + 1, true)
|
||||
local nFullExp = 0
|
||||
if mapCfg then
|
||||
nFullExp = mapCfg.Exp
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel[1], self.nCurWorldClass)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel[2], self.nCurWorldClass)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtExp, string.format("%d/%d", nCurExp, nFullExp))
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgExpBar, nCurExp / nFullExp)
|
||||
local curData = self.tbWorldClass[self.nCurIndex]
|
||||
if curData ~= nil then
|
||||
self._mapNode.bgLevelUp.gameObject:SetActive(curData.nType == AllEnum.WorldClassType.LevelUp)
|
||||
self._mapNode.bgAdvance.gameObject:SetActive(curData.nType == AllEnum.WorldClassType.Advance)
|
||||
EventManager.Hit("RefreshWorldClassBg", curData.nType == AllEnum.WorldClassType.LevelUp)
|
||||
return curData.nType
|
||||
end
|
||||
end
|
||||
function QuestWorldClassCtrl:RefreshDemonList()
|
||||
self.bFold = true
|
||||
self._mapNode.rtLevelInfo.gameObject:SetActive(false)
|
||||
self._mapNode.rtWorldClassList.gameObject:SetActive(true)
|
||||
self.nCurIndex = 0
|
||||
self.nRewardIndex = 0
|
||||
self.nCurIndex = PlayerData.Base:GetCurWorldClassStageIndex()
|
||||
for nIdx, v in ipairs(self.tbWorldClass) do
|
||||
if v.nType == AllEnum.WorldClassType.LevelUp and RedDotManager.GetValid(RedDotDefine.WorldClass_LevelUp, v.nId) and self.nRewardIndex == 0 then
|
||||
self.nRewardIndex = nIdx
|
||||
end
|
||||
end
|
||||
for nInstanceId, v in pairs(self.tbGridWorldClass) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
self.tbGridWorldClass[nInstanceId] = nil
|
||||
end
|
||||
self._mapNode.worldClassLsv:Init(#self.tbWorldClass, self, self.OnWorldClassGridRefresh, self.OnWorldClassGridClick, true)
|
||||
local mapData = self.tbWorldClass[#self.tbWorldClass]
|
||||
local bMax = mapData.nMaxLevel == self.nCurWorldClass
|
||||
self._mapNode.imgAllReceive.gameObject:SetActive(bMax)
|
||||
self._mapNode.txtExp.gameObject:SetActive(not bMax)
|
||||
local posX = self._mapNode.rtWorldClassLsv.anchoredPosition.x
|
||||
local posY = bMax and worldClassLsvPosY_1 or worldClassLsvPosY_2
|
||||
self._mapNode.rtWorldClassLsv.anchoredPosition = Vector2(posX, posY)
|
||||
end
|
||||
function QuestWorldClassCtrl:OnWorldClassGridRefresh(goGrid, nGridIndex)
|
||||
local nIndex = nGridIndex + 1
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
if nil == self.tbGridWorldClass[nInstanceId] then
|
||||
self.tbGridWorldClass[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Quest.WorldClass.WorldClassItemCtrl")
|
||||
end
|
||||
local data = self.tbWorldClass[nIndex]
|
||||
if data ~= nil then
|
||||
self.tbGridWorldClass[nInstanceId]:SetItem(data)
|
||||
end
|
||||
end
|
||||
function QuestWorldClassCtrl:OnWorldClassGridClick(goGrid, nGridIndex)
|
||||
local nIndex = nGridIndex + 1
|
||||
self.nCurSelectIndex = nIndex
|
||||
self:RefreshLevelInfo(nIndex)
|
||||
end
|
||||
function QuestWorldClassCtrl:RefreshLevelInfo(nIndex)
|
||||
self.bFold = false
|
||||
self._mapNode.rtLevelInfo.gameObject:SetActive(true)
|
||||
self._mapNode.rtWorldClassList.gameObject:SetActive(false)
|
||||
local data = self.tbWorldClass[nIndex]
|
||||
if data ~= nil then
|
||||
self._mapNode.goLevelItem:SetItem(data)
|
||||
if data.nType == AllEnum.WorldClassType.LevelUp then
|
||||
self._mapNode.rtLevelLsv.gameObject:SetActive(true)
|
||||
self._mapNode.rtQuestLsv.gameObject:SetActive(false)
|
||||
self:RefreshLevelUpInfo(data)
|
||||
elseif data.nType == AllEnum.WorldClassType.Advance then
|
||||
self._mapNode.rtLevelLsv.gameObject:SetActive(false)
|
||||
self._mapNode.rtQuestLsv.gameObject:SetActive(true)
|
||||
self:RefreshAdvanceInfo(data.nId)
|
||||
end
|
||||
end
|
||||
end
|
||||
function QuestWorldClassCtrl:CalRecordInfoGridSize(sContent)
|
||||
if sContent == nil or sContent == "" then
|
||||
return 0
|
||||
end
|
||||
self._mapNode.txtContentSize.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtContentSize, sContent)
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rectContentSize)
|
||||
return self._mapNode.rectContentSize.rect.height
|
||||
end
|
||||
function QuestWorldClassCtrl:RefreshLevelUpInfo(data)
|
||||
local nMinLevel = data.nMinLevel
|
||||
local nMaxLevel = data.nMaxLevel
|
||||
self.tbLevelInfo = {}
|
||||
self.tbLevelGridHeight = {}
|
||||
local nIndex = 0
|
||||
for i = nMinLevel, nMaxLevel do
|
||||
if i == self.nCurWorldClass then
|
||||
nIndex = i - nMinLevel + 1
|
||||
end
|
||||
table.insert(self.tbLevelInfo, i)
|
||||
local nHeight = levelInfoGridHeight.LevelReward
|
||||
local worldClassCfg = ConfigTable.GetData("WorldClass", i)
|
||||
if worldClassCfg ~= nil then
|
||||
local nCount = 0
|
||||
if 0 < #worldClassCfg.OpenFunc then
|
||||
for _, v in ipairs(worldClassCfg.OpenFunc) do
|
||||
local openFuncCfg = ConfigTable.GetData("OpenFunc", v)
|
||||
if openFuncCfg ~= nil then
|
||||
nCount = nCount + 1
|
||||
nHeight = nHeight + levelInfoGridHeight.FuncOpen + self:CalRecordInfoGridSize(openFuncCfg.Desc)
|
||||
end
|
||||
end
|
||||
end
|
||||
for i = 1, 3 do
|
||||
if worldClassCfg["FuncChangeText" .. i] ~= "" then
|
||||
nCount = nCount + 1
|
||||
nHeight = nHeight + levelInfoGridHeight.FuncChange + self:CalRecordInfoGridSize(worldClassCfg["FuncChangeText" .. i])
|
||||
end
|
||||
end
|
||||
if 0 < nCount then
|
||||
nHeight = nHeight + (nCount - 1) * levelInfoGridHeight.InfoSpacing + levelInfoGridHeight.InfoTopBottom
|
||||
end
|
||||
end
|
||||
table.insert(self.tbLevelGridHeight, nHeight)
|
||||
end
|
||||
for nInstanceId, v in pairs(self.tbGridLevel) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
self.tbGridLevel[nInstanceId] = nil
|
||||
end
|
||||
self._mapNode.levelLsv:InitEx(self.tbLevelGridHeight, self, self.OnLevelGridRefresh)
|
||||
if 1 < nIndex then
|
||||
self:AddTimer(1, 0.1, function()
|
||||
if PlayerData.Guide:CheckInGuideGroup(9) then
|
||||
nIndex = 2
|
||||
end
|
||||
self._mapNode.levelLsv:SetScrollGridPosEx(self.tbLevelGridHeight, nIndex, 0.2)
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
function QuestWorldClassCtrl:OnLevelGridRefresh(goGrid, nGridIndex)
|
||||
local nIndex = nGridIndex + 1
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
if nil == self.tbGridLevel[nInstanceId] then
|
||||
self.tbGridLevel[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Quest.WorldClass.WorldClassLevelItemCtrl")
|
||||
end
|
||||
local nLevel = self.tbLevelInfo[nIndex]
|
||||
if nLevel ~= nil then
|
||||
local data = self.tbWorldClass[self.nCurSelectIndex]
|
||||
local bUnOpen = false
|
||||
if data ~= nil then
|
||||
bUnOpen = self.nCurWorldClass < data.nMinLevel
|
||||
end
|
||||
self.tbGridLevel[nInstanceId]:SetItem(nLevel, bUnOpen)
|
||||
end
|
||||
end
|
||||
function QuestWorldClassCtrl:RefreshAdvanceInfo(nId)
|
||||
local mapCfg = ConfigTable.GetData("DemonAdvance", nId)
|
||||
if mapCfg ~= nil then
|
||||
local nQuestGroupId = mapCfg.AdvanceQuestGroup
|
||||
self.tbQuestList = PlayerData.Quest:GetDemonQuestData(nQuestGroupId, nId)
|
||||
for nInstanceId, v in pairs(self.tbGridQuest) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
self.tbGridQuest[nInstanceId] = nil
|
||||
end
|
||||
self._mapNode.questLsv:Init(#self.tbQuestList, self, self.OnQuestGridRefresh)
|
||||
end
|
||||
end
|
||||
function QuestWorldClassCtrl:OnQuestGridRefresh(goGrid, nGridIndex)
|
||||
local nIndex = nGridIndex + 1
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
if nil == self.tbGridQuest[nInstanceId] then
|
||||
self.tbGridQuest[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Quest.WorldClass.WorldClassQuestItemCtrl")
|
||||
end
|
||||
local data = self.tbQuestList[nIndex]
|
||||
if data ~= nil then
|
||||
local itemData = self.tbWorldClass[self.nCurSelectIndex]
|
||||
local bUnOpen = false
|
||||
if itemData ~= nil then
|
||||
bUnOpen = self.nCurWorldClass < itemData.nMinLevel
|
||||
end
|
||||
self.tbGridQuest[nInstanceId]:SetItem(data, bUnOpen)
|
||||
end
|
||||
end
|
||||
function QuestWorldClassCtrl:FoldList()
|
||||
self.bFold = true
|
||||
self._mapNode.rtLevelInfo.gameObject:SetActive(false)
|
||||
self._mapNode.rtWorldClassList.gameObject:SetActive(true)
|
||||
end
|
||||
function QuestWorldClassCtrl:Awake()
|
||||
self.bFold = true
|
||||
self.tbGridWorldClass = {}
|
||||
self.tbGridQuest = {}
|
||||
self.tbGridLevel = {}
|
||||
self.tbLevelGridHeight = {}
|
||||
self.nCurIndex = 0
|
||||
self.nCurSelectIndex = 0
|
||||
self.tbWorldClass = CacheTable.Get("_DemonAdvance")
|
||||
end
|
||||
function QuestWorldClassCtrl:FadeIn()
|
||||
end
|
||||
function QuestWorldClassCtrl:FadeOut()
|
||||
end
|
||||
function QuestWorldClassCtrl:OnEnable()
|
||||
end
|
||||
function QuestWorldClassCtrl:OnDisable()
|
||||
for _, v in pairs(self.tbGridWorldClass) do
|
||||
local obj = v.gameObject
|
||||
self:UnbindCtrlByNode(v)
|
||||
destroy(obj)
|
||||
end
|
||||
self.tbGridWorldClass = {}
|
||||
for _, v in pairs(self.tbGridLevel) do
|
||||
local obj = v.gameObject
|
||||
self:UnbindCtrlByNode(v)
|
||||
destroy(obj)
|
||||
end
|
||||
self.tbGridLevel = {}
|
||||
for _, v in pairs(self.tbGridQuest) do
|
||||
local obj = v.gameObject
|
||||
self:UnbindCtrlByNode(v)
|
||||
destroy(obj)
|
||||
end
|
||||
self.tbGridQuest = {}
|
||||
end
|
||||
function QuestWorldClassCtrl:OnDestroy()
|
||||
end
|
||||
function QuestWorldClassCtrl:OnRelease()
|
||||
end
|
||||
function QuestWorldClassCtrl:OnBtnClick_LevelItem()
|
||||
end
|
||||
function QuestWorldClassCtrl:OnEvent_ReceiveWorldClassLevelReward()
|
||||
if not self.bFold then
|
||||
self._mapNode.levelLsv:InitEx(self.tbLevelGridHeight, self, self.OnLevelGridRefresh, nil, true)
|
||||
end
|
||||
end
|
||||
function QuestWorldClassCtrl:OnEvent_UpdateWorldClass()
|
||||
self.nCurWorldClass = PlayerData.Base:GetWorldClass()
|
||||
self:RefreshDemonList()
|
||||
self:RefreshWorldClass()
|
||||
if not self.bFold then
|
||||
self:RefreshLevelInfo(self.nCurIndex)
|
||||
end
|
||||
end
|
||||
function QuestWorldClassCtrl:OnEvent_DemonAdvanceSuccess()
|
||||
self.nCurWorldClass = PlayerData.Base:GetWorldClass()
|
||||
self.nCurIndex = PlayerData.Base:GetCurWorldClassStageIndex()
|
||||
if self.bFold then
|
||||
self:RefreshDemonList()
|
||||
else
|
||||
self:RefreshLevelInfo(self.nCurIndex)
|
||||
end
|
||||
self:RefreshWorldClass()
|
||||
local data = self.tbWorldClass[self.nCurIndex]
|
||||
if data ~= nil then
|
||||
self._mapNode.goLevelItem:SetItem(data)
|
||||
end
|
||||
end
|
||||
function QuestWorldClassCtrl:OnEvent_DisableScrollView(bDisable)
|
||||
NovaAPI.SetScrollRectVertical(self._mapNode.levelLsv, not bDisable)
|
||||
end
|
||||
return QuestWorldClassCtrl
|
||||
@@ -0,0 +1,222 @@
|
||||
local WorldClassItemCtrl = class("WorldClassItemCtrl", BaseCtrl)
|
||||
WorldClassItemCtrl._mapNodeConfig = {
|
||||
rtLevelUp = {},
|
||||
txtLevelUp = {sComponentName = "TMP_Text"},
|
||||
txtLevelUpDesc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_Level_LevelUp_Cur"
|
||||
},
|
||||
imgProgressBarBg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
rtBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtProgress = {sComponentName = "TMP_Text"},
|
||||
rtAdvance = {},
|
||||
txtAdvance = {sComponentName = "TMP_Text"},
|
||||
txtAdvanceDesc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_Level_Advance_Cur"
|
||||
},
|
||||
imgMissionBg = {nCount = 8},
|
||||
btnRewardItem = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_RewardItem"
|
||||
},
|
||||
goRewardItem = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
goingTip = {},
|
||||
txtGoing = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_Level_Cur"
|
||||
},
|
||||
rtImgArrow = {
|
||||
sNodeName = "imgArrow",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgComplete = {},
|
||||
txtLock = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_Level_Lock"
|
||||
},
|
||||
btnReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
txtBtnReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_Level_Receive_All"
|
||||
},
|
||||
redDot = {}
|
||||
}
|
||||
WorldClassItemCtrl._mapEventConfig = {
|
||||
ReceiveWorldClassLevelReward = "OnEvent_ReceiveWorldClassLevelReward"
|
||||
}
|
||||
WorldClassItemCtrl._mapRedDotConfig = {}
|
||||
local worldClass_Lock = 1
|
||||
local worldClass_Going = 2
|
||||
local worldClass_CanReceive = 3
|
||||
local worldClass_Received = 4
|
||||
local totalLength = 674
|
||||
local totalHeight = 37
|
||||
function WorldClassItemCtrl:SetItem(itemData)
|
||||
self.itemData = itemData
|
||||
self.nCurWorldClass = PlayerData.Base:GetWorldClass()
|
||||
if itemData.nType == AllEnum.WorldClassType.LevelUp then
|
||||
self:SetLevelUpItem()
|
||||
else
|
||||
self:SetAdvanceItem()
|
||||
end
|
||||
end
|
||||
function WorldClassItemCtrl:SetLevelUpItem()
|
||||
self.nState = 0
|
||||
self._mapNode.rtAdvance.gameObject:SetActive(false)
|
||||
self._mapNode.rtLevelUp.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBtnReceive, ConfigTable.GetUIText("WorldClass_Level_Receive_All"))
|
||||
local nCurStageId = PlayerData.Base:GetCurWorldClassStageId()
|
||||
local bAllReceived = true
|
||||
local bCanReceive = false
|
||||
for i = self.itemData.nMinLevel, self.itemData.nMaxLevel do
|
||||
if i > self.nCurWorldClass then
|
||||
bAllReceived = false
|
||||
end
|
||||
local bUnReceive = PlayerData.Base:GetWorldClassState(i) and i <= self.nCurWorldClass
|
||||
if bUnReceive then
|
||||
bAllReceived = false
|
||||
end
|
||||
bCanReceive = bCanReceive or bUnReceive
|
||||
end
|
||||
if nCurStageId ~= self.itemData.nId and self.nCurWorldClass < self.itemData.nMinLevel then
|
||||
self.nState = worldClass_Lock
|
||||
elseif bAllReceived then
|
||||
self.nState = worldClass_Received
|
||||
elseif bCanReceive then
|
||||
self.nState = worldClass_CanReceive
|
||||
else
|
||||
self.nState = worldClass_Going
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData("DemonAdvance", self.itemData.nId)
|
||||
if mapCfg ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelUp, orderedFormat(ConfigTable.GetUIText("WorldClass_Level_LevelUp_Title"), mapCfg.AdvanceName))
|
||||
local nAllProgress = self.itemData.nMaxLevel - self.itemData.nMinLevel + 1
|
||||
local nCurProgress = 0
|
||||
if self.nState == worldClass_Received then
|
||||
nCurProgress = nAllProgress
|
||||
elseif self.nState == worldClass_Lock then
|
||||
nCurProgress = 0
|
||||
else
|
||||
nCurProgress = math.min(self.nCurWorldClass - self.itemData.nMinLevel + 1, nAllProgress)
|
||||
end
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(totalLength * (nCurProgress / nAllProgress), totalHeight)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProgress, string.format("%s/%s", nCurProgress, nAllProgress))
|
||||
end
|
||||
self:RefreshRewardState()
|
||||
RedDotManager.RegisterNode(RedDotDefine.WorldClass_LevelUp, self.itemData.nId, self._mapNode.redDot, nil, nil, true)
|
||||
end
|
||||
function WorldClassItemCtrl:SetAdvanceItem()
|
||||
self.nState = 0
|
||||
self._mapNode.rtAdvance.gameObject:SetActive(true)
|
||||
self._mapNode.rtLevelUp.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBtnReceive, ConfigTable.GetUIText("WorldClass_Level_Advance"))
|
||||
local mapCfg = ConfigTable.GetData("DemonAdvance", self.itemData.nId)
|
||||
if mapCfg ~= nil then
|
||||
local tbQuestList = PlayerData.Quest:GetDemonQuestData(mapCfg.AdvanceQuestGroup, self.itemData.nId)
|
||||
local nAllProgress = #tbQuestList
|
||||
local nCurProgress = 0
|
||||
local nCurWorldClass = PlayerData.Base:GetWorldClass()
|
||||
local nCurStageId = PlayerData.Base:GetCurWorldClassStageId()
|
||||
if nCurStageId == self.itemData.nId and nCurWorldClass == self.itemData.nMaxLevel then
|
||||
for _, v in ipairs(tbQuestList) do
|
||||
if v.nStatus ~= 0 then
|
||||
nCurProgress = nCurProgress + 1
|
||||
end
|
||||
end
|
||||
if nAllProgress <= nCurProgress then
|
||||
self.nState = worldClass_CanReceive
|
||||
else
|
||||
self.nState = worldClass_Going
|
||||
end
|
||||
elseif nCurWorldClass < self.itemData.nMinLevel then
|
||||
nCurProgress = 0
|
||||
self.nState = worldClass_Lock
|
||||
elseif nCurWorldClass >= self.itemData.nMinLevel then
|
||||
nCurProgress = nAllProgress
|
||||
self.nState = worldClass_Received
|
||||
end
|
||||
for k, v in ipairs(self._mapNode.imgMissionBg) do
|
||||
v.gameObject:SetActive(k <= nAllProgress)
|
||||
if k <= nAllProgress then
|
||||
local imgMission = v.gameObject.transform:Find("imgMission")
|
||||
imgMission.gameObject:SetActive(k <= nCurProgress)
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAdvance, orderedFormat(ConfigTable.GetUIText("WorldClass_Level_Advance_Title"), mapCfg.AdvanceName))
|
||||
self.tbReward = {}
|
||||
for i = 1, 4 do
|
||||
local itemId = mapCfg["Item" .. i]
|
||||
local nRarity = 0
|
||||
local mapCfg = ConfigTable.GetData_Item(itemId)
|
||||
if mapCfg ~= nil then
|
||||
nRarity = mapCfg.Rarity
|
||||
end
|
||||
self._mapNode.btnRewardItem[i].gameObject:SetActive(0 < itemId)
|
||||
if itemId ~= 0 then
|
||||
local itemCount = mapCfg["Qty" .. i]
|
||||
table.insert(self.tbReward, {
|
||||
nId = itemId,
|
||||
nCount = itemCount,
|
||||
nRarity = nRarity
|
||||
})
|
||||
self._mapNode.goRewardItem[i]:SetItem(itemId, nil, itemCount, nil, self.nState == worldClass_Received, nil, nil, true)
|
||||
end
|
||||
end
|
||||
table.sort(self.tbReward, function(a, b)
|
||||
if a.nRarity == b.nRarity then
|
||||
return a.nId < b.nId
|
||||
end
|
||||
return a.nRarity < b.nRarity
|
||||
end)
|
||||
end
|
||||
self:RefreshRewardState()
|
||||
RedDotManager.RegisterNode(RedDotDefine.WorldClass_Advance, self.itemData.nId, self._mapNode.redDot, nil, nil, true)
|
||||
end
|
||||
function WorldClassItemCtrl:RefreshRewardState()
|
||||
self._mapNode.goingTip.gameObject:SetActive(self.nState == worldClass_Going)
|
||||
self._mapNode.imgComplete.gameObject:SetActive(self.nState == worldClass_Received)
|
||||
self._mapNode.txtLock.gameObject:SetActive(self.nState == worldClass_Lock)
|
||||
self._mapNode.btnReceive.gameObject:SetActive(self.nState == worldClass_CanReceive)
|
||||
end
|
||||
function WorldClassItemCtrl:Awake()
|
||||
end
|
||||
function WorldClassItemCtrl:OnEnable()
|
||||
end
|
||||
function WorldClassItemCtrl:OnDisable()
|
||||
end
|
||||
function WorldClassItemCtrl:OnDestroy()
|
||||
end
|
||||
function WorldClassItemCtrl:OnBtnClick_Receive()
|
||||
if self.itemData.nType == AllEnum.WorldClassType.LevelUp then
|
||||
local callback = function()
|
||||
local nMaxLevel = math.min(self.nCurWorldClass, self.itemData.nMaxLevel)
|
||||
PlayerData.State:ResetIntervalWorldClassRewardState(self.itemData.nMinLevel, nMaxLevel)
|
||||
EventManager.Hit("ReceiveWorldClassLevelReward")
|
||||
end
|
||||
PlayerData.Base:SendPlayerWorldClassRewardReceiveReq(nil, self.itemData.nId, callback, self.itemData.nMinLevel)
|
||||
else
|
||||
PlayerData.Base:SendPlayerWorldClassAdvanceReq(self.itemData.nId)
|
||||
end
|
||||
end
|
||||
function WorldClassItemCtrl:OnBtnClick_RewardItem(btn, nIndex)
|
||||
local nTid = self.tbReward[nIndex].nId
|
||||
UTILS.ClickItemGridWithTips(nTid, btn.gameObject.transform, false, true, false)
|
||||
end
|
||||
function WorldClassItemCtrl:OnEvent_ReceiveWorldClassLevelReward()
|
||||
if self.itemData ~= nil and self.itemData.nType == AllEnum.WorldClassType.LevelUp then
|
||||
self:SetLevelUpItem()
|
||||
end
|
||||
end
|
||||
return WorldClassItemCtrl
|
||||
@@ -0,0 +1,148 @@
|
||||
local WorldClassLevelItemCtrl = class("WorldClassLevelItemCtrl", BaseCtrl)
|
||||
WorldClassLevelItemCtrl._mapNodeConfig = {
|
||||
rtImgBg = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtLevelCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_Level"
|
||||
},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
btnRewardItem = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_RewardItem"
|
||||
},
|
||||
goRewardItem = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
btnReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
txtBtnReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_Level_Receive"
|
||||
},
|
||||
txtUnComplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_Level_UnComplete"
|
||||
},
|
||||
imgComplete = {},
|
||||
imgUnOpen = {},
|
||||
txtUnOpen = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_Level_Lock"
|
||||
},
|
||||
goInfo = {},
|
||||
imgOpenFunc = {nCount = 3},
|
||||
imgLevelInfo = {nCount = 3}
|
||||
}
|
||||
WorldClassLevelItemCtrl._mapEventConfig = {}
|
||||
WorldClassLevelItemCtrl._mapRedDotConfig = {}
|
||||
function WorldClassLevelItemCtrl:SetItem(nLevel, bUnOpen)
|
||||
self.nLevel = nLevel
|
||||
self.bUnOpen = bUnOpen
|
||||
local nCurWorldClass = PlayerData.Base:GetWorldClass()
|
||||
local bUnReceive = PlayerData.Base:GetWorldClassState(self.nLevel)
|
||||
local mapCfg = ConfigTable.GetData("WorldClass", nLevel)
|
||||
if mapCfg ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, nLevel)
|
||||
local tbRewardCfg = decodeJson(mapCfg.Reward)
|
||||
for _, v in ipairs(self._mapNode.btnRewardItem) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
self.tbReward = {}
|
||||
local i = 1
|
||||
for sItem, nCount in pairs(tbRewardCfg) do
|
||||
local nItemId = tonumber(sItem)
|
||||
local nRarity = 0
|
||||
local mapCfg = ConfigTable.GetData_Item(nItemId)
|
||||
if mapCfg ~= nil then
|
||||
nRarity = mapCfg.Rarity
|
||||
end
|
||||
table.insert(self.tbReward, {
|
||||
nId = nItemId,
|
||||
nCount = nCount,
|
||||
nRarity = nRarity
|
||||
})
|
||||
i = i + 1
|
||||
end
|
||||
table.sort(self.tbReward, function(a, b)
|
||||
if a.nRarity == b.nRarity then
|
||||
return a.nId < b.nId
|
||||
end
|
||||
return a.nRarity < b.nRarity
|
||||
end)
|
||||
for k, v in ipairs(self._mapNode.btnRewardItem) do
|
||||
v.gameObject:SetActive(k <= #self.tbReward)
|
||||
if k <= #self.tbReward then
|
||||
self._mapNode.goRewardItem[k]:SetItem(self.tbReward[k].nId, nil, self.tbReward[k].nCount, nil, not bUnReceive and nLevel <= nCurWorldClass, nil, nil, true)
|
||||
end
|
||||
end
|
||||
local nInfoCount = 0
|
||||
local tbOpenFunc = mapCfg.OpenFunc
|
||||
for k, v in ipairs(self._mapNode.imgOpenFunc) do
|
||||
v.gameObject:SetActive(tbOpenFunc[k] ~= nil and tbOpenFunc[k] ~= 0)
|
||||
if tbOpenFunc[k] ~= nil and tbOpenFunc[k] ~= 0 then
|
||||
nInfoCount = nInfoCount + 1
|
||||
local mapOpenFuncCfg = ConfigTable.GetData("OpenFunc", tbOpenFunc[k])
|
||||
if mapOpenFuncCfg ~= nil then
|
||||
local txtFunc = v.gameObject.transform:Find("txtFunc"):GetComponent("TMP_Text")
|
||||
local txtFuncDesc = v.gameObject.transform:Find("txtFuncDesc"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtFunc, orderedFormat(ConfigTable.GetUIText("WorldClass_Level_FuncOpen"), mapOpenFuncCfg.Name))
|
||||
NovaAPI.SetTMPText(txtFuncDesc, mapOpenFuncCfg.Desc)
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, v in ipairs(self._mapNode.imgLevelInfo) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
for i = 1, 3 do
|
||||
if mapCfg["FuncChangeText" .. i] ~= "" then
|
||||
nInfoCount = nInfoCount + 1
|
||||
self._mapNode.imgLevelInfo[i].gameObject:SetActive(true)
|
||||
local txtLevelLimit = self._mapNode.imgLevelInfo[i].gameObject.transform:Find("txtLevelLimit"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtLevelLimit, mapCfg["FuncChangeText" .. i])
|
||||
end
|
||||
end
|
||||
self._mapNode.goInfo:SetActive(0 < nInfoCount)
|
||||
end
|
||||
self:RefreshStatus()
|
||||
end
|
||||
function WorldClassLevelItemCtrl:RefreshStatus()
|
||||
local nCurWorldClass = PlayerData.Base:GetWorldClass()
|
||||
local bUnReceive = PlayerData.Base:GetWorldClassState(self.nLevel)
|
||||
self._mapNode.txtUnComplete.gameObject:SetActive(not self.bUnOpen and nCurWorldClass < self.nLevel)
|
||||
self._mapNode.btnReceive.gameObject:SetActive(bUnReceive and nCurWorldClass >= self.nLevel)
|
||||
self._mapNode.imgComplete.gameObject:SetActive(not bUnReceive and nCurWorldClass >= self.nLevel)
|
||||
self._mapNode.imgUnOpen.gameObject:SetActive(self.bUnOpen)
|
||||
for k, v in ipairs(self._mapNode.btnRewardItem) do
|
||||
if k <= #self.tbReward then
|
||||
self._mapNode.goRewardItem[k]:SetItem(self.tbReward[k].nId, nil, self.tbReward[k].nCount, nil, not bUnReceive and nCurWorldClass >= self.nLevel, nil, nil, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function WorldClassLevelItemCtrl:Awake()
|
||||
end
|
||||
function WorldClassLevelItemCtrl:OnEnable()
|
||||
end
|
||||
function WorldClassLevelItemCtrl:OnDisable()
|
||||
end
|
||||
function WorldClassLevelItemCtrl:OnDestroy()
|
||||
end
|
||||
function WorldClassLevelItemCtrl:OnBtnClick_RewardItem(btn, nIndex)
|
||||
local nTid = self.tbReward[nIndex].nId
|
||||
UTILS.ClickItemGridWithTips(nTid, btn.gameObject.transform, false, true, false)
|
||||
end
|
||||
function WorldClassLevelItemCtrl:OnBtnClick_Receive()
|
||||
local callback = function()
|
||||
PlayerData.State:ResetWorldClassRewardState(self.nLevel)
|
||||
self:RefreshStatus()
|
||||
EventManager.Hit("ReceiveWorldClassLevelReward")
|
||||
end
|
||||
PlayerData.Base:SendPlayerWorldClassRewardReceiveReq(self.nLevel, nil, callback)
|
||||
end
|
||||
return WorldClassLevelItemCtrl
|
||||
@@ -0,0 +1,76 @@
|
||||
local WorldClassQuestItemCtrl = class("WorldClassQuestItemCtrl", BaseCtrl)
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
WorldClassQuestItemCtrl._mapNodeConfig = {
|
||||
txtUnComplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Demon_Quest_UnComplete"
|
||||
},
|
||||
imgComplete = {},
|
||||
imgCompleteMask = {},
|
||||
imgUnOpen = {},
|
||||
txtUnOpen = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_Level_Lock"
|
||||
},
|
||||
txtQuestDesc = {sComponentName = "TMP_Text", nCount = 2},
|
||||
goOpen = {},
|
||||
btnJump = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Jump"
|
||||
},
|
||||
txtBtnJump = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Demon_Quest_JumpTo"
|
||||
},
|
||||
imgProgressBar = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
rtBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtProgress = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
WorldClassQuestItemCtrl._mapEventConfig = {}
|
||||
WorldClassQuestItemCtrl._mapRedDotConfig = {}
|
||||
local totalLength = 700
|
||||
local totalHeight = 37
|
||||
function WorldClassQuestItemCtrl:SetItem(questData, bUnOpen)
|
||||
self.mapQuest = questData
|
||||
self.bUnOpen = bUnOpen
|
||||
local mapQuestCfg = ConfigTable.GetData("DemonQuest", questData.nTid)
|
||||
if mapQuestCfg ~= nil then
|
||||
self.nJumpTo = mapQuestCfg.JumpTo
|
||||
for _, v in ipairs(self._mapNode.txtQuestDesc) do
|
||||
NovaAPI.SetTMPText(v, mapQuestCfg.Title)
|
||||
end
|
||||
self._mapNode.imgUnOpen.gameObject:SetActive(self.bUnOpen)
|
||||
self._mapNode.goOpen:SetActive(not self.bUnOpen)
|
||||
if not self.bUnOpen then
|
||||
self._mapNode.txtUnComplete.gameObject:SetActive(questData.nStatus == 0 and self.nJumpTo == 0)
|
||||
self._mapNode.imgComplete.gameObject:SetActive(questData.nStatus ~= 0)
|
||||
self._mapNode.imgCompleteMask.gameObject:SetActive(questData.nStatus ~= 0)
|
||||
self._mapNode.btnJump.gameObject:SetActive(questData.nStatus == 0 and self.nJumpTo ~= 0)
|
||||
end
|
||||
if questData.nStatus == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProgress, string.format("%s/%s", questData.nCurProgress, questData.nGoal))
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(questData.nCurProgress / questData.nGoal * totalLength, totalHeight)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProgress, string.format("%s/%s", questData.nCurProgress, questData.nGoal))
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(totalLength, totalHeight)
|
||||
end
|
||||
end
|
||||
end
|
||||
function WorldClassQuestItemCtrl:Awake()
|
||||
end
|
||||
function WorldClassQuestItemCtrl:OnEnable()
|
||||
end
|
||||
function WorldClassQuestItemCtrl:OnDisable()
|
||||
end
|
||||
function WorldClassQuestItemCtrl:OnDestroy()
|
||||
end
|
||||
function WorldClassQuestItemCtrl:OnBtnClick_Jump()
|
||||
if self.nJumpTo ~= nil and self.nJumpTo ~= 0 then
|
||||
JumpUtil.JumpTo(self.nJumpTo)
|
||||
end
|
||||
end
|
||||
return WorldClassQuestItemCtrl
|
||||
Reference in New Issue
Block a user