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,108 @@
|
||||
local TravelerDuelQuestCtrl = class("TravelerDuelQuestCtrl", BaseCtrl)
|
||||
TravelerDuelQuestCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
togCtrl = {
|
||||
sNodeName = "tog",
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
tog = {
|
||||
sComponentName = "UIButton",
|
||||
nCount = 2,
|
||||
callback = "OnBtnClick_Tog"
|
||||
},
|
||||
rtQuestSeason = {
|
||||
sCtrlName = "Game.UI.TravelerDuelLevelSelect.TravelerDuelQuest.TravelerDuelQuestSeasonCtrl"
|
||||
},
|
||||
rtQuestNormal = {
|
||||
sCtrlName = "Game.UI.TravelerDuelLevelSelect.TravelerDuelQuest.TravelerDuelQuestNormalCtrl"
|
||||
},
|
||||
redDotTog = {nCount = 2}
|
||||
}
|
||||
TravelerDuelQuestCtrl._mapEventConfig = {
|
||||
[EventId.TRChallengeQusetReceived] = "OnEvent_ChallengeQusetReceived",
|
||||
[EventId.TRNormalQusetReceived] = "OnEvent_NormalQusetReceived"
|
||||
}
|
||||
function TravelerDuelQuestCtrl:RegisterRedDot()
|
||||
RedDotManager.RegisterNode(RedDotDefine.Task_Season, nil, self._mapNode.redDotTog[1])
|
||||
RedDotManager.RegisterNode(RedDotDefine.Task_Duel, nil, self._mapNode.redDotTog[2])
|
||||
end
|
||||
function TravelerDuelQuestCtrl:Awake()
|
||||
self.tbSheet = {
|
||||
[1] = self._mapNode.rtQuestSeason,
|
||||
[2] = self._mapNode.rtQuestNormal
|
||||
}
|
||||
end
|
||||
function TravelerDuelQuestCtrl:FadeIn()
|
||||
end
|
||||
function TravelerDuelQuestCtrl:FadeOut()
|
||||
end
|
||||
function TravelerDuelQuestCtrl:OnEnable()
|
||||
self:RegisterRedDot()
|
||||
local mapNormal, mapSeason = PlayerData.Quest:GetTravelerDuelQuestData()
|
||||
local mapChallenge = PlayerData.TravelerDuel:GetTravelerDuelChallenge()
|
||||
local bUnlockLevel, sLock = PlayerData.TravelerDuel:GetTravelerChallengeUnlock()
|
||||
local bUnlock = bUnlockLevel and mapChallenge.bUnlock
|
||||
if mapSeason == nil or mapChallenge.nIdx == 0 or not bUnlock then
|
||||
self.nCurSheet = 2
|
||||
self._mapNode.togCtrl[1]:SetText(ConfigTable.GetUIText("TDQuest_Season"))
|
||||
self._mapNode.togCtrl[2]:SetText(ConfigTable.GetUIText("TDQuest_Normal"))
|
||||
self._mapNode.togCtrl[1]:SetDefault(false)
|
||||
self._mapNode.togCtrl[2]:SetDefault(true)
|
||||
self._mapNode.togCtrl[1].gameObject:SetActive(false)
|
||||
self._mapNode.rtQuestSeason.gameObject:SetActive(false)
|
||||
self._mapNode.rtQuestNormal.gameObject:SetActive(true)
|
||||
self._mapNode.rtQuestNormal:Refresh(mapNormal)
|
||||
else
|
||||
local mapDuelChallenge = PlayerData.TravelerDuel:GetTravelerDuelChallenge()
|
||||
self._mapNode.rtQuestSeason.gameObject:SetActive(true)
|
||||
self._mapNode.rtQuestNormal.gameObject:SetActive(false)
|
||||
self._mapNode.rtQuestSeason:Refresh(mapSeason, mapDuelChallenge)
|
||||
self._mapNode.rtQuestNormal:Refresh(mapNormal)
|
||||
self._mapNode.togCtrl[1].gameObject:SetActive(true)
|
||||
self.nCurSheet = 1
|
||||
self._mapNode.togCtrl[1]:SetText(ConfigTable.GetUIText("TDQuest_Season"))
|
||||
self._mapNode.togCtrl[2]:SetText(ConfigTable.GetUIText("TDQuest_Normal"))
|
||||
self._mapNode.togCtrl[1]:SetDefault(true)
|
||||
self._mapNode.togCtrl[2]:SetDefault(false)
|
||||
end
|
||||
end
|
||||
function TravelerDuelQuestCtrl:OnDisable()
|
||||
end
|
||||
function TravelerDuelQuestCtrl:OnDestroy()
|
||||
end
|
||||
function TravelerDuelQuestCtrl:OnRelease()
|
||||
end
|
||||
function TravelerDuelQuestCtrl:OnBtnClick_Tog(btn, nIndex)
|
||||
if self.nCurSheet == nIndex then
|
||||
return
|
||||
end
|
||||
self._mapNode.togCtrl[self.nCurSheet]:SetTrigger(false)
|
||||
self._mapNode.togCtrl[nIndex]:SetTrigger(true)
|
||||
self.tbSheet[self.nCurSheet].gameObject:SetActive(false)
|
||||
self.tbSheet[nIndex].gameObject:SetActive(true)
|
||||
self.nCurSheet = nIndex
|
||||
end
|
||||
function TravelerDuelQuestCtrl:OnEvent_ChallengeQusetReceived(QuestRewards, tbReceivedId, mapChangeInfo)
|
||||
UTILS.OpenReceiveByDisplayItem(QuestRewards, mapChangeInfo)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local mapNormal, mapSeason = PlayerData.Quest:GetTravelerDuelQuestData()
|
||||
local mapDuelChallenge = PlayerData.TravelerDuel:GetTravelerDuelChallenge()
|
||||
self._mapNode.rtQuestSeason:Refresh(mapSeason, mapDuelChallenge)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function TravelerDuelQuestCtrl:OnEvent_NormalQusetReceived(QuestRewards, tbReceivedId, mapChangeInfo)
|
||||
UTILS.OpenReceiveByDisplayItem(QuestRewards, mapChangeInfo)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local mapNormal, mapSeason = PlayerData.Quest:GetTravelerDuelQuestData()
|
||||
self._mapNode.rtQuestNormal:Refresh(mapNormal)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
return TravelerDuelQuestCtrl
|
||||
@@ -0,0 +1,83 @@
|
||||
local TravelerDuelQuestGridCtrl = class("TravelerDuelQuestGridCtrl", BaseCtrl)
|
||||
local totalLength = 517
|
||||
local totalHeight = 37
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
TravelerDuelQuestGridCtrl._mapNodeConfig = {
|
||||
TMPTitle = {sComponentName = "TMP_Text"},
|
||||
TMPUncomplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_undone"
|
||||
},
|
||||
txtBtnReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Receive"
|
||||
},
|
||||
TMPComplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Complete"
|
||||
},
|
||||
txtBtnJump = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_JumpTo"
|
||||
},
|
||||
rtBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
TMPProcess = {sComponentName = "TMP_Text"},
|
||||
btnReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reward"
|
||||
},
|
||||
btnReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
btnJump = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_JumpTo"
|
||||
},
|
||||
rtReward = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
imgComplete = {},
|
||||
imgCompleteMask = {}
|
||||
}
|
||||
TravelerDuelQuestGridCtrl._mapEventConfig = {}
|
||||
function TravelerDuelQuestGridCtrl:Refresh(mapNormalQuest, mapNormalQuestCfgData)
|
||||
if mapNormalQuest == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
if mapNormalQuestCfgData == nil then
|
||||
printError("guide quest data missing:" .. mapNormalQuest.nTid)
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self.mapNormalQuestCfgData = mapNormalQuestCfgData
|
||||
self.mapNormalQuest = mapNormalQuest
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitle, mapNormalQuestCfgData.Desc)
|
||||
self._mapNode.rtReward:SetItem(mapNormalQuestCfgData.AwardItemTid1, nil, mapNormalQuestCfgData.AwardItemNum1, nil, nil, nil, nil, true)
|
||||
if mapNormalQuest.nStatus ~= 2 then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPProcess, string.format("%d/%d", mapNormalQuest.nCurProgress, mapNormalQuest.nGoal))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPProcess, ConfigTable.GetUIText("Quest_Complete"))
|
||||
end
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(mapNormalQuest.nCurProgress / mapNormalQuest.nGoal * totalLength, totalHeight)
|
||||
self._mapNode.imgComplete:SetActive(mapNormalQuest.nStatus == 2)
|
||||
self._mapNode.imgCompleteMask:SetActive(mapNormalQuest.nStatus == 2)
|
||||
self._mapNode.imgCompleteMask:SetActive(mapNormalQuest.nStatus == 2)
|
||||
self._mapNode.TMPUncomplete.gameObject:SetActive(mapNormalQuest.nStatus == 0 and mapNormalQuestCfgData.JumpTo == 0)
|
||||
self._mapNode.btnJump.gameObject:SetActive(mapNormalQuest.nStatus == 0 and mapNormalQuestCfgData.JumpTo ~= 0)
|
||||
self._mapNode.btnReceive.gameObject:SetActive(mapNormalQuest.nStatus == 1)
|
||||
end
|
||||
function TravelerDuelQuestGridCtrl:OnBtnClick_Receive()
|
||||
PlayerData.Quest:ReceiveTravelerDuelReward(self.mapNormalQuest.nTid, nil)
|
||||
end
|
||||
function TravelerDuelQuestGridCtrl:OnBtnClick_JumpTo()
|
||||
local nJumptoId = self.mapNormalQuestCfgData.JumpTo
|
||||
JumpUtil.JumpTo(nJumptoId)
|
||||
end
|
||||
function TravelerDuelQuestGridCtrl:OnBtnClick_Reward(btn)
|
||||
UTILS.ClickItemGridWithTips(self.mapNormalQuestCfgData.AwardItemTid1, btn.transform, true, true, false)
|
||||
end
|
||||
return TravelerDuelQuestGridCtrl
|
||||
@@ -0,0 +1,99 @@
|
||||
local TravelerDuelQuestSeasonCtrl = class("TravelerDuelQuestSeasonCtrl", BaseCtrl)
|
||||
local totalLength = 130
|
||||
local totalHeight = 19
|
||||
TravelerDuelQuestSeasonCtrl._mapNodeConfig = {
|
||||
btnFastReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_FastReceive"
|
||||
},
|
||||
txtBtnFastReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_ReceiveAll"
|
||||
},
|
||||
TMPProcessGroup = {sComponentName = "TMP_Text"},
|
||||
rtBarFillGroup = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
srNormalQuest = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
TMPGroupTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TD_QusetTitle"
|
||||
}
|
||||
}
|
||||
TravelerDuelQuestSeasonCtrl._mapEventConfig = {}
|
||||
function TravelerDuelQuestSeasonCtrl:Awake()
|
||||
self.mapQuestsGrids = {}
|
||||
self.AllQuests = {}
|
||||
local forEachTravelerDuelQuest = function(mapData)
|
||||
table.insert(self.AllQuests, mapData)
|
||||
end
|
||||
ForEachTableLine(DataTable.TravelerDuelQuest, forEachTravelerDuelQuest)
|
||||
end
|
||||
function TravelerDuelQuestSeasonCtrl:OnDisable()
|
||||
for nInstanceId, objCtrl in pairs(self.mapQuestsGrids) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.mapQuestsGrids[nInstanceId] = nil
|
||||
end
|
||||
self.mapQuestsGrids = {}
|
||||
end
|
||||
function TravelerDuelQuestSeasonCtrl:Refresh(mapQuest)
|
||||
self.mapQuest = mapQuest
|
||||
local statusOrder = {
|
||||
[0] = 1,
|
||||
[1] = 2,
|
||||
[2] = 0
|
||||
}
|
||||
self.curAllQuests = {}
|
||||
for _, mapQuestData in ipairs(self.AllQuests) do
|
||||
if self.mapQuest[mapQuestData.Id] ~= nil then
|
||||
table.insert(self.curAllQuests, mapQuestData)
|
||||
end
|
||||
end
|
||||
local sort = function(a, b)
|
||||
if mapQuest[a.Id] ~= nil and mapQuest[b.Id] ~= nil and mapQuest[a.Id].nStatus ~= mapQuest[b.Id].nStatus then
|
||||
return statusOrder[mapQuest[a.Id].nStatus] > statusOrder[mapQuest[b.Id].nStatus]
|
||||
end
|
||||
return a.Id < b.Id
|
||||
end
|
||||
table.sort(self.curAllQuests, sort)
|
||||
local nTotal = #self.curAllQuests
|
||||
local nCur = 0
|
||||
for _, mapData in pairs(mapQuest) do
|
||||
if mapQuest ~= nil and mapData.nStatus == 2 then
|
||||
nCur = nCur + 1
|
||||
end
|
||||
end
|
||||
local bFastReceive = false
|
||||
for _, mapData in pairs(self.mapQuest) do
|
||||
if mapData.nStatus == 1 then
|
||||
bFastReceive = true
|
||||
break
|
||||
end
|
||||
end
|
||||
self._mapNode.btnFastReceive.gameObject:SetActive(bFastReceive)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPProcessGroup, string.format("<color=#FFA2D8>%d</color>/%d", nCur, nTotal))
|
||||
self._mapNode.rtBarFillGroup.sizeDelta = Vector2(nCur / nTotal * totalLength, totalHeight)
|
||||
if self.gameObject.activeInHierarchy then
|
||||
self._mapNode.srNormalQuest:SetAnim(0.08)
|
||||
end
|
||||
self._mapNode.srNormalQuest:Init(#self.curAllQuests, self, self.OnQuestGridRefresh, nil, false)
|
||||
end
|
||||
function TravelerDuelQuestSeasonCtrl:OnQuestGridRefresh(goGrid, gridIndex)
|
||||
if self.mapQuestsGrids[goGrid] == nil then
|
||||
self.mapQuestsGrids[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.TravelerDuelLevelSelect.TravelerDuelQuest.TravelerDuelQuestGridCtrl")
|
||||
end
|
||||
local nIdx = gridIndex + 1
|
||||
local mapQuestCfgData = self.curAllQuests[nIdx]
|
||||
if mapQuestCfgData == nil then
|
||||
printError("GuideQuestData missing" .. nIdx)
|
||||
self.mapQuestsGrids[goGrid]:Refresh(nil, nil)
|
||||
return
|
||||
end
|
||||
self.mapQuestsGrids[goGrid]:Refresh(self.mapQuest[mapQuestCfgData.Id], mapQuestCfgData)
|
||||
end
|
||||
function TravelerDuelQuestSeasonCtrl:OnBtnClick_FastReceive()
|
||||
PlayerData.Quest:ReceiveTravelerDuelReward(0, nil)
|
||||
end
|
||||
return TravelerDuelQuestSeasonCtrl
|
||||
@@ -0,0 +1,18 @@
|
||||
local TravelerDuelQuestPanel = class("TravelerDuelQuestPanel", BasePanel)
|
||||
TravelerDuelQuestPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "TravelerDuelLevelSelect/TravelerDuelLevelQuestPanel.prefab",
|
||||
sCtrlName = "Game.UI.TravelerDuelLevelSelect.TravelerDuelQuest.TravelerDuelQuestCtrl"
|
||||
}
|
||||
}
|
||||
function TravelerDuelQuestPanel:Awake()
|
||||
end
|
||||
function TravelerDuelQuestPanel:OnEnable()
|
||||
end
|
||||
function TravelerDuelQuestPanel:OnDisable()
|
||||
end
|
||||
function TravelerDuelQuestPanel:OnDestroy()
|
||||
end
|
||||
function TravelerDuelQuestPanel:OnRelease()
|
||||
end
|
||||
return TravelerDuelQuestPanel
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
local TravelerDuelQuestSeasonCtrl = class("TravelerDuelQuestSeasonCtrl", BaseCtrl)
|
||||
local totalLength = 130
|
||||
local totalHeight = 19
|
||||
TravelerDuelQuestSeasonCtrl._mapNodeConfig = {
|
||||
btnFastReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_FastReceive"
|
||||
},
|
||||
txtBtnFastReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_ReceiveAll"
|
||||
},
|
||||
TMPGroupTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TD_QusetTitle"
|
||||
},
|
||||
TMP_SeasonEndTime = {sComponentName = "TMP_Text"},
|
||||
imgCover = {sComponentName = "Image"},
|
||||
TMPProcessGroup = {sComponentName = "TMP_Text"},
|
||||
TMP_QuestHint = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TD_SeasonQuestHint"
|
||||
},
|
||||
rtBarFillGroup = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
srSeasonQuests = {
|
||||
sComponentName = "LoopScrollView"
|
||||
}
|
||||
}
|
||||
TravelerDuelQuestSeasonCtrl._mapEventConfig = {}
|
||||
function TravelerDuelQuestSeasonCtrl:Awake()
|
||||
self.mapQuestsGrids = {}
|
||||
self.mapAllQuests = {}
|
||||
local forEachTravelerDuelChallengeQuest = function(mapData)
|
||||
if self.mapAllQuests[mapData.GroupId] == nil then
|
||||
self.mapAllQuests[mapData.GroupId] = {}
|
||||
end
|
||||
table.insert(self.mapAllQuests[mapData.GroupId], mapData)
|
||||
end
|
||||
ForEachTableLine(DataTable.TravelerDuelChallengeQuest, forEachTravelerDuelChallengeQuest)
|
||||
end
|
||||
function TravelerDuelQuestSeasonCtrl:OnDisable()
|
||||
for nInstanceId, objCtrl in pairs(self.mapQuestsGrids) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.mapQuestsGrids[nInstanceId] = nil
|
||||
end
|
||||
self.mapQuestsGrids = {}
|
||||
end
|
||||
function TravelerDuelQuestSeasonCtrl:Refresh(mapQuest, mapSeasonData)
|
||||
local mapSeason = ConfigTable.GetData("TravelerDuelChallengeSeason", mapSeasonData.nIdx)
|
||||
if mapSeason == nil then
|
||||
return
|
||||
end
|
||||
self.curGroup = mapSeason.QuestGroupId
|
||||
self.mapQuest = mapQuest
|
||||
self.curAllQuests = {}
|
||||
for _, mapQuestData in ipairs(self.mapAllQuests[self.curGroup]) do
|
||||
if self.mapQuest[mapQuestData.Id] ~= nil then
|
||||
table.insert(self.curAllQuests, mapQuestData)
|
||||
end
|
||||
end
|
||||
local statusOrder = {
|
||||
[0] = 1,
|
||||
[1] = 2,
|
||||
[2] = 0
|
||||
}
|
||||
local sort = function(a, b)
|
||||
if mapQuest[a.Id] ~= nil and mapQuest[b.Id] ~= nil and mapQuest[a.Id].nStatus ~= mapQuest[b.Id].nStatus then
|
||||
return statusOrder[mapQuest[a.Id].nStatus] > statusOrder[mapQuest[b.Id].nStatus]
|
||||
end
|
||||
return a.Id < b.Id
|
||||
end
|
||||
table.sort(self.curAllQuests, sort)
|
||||
self:SetPngSprite(self._mapNode.imgCover, "Icon/ZZZOther/" .. mapSeason.BackGroundSource)
|
||||
local nDay = math.floor((mapSeasonData.nCloseTime - CS.ClientManager.Instance.serverTimeStamp) / 3600 / 24)
|
||||
local nHour = math.floor((mapSeasonData.nCloseTime - CS.ClientManager.Instance.serverTimeStamp) / 3600)
|
||||
local nMin = math.ceil((mapSeasonData.nCloseTime - CS.ClientManager.Instance.serverTimeStamp) / 60)
|
||||
if 1 < nDay then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_SeasonEndTime, orderedFormat(ConfigTable.GetUIText("TDQuest_Day"), nDay))
|
||||
elseif 1 < nHour then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_SeasonEndTime, orderedFormat(ConfigTable.GetUIText("TDQuest_Hour"), nHour))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_SeasonEndTime, orderedFormat(ConfigTable.GetUIText("TDQuest_Min"), nMin))
|
||||
end
|
||||
local nTotal = #self.curAllQuests
|
||||
local nCur = 0
|
||||
for _, mapData in pairs(mapQuest) do
|
||||
if mapQuest ~= nil and mapData.nStatus == 2 then
|
||||
nCur = nCur + 1
|
||||
end
|
||||
end
|
||||
local bFastReceive = false
|
||||
for _, mapData in pairs(self.mapQuest) do
|
||||
if mapData.nStatus == 1 then
|
||||
bFastReceive = true
|
||||
break
|
||||
end
|
||||
end
|
||||
self._mapNode.btnFastReceive.gameObject:SetActive(bFastReceive)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPProcessGroup, string.format("<color=#FFA2D8>%d</color>/%d", nCur, nTotal))
|
||||
self._mapNode.rtBarFillGroup.sizeDelta = Vector2(nCur / nTotal * totalLength, totalHeight)
|
||||
self._mapNode.srSeasonQuests.gameObject:SetActive(#self.curAllQuests > 0)
|
||||
self._mapNode.srSeasonQuests:SetAnim(0.08)
|
||||
self._mapNode.srSeasonQuests:Init(#self.curAllQuests, self, self.OnQuestGridRefresh, nil, false)
|
||||
end
|
||||
function TravelerDuelQuestSeasonCtrl:OnQuestGridRefresh(goGrid, gridIndex)
|
||||
if self.mapQuestsGrids[goGrid] == nil then
|
||||
self.mapQuestsGrids[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.TravelerDuelLevelSelect.TravelerDuelQuest.TravelerDuelQuestSeasonGridCtrl")
|
||||
end
|
||||
local nIdx = gridIndex + 1
|
||||
local mapQuestCfgData = self.curAllQuests[nIdx]
|
||||
if mapQuestCfgData == nil then
|
||||
printError("GuideQuestData missing" .. nIdx)
|
||||
self.mapQuestsGrids[goGrid]:Refresh(nil, nil)
|
||||
return
|
||||
end
|
||||
self.mapQuestsGrids[goGrid]:Refresh(self.mapQuest[mapQuestCfgData.Id], mapQuestCfgData)
|
||||
end
|
||||
function TravelerDuelQuestSeasonCtrl:OnBtnClick_FastReceive()
|
||||
PlayerData.Quest:ReceiveTravelerDuelChallengeReward(0, nil)
|
||||
end
|
||||
return TravelerDuelQuestSeasonCtrl
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
local TravelerDuelQuestSeasonGridCtrl = class("TravelerDuelQuestSeasonGridCtrl", BaseCtrl)
|
||||
local totalLength = 517
|
||||
local totalHeight = 37
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
TravelerDuelQuestSeasonGridCtrl._mapNodeConfig = {
|
||||
TMPTitle = {sComponentName = "TMP_Text"},
|
||||
TMPUncomplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_undone"
|
||||
},
|
||||
txtBtnReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Receive"
|
||||
},
|
||||
txtBtnJump = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_JumpTo"
|
||||
},
|
||||
rtBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
TMPProcess = {sComponentName = "TMP_Text"},
|
||||
btnReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reward"
|
||||
},
|
||||
btnReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
btnJump = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_JumpTo"
|
||||
},
|
||||
rtReward = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
imgComplete = {},
|
||||
imgCompleteMask = {}
|
||||
}
|
||||
TravelerDuelQuestSeasonGridCtrl._mapEventConfig = {}
|
||||
function TravelerDuelQuestSeasonGridCtrl:Refresh(mapSeasonQuest, mapSeasonQuestCfgData)
|
||||
if mapSeasonQuest == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
if mapSeasonQuestCfgData == nil then
|
||||
printError("guide quest data missing:" .. mapSeasonQuest.nTid)
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self.mapSeasonQuestCfgData = mapSeasonQuestCfgData
|
||||
self.mapSeasonQuest = mapSeasonQuest
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitle, mapSeasonQuestCfgData.Desc)
|
||||
self._mapNode.rtReward:SetItem(mapSeasonQuestCfgData.AwardItemTid1, nil, mapSeasonQuestCfgData.AwardItemNum1, nil, nil, nil, nil, true)
|
||||
if mapSeasonQuest.nStatus ~= 2 then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPProcess, string.format("%d/%d", mapSeasonQuest.nCurProgress, mapSeasonQuest.nGoal))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPProcess, ConfigTable.GetUIText("Quest_Complete"))
|
||||
end
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(mapSeasonQuest.nCurProgress / mapSeasonQuest.nGoal * totalLength, totalHeight)
|
||||
self._mapNode.imgComplete:SetActive(mapSeasonQuest.nStatus == 2)
|
||||
self._mapNode.imgCompleteMask:SetActive(mapSeasonQuest.nStatus == 2)
|
||||
self._mapNode.imgCompleteMask:SetActive(mapSeasonQuest.nStatus == 2)
|
||||
self._mapNode.TMPUncomplete.gameObject:SetActive(mapSeasonQuest.nStatus == 0 and mapSeasonQuestCfgData.JumpTo == 0)
|
||||
self._mapNode.btnJump.gameObject:SetActive(mapSeasonQuest.nStatus == 0 and mapSeasonQuestCfgData.JumpTo ~= 0)
|
||||
self._mapNode.btnReceive.gameObject:SetActive(mapSeasonQuest.nStatus == 1)
|
||||
end
|
||||
function TravelerDuelQuestSeasonGridCtrl:OnBtnClick_Receive()
|
||||
PlayerData.Quest:ReceiveTravelerDuelChallengeReward(self.mapSeasonQuest.nTid, nil)
|
||||
end
|
||||
function TravelerDuelQuestSeasonGridCtrl:OnBtnClick_JumpTo()
|
||||
local nJumptoId = self.mapSeasonQuestCfgData.JumpTo
|
||||
JumpUtil.JumpTo(nJumptoId)
|
||||
end
|
||||
function TravelerDuelQuestSeasonGridCtrl:OnBtnClick_Reward(btn)
|
||||
UTILS.ClickItemGridWithTips(self.mapSeasonQuestCfgData.AwardItemTid1, btn.transform, true, true, false)
|
||||
end
|
||||
return TravelerDuelQuestSeasonGridCtrl
|
||||
Reference in New Issue
Block a user