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:
SL1900
2025-12-03 01:00:00 +09:00
commit 5e0d58cfad
3595 changed files with 9373562 additions and 0 deletions
@@ -0,0 +1,85 @@
local TDClassUpgradeCtrl = class("TDClassUpgradeCtrl", BaseCtrl)
TDClassUpgradeCtrl._mapNodeConfig = {
imgBlurredBg = {},
btnMaskClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
goRoot = {
sNodeName = "----SafeAreaRoot----"
},
txtRankNum = {sComponentName = "TMP_Text"},
imgExp = {sComponentName = "Image"},
txtEffect = {sComponentName = "TMP_Text"},
txtEffectValueBefore = {sComponentName = "TMP_Text"},
txtEffectValueAfter = {sComponentName = "TMP_Text"}
}
TDClassUpgradeCtrl._mapEventConfig = {}
function TDClassUpgradeCtrl:SetOldWorldClass()
local nOldWorldClass, nOldWorldExp = PlayerData.TravelerDuel:GetOldTDLevelData()
local mapOldCfg = ConfigTable.GetData("TravelerDuelLevel", nOldWorldClass + 1)
local nOldFullExp = 0
if mapOldCfg then
nOldFullExp = mapOldCfg.LevelUpExp
end
NovaAPI.SetTMPText(self._mapNode.txtRankNum, nOldWorldClass)
NovaAPI.SetImageFillAmount(self._mapNode.imgExp, nOldWorldExp / nOldFullExp)
local nWorldClass, nCurExp = PlayerData.TravelerDuel:GetTravelerDuelLevel()
local mapCfg = ConfigTable.GetData("TravelerDuelLevel", nWorldClass + 1)
local nFullExp = 0
if mapCfg then
nFullExp = mapCfg.LevelUpExp
end
local sequence = DOTween.Sequence()
sequence:Append(NovaAPI.ImageDoFillAmount(self._mapNode.imgExp, 1, 0.65, true))
sequence:AppendCallback(function()
self:Refresh()
end)
sequence:AppendInterval(0.5)
sequence:Append(NovaAPI.ImageDoFillAmount(self._mapNode.imgExp, nCurExp / nFullExp, 0.5, true))
sequence:SetUpdate(true)
end
function TDClassUpgradeCtrl:Refresh()
local nWorldClass = PlayerData.TravelerDuel:GetTravelerDuelLevel()
local nWorldClassBefore = PlayerData.TravelerDuel:GetOldTDLevelData()
local mapCurCfg = ConfigTable.GetData("TravelerDuelLevel", nWorldClass)
local mapBeforeCfg = ConfigTable.GetData("TravelerDuelLevel", nWorldClassBefore)
NovaAPI.SetTMPText(self._mapNode.txtRankNum, nWorldClass)
NovaAPI.SetImageFillAmount(self._mapNode.imgExp, 0)
NovaAPI.SetTMPText(self._mapNode.txtEffect, ConfigTable.GetUIText("TD_TitleCurCoinAdd"))
NovaAPI.SetTMPText(self._mapNode.txtEffectValueBefore, mapBeforeCfg.CoinAdditionProb .. "%")
NovaAPI.SetTMPText(self._mapNode.txtEffectValueAfter, mapCurCfg.CoinAdditionProb .. "%")
end
function TDClassUpgradeCtrl:FadeIn()
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
end
function TDClassUpgradeCtrl:Awake()
end
function TDClassUpgradeCtrl:OnEnable()
local tbParam = self:GetPanelParam()
if nil ~= tbParam and nil ~= tbParam[1] then
self.cbClose = tbParam[1]
end
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
self._mapNode.goRoot.gameObject:SetActive(false)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
NovaAPI.UIEffectSnapShotCapture(self._mapNode.imgBlurredBg.gameObject)
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.goRoot.gameObject:SetActive(true)
self:SetOldWorldClass()
end
cs_coroutine.start(wait)
end
function TDClassUpgradeCtrl:OnDisable()
end
function TDClassUpgradeCtrl:OnDestroy()
end
function TDClassUpgradeCtrl:OnBtnClick_Close()
PlayerData.Base:SetWorldClassChange(false)
EventManager.Hit(EventId.ClosePanel, PanelId.TDLevelUpgrade)
if nil ~= self.cbClose then
self.cbClose()
end
end
return TDClassUpgradeCtrl
@@ -0,0 +1,18 @@
local TDClassUpgradePanel = class("TDClassUpgradePanel", BasePanel)
TDClassUpgradePanel._bIsMainPanel = false
TDClassUpgradePanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
TDClassUpgradePanel._tbDefine = {
{
sPrefabPath = "TravelerDuelLevelSelect/TDClassUpgradePanel.prefab",
sCtrlName = "Game.UI.TravelerDuelLevelSelect.TDClassUpgradeCtrl"
}
}
function TDClassUpgradePanel:Awake()
end
function TDClassUpgradePanel:OnEnable()
end
function TDClassUpgradePanel:OnDisable()
end
function TDClassUpgradePanel:OnDestroy()
end
return TDClassUpgradePanel
@@ -0,0 +1,95 @@
local TDCoverCtrl = class("TDCoverCtrl", BaseCtrl)
TDCoverCtrl._mapNodeConfig = {
TMPOpenTime = {sComponentName = "TMP_Text"},
btnChallenge = {
sComponentName = "UIButton",
callback = "OnBtnClick_Challenge"
},
btnChallengeOff = {
sComponentName = "UIButton",
callback = "OnBtnClick_ChallengeOff"
},
txtBtnChallenge = {
sComponentName = "TMP_Text",
nCount = 2,
sLanguageId = "TD_Btn_Challenge"
},
txtLockDesc = {sComponentName = "TMP_Text"},
imgPreview = {},
txtPreview = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_Cover_Preview"
}
}
TDCoverCtrl._mapEventConfig = {
TDLevelSelectIn = "OnEvent_PlayIn",
TDLevelSelectOut = "OnEvent_PlayOut"
}
function TDCoverCtrl:Refresh(mapChallenge, nLevelId, funcChallenge, bPreview)
self.funcChallenge = funcChallenge
local bUnlockLevel, sLock = PlayerData.TravelerDuel:GetTravelerChallengeUnlock()
local bUnlock = bUnlockLevel and mapChallenge.bUnlock
if bPreview then
self._mapNode.btnChallenge.gameObject:SetActive(false)
self._mapNode.btnChallengeOff.gameObject:SetActive(false)
self._mapNode.TMPOpenTime.gameObject:SetActive(false)
self._mapNode.imgPreview:SetActive(true)
else
self._mapNode.btnChallenge.gameObject:SetActive(bUnlock)
self._mapNode.btnChallengeOff.gameObject:SetActive(not bUnlock)
self._mapNode.TMPOpenTime.gameObject:SetActive(true)
self._mapNode.imgPreview:SetActive(false)
if not bUnlock then
local nPreLevel = ConfigTable.GetData("TravelerDuelBossLevel", nLevelId).PreLevelId
local mapPreCfg = ConfigTable.GetData("TravelerDuelBossLevel", nPreLevel)
local bPreLevelSuc = true
if nPreLevel ~= 0 then
local nPreStar = PlayerData.TravelerDuel:GetTravelerDuelLevelStar(nPreLevel)
bPreLevelSuc = 0 < nPreStar
end
if bPreLevelSuc == false then
sLock = orderedFormat(ConfigTable.GetUIText("TD_Lock_PreNormal"), orderedFormat(ConfigTable.GetUIText("Dungeon_Difficulty") or "", mapPreCfg.Name, ConfigTable.GetUIText("Diffculty_" .. mapPreCfg.Difficulty) or ""))
end
NovaAPI.SetTMPText(self._mapNode.txtLockDesc, sLock)
end
local openYear, openMonth, openDay = self:GetDate(mapChallenge.nOpenTime)
local closeYear, closeMonth, closeDay = self:GetDate(mapChallenge.nCloseTime)
NovaAPI.SetTMPText(self._mapNode.TMPOpenTime, string.format("<color=#FFFFFF>%d.%d.%d-%d.%d.%d</color>", openYear, openMonth, openDay, closeYear, closeMonth, closeDay))
end
end
function TDCoverCtrl:GetDate(nTs)
local nServerTimeStampWithTimeZone = nTs + CS.ClientManager.Instance.serverTimeZone * 3600
local nYear = tonumber(os.date("!%Y", nServerTimeStampWithTimeZone))
local nMonth = tonumber(os.date("!%m", nServerTimeStampWithTimeZone))
local nDay = tonumber(os.date("!%d", nServerTimeStampWithTimeZone))
return nYear, nMonth, nDay
end
function TDCoverCtrl:Awake()
self.ani = self.gameObject.transform:GetComponent("Animator")
end
function TDCoverCtrl:OnEnable()
end
function TDCoverCtrl:OnDisable()
end
function TDCoverCtrl:OnDestroy()
end
function TDCoverCtrl:OnBtnClick_Challenge()
self.ani:Play("ChallengeInfo_in")
if self.funcChallenge then
self.funcChallenge()
end
end
function TDCoverCtrl:OnBtnClick_ChallengeOff()
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("TD_ChallengeLock"))
end
function TDCoverCtrl:OnEvent_PlayIn(nType)
if nType == 1 then
self.ani:Play("TravelerDuelSelect_CoverRoot_in")
else
self.ani:Play("TravelerDuelSelect_CoverRoot_switch")
end
end
function TDCoverCtrl:OnEvent_PlayOut()
self.ani:Play("TravelerDuelInfo_CoverRoot_in")
end
return TDCoverCtrl
@@ -0,0 +1,48 @@
local TravelerDuelChallengeAffixGrid = class("TravelerDuelChallengeAffixGrid", BaseCtrl)
TravelerDuelChallengeAffixGrid._mapNodeConfig = {
imgSelect = {},
imgGroupMask = {},
imgLock = {},
imgHardMask = {},
TMPLockCond = {sComponentName = "TMP_Text"},
imgAffixIcon = {sComponentName = "Image"},
TMPHard = {sComponentName = "TMP_Text"},
TMPHardMask = {sComponentName = "TMP_Text"},
imgLine = {},
btnGrid = {sComponentName = "UIButton"}
}
TravelerDuelChallengeAffixGrid._mapEventConfig = {}
function TravelerDuelChallengeAffixGrid:Refresh(nAffixId, bSelect, bGroupMask, bLine)
if nAffixId == 0 then
self._mapNode.btnGrid.gameObject:SetActive(false)
return
else
self._mapNode.btnGrid.gameObject:SetActive(true)
end
local bUnlock, nType, nCond = PlayerData.TravelerDuel:GetTravelerDuelAffixUnlock(nAffixId)
self.bUnlock = bUnlock
local mapAffixCfgData = ConfigTable.GetData("TravelerDuelChallengeAffix", nAffixId)
self._mapNode.imgLine:SetActive(bLine)
self:SetPngSprite(self._mapNode.imgAffixIcon, mapAffixCfgData.Icon)
NovaAPI.SetTMPText(self._mapNode.TMPHard, mapAffixCfgData.Difficulty)
NovaAPI.SetTMPText(self._mapNode.TMPHardMask, mapAffixCfgData.Difficulty)
self._mapNode.imgSelect:SetActive(bSelect)
self._mapNode.btnGrid.interactable = not bGroupMask and self.bUnlock
self._mapNode.imgGroupMask:SetActive(bGroupMask or not bUnlock)
self._mapNode.imgHardMask:SetActive(bGroupMask or not bUnlock)
self._mapNode.TMPHardMask.gameObject:SetActive(bGroupMask or not bUnlock)
self._mapNode.imgLock:SetActive(not bUnlock)
if not bUnlock then
NovaAPI.SetTMPText(self._mapNode.TMPLockCond, orderedFormat(ConfigTable.GetUIText("TD_AffixCond" .. nType), nType))
end
end
function TravelerDuelChallengeAffixGrid:SetSelect(bSelect)
self._mapNode.imgSelect:SetActive(bSelect)
end
function TravelerDuelChallengeAffixGrid:SetGroupMask(bGroupSelect)
self._mapNode.imgGroupMask:SetActive(bGroupSelect or not self.bUnlock)
self._mapNode.imgHardMask:SetActive(bGroupSelect or not self.bUnlock)
self._mapNode.TMPHardMask.gameObject:SetActive(bGroupSelect or not self.bUnlock)
self._mapNode.btnGrid.interactable = not bGroupSelect and self.bUnlock
end
return TravelerDuelChallengeAffixGrid
@@ -0,0 +1,581 @@
local TravelerDuelChallengeInfoCtrl = class("TravelerDuelChallengeInfoCtrl", BaseCtrl)
local ConfigData = require("GameCore.Data.ConfigData")
TravelerDuelChallengeInfoCtrl._mapNodeConfig = {
svAffixSelect = {
sComponentName = "LoopScrollView"
},
txtTitleHard = {
sComponentName = "TMP_Text",
sLanguageId = "TD_AffixHardLevelTitle"
},
txtTitleAffix = {
sComponentName = "TMP_Text",
sLanguageId = "TD_SelectedAffixTitle"
},
gridAffix = {},
rtAffixListContent = {sComponentName = "Transform"},
ContentAffixSelect = {sComponentName = "Transform"},
TMPTitleChallengeAttr = {
sComponentName = "TMP_Text",
sLanguageId = "TD_EnemyAttrTitle"
},
TMPTitleChallengeScore = {
sComponentName = "TMP_Text",
sLanguageId = "TD_ScoreTitle"
},
TMPChallengeAttr = {sComponentName = "TMP_Text"},
TMPChallengeScore = {sComponentName = "TMP_Text"},
TMPCurLevel = {sComponentName = "TMP_Text"},
txtRecommendLevelChallenge = {sComponentName = "TMP_Text"},
imgElementInfoChallenge = {sComponentName = "Image", nCount = 3},
imgChallengeCover = {sComponentName = "Transform"},
btnGoChallenge = {
sComponentName = "UIButton",
callback = "OnBtnClick_Go"
},
txtBtnGoChallenge = {
sComponentName = "TMP_Text",
sLanguageId = "Maninline_Btn_Go"
},
btnDuelQuest = {
sComponentName = "UIButton",
callback = "OnBtnClick_Quest"
},
txtAffixSelectTitle = {
sComponentName = "TMP_Text",
sLanguageId = "TD_AffixSelectTitle"
},
btnClearSelect = {
sComponentName = "UIButton",
callback = "OnBtnClick_ClearAllAffix"
},
txtClearSelect = {
sComponentName = "TMP_Text",
sLanguageId = "TD_ClearAffixTitle"
},
srAffixList = {
sComponentName = "UIScrollToClick"
},
redDotDuelQuest2 = {},
goEmpty = {},
txtEmpty = {
sComponentName = "TMP_Text",
sLanguageId = "TDEmptyAffix"
},
TMPRecommendBuildTitleChallenge = {
sComponentName = "TMP_Text",
sLanguageId = "InfinityTower_Recommend_Construct"
},
imgReconmendBuildChallenge = {sComponentName = "Image"},
imgRankingIcon = {sComponentName = "Image"},
TMPRanking = {sComponentName = "TMP_Text"},
TMPScore = {sComponentName = "TMP_Text"},
TMPUploadTimes = {sComponentName = "TMP_Text"},
btnRankingHint = {
sComponentName = "UIButton",
callback = "OnBtnClick_RankingHint"
},
rtRanking = {},
rtEmpty = {},
TMPEmptyHint = {
sComponentName = "TMP_Text",
sLanguageId = "STRanking_Empty"
},
txtBtnRankingDetail = {
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Rank_Score_Detail"
}
}
TravelerDuelChallengeInfoCtrl._mapEventConfig = {}
TravelerDuelChallengeInfoCtrl._mapRedDotConfig = {
[RedDotDefine.Map_TravelerDuel] = {
sNodeName = "redDotDuelQuest2"
}
}
function TravelerDuelChallengeInfoCtrl:Awake()
end
function TravelerDuelChallengeInfoCtrl:FadeIn()
end
function TravelerDuelChallengeInfoCtrl:FadeOut()
end
function TravelerDuelChallengeInfoCtrl:OnEnable()
end
function TravelerDuelChallengeInfoCtrl:OnDisable()
if self.goCover ~= nil then
self:UnbindCoverBtn(self.goCover)
delChildren(self._mapNode.imgChallengeCover)
self.goCover = nil
end
self:ClearListGrids()
end
function TravelerDuelChallengeInfoCtrl:OnDestroy()
end
function TravelerDuelChallengeInfoCtrl:OnRelease()
end
function TravelerDuelChallengeInfoCtrl:Refresh(nLevelId)
self:ClearListGrids()
local mapBossLevelData = ConfigTable.GetData("TravelerDuelBossLevel", nLevelId)
if mapBossLevelData == nil then
return
end
self.nLevelId = nLevelId
if self.goCover ~= nil then
self:UnbindCoverBtn(self.goCover)
delChildren(self._mapNode.imgChallengeCover)
self.goCover = nil
end
local coverPrefab = self:LoadAsset(string.format("%s.prefab", mapBossLevelData.Cover))
self.goCover = instantiate(coverPrefab, self._mapNode.imgChallengeCover)
self:BindCoverBtn(self.goCover)
local mapLevel = ConfigTable.GetData("TravelerDuelChallengeDifficulty", 0)
if mapLevel ~= nil then
local rBuildRank = mapLevel.RecommendBuildRank
local sScore = "Icon/BuildRank/BuildRank_" .. rBuildRank
self:SetPngSprite(self._mapNode.imgReconmendBuildChallenge, sScore)
NovaAPI.SetTMPText(self._mapNode.TMPChallengeScore, mapLevel.BaseScore)
NovaAPI.SetTMPText(self._mapNode.TMPChallengeAttr, string.format("%d%%", mapLevel.Attr))
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevelChallenge, mapLevel.RecommendScore)
else
NovaAPI.SetTMPText(self._mapNode.TMPChallengeScore, "0")
NovaAPI.SetTMPText(self._mapNode.TMPChallengeAttr, "0%")
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevelChallenge, "0")
local sScore = "Icon/BuildRank/BuildRank_" .. 1
self:SetPngSprite(self._mapNode.imgReconmendBuildChallenge, sScore)
end
NovaAPI.SetTMPText(self._mapNode.TMPCurLevel, "0")
self.mapChallengeData = PlayerData.TravelerDuel:GetTravelerDuelChallenge()
for i = 1, 3 do
if mapBossLevelData.EET == nil or mapBossLevelData.EET[i] == nil then
self._mapNode.imgElementInfoChallenge[i].gameObject:SetActive(false)
else
self._mapNode.imgElementInfoChallenge[i].gameObject:SetActive(true)
self:SetAtlasSprite(self._mapNode.imgElementInfoChallenge[i], "12_rare", AllEnum.ElementIconType.Icon .. mapBossLevelData.EET[i])
end
end
self.selectedAffixIds = {}
self.tbAllAffix = {}
self.lastSelAffixId = nil
local tbAffixCfgData = ConfigTable.GetData("TravelerDuelChallengeSeason", self.mapChallengeData.nIdx)
if tbAffixCfgData == nil then
printError("Season Data Missing" .. self.mapChallengeData.nIdx)
return
end
local tbRawData = decodeJson(tbAffixCfgData.AffixGroupIds)
local mapAffixes = {}
if tbRawData ~= nil then
local forEachAffix = function(mapData)
if table.indexof(tbRawData, mapData.GroupId) > 0 and mapData.GroupId ~= 0 then
if mapAffixes[mapData.GroupId] == nil then
mapAffixes[mapData.GroupId] = {}
end
table.insert(mapAffixes[mapData.GroupId], mapData.Id)
end
end
ForEachTableLine(DataTable.TravelerDuelChallengeAffix, forEachAffix)
else
self._mapNode.svAffixSelect:Init(0, self, self.OnGridRefresh, self.OnBtnClickGrid)
return
end
local Sort = function(a, b)
local mapCfgDataA = ConfigTable.GetData("TravelerDuelChallengeAffix", a)
local mapCfgDataB = ConfigTable.GetData("TravelerDuelChallengeAffix", b)
if mapCfgDataA == nil or mapCfgDataB == nil then
return mapCfgDataA ~= nil
end
if mapCfgDataA.Difficulty ~= mapCfgDataB.Difficulty then
return mapCfgDataA.Difficulty < mapCfgDataB.Difficulty
end
return a[1] < b[1]
end
for _, tbAffixes in pairs(mapAffixes) do
table.sort(tbAffixes, Sort)
end
for _, nGroupId in ipairs(tbRawData) do
if nGroupId == 0 then
table.insert(self.tbAllAffix, {0, 0})
elseif mapAffixes[nGroupId] ~= nil then
for _, value in ipairs(mapAffixes[nGroupId]) do
table.insert(self.tbAllAffix, {value, nGroupId})
end
end
end
local nCount = #self.tbAllAffix
self._mapNode.svAffixSelect:Init(nCount, self, self.OnGridRefresh, self.OnBtnClickGrid)
self:InitCachedSelectedGridState()
local mapSelfRanking, _, _, nTimes = PlayerData.TravelerDuel:GetTDRankingData()
NovaAPI.SetTMPText(self._mapNode.TMPUploadTimes, orderedFormat(ConfigTable.GetUIText("TDRanking_UploadTimes"), nTimes))
self.bHasUploadRankingTimes = 0 < nTimes
if mapSelfRanking ~= nil then
self._mapNode.rtRanking:SetActive(true)
self._mapNode.rtEmpty:SetActive(false)
self:SetAtlasSprite(self._mapNode.imgRankingIcon, "12_rare", "travelerduel_rank_" .. mapSelfRanking.nRewardIdx)
if mapSelfRanking.nRewardIdx == 4 then
local nRanking = ConfigTable.GetData("TravelerDuelChallengeRankReward", 4).RankUpper * ConfigData.IntFloatPrecision * 100
NovaAPI.SetTMPText(self._mapNode.TMPRanking, orderedFormat(ConfigTable.GetUIText("TravelerDuel_ChallengeRankTitle1"), nRanking))
else
NovaAPI.SetTMPText(self._mapNode.TMPRanking, orderedFormat(ConfigTable.GetUIText("TravelerDuel_ChallengeRankTitle2"), mapSelfRanking.Rank))
end
NovaAPI.SetTMPText(self._mapNode.TMPScore, orderedFormat(ConfigTable.GetUIText("TravelerDuel_ChallengeRankScore"), mapSelfRanking.Score))
else
self._mapNode.rtRanking:SetActive(false)
self._mapNode.rtEmpty:SetActive(true)
end
end
function TravelerDuelChallengeInfoCtrl:BindCoverBtn(goCover)
local btnInfo = goCover.transform:Find("btnEnemyInfoChallengeInfo")
if btnInfo ~= nil then
local compBtn = btnInfo:GetComponent("UIButton")
if compBtn ~= nil then
compBtn.onClick:AddListener(function()
self:OnBtnClick_EnemyInfo()
end)
end
end
end
function TravelerDuelChallengeInfoCtrl:UnbindCoverBtn(goCover)
local btnInfo = goCover.transform:Find("btnEnemyInfoChallengeInfo")
if btnInfo ~= nil then
local compBtn = btnInfo:GetComponent("UIButton")
if compBtn ~= nil then
compBtn.onClick:RemoveAllListeners()
end
end
end
function TravelerDuelChallengeInfoCtrl:InitCachedSelectedGridState()
local cachedAffixes, cachedBossId = PlayerData.TravelerDuel:GetCacheAffixids()
if cachedAffixes ~= nil then
for index, nAffixId in ipairs(cachedAffixes) do
local grid = self:GetGridByDataID(nAffixId)
if grid ~= nil then
self:OnBtnClickGrid(grid)
self:RefreshGridSelectState(grid, nAffixId, false)
else
self:AddAffixGrid(nAffixId)
end
end
end
end
function TravelerDuelChallengeInfoCtrl:OnGridRefresh(goGrid, gridIndex)
if self.mapAffixGrid[goGrid] == nil then
self.mapAffixGrid[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.TravelerDuelLevelSelect.TravelerDuelChallengeAffixGrid")
end
local nIdx = gridIndex + 1
local tbData = self.tbAllAffix[nIdx]
local bLine = self.tbAllAffix[nIdx + 1] ~= nil and self.tbAllAffix[nIdx + 1][2] == tbData[2]
local bSelect = table.indexof(self.selectedAffixIds, tbData[1]) > 0
local bGroupMask = false
if not bSelect then
for _, nSelectId in ipairs(self.selectedAffixIds) do
local mapAffixCfgDataSelect = ConfigTable.GetData("TravelerDuelChallengeAffix", nSelectId)
if mapAffixCfgDataSelect == nil then
return
end
if mapAffixCfgDataSelect.GroupId == tbData[2] then
bGroupMask = true
break
end
end
end
local imgFocus = goGrid.transform:Find("btnGrid/imgFocus")
local bFocus = tbData[1] == self.lastSelAffixId
if bFocus then
if imgFocus ~= nil then
imgFocus.gameObject:SetActive(true)
end
elseif imgFocus ~= nil then
imgFocus.gameObject:SetActive(false)
end
if nIdx >= goGrid.transform.parent.childCount then
goGrid.transform:SetAsLastSibling()
else
goGrid.transform:SetSiblingIndex(nIdx)
end
self.mapAffixGrid[goGrid]:Refresh(tbData[1], bSelect, bGroupMask, bLine)
end
function TravelerDuelChallengeInfoCtrl:RefreshGridSelectState(goGrid, affixId, bSelect)
if goGrid == nil then
return
end
if bSelect then
self.lastSelAffixId = affixId
else
self.lastSelAffixId = nil
end
local imgFocus = goGrid.transform:Find("btnGrid/imgFocus")
if imgFocus ~= nil then
imgFocus.gameObject:SetActive(bSelect)
end
local strId = tostring(affixId)
for index, nAffixId in ipairs(self.selectedAffixIds) do
local grid = self.tbAffixGrid[index]
if grid == nil then
printError("词条数量错误")
return
end
local selNode = grid.transform:Find("selNode")
local bindGrid = grid.transform:Find("BindGridID")
if bindGrid ~= nil and selNode ~= nil then
do
local textComp = bindGrid.gameObject:GetComponent("Text")
if textComp ~= nil then
local text = NovaAPI.GetText(textComp)
if text == strId then
selNode.gameObject:SetActive(bSelect)
if bSelect then
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.srAffixList:ScrollToClick(grid)
end
cs_coroutine.start(wait)
end
else
selNode.gameObject:SetActive(false)
end
end
end
end
end
end
function TravelerDuelChallengeInfoCtrl:GetGridByDataID(dataID)
local grid
for index, tbData in ipairs(self.tbAllAffix) do
if dataID == tbData[1] then
grid = self._mapNode.ContentAffixSelect:Find(tostring(index - 1))
break
end
end
return grid
end
function TravelerDuelChallengeInfoCtrl:OnBtnClickGrid(goGrid, gridIndex)
if self.mapAffixGrid[goGrid] == nil then
self.mapAffixGrid[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.TravelerDuelLevelSelect.TravelerDuelChallengeAffixGrid")
end
gridIndex = gridIndex or tonumber(goGrid.name)
local nIdx = gridIndex + 1
local tbData = self.tbAllAffix[nIdx]
if self.lastSelAffixId ~= nil then
local lastGrid = self:GetGridByDataID(self.lastSelAffixId)
self:RefreshGridSelectState(lastGrid, self.lastSelAffixId, false)
end
if table.indexof(self.selectedAffixIds, tbData[1]) > 0 then
self:RemoveAffixGrid(tbData[1])
self.mapAffixGrid[goGrid]:SetSelect(false)
for index, Data in ipairs(self.tbAllAffix) do
if index ~= nIdx and Data[2] == tbData[2] then
local goGridAffix = self._mapNode.ContentAffixSelect:Find(tostring(index - 1)).gameObject
if goGridAffix ~= nil and self.mapAffixGrid[goGridAffix] ~= nil then
self.mapAffixGrid[goGridAffix]:SetGroupMask(false)
end
end
end
self:RefreshGridSelectState(goGrid, tbData[1], false)
else
self:AddAffixGrid(tbData[1])
self.mapAffixGrid[goGrid]:SetSelect(true)
for index, Data in ipairs(self.tbAllAffix) do
if index ~= nIdx and Data[2] == tbData[2] then
local goGridAffix = self._mapNode.ContentAffixSelect:Find(tostring(index - 1)).gameObject
if goGridAffix ~= nil and self.mapAffixGrid[goGridAffix] ~= nil then
self.mapAffixGrid[goGridAffix]:SetGroupMask(true)
end
end
end
self:RefreshGridSelectState(goGrid, tbData[1], true)
end
end
function TravelerDuelChallengeInfoCtrl:ClearListGrids()
if self.tbAffixGrid ~= nil then
for _, goAffixGrid in ipairs(self.tbAffixGrid) do
destroy(goAffixGrid)
end
end
self.tbAffixGrid = {}
if self.mapAffixGrid ~= nil then
for go, mapCtrl in ipairs(self.mapAffixGrid) do
self:UnbindCtrlByNode(mapCtrl)
end
end
self.mapAffixGrid = {}
end
function TravelerDuelChallengeInfoCtrl:AddAffixGrid(nAffixId)
local Sort = function(a, b)
local mapCfgDataA = ConfigTable.GetData("TravelerDuelChallengeAffix", a)
local mapCfgDataB = ConfigTable.GetData("TravelerDuelChallengeAffix", b)
if mapCfgDataA == nil or mapCfgDataB == nil then
return mapCfgDataA ~= nil
end
if mapCfgDataA.Difficulty ~= mapCfgDataB.Difficulty then
return mapCfgDataA.Difficulty < mapCfgDataB.Difficulty
end
return a < b
end
table.insert(self.selectedAffixIds, nAffixId)
table.sort(self.selectedAffixIds, Sort)
local goAffix = instantiate(self._mapNode.gridAffix, self._mapNode.rtAffixListContent)
goAffix:SetActive(true)
table.insert(self.tbAffixGrid, goAffix)
self:RefreshAffixList()
end
function TravelerDuelChallengeInfoCtrl:RemoveAffixGrid(nAffixId)
table.removebyvalue(self.selectedAffixIds, nAffixId)
local go = table.remove(self.tbAffixGrid)
destroy(go)
self:RefreshAffixList()
end
function TravelerDuelChallengeInfoCtrl:OnClickAffixListButton(goGrid, affixId)
for index, nAffixId in ipairs(self.selectedAffixIds) do
local grid = self.tbAffixGrid[index]
if grid == nil then
printError("词条数量错误")
return
end
local node = grid.transform:Find("selNode")
if node ~= nil then
node.gameObject:SetActive(false)
end
end
local selNode = goGrid.transform:Find("selNode")
if selNode ~= nil then
selNode.gameObject:SetActive(true)
local selIndex
for index, Data in ipairs(self.tbAllAffix) do
local id = Data[1]
if id == affixId then
selIndex = index - 1
end
end
if selIndex ~= nil then
self._mapNode.svAffixSelect:SetScrollGridPos(selIndex, 0, 1)
printLog("取消" .. tostring(self.lastSelAffixId))
if self.lastSelAffixId ~= nil then
local goGridAffix = self:GetGridByDataID(self.lastSelAffixId)
if goGridAffix ~= nil then
local gameObj = goGridAffix.gameObject
local imgFocus = gameObj.transform:Find("btnGrid/imgFocus")
if imgFocus ~= nil then
imgFocus.gameObject:SetActive(false)
end
end
end
self.lastSelAffixId = affixId
printLog("选中" .. tostring(selIndex))
if self.lastSelAffixId ~= nil then
local goGridAffix = self:GetGridByDataID(self.lastSelAffixId)
if goGridAffix ~= nil then
printLog("herer")
local gameObj = goGridAffix.gameObject
local imgFocus = gameObj.transform:Find("btnGrid/imgFocus")
if imgFocus ~= nil then
imgFocus.gameObject:SetActive(true)
end
end
end
end
end
end
function TravelerDuelChallengeInfoCtrl:RefreshAffixList()
local nTotalDifficulty = 0
self._mapNode.goEmpty:SetActive(0 >= #self.tbAffixGrid)
for index, nAffixId in ipairs(self.selectedAffixIds) do
local goGrid = self.tbAffixGrid[index]
if goGrid == nil then
printError("词条数量错误")
return
end
local button = goGrid.transform:GetComponent("Button")
if button ~= nil then
button.onClick:RemoveAllListeners()
local listener = function()
self:OnClickAffixListButton(goGrid, nAffixId)
end
button.onClick:AddListener(listener)
end
local mapAffixCfgData = ConfigTable.GetData("TravelerDuelChallengeAffix", nAffixId)
local imgAffixIcon = goGrid.transform:Find("imgAffixIconBg/imgAffixIcon"):GetComponent("Image")
local TMPAffixDesc = goGrid.transform:Find("TMPAffixDesc"):GetComponent("TMP_Text")
local TMPHard = goGrid.transform:Find("imgHardBg/TMPHard"):GetComponent("TMP_Text")
local bindGrid = goGrid.transform:Find("BindGridID")
if bindGrid ~= nil then
local textComp = bindGrid.gameObject:GetComponent("Text")
if textComp ~= nil then
NovaAPI.SetText(textComp, tostring(nAffixId))
end
end
self:SetPngSprite(imgAffixIcon, mapAffixCfgData.Icon)
NovaAPI.SetTMPText(TMPAffixDesc, mapAffixCfgData.Desc)
NovaAPI.SetTMPText(TMPHard, mapAffixCfgData.Difficulty)
nTotalDifficulty = nTotalDifficulty + mapAffixCfgData.Difficulty
end
NovaAPI.SetTMPText(self._mapNode.TMPCurLevel, nTotalDifficulty)
local mapLevel = ConfigTable.GetData("TravelerDuelChallengeDifficulty", nTotalDifficulty)
if mapLevel == nil then
for i = nTotalDifficulty, 0, -1 do
if ConfigTable.GetData("TravelerDuelChallengeDifficulty", i) ~= nil then
mapLevel = ConfigTable.GetData("TravelerDuelChallengeDifficulty", i)
break
end
end
end
if mapLevel ~= nil then
local rBuildRank = mapLevel.RecommendBuildRank
local sScore = "Icon/BuildRank/BuildRank_" .. rBuildRank
self:SetPngSprite(self._mapNode.imgReconmendBuildChallenge, sScore)
NovaAPI.SetTMPText(self._mapNode.TMPChallengeScore, mapLevel.BaseScore)
NovaAPI.SetTMPText(self._mapNode.TMPChallengeAttr, string.format("%d%%", mapLevel.Attr))
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevelChallenge, mapLevel.RecommendScore)
else
local sScore = "Icon/BuildRank/BuildRank_" .. 1
self:SetPngSprite(self._mapNode.imgReconmendBuildChallenge, sScore)
NovaAPI.SetTMPText(self._mapNode.TMPChallengeScore, "0")
NovaAPI.SetTMPText(self._mapNode.TMPChallengeAttr, "0%")
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevelChallenge, "0")
end
end
function TravelerDuelChallengeInfoCtrl:CacheAffixes()
if self.nLevelId == nil or self.nLevelId == 0 then
return
end
local mapBossLevelData = ConfigTable.GetData("TravelerDuelBossLevel", self.nLevelId)
PlayerData.TravelerDuel:SetCacheAffixids(self.selectedAffixIds, mapBossLevelData.BossId)
end
function TravelerDuelChallengeInfoCtrl:OnBtnClick_ClearAllAffix()
self.selectedAffixIds = {}
if self.tbAffixGrid ~= nil then
for _, goAffixGrid in ipairs(self.tbAffixGrid) do
destroy(goAffixGrid)
end
end
self._mapNode.svAffixSelect:ForceRefresh()
self.tbAffixGrid = {}
self:RefreshAffixList()
end
function TravelerDuelChallengeInfoCtrl:OnBtnClick_Go()
local confirmCallback = function()
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.TravelerDuel, self.nLevelId, self.selectedAffixIds)
end
self:CacheAffixes()
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
end
local msg = {
nType = AllEnum.MessageBox.Confirm,
sContent = ConfigTable.GetUIText("TravelerDuel_Rank_Continue_Notice"),
callbackConfirm = confirmCallback
}
if self.bHasUploadRankingTimes then
confirmCallback()
else
EventManager.Hit(EventId.OpenMessageBox, msg)
end
end
function TravelerDuelChallengeInfoCtrl:OnBtnClick_Quest()
self:CacheAffixes()
EventManager.Hit(EventId.OpenPanel, PanelId.TravelerDuelLevelQuestPanel)
end
function TravelerDuelChallengeInfoCtrl:OnBtnClick_RankingHint()
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("TD_RankingHint"))
end
function TravelerDuelChallengeInfoCtrl:OnBtnClick_EnemyInfo()
EventManager.Hit("OpenTravelerDuelMonsterInfo", self.nLevelId)
end
return TravelerDuelChallengeInfoCtrl
@@ -0,0 +1,49 @@
local TravelerDuelLevelGridCtrl = class("TravelerDuelLevelGridCtrl", BaseCtrl)
TravelerDuelLevelGridCtrl._mapNodeConfig = {
imgLevelChar = {sComponentName = "Image"},
imgMask = {sComponentName = "Image"},
txtLock = {
sComponentName = "TMP_Text",
sLanguageId = "TD_Lock_Normal"
},
TMPRewardTitle = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_LevelRewardTitle"
},
TMPTravelerLevelName = {sComponentName = "TMP_Text"},
btnGrid = {sComponentName = "UIButton"},
rewardItem = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
nCount = 2
}
}
TravelerDuelLevelGridCtrl._mapEventConfig = {}
function TravelerDuelLevelGridCtrl:Refresh(nBossId, nBossLevelId)
local mapLevelCfgData = ConfigTable.GetData("TravelerDuelBoss", nBossId)
if mapLevelCfgData == nil then
printError("TravelerDuelBoss Data Missing:" .. nBossId)
self.gameObject:SetActive(false)
return
end
self:SetPngSprite(self._mapNode.imgLevelChar, mapLevelCfgData.Image)
self:SetPngSprite(self._mapNode.imgMask, mapLevelCfgData.Image)
local bUnlock = PlayerData.TravelerDuel:GetTravelerDuelLevelUnlock(nBossLevelId)
self._mapNode.imgMask.gameObject:SetActive(not bUnlock)
local totalRewardCount = ConfigTable.GetConfigValue("TravelerDuelWeeklyAwardLimit")
NovaAPI.SetTMPText(self._mapNode.TMPTravelerLevelName, mapLevelCfgData.Name)
local nRewardCount = PlayerData.TravelerDuel:GetTravelerDuelLevelRewardCount(nBossId)
nRewardCount = -1 < nRewardCount and totalRewardCount - nRewardCount or totalRewardCount
if nRewardCount < 0 then
nRewardCount = 0
end
self._mapNode.btnGrid.interactable = true
for i = 1, 2 do
if mapLevelCfgData.ShowReward[i] ~= nil then
self._mapNode.rewardItem[i].gameObject:SetActive(true)
self._mapNode.rewardItem[i]:SetItem(mapLevelCfgData.ShowReward[i], nil, nil, nil, false, false, false, false, false)
else
self._mapNode.rewardItem[i].gameObject:SetActive(false)
end
end
end
return TravelerDuelLevelGridCtrl
@@ -0,0 +1,96 @@
local TravelerDuelLevelInfoCtrl = class("TravelerDuelLevelInfoCtrl", BaseCtrl)
local nFullLength = 514
TravelerDuelLevelInfoCtrl._mapNodeConfig = {
TMPDuelLevelInfo = {sComponentName = "TMP_Text"},
TMPDuelExpInfo = {sComponentName = "TMP_Text"},
imgExpBarFillMaskInfo = {
sComponentName = "RectTransform"
},
TMPAddInfo = {sComponentName = "TMP_Text"},
svLevelInfo = {
sComponentName = "LoopScrollView"
},
btnCloseLevelInfoScreen = {
sComponentName = "Button",
callback = "OnBtnClick_Close"
},
btnCloseLevelInfo = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
txtTitleCurLevel = {
sComponentName = "TMP_Text",
sLanguageId = "TD_TitleCurLevel"
},
txtTitletxtTitleCurExp = {
sComponentName = "TMP_Text",
sLanguageId = "TD_LevelExp"
},
txtTitleCoinAdd = {
sComponentName = "TMP_Text",
sLanguageId = "TD_TitleCurCoinAdd"
}
}
TravelerDuelLevelInfoCtrl._mapEventConfig = {}
function TravelerDuelLevelInfoCtrl:Awake()
end
function TravelerDuelLevelInfoCtrl:FadeIn()
end
function TravelerDuelLevelInfoCtrl:FadeOut()
end
function TravelerDuelLevelInfoCtrl:OnEnable()
self.tbLevelInfo = {}
local ForEachLevel = function(mapData)
table.insert(self.tbLevelInfo, mapData)
end
ForEachTableLine(DataTable.TravelerDuelLevel, ForEachLevel)
local Sort = function(a, b)
return a.Id < b.Id
end
table.sort(self.tbLevelInfo, Sort)
self.nDuelLevel, self.nDuelExp = PlayerData.TravelerDuel:GetTravelerDuelLevel()
local mapExp = ConfigTable.GetData("TravelerDuelLevel", self.nDuelLevel + 1)
self.nTotalExp = 0
if mapExp ~= nil then
self.nTotalExp = mapExp.LevelUpExp
end
NovaAPI.SetTMPText(self._mapNode.TMPDuelLevelInfo, self.nDuelLevel)
NovaAPI.SetTMPText(self._mapNode.TMPAddInfo, string.format("%d%%", self.tbLevelInfo[self.nDuelLevel].CoinAdditionProb))
NovaAPI.SetTMPText(self._mapNode.TMPDuelExpInfo, string.format("<size=37><color=#3b62ae>%d</color></size>/%d", self.nDuelExp, self.nTotalExp))
if self.nTotalExp > 0 then
NovaAPI.SetTMPText(self._mapNode.TMPDuelExpInfo, string.format("<size=37><color=#3b62ae>%d</color></size>/%d", self.nDuelExp, self.nTotalExp))
self._mapNode.imgExpBarFillMaskInfo.sizeDelta = Vector2(nFullLength * (self.nDuelExp / self.nTotalExp), self._mapNode.imgExpBarFillMaskInfo.sizeDelta.y)
else
NovaAPI.SetTMPText(self._mapNode.TMPDuelExpInfo, "Max")
self._mapNode.imgExpBarFillMaskInfo.sizeDelta = Vector2(nFullLength, self._mapNode.imgExpBarFillMaskInfo.sizeDelta.y)
end
self.gameObject:SetActive(false)
end
function TravelerDuelLevelInfoCtrl:OnDisable()
end
function TravelerDuelLevelInfoCtrl:OnDestroy()
end
function TravelerDuelLevelInfoCtrl:OnRelease()
end
function TravelerDuelLevelInfoCtrl:OnGridRefresh(goGrid, gridIndex)
local nIdx = gridIndex + 1
local tmpLevel = goGrid.transform:Find("btnGrid/AnimRoot/imgBg/TMPLevel"):GetComponent("TMP_Text")
local TMPLevelAdd = goGrid.transform:Find("btnGrid/AnimRoot/imgBg/TMPLevelAdd"):GetComponent("TMP_Text")
local imgLevelBgCur = goGrid.transform:Find("btnGrid/AnimRoot/imgBg/imgLevelBgCur").gameObject
local imgLevelBgCurBg = goGrid.transform:Find("btnGrid/AnimRoot/imgLevelBgCur").gameObject
local TMPLevelTitle = goGrid.transform:Find("btnGrid/AnimRoot/imgBg/TMPLevelTitle"):GetComponent("TMP_Text")
local mapLevel = self.tbLevelInfo[nIdx]
NovaAPI.SetTMPText(tmpLevel, mapLevel.Id)
NovaAPI.SetTMPText(TMPLevelTitle, ConfigTable.GetUIText("TD_LevelTitle"))
NovaAPI.SetTMPText(TMPLevelAdd, mapLevel.CoinAdditionProb .. "%")
imgLevelBgCur:SetActive(mapLevel.Id == self.nDuelLevel)
imgLevelBgCurBg:SetActive(mapLevel.Id == self.nDuelLevel)
end
function TravelerDuelLevelInfoCtrl:Show()
self.gameObject:SetActive(true)
self._mapNode.svLevelInfo:Init(#self.tbLevelInfo, self, self.OnGridRefresh)
end
function TravelerDuelLevelInfoCtrl:OnBtnClick_Close()
self.gameObject:SetActive(false)
end
return TravelerDuelLevelInfoCtrl
@@ -0,0 +1,18 @@
local TravelerDuelLevelPanel = class("TravelerDuelLevelPanel", BasePanel)
TravelerDuelLevelPanel._tbDefine = {
{
sPrefabPath = "TravelerDuelLevelSelect/TravelerDuelLevelPanel.prefab",
sCtrlName = "Game.UI.TravelerDuelLevelSelect.TravelerDuelLevelSelectCtrl"
}
}
function TravelerDuelLevelPanel:Awake()
end
function TravelerDuelLevelPanel:OnEnable()
end
function TravelerDuelLevelPanel:OnDisable()
end
function TravelerDuelLevelPanel:OnDestroy()
end
function TravelerDuelLevelPanel:OnRelease()
end
return TravelerDuelLevelPanel
@@ -0,0 +1,851 @@
local TravelerDuelLevelSelectCtrl = class("TravelerDuelLevelSelectCtrl", BaseCtrl)
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local LocalSettingData = require("GameCore.Data.LocalSettingData")
local Path = require("path")
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local ResTypeAny = GameResourceLoader.ResType.Any
local typeof = typeof
local mapToggle = {
[0] = "Challenge",
[1] = GameEnum.diffculty.Diffculty_1,
[2] = GameEnum.diffculty.Diffculty_2,
[3] = GameEnum.diffculty.Diffculty_3,
[4] = GameEnum.diffculty.Diffculty_4
}
TravelerDuelLevelSelectCtrl._mapNodeConfig = {
aniRoot = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "Animator"
},
bgLevelInfo = {sNodeName = "----Bg----"},
rt_TravelerDuelSelect = {},
rt_TravelerDuelInfo = {},
RImagChar = {sComponentName = "RawImage"},
rt_ChallengeInfo = {
sCtrlName = "Game.UI.TravelerDuelLevelSelect.TravelerDuelChallengeInfoCtrl"
},
Skill = {
sCtrlName = "Game.UI.TemplateEx.TemplateSkillCtrl",
nCount = 5
},
btnSkill = {
sNodeName = "Skill",
sComponentName = "UIButton",
nCount = 5,
callback = "OnBtnClick_Skill"
},
btnGo = {
sComponentName = "UIButton",
callback = "OnBtnClick_Go"
},
svTravelerDuel = {
sComponentName = "LoopScrollView"
},
imgElementInfo = {sComponentName = "Image", nCount = 3},
TMPTravelerDesc = {sComponentName = "TMP_Text"},
TMPTravelerLevelNameNormal = {sComponentName = "TMP_Text"},
TMPRecommendBuildTitle = {
sComponentName = "TMP_Text",
sLanguageId = "InfinityTower_Recommend_Construct"
},
imgReconmendBuild = {sComponentName = "Image"},
txtRecommendLevel = {sComponentName = "TMP_Text"},
TMPRewardCount = {sComponentName = "TMP_Text"},
TMPDuelLevel = {sComponentName = "TMP_Text"},
TMPDuelExp = {sComponentName = "TMP_Text"},
imgExpBarFillMask = {
sComponentName = "RectTransform"
},
item = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
nCount = 5
},
ItemBtn = {
sComponentName = "UIButton",
nCount = 5,
callback = "OnBtnClick_RewardItem"
},
tog = {
sComponentName = "UIButton",
nCount = 4,
callback = "OnBtnClick_Tog"
},
imgLockMask = {
sComponentName = "UIButton",
callback = "OnBtnClick_TogTips",
nCount = 4
},
togCtrl = {
sNodeName = "tog",
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl",
nCount = 4
},
TopBarPanel = {
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
goEnemyInfo = {
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
},
goRewardList = {
sCtrlName = "Game.UI.MainlineEx.RewardListCtrl"
},
btnAllReward = {
sComponentName = "UIButton",
callback = "OnBtnClick_RewardList"
},
txtEnergyCount = {sComponentName = "TMP_Text"},
TMPTitleShop = {
sComponentName = "TMP_Text",
sLanguageId = "TD_ShopTitle"
},
TMPTitleQuest = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "TD_QusetTitle"
},
TMPDuelLevelTitle = {
sComponentName = "TMP_Text",
sLanguageId = "TD_LevelTitle"
},
TMPRewardHint = {sComponentName = "TMP_Text"},
rt_LevelInfo = {
sCtrlName = "Game.UI.TravelerDuelLevelSelect.TravelerDuelLevelInfoCtrl"
},
btnLevel = {
sComponentName = "UIButton",
callback = "OnBtnClick_Level"
},
btnDuelQuestMain = {
sComponentName = "UIButton",
callback = "OnBtnClick_Quest"
},
btnDuelShopMain = {
sComponentName = "UIButton",
callback = "OnBtnClick_Shop"
},
btnEnemyInfoChallenge = {
sComponentName = "UIButton",
callback = "OnBtnClick_EnemyInfo"
},
rtCoverRoot = {sComponentName = "Transform"},
redDotDuelQuest1 = {},
btnRankingDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_OpenRankingInfo"
},
TDRankingPanel = {
sCtrlName = "Game.UI.TravelerDuelLevelSelect.TravelerDuelRanking.TravelerDuelRankingCtrl"
},
TMPNpcName = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_NPC2"
},
TMPSubTitle = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_NPC1"
},
TMPSubName = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_NPC3"
},
TMPNpcTime = {sComponentName = "TMP_Text"},
TMPNpcDate = {sComponentName = "TMP_Text"},
TMPTitleChallenge = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_ChallengeTitle"
},
TMPTitleChallengel = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_NormalTitle"
},
OffScreen3DCameraNpc = {sComponentName = "Camera"},
rimgNpc = {sComponentName = "RawImage"},
goNpcPos = {},
SpriteNpc = {
sComponentName = "SpriteRenderer"
},
SpriteNpcFace = {
sComponentName = "SpriteRenderer"
},
rtOffscreen = {
sNodeName = "----Actor2D_OffScreen_Renderer----",
sComponentName = "Transform"
},
txtRecommendLevelTitle = {
sComponentName = "TMP_Text",
sLanguageId = "InfinityTower_Recommend_Lv"
},
txtTitleSkill = {
sComponentName = "TMP_Text",
sLanguageId = "RegusBoss_Enemy_Skill"
},
txtTitleReward = {
sComponentName = "TMP_Text",
sLanguageId = "Level_Award"
},
txtBtnAllReward = {
sComponentName = "TMP_Text",
sLanguageId = "Mall_Btn_All"
},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "Maninline_Btn_Go"
}
}
TravelerDuelLevelSelectCtrl._mapEventConfig = {
[EventId.UIHomeConfirm] = "OnEvent_Home",
[EventId.UIBackConfirm] = "OnEvent_Back",
[EventId.UpdateWorldClass] = "OnEvent_UpdateWorldClass"
}
TravelerDuelLevelSelectCtrl._mapRedDotConfig = {
[RedDotDefine.Map_TravelerDuel] = {
sNodeName = "redDotDuelQuest1"
}
}
function TravelerDuelLevelSelectCtrl:Awake()
self.mapLevelGrid = {}
self.mapBossDefaultHard = {}
self.mapBossMaxHard = {}
end
function TravelerDuelLevelSelectCtrl:FadeIn()
end
function TravelerDuelLevelSelectCtrl:FadeOut()
EventManager.Hit(EventId.SetTransition)
end
function TravelerDuelLevelSelectCtrl:OnEnable()
local month = os.date("%m")
local day = os.date("%d")
local hour = os.date("%H")
local min = os.date("%M")
NovaAPI.SetTMPText(self._mapNode.TMPNpcDate, string.format("%s/%s", month, day))
NovaAPI.SetTMPText(self._mapNode.TMPNpcTime, string.format("%s:%s", hour, min))
if nil == self.npcTimer then
self.npcTimer = self:AddTimer(0, 1, function()
local month = os.date("%m")
local day = os.date("%d")
local hour = os.date("%H")
local min = os.date("%M")
NovaAPI.SetTMPText(self._mapNode.TMPNpcDate, string.format("%s/%s", month, day))
NovaAPI.SetTMPText(self._mapNode.TMPNpcTime, string.format("%s:%s", hour, min))
end, true, true, true)
end
local windowResolution = CS.ClientManager.Instance.currentWindowResolution
local scaleFactor = math.min(windowResolution.x / 2160, windowResolution.y / 1080)
local fixedScale = windowResolution.x / scaleFactor * windowResolution.y / scaleFactor / 2332800
self._mapNode.rtOffscreen.localScale = Vector3(fixedScale, fixedScale, fixedScale)
self._mapNode.rimgNpc.gameObject:GetComponent("RectTransform").sizeDelta = Vector2(Settings.CURRENT_CANVAS_FULL_RECT_WIDTH, Settings.CURRENT_CANVAS_FULL_RECT_HEIGHT)
self._mapNode.OffScreen3DCameraNpc.orthographicSize = Settings.CURRENT_CANVAS_FULL_RECT_HEIGHT / 200
local nW = math.floor(Settings.CURRENT_CANVAS_FULL_RECT_WIDTH * Settings.RENDERTEXTURE_SIZE_FACTOR)
local nH = math.floor(Settings.CURRENT_CANVAS_FULL_RECT_HEIGHT * Settings.RENDERTEXTURE_SIZE_FACTOR)
self._NpcRenderTexture = GameUIUtils.GenerateRenderTextureFor2D(nW, nH)
self._NpcRenderTexture.name = "TravelerDuelLevelSelect"
self._mapNode.OffScreen3DCameraNpc.targetTexture = self._NpcRenderTexture
NovaAPI.SetTexture(self._mapNode.rimgNpc, self._NpcRenderTexture)
if self.goNpc ~= nil then
destroy(self.goNpc)
end
self.goNpc = nil
local mapSkinData = ConfigTable.GetData("NPCSkin", 917202)
if mapSkinData ~= nil then
if LocalSettingData.mapData.UseLive2D then
self.goNpc = self:CreatePrefabInstance(mapSkinData.L2D, self._mapNode.goNpcPos.transform)
self.goNpc.transform:SetLayerRecursively(CS.UnityEngine.LayerMask.NameToLayer("Cam_Layer_4"))
Actor2DManager.PlayL2DAnim(self.goNpc.transform, "idle", true, true)
else
local sFileFullName = Path.basename(mapSkinData.Portrait)
local sFileExtName = Path.extension(mapSkinData.Portrait)
local sFileName = string.gsub(sFileFullName, sFileExtName, "")
sFileName = string.gsub(sFileName, "_a", "")
local sBodyName = string.format("%s_%s", sFileName, "001")
local sFaceName = string.format("%s_%s", sFileName, "002")
local LoadSprite = function(sPath, sName)
local _sPath = string.format("%s/atlas_png/a/%s.png", Path.dirname(sPath), sName)
return self:LoadAsset(_sPath, typeof(Sprite))
end
NovaAPI.SetSpriteRendererSprite(self._mapNode.SpriteNpc, LoadSprite(mapSkinData.Portrait, sBodyName))
NovaAPI.SetSpriteRendererSprite(self._mapNode.SpriteNpcFace, LoadSprite(mapSkinData.Portrait, sFaceName))
end
end
local GetRankingCallback = function()
EventManager.Hit(EventId.SetTransition)
local mapSelfRankingData, _, LastRankingRefreshTime, _ = PlayerData.TravelerDuel:GetTDRankingData()
self.mapSelfRankingData = mapSelfRankingData
local nNextRefreshTime = LastRankingRefreshTime + PlayerData.TravelerDuel.rankingRefreshTime
if self.rankingRefrehTimer ~= nil then
self.rankingRefrehTimer:Cancel()
self.rankingRefrehTimer = nil
end
local nCountTime = nNextRefreshTime - CS.ClientManager.Instance.serverTimeStamp
if 0 < nCountTime then
self.rankingRefrehTimer = self:AddTimer(1, nCountTime, "OnTimer_RefreshRanking", true, true, true, nil)
else
end
end
local _, _, LastRefreshTime, _ = PlayerData.TravelerDuel:GetTDRankingData()
if LastRefreshTime == 0 then
PlayerData.TravelerDuel:SendMsg_GetTravelerDuelRanking(GetRankingCallback)
else
local curTimeStamp = CS.ClientManager.Instance.serverTimeStamp
local sum = curTimeStamp - LastRefreshTime
if sum < PlayerData.TravelerDuel.rankingRefreshTime then
GetRankingCallback()
else
PlayerData.TravelerDuel:SendMsg_GetTravelerDuelRanking(GetRankingCallback)
end
end
self._mapNode.rt_TravelerDuelSelect:SetActive(true)
self._mapNode.TopBarPanel:SetCoinVisible(true)
self._mapNode.rt_TravelerDuelInfo:SetActive(false)
self.nCurSkinId = nil
Actor2DManager.UnsetActor2D()
self._mapNode.rt_ChallengeInfo.gameObject:SetActive(false)
self.nDuelLevel, self.nDuelExp = PlayerData.TravelerDuel:GetTravelerDuelLevel()
self.mapChallenge = PlayerData.TravelerDuel:GetTravelerDuelChallenge()
local nTotalExp = 0
if ConfigTable.GetData("TravelerDuelLevel", self.nDuelLevel + 1) ~= nil then
nTotalExp = ConfigTable.GetData("TravelerDuelLevel", self.nDuelLevel + 1).LevelUpExp
end
self.nCurChallengeBossId = 0
if self.mapChallenge.nIdx == 0 then
self.nCurChallengeBossId = 0
else
self.nCurChallengeBossId = ConfigTable.GetData("TravelerDuelChallengeSeason", self.mapChallenge.nIdx).BossId
end
NovaAPI.SetTMPText(self._mapNode.TMPDuelLevel, self.nDuelLevel)
local nFullLength = 514
local nFullHeight = 38
if 0 < nTotalExp then
NovaAPI.SetTMPText(self._mapNode.TMPDuelExp, string.format("<color=#3b62ae>%d</color>/%d", self.nDuelExp, nTotalExp))
self._mapNode.imgExpBarFillMask.sizeDelta = Vector2(nFullLength * (self.nDuelExp / nTotalExp), nFullHeight)
else
NovaAPI.SetTMPText(self._mapNode.TMPDuelExp, "Max")
self._mapNode.imgExpBarFillMask.sizeDelta = Vector2(nFullLength, nFullHeight)
end
local tbParam = self:GetPanelParam()
if 0 < #tbParam then
if tbParam[3] == nil then
end
self.bJumpto = tbParam[3]
self.nJumptoHard = tbParam[1] == nil and 0 or tbParam[1]
self.nJumptoGroup = tbParam[2] == nil and 0 or tbParam[2]
end
local tbCachedAffix, nCachedBossId = PlayerData.TravelerDuel:GetCacheAffixids()
if nCachedBossId ~= nil and nCachedBossId ~= 0 then
self.bJumpto = false
self.nJumptoHard = 0
self.nJumptoGroup = 0
end
self._mapNode.rt_TravelerDuelInfo:SetActive(false)
self.nCurSkinId = nil
Actor2DManager.UnsetActor2D()
self._mapNode.rt_ChallengeInfo.gameObject:SetActive(false)
self._mapNode.bgLevelInfo:SetActive(false)
self.curState = 1
self.curSelectHard = GameEnum.diffculty.Diffculty_1
self.nCurGroupId = 0
self.mapAllTravelerDuel = {}
self.tbTravelerGroup = {}
local forEachTravelerDuel = function(mapData)
if self.mapAllTravelerDuel[mapData.BossId] == nil then
if mapData.Difficulty ~= 0 or mapData.BossId == self.nCurChallengeBossId then
self.mapAllTravelerDuel[mapData.BossId] = {}
if mapData.BossId ~= self.nCurChallengeBossId then
table.insert(self.tbTravelerGroup, mapData.BossId)
end
else
return
end
end
self.mapAllTravelerDuel[mapData.BossId][mapData.Difficulty] = mapData
end
ForEachTableLine(DataTable.TravelerDuelBossLevel, forEachTravelerDuel)
self:InitBossMaxHard()
local sortBoss = function(a, b)
local mapBossA = ConfigTable.GetData("TravelerDuelBoss", a)
local mapBossB = ConfigTable.GetData("TravelerDuelBoss", b)
if mapBossA.TravelerDuelBossType ~= mapBossB.TravelerDuelBossType then
return mapBossA.TravelerDuelBossType < mapBossB.TravelerDuelBossType
end
return mapBossA.Id < mapBossB.Id
end
table.sort(self.tbTravelerGroup, sortBoss)
self._mapNode.svTravelerDuel:Init(#self.tbTravelerGroup, self, self.RefreshGrid, self.OnBtnClick_Grid)
if self.nCurChallengeBossId ~= 0 then
self._mapNode.rtCoverRoot.gameObject:SetActive(true)
local mapLevelCfgData = ConfigTable.GetData("TravelerDuelBoss", self.nCurChallengeBossId)
local nLevelId = self.mapAllTravelerDuel[self.nCurChallengeBossId][0].Id
local coverPrefab = self:LoadAsset(string.format("%s.prefab", mapLevelCfgData.Cover))
local goCover = instantiate(coverPrefab, self._mapNode.rtCoverRoot)
local ctrlCover = self:BindCtrlByNode(goCover, "Game.UI.TravelerDuelLevelSelect.TDCoverCtrl")
ctrlCover:Refresh(self.mapChallenge, nLevelId, function()
self:OnBtnClick_Challenge()
end, false)
else
self._mapNode.rtCoverRoot.gameObject:SetActive(true)
local mapLevelCfgData = ConfigTable.GetData("TravelerDuelBoss", 1001)
local nLevelId = 1001
local coverPrefab = self:LoadAsset(string.format("%s.prefab", mapLevelCfgData.Cover))
local goCover = instantiate(coverPrefab, self._mapNode.rtCoverRoot)
local ctrlCover = self:BindCtrlByNode(goCover, "Game.UI.TravelerDuelLevelSelect.TDCoverCtrl")
ctrlCover:Refresh(self.mapChallenge, nLevelId, function()
self:OnBtnClick_Challenge()
end, false)
end
if self.nJumptoGroup ~= 0 and self.nJumptoGroup ~= nil then
if self.nJumptoHard ~= 0 and self.nJumptoHard ~= nil then
self:OpenJumptoHard()
else
self:OpenJumptoGroup()
end
end
if nCachedBossId ~= nil and nCachedBossId ~= 0 then
self.curState = 2
self.nCurGroupId = nCachedBossId
local nLevelId = self.mapAllTravelerDuel[self.nCurGroupId][0].Id
self._mapNode.rt_ChallengeInfo:Refresh(nLevelId)
self._mapNode.rt_TravelerDuelSelect:SetActive(false)
self._mapNode.TopBarPanel:SetCoinVisible(false)
self._mapNode.rt_TravelerDuelInfo:SetActive(false)
self.nCurSkinId = nil
Actor2DManager.UnsetActor2D()
self._mapNode.rt_ChallengeInfo.gameObject:SetActive(true)
self._mapNode.bgLevelInfo:SetActive(true)
end
local totalRewardCount = ConfigTable.GetConfigValue("TravelerDuelWeeklyAwardLimit")
local nRewardCount = PlayerData.TravelerDuel:GetTravelerDuelLevelRewardCount()
nRewardCount = -1 < nRewardCount and totalRewardCount - nRewardCount or totalRewardCount
if nRewardCount == nil then
nRewardCount = 0
end
if nRewardCount < 0 then
nRewardCount = 0
end
NovaAPI.SetTMPText(self._mapNode.TMPRewardCount, orderedFormat(ConfigTable.GetUIText("TD_WeekRewardTimes"), math.floor(nRewardCount), totalRewardCount))
self._mapNode.aniRoot:Play("TravelerDuelSelect_in")
end
function TravelerDuelLevelSelectCtrl:OnDisable()
self:UnbindAllGrids()
if self.rankingRefrehTimer ~= nil then
self.rankingRefrehTimer:Cancel()
self.rankingRefrehTimer = nil
end
if nil ~= self.npcTimer then
self.npcTimer:Cancel()
self.npcTimer = nil
end
self._mapNode.OffScreen3DCameraNpc.targetTexture = nil
NovaAPI.SetTexture(self._mapNode.rimgNpc, nil)
if self._NpcRenderTexture ~= nil then
GameUIUtils.ReleaseRenderTexture(self._NpcRenderTexture)
self._NpcRenderTexture = nil
end
if self.goNpc ~= nil then
destroy(self.goNpc)
self.goNpc = nil
end
end
function TravelerDuelLevelSelectCtrl:OnDestroy()
end
function TravelerDuelLevelSelectCtrl:OnRelease()
end
function TravelerDuelLevelSelectCtrl:RefreshGrid(goGrid, gridIndex)
if self.mapLevelGrid[goGrid] == nil then
self.mapLevelGrid[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.TravelerDuelLevelSelect.TravelerDuelLevelGridCtrl")
end
local nIdx = gridIndex + 1
local nBossId = self.tbTravelerGroup[nIdx]
local nLevelId = self.mapAllTravelerDuel[nBossId][mapToggle[1]].Id
self.mapLevelGrid[goGrid]:Refresh(nBossId, nLevelId)
end
function TravelerDuelLevelSelectCtrl:UnbindAllGrids()
for go, mapCtrl in ipairs(self.mapLevelGrid) do
self:UnbindCtrlByNode(mapCtrl)
end
self.mapLevelGrid = {}
delChildren(self._mapNode.rtCoverRoot)
end
function TravelerDuelLevelSelectCtrl:OpenJumptoGroup()
self.curState = 2
self.nCurGroupId = self.nJumptoGroup
local mapBossCfgData = ConfigTable.GetData("TravelerDuelBoss", self.nCurGroupId)
if mapBossCfgData == nil then
printError("TravelerDuelBoss Data Missing:" .. self.nCurGroupId)
return
end
if mapBossCfgData.TravelerDuelBossType == GameEnum.travelerDuelBossType.NORMAL then
local nHard = self:GetMaxTravelerDuelHard(self.nCurGroupId)
self:RefreshTravelerDuelInfo(self.nCurGroupId, nHard)
self._mapNode.rt_TravelerDuelInfo:SetActive(true)
self._mapNode.rt_TravelerDuelSelect:SetActive(false)
self._mapNode.TopBarPanel:SetCoinVisible(false)
self._mapNode.rt_ChallengeInfo.gameObject:SetActive(false)
self._mapNode.bgLevelInfo:SetActive(true)
else
local nLevelId = self.mapAllTravelerDuel[self.nCurGroupId][0].Id
self._mapNode.rt_ChallengeInfo:Refresh(nLevelId)
self._mapNode.rt_TravelerDuelInfo:SetActive(false)
self._mapNode.TopBarPanel:SetCoinVisible(false)
self.nCurSkinId = nil
Actor2DManager.UnsetActor2D()
self._mapNode.rt_ChallengeInfo.gameObject:SetActive(true)
self._mapNode.bgLevelInfo:SetActive(true)
end
end
function TravelerDuelLevelSelectCtrl:OpenJumptoHard()
self.curState = 2
self.nCurGroupId = self.nJumptoGroup
local nJumptoDuelId = self.mapAllTravelerDuel[self.nCurGroupId][self.nJumptoHard].Id
if not PlayerData.TravelerDuel:GetTravelerDuelLevelUnlock(nJumptoDuelId) then
self.nJumptoHard = GameEnum.diffculty.Diffculty_1
end
self:RefreshTravelerDuelInfo(self.nCurGroupId, self.nJumptoHard)
self._mapNode.rt_TravelerDuelInfo:SetActive(true)
self._mapNode.rt_TravelerDuelSelect:SetActive(false)
self._mapNode.TopBarPanel:SetCoinVisible(false)
self._mapNode.bgLevelInfo:SetActive(true)
end
function TravelerDuelLevelSelectCtrl:OnBtnClick_Grid(goGrid, gridIndex)
local nIdx = gridIndex + 1
local nBossId = self.tbTravelerGroup[nIdx]
self.curState = 2
self.nCurGroupId = nBossId
self._panel._tbParam[2] = nBossId
self.mapBossDefaultHard = {}
local nHard = self:GetMaxTravelerDuelHard(nBossId)
local mapBosslevel = self.mapAllTravelerDuel[self.nCurGroupId][mapToggle[1]]
local nBossLevelId = mapBosslevel.Id
local bUnlock, sTip = PlayerData.TravelerDuel:GetTravelerDuelLevelUnlock(nBossLevelId)
if not bUnlock then
EventManager.Hit(EventId.OpenMessageBox, sTip)
return
end
self:RefreshTravelerDuelInfo(nBossId, nHard)
self._mapNode.rt_TravelerDuelInfo:SetActive(true)
self:AddTimer(1, 0.6, function()
self._mapNode.rt_ChallengeInfo.gameObject:SetActive(false)
end, true, true, true)
self._mapNode.TopBarPanel:SetCoinVisible(false)
self._mapNode.bgLevelInfo:SetActive(true)
self._mapNode.aniRoot:Play("TravelerDuelInfo_in")
EventManager.Hit("TDLevelSelectOut")
EventManager.Hit(EventId.TemporaryBlockInput, 0.6)
end
function TravelerDuelLevelSelectCtrl:RefreshLevelUnlock()
for index, hardBtn in ipairs(self._mapNode.tog) do
local bActive = self.mapAllTravelerDuel[self.nCurGroupId][mapToggle[index]] ~= nil
hardBtn.gameObject:SetActive(bActive)
if bActive then
local nBossId = self.mapAllTravelerDuel[self.nCurGroupId][mapToggle[index]].Id
local bLock = PlayerData.TravelerDuel:GetTravelerDuelLevelUnlock(nBossId)
hardBtn.interactable = bLock
self._mapNode.imgLockMask[index].gameObject:SetActive(not bLock)
self._mapNode.imgLockMask[index].interactable = not bLock
local tmpTitle = self._mapNode.togCtrl[index].gameObject.transform:Find("AnimRoot/AnimSwitch/txt_Select"):GetComponent("TMP_Text")
local tmpTitle1 = self._mapNode.togCtrl[index].gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelect"):GetComponent("TMP_Text")
NovaAPI.SetTMPText(tmpTitle, ConfigTable.GetUIText("Diffculty_" .. index))
NovaAPI.SetTMPText(tmpTitle1, ConfigTable.GetUIText("Diffculty_" .. index))
for j = 1, 3 do
local btnStar = self._mapNode.togCtrl[index].gameObject.transform:Find("rtLockInfo/rt_Targets/btnTarget" .. j):GetComponent("Button")
btnStar.gameObject:SetActive(false)
end
end
end
end
function TravelerDuelLevelSelectCtrl:RefreshTravelerDuelInfo(nGroupId, nHard)
self:RefreshLevelUnlock()
for i = 1, 4 do
self._mapNode.togCtrl[i]:SetDefault(i == nHard)
end
self.curSelectHard = nHard
self._panel._tbParam[1] = 0
local mapTravelerDuelData = self.mapAllTravelerDuel[nGroupId][nHard]
self.TravelerDuel = mapTravelerDuelData.Id
if mapTravelerDuelData == nil then
return
end
NovaAPI.SetTMPText(self._mapNode.TMPTravelerLevelNameNormal, mapTravelerDuelData.Name)
NovaAPI.SetTMPText(self._mapNode.TMPTravelerDesc, mapTravelerDuelData.Desc)
local rBuildRank = mapTravelerDuelData.RecommendBuildRank
local sScore = "Icon/BuildRank/BuildRank_" .. rBuildRank
self:SetPngSprite(self._mapNode.imgReconmendBuild, sScore)
local nCharId = math.floor(mapTravelerDuelData.SkinId / 100)
if self.nCurSkinId ~= mapTravelerDuelData.SkinId then
self.nCurSkinId = mapTravelerDuelData.SkinId
local bSuc, nType, nAnimLen = Actor2DManager.SetActor2D(self:GetPanelId(), self._mapNode.RImagChar, nCharId, mapTravelerDuelData.SkinId)
end
for i = 1, 3 do
if mapTravelerDuelData.EET == nil or mapTravelerDuelData.EET[i] == nil then
self._mapNode.imgElementInfo[i].gameObject:SetActive(false)
else
self._mapNode.imgElementInfo[i].gameObject:SetActive(true)
self:SetAtlasSprite(self._mapNode.imgElementInfo[i], "12_rare", AllEnum.ElementIconType.Icon .. mapTravelerDuelData.EET[i])
end
end
local tbReward = decodeJson(mapTravelerDuelData.BaseAwardPreview)
self.tbReward = tbReward
local tbShowReward = {}
local curLevelStar = PlayerData.TravelerDuel:GetTravelerDuelLevelStar(self.TravelerDuel)
for _, tbValue in ipairs(tbReward) do
local nLastIndex = #tbValue
if not (0 < curLevelStar) or tbValue[nLastIndex] ~= 1 and tbValue[nLastIndex] ~= 2 then
table.insert(tbShowReward, tbValue)
end
end
for index = 1, 4 do
self._mapNode.ItemBtn[index].interactable = tbShowReward[index] ~= nil
if tbShowReward[index] ~= nil then
local nLastIndex = #tbShowReward[index]
self._mapNode.item[index]:SetItem(tbShowReward[index][1], nil, UTILS.ParseRewardItemCount(tbShowReward[index]), nil, false, tbShowReward[index][nLastIndex] == 1, tbShowReward[index][nLastIndex] == 2, true)
else
self._mapNode.item[index]:SetItem(nil)
end
end
self.tbExtraDropReward = {}
self._mapNode.ItemBtn[5].interactable = mapTravelerDuelData.ExtraDropPreview ~= nil and 0 < #mapTravelerDuelData.ExtraDropPreview
if mapTravelerDuelData.ExtraDropPreview ~= nil and 0 < #mapTravelerDuelData.ExtraDropPreview then
self._mapNode.item[5]:SetItem(mapTravelerDuelData.ExtraDropPreview[1], nil, nil, nil, false, false, false, false, false, false, true)
local countTxt = ""
if mapTravelerDuelData.ExtraDropPreview[2] == mapTravelerDuelData.ExtraDropPreview[3] then
countTxt = mapTravelerDuelData.ExtraDropPreview[2]
else
countTxt = mapTravelerDuelData.ExtraDropPreview[2] .. "~" .. mapTravelerDuelData.ExtraDropPreview[3]
end
local txtCount = self._mapNode.item[5].gameObject.transform:Find("--Common--/txtCount"):GetComponent("TMP_Text")
local txtX = txtCount.transform:Find("txtX")
txtCount.gameObject:SetActive(0 < mapTravelerDuelData.ExtraDropPreview[2])
txtX.gameObject:SetActive(mapTravelerDuelData.ExtraDropPreview[2] == mapTravelerDuelData.ExtraDropPreview[3])
self.tbExtraDropReward = mapTravelerDuelData.ExtraDropPreview
NovaAPI.SetTMPText(txtCount, countTxt)
else
self._mapNode.item[5]:SetItem(nil)
end
local tbSkill = mapTravelerDuelData.SkillShow
for i = 1, 5 do
if i <= #tbSkill then
self._mapNode.Skill[i].gameObject:SetActive(true)
self._mapNode.Skill[i]:SetTravelerDuelSkill(tbSkill[i])
else
self._mapNode.Skill[i].gameObject:SetActive(false)
end
end
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevel, mapTravelerDuelData.SuggestedPower)
local totalRewardCount = ConfigTable.GetConfigValue("TravelerDuelWeeklyAwardLimit")
local nRewardCount = PlayerData.TravelerDuel:GetTravelerDuelLevelRewardCount(nGroupId)
if curLevelStar <= 0 then
NovaAPI.SetTMPText(self._mapNode.TMPRewardHint, ConfigTable.GetUIText("TD_FreeReward"))
else
local nShowCount = totalRewardCount - nRewardCount
if 0 < nShowCount then
NovaAPI.SetTMPText(self._mapNode.TMPRewardHint, string.format("%s %d/%d", ConfigTable.GetUIText("TD_WeekRewardTimes_Title"), nShowCount, totalRewardCount))
else
NovaAPI.SetTMPText(self._mapNode.TMPRewardHint, string.format("%s <color=#BD3059>%d</color>/<color=#264278>%d</color>", ConfigTable.GetUIText("TD_WeekRewardTimes_Title"), 0, totalRewardCount))
end
end
end
function TravelerDuelLevelSelectCtrl:GetMaxTravelerDuelHard(nBossId)
local retHard = 1
if self.mapAllTravelerDuel[nBossId] == nil then
printError("BossId Error:" .. nBossId)
return 1
end
if self.mapBossDefaultHard[nBossId] ~= nil then
return self.mapBossDefaultHard[nBossId]
end
for nHard, mapBossLevel in pairs(self.mapAllTravelerDuel[nBossId]) do
if PlayerData.TravelerDuel:GetTravelerDuelLevelUnlock(mapBossLevel.Id) then
retHard = math.max(nHard, retHard)
end
end
return retHard
end
function TravelerDuelLevelSelectCtrl:OnEvent_Back(nPanelId)
if self._panel._nPanelId ~= nPanelId then
return
end
self._mapNode.rt_ChallengeInfo:CacheAffixes()
PlayerData.TravelerDuel:SetCacheAffixids(nil, nil)
if self.bJumpto then
EventManager.Hit(EventId.CloesCurPanel)
return
end
if self.curState == 1 then
EventManager.Hit(EventId.CloesCurPanel)
else
self.curSelectHard = GameEnum.diffculty.Diffculty_1
self.nCurGroupId = 0
self.curState = 1
self._panel._tbParam[2] = 0
self._panel._tbParam[1] = 0
self:AddTimer(1, 0.5, function()
self._mapNode.rt_TravelerDuelInfo:SetActive(false)
self._mapNode.rt_TravelerDuelSelect:SetActive(true)
self.nCurSkinId = nil
Actor2DManager.UnsetActor2D()
self._mapNode.rt_ChallengeInfo.gameObject:SetActive(false)
self._mapNode.rt_ChallengeInfo:ClearListGrids(false)
self._mapNode.bgLevelInfo:SetActive(false)
self._mapNode.aniRoot:Play("TravelerDuelSelect_in")
self._mapNode.TopBarPanel:SetCoinVisible(true)
EventManager.Hit("TDLevelSelectIn", 1)
end, true, true, true)
EventManager.Hit(EventId.TemporaryBlockInput, 1.2)
end
end
function TravelerDuelLevelSelectCtrl:OnEvent_Home(nPanelId)
if self._panel._nPanelId ~= nPanelId then
return
end
self._mapNode.rt_ChallengeInfo:CacheAffixes()
PlayerData.TravelerDuel:SetCacheAffixids(nil, nil)
PanelManager.Home()
end
function TravelerDuelLevelSelectCtrl:OnEvent_UpdateWorldClass()
self:RefreshLevelUnlock()
end
function TravelerDuelLevelSelectCtrl:OnBtnClick_Go()
self.mapBossDefaultHard[self.nCurGroupId] = self.curSelectHard
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.TravelerDuel, self.TravelerDuel, {})
end
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
end
function TravelerDuelLevelSelectCtrl:OnBtnClick_Tog(btn)
local nHard = table.indexof(self._mapNode.tog, btn:GetComponent("UIButton"))
local togIdx = table.indexof(self._mapNode.tog, btn)
if nHard == nil then
return
end
if self.curSelectHard ~= nHard then
for idx, value in pairs(mapToggle) do
if value == self.curSelectHard then
self._mapNode.togCtrl[idx]:SetTrigger(false)
end
end
self._mapNode.togCtrl[togIdx]:SetTrigger(true)
self:RefreshTravelerDuelInfo(self.nCurGroupId, nHard)
end
end
function TravelerDuelLevelSelectCtrl:OnBtnClick_RewardList(btn)
local mapLevel = ConfigTable.GetData("TravelerDuelBossLevel", self.TravelerDuel)
local tbReward = decodeJson(mapLevel.BaseAwardPreview)
local curLevelStar = PlayerData.TravelerDuel:GetTravelerDuelLevelStar(self.TravelerDuel)
for _, tbValue in ipairs(tbReward) do
local nLastIndex = #tbValue
if 0 < curLevelStar and tbValue[nLastIndex] == 1 or curLevelStar == 3 and tbValue[nLastIndex] == 2 then
table.insert(tbValue, true)
end
end
self._mapNode.goRewardList:OpenPanel(tbReward, self.tbExtraDropReward)
end
function TravelerDuelLevelSelectCtrl:OnBtnClick_RewardItem(btn)
local nIdx = table.indexof(self._mapNode.ItemBtn, btn)
if nIdx == 5 then
if self.tbExtraDropReward == nil then
return
end
local nTid = self.tbExtraDropReward[1]
if nTid == nil then
return
end
local rtBtn = btn.transform
UTILS.ClickItemGridWithTips(nTid, rtBtn, false, true, false)
return
end
local mapLevel = ConfigTable.GetData("TravelerDuelBossLevel", self.TravelerDuel)
local tbReward = decodeJson(mapLevel.BaseAwardPreview)
local tbShowReward = {}
local curLevelStar = PlayerData.TravelerDuel:GetTravelerDuelLevelStar(self.TravelerDuel)
for _, tbValue in ipairs(tbReward) do
local nLastIndex = #tbValue
if not (0 < curLevelStar) or tbValue[nLastIndex] ~= 1 and tbValue[nLastIndex] ~= 2 then
table.insert(tbShowReward, tbValue)
end
end
tbReward = tbShowReward
local rtBtn = btn.transform
if tbReward[nIdx] ~= nil then
local nTid = tbReward[nIdx][1]
UTILS.ClickItemGridWithTips(nTid, rtBtn, false, true, false)
end
end
function TravelerDuelLevelSelectCtrl:OnBtnClick_TogTips(btn, nidx)
local nBossId = self.mapAllTravelerDuel[self.nCurGroupId][mapToggle[nidx]].Id
local bUnLock, sMsg = PlayerData.TravelerDuel:GetTravelerDuelLevelUnlock(nBossId)
if not bUnLock then
EventManager.Hit(EventId.OpenMessageBox, sMsg)
end
end
function TravelerDuelLevelSelectCtrl:OnBtnClick_Skill(btn, nidx)
local mapTravelerDuelData = self.mapAllTravelerDuel[self.nCurGroupId][self.curSelectHard]
local nSkillId = mapTravelerDuelData.SkillShow[nidx]
if nSkillId ~= 0 then
local mapData = {nSkillId = nSkillId, bTravelerDuel = true}
EventManager.Hit(EventId.OpenPanel, PanelId.SkillTips, btn.transform, mapData)
end
end
function TravelerDuelLevelSelectCtrl:OnBtnClick_Level(btn)
self._mapNode.rt_LevelInfo:Show()
end
function TravelerDuelLevelSelectCtrl:OnBtnClick_Quest(btn)
self:AddTimer(1, 0.2, function()
EventManager.Hit(EventId.OpenPanel, PanelId.TravelerDuelLevelQuestPanel)
self._panel._nFadeInType = 2
end, true, true, true)
self._mapNode.aniRoot:Play("TravelerDuelTask")
end
function TravelerDuelLevelSelectCtrl:OnBtnClick_Shop(btn)
EventManager.Hit(EventId.OpenPanel, PanelId.ShopPanel, 2)
self._panel._nFadeInType = 2
end
function TravelerDuelLevelSelectCtrl:OnBtnClick_EnemyInfo()
local nLevelId = self.mapAllTravelerDuel[self.nCurGroupId][0].Id
EventManager.Hit("OpenTravelerDuelMonsterInfo", nLevelId)
end
function TravelerDuelLevelSelectCtrl:OnTimer_RefreshRanking()
local callback = function()
local mapSelfRankingData, _, LastRankingRefreshTime, _ = PlayerData.TravelerDuel:GetTDRankingData()
self.mapSelfRankingData = mapSelfRankingData
local nNextRefreshTime = LastRankingRefreshTime + PlayerData.TravelerDuel.rankingRefreshTime
if self.rankingRefrehTimer ~= nil then
self.rankingRefrehTimer:Cancel()
self.rankingRefrehTimer = nil
end
self.rankingRefrehTimer = self:AddTimer(1, nNextRefreshTime - CS.ClientManager.Instance.serverTimeStamp, "OnTimer_RefreshRanking", true, true, true, nil)
end
PlayerData.TravelerDuel:SendMsg_GetTravelerDuelRanking(callback)
end
function TravelerDuelLevelSelectCtrl:OnBtnClick_Challenge(btn)
self.curState = 2
self.nCurGroupId = self.nCurChallengeBossId
self._panel._tbParam[2] = self.nCurChallengeBossId
local nLevelId = self.mapAllTravelerDuel[self.nCurGroupId][0].Id
self._mapNode.rt_ChallengeInfo:Refresh(nLevelId)
self._mapNode.rt_ChallengeInfo.gameObject:SetActive(true)
self:AddTimer(1, 0.6, function()
self._mapNode.rt_TravelerDuelInfo:SetActive(false)
self.nCurSkinId = nil
Actor2DManager.UnsetActor2D()
end, true, true, true)
self._mapNode.bgLevelInfo:SetActive(true)
self._mapNode.aniRoot:Play("ChallengeInfo_in")
self._mapNode.TopBarPanel:SetCoinVisible(false)
EventManager.Hit(EventId.TemporaryBlockInput, 0.6)
end
function TravelerDuelLevelSelectCtrl:OnBtnClick_OpenRankingInfo(btn)
self._mapNode.TDRankingPanel:OpenPanel()
end
function TravelerDuelLevelSelectCtrl:InitBossMaxHard()
for nBossId, mapLevels in pairs(self.mapAllTravelerDuel) do
local nNewHard = 0
for nHard, mapBossLevel in pairs(mapLevels) do
if PlayerData.TravelerDuel:GetTravelerDuelLevelUnlock(mapBossLevel.Id) then
nNewHard = math.max(nHard, nNewHard)
end
end
if self.mapBossMaxHard ~= nil and self.mapBossMaxHard[nBossId] ~= nNewHard then
self.mapBossMaxHard[nBossId] = nNewHard
self.mapBossDefaultHard[nBossId] = nNewHard
end
end
end
return TravelerDuelLevelSelectCtrl
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,155 @@
local TravelerDuelRankingCtrl = class("TravelerDuelRankingCtrl", BaseCtrl)
TravelerDuelRankingCtrl._mapNodeConfig = {
TMPEmpty = {
sComponentName = "TMP_Text",
sLanguageId = "STRanking_PlayerInfo_Empty"
},
rtPlayerInfo = {
sCtrlName = "Game.UI.TravelerDuelLevelSelect.TravelerDuelRanking.TravelerDuelRankingPlayerInfoCtrl"
},
svRankingInfo = {
sComponentName = "LoopScrollView"
},
imgEmpty = {},
svRankingReward = {
sComponentName = "LoopScrollView"
},
btnClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
btnCloseScreen = {
sComponentName = "Button",
callback = "OnBtnClick_Close"
},
rtRankingInfo = {},
rtRankingReward = {},
btnLeft = {
sComponentName = "UIButton",
callback = "OnBtnClick_left"
},
btnRight = {
sComponentName = "UIButton",
callback = "OnBtnClick_right"
},
tcTab = {
sCtrlName = "Game.UI.TemplateEx.TemplateTogTabCtrl"
},
t_window = {sComponentName = "Animator"},
t_fullscreen_blur_black = {sComponentName = "Animator"},
txtLeft = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Ranking_Info"
},
txtRight = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Ranking_Reward"
},
txtRefreshTime = {
sComponentName = "TMP_Text",
sLanguageId = "STRanking_Refresh_Tips"
}
}
TravelerDuelRankingCtrl._mapEventConfig = {}
TravelerDuelRankingCtrl._mapRedDotConfig = {}
function TravelerDuelRankingCtrl:Awake()
self._mapRankingGrid = {}
self._mapRewardGrid = {}
end
function TravelerDuelRankingCtrl:FadeIn()
end
function TravelerDuelRankingCtrl:FadeOut()
end
function TravelerDuelRankingCtrl:OnEnable()
self._mapNode.tcTab:SetText("排行奖励", "排行信息")
if self.bOpenPanel then
self:OpenPanel()
end
end
function TravelerDuelRankingCtrl:OnDisable()
for go, mapCtrl in pairs(self._mapRankingGrid) do
self:UnbindCtrlByNode(mapCtrl)
end
for go, mapCtrl in pairs(self._mapRewardGrid) do
self:UnbindCtrlByNode(mapCtrl)
end
self._mapRankingGrid = {}
self._mapRewardGrid = {}
end
function TravelerDuelRankingCtrl:OnDestroy()
end
function TravelerDuelRankingCtrl:OnRelease()
end
function TravelerDuelRankingCtrl:OpenPanel()
self.gameObject:SetActive(true)
self._mapNode.t_window:Play("t_window_04_t_in")
local mapSelfRankingData, mapRankingData = PlayerData.TravelerDuel:GetTDRankingData()
self.mapRankingData = mapRankingData
self.mapSelfRankingData = mapSelfRankingData
self._mapNode.rtPlayerInfo:Refresh(mapSelfRankingData)
if #self.mapRankingData > 0 then
self._mapNode.svRankingInfo.gameObject:SetActive(true)
self._mapNode.svRankingInfo:Init(#self.mapRankingData, self, self.OnGridRankingRefresh)
self._mapNode.imgEmpty:SetActive(false)
else
self._mapNode.svRankingInfo.gameObject:SetActive(false)
self._mapNode.imgEmpty:SetActive(true)
end
self._mapNode.svRankingReward:Init(4, self, self.OnGridRankingRewardRefresh)
if not self.bOpenPanel then
self._mapNode.tcTab:SetState(false)
self._mapNode.rtRankingInfo:SetActive(true)
self._mapNode.rtRankingReward:SetActive(false)
self.bOpenPanel = true
end
end
function TravelerDuelRankingCtrl:OnBtnClick_Close()
self._mapNode.t_window:Play("t_window_04_t_out")
self._mapNode.t_fullscreen_blur_black:SetTrigger("tOut")
local close = function()
self.gameObject:SetActive(false)
self.bOpenPanel = false
end
self:AddTimer(1, 0.2, close, true, true, true)
end
function TravelerDuelRankingCtrl:OnGridRankingRefresh(grid)
if self._mapRankingGrid[grid] == nil then
local mapCtrl = self:BindCtrlByNode(grid, "Game.UI.TravelerDuelLevelSelect.TravelerDuelRanking.TravelerDuelRankingGrid")
self._mapRankingGrid[grid] = mapCtrl
end
local nIdx = tonumber(grid.name)
if nIdx == nil then
return
end
nIdx = nIdx + 1
self._mapRankingGrid[grid]:Refresh(self.mapRankingData[nIdx])
end
function TravelerDuelRankingCtrl:OnGridRankingRewardRefresh(grid)
if self._mapRewardGrid[grid] == nil then
local mapCtrl = self:BindCtrlByNode(grid, "Game.UI.TravelerDuelLevelSelect.TravelerDuelRanking.TravelerDuelRewardGridCtrl")
self._mapRewardGrid[grid] = mapCtrl
end
local nIdx = tonumber(grid.name)
if nIdx == nil then
return
end
nIdx = nIdx + 1
local nSelfIdx = 0
if self.mapSelfRankingData ~= nil then
nSelfIdx = self.mapSelfRankingData.nRewardIdx
end
self._mapRewardGrid[grid]:Refresh(nIdx, nSelfIdx)
end
function TravelerDuelRankingCtrl:OnBtnClick_right()
self._mapNode.tcTab:SetState(true)
self._mapNode.rtRankingInfo:SetActive(false)
self._mapNode.rtRankingReward:SetActive(true)
end
function TravelerDuelRankingCtrl:OnBtnClick_left()
self._mapNode.tcTab:SetState(false)
self._mapNode.rtRankingInfo:SetActive(true)
self._mapNode.rtRankingReward:SetActive(false)
end
return TravelerDuelRankingCtrl
@@ -0,0 +1,100 @@
local TravelerDuelRankingGrid = class("TravelerDuelRankingGrid", BaseCtrl)
TravelerDuelRankingGrid._mapNodeConfig = {
imgTitleBg1 = {},
imgTitleBg2 = {},
imgRankIcon = {sComponentName = "Image"},
TMPRank = {sComponentName = "TMP_Text"},
TMPScoreTitle = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_RankScoreTitle"
},
TMPTitle = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_RankNameTitle"
},
TMPScore = {sComponentName = "TMP_Text"},
imgItemIcon = {sComponentName = "Image", nCount = 3},
imgItemRare = {sComponentName = "Image", nCount = 3},
txtRank = {sComponentName = "TMP_Text", nCount = 3},
imgHead = {sComponentName = "Image"},
TMPPlayerLevel = {sComponentName = "TMP_Text"},
TMPPlayerLevelTitle = {sComponentName = "TMP_Text"},
TMPPlayerName = {sComponentName = "TMP_Text"},
TMPPlayerTitle = {sComponentName = "TMP_Text"},
TMPBuildTitle = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_RankBuildTitle"
},
imgScoreIcon = {sComponentName = "Image"},
goHonorTitle = {
nCount = 3,
sCtrlName = "Game.UI.FriendEx.HonorTitleCtrl"
},
txtLeader = {
sComponentName = "TMP_Text",
sLanguageId = "Build_Leader"
},
txtSub = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Build_Sub"
}
}
TravelerDuelRankingGrid._mapEventConfig = {}
TravelerDuelRankingGrid._mapRedDotConfig = {}
function TravelerDuelRankingGrid:Awake()
end
function TravelerDuelRankingGrid:FadeIn()
end
function TravelerDuelRankingGrid:FadeOut()
end
function TravelerDuelRankingGrid:OnEnable()
end
function TravelerDuelRankingGrid:OnDisable()
end
function TravelerDuelRankingGrid:OnDestroy()
end
function TravelerDuelRankingGrid:OnRelease()
end
function TravelerDuelRankingGrid:Refresh(mapRanking)
self._mapNode.imgTitleBg1:SetActive(mapRanking.bSelf == true)
self._mapNode.imgTitleBg2:SetActive(mapRanking.bSelf ~= true)
self:SetAtlasSprite(self._mapNode.imgRankIcon, "12_rare", "travelerduel_rank_" .. mapRanking.nRewardIdx)
NovaAPI.SetTMPText(self._mapNode.TMPRank, orderedFormat(ConfigTable.GetUIText("TravelerDuel_RankTitle"), mapRanking.Rank))
NovaAPI.SetTMPText(self._mapNode.TMPScore, string.formatnumberthousands(mapRanking.Score))
NovaAPI.SetTMPText(self._mapNode.TMPPlayerName, mapRanking.NickName)
NovaAPI.SetTMPText(self._mapNode.TMPPlayerLevel, mapRanking.WorldClass)
local sScore = "Icon/BuildRank/BuildRank_" .. mapRanking.nBuildRank
self:SetPngSprite(self._mapNode.imgScoreIcon, sScore)
if mapRanking.TitlePrefix == 0 or mapRanking.TitleSuffix == 0 then
NovaAPI.SetTMPText(self._mapNode.TMPPlayerTitle, "")
else
local sTitle = orderedFormat(ConfigTable.GetUIText("FriendPanel_PlayerTitle") or "", ConfigTable.GetData("Title", mapRanking.TitlePrefix).Desc, ConfigTable.GetData("Title", mapRanking.TitleSuffix).Desc)
NovaAPI.SetTMPText(self._mapNode.TMPPlayerTitle, sTitle)
end
local mapCfg = ConfigTable.GetData("PlayerHead", mapRanking.HeadIcon)
self:SetPngSprite(self._mapNode.imgHead, mapCfg.Icon)
for i = 1, 3 do
local nCharId = mapRanking.Chars[i].Id
local mapChar = ConfigTable.GetData_Character(nCharId)
NovaAPI.SetTMPText(self._mapNode.txtRank[i], mapRanking.Chars[i].Level)
local nCharSkinId = mapChar.DefaultSkinId
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
self:SetPngSprite(self._mapNode.imgItemIcon[i], mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
local nRarity = mapChar.Grade
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[GameEnum.characterGrade.R and GameEnum.characterGrade.SR or nRarity]
self:SetAtlasSprite(self._mapNode.imgItemRare[i], "12_rare", sFrame, true)
local tbhonorTitle = mapRanking.Honors
if tbhonorTitle ~= nil and tbhonorTitle[i] ~= nil and tbhonorTitle[i].Id ~= nil and 0 < tbhonorTitle[i].Id then
local honorData = ConfigTable.GetData("Honor", tbhonorTitle[i].Id)
local level
if honorData.Type == GameEnum.honorType.Character then
local affinityData = PlayerData.Char:GetCharAffinityData(honorData.Params[1])
level = affinityData.Level
end
self._mapNode.goHonorTitle[i]:SetHonotTitle(honorData.Id, i == 1, level)
end
self._mapNode.goHonorTitle[i].gameObject:SetActive(tbhonorTitle ~= nil and tbhonorTitle[i] ~= nil and tbhonorTitle[i].Id ~= nil and 0 < tbhonorTitle[i].Id)
end
end
return TravelerDuelRankingGrid
@@ -0,0 +1,61 @@
local TravelerDuelRankingPlayerInfoCtrl = class("TravelerDuelRankingPlayerInfoCtrl", BaseCtrl)
local ConfigData = require("GameCore.Data.ConfigData")
TravelerDuelRankingPlayerInfoCtrl._mapNodeConfig = {
imgHead = {sComponentName = "Image"},
imgIconRank = {sComponentName = "Image"},
TMPPlayerLevel = {sComponentName = "TMP_Text"},
TMPPlayerLevelTitle = {sComponentName = "TMP_Text"},
TMPPlayerName = {sComponentName = "TMP_Text"},
TMPPlayerTitle = {sComponentName = "TMP_Text"},
TMPRank = {sComponentName = "TMP_Text"},
TMPScore = {sComponentName = "TMP_Text"},
rtEmpty = {},
rtRankingInfo = {}
}
TravelerDuelRankingPlayerInfoCtrl._mapEventConfig = {}
TravelerDuelRankingPlayerInfoCtrl._mapRedDotConfig = {}
function TravelerDuelRankingPlayerInfoCtrl:Awake()
end
function TravelerDuelRankingPlayerInfoCtrl:FadeIn()
end
function TravelerDuelRankingPlayerInfoCtrl:FadeOut()
end
function TravelerDuelRankingPlayerInfoCtrl:OnEnable()
end
function TravelerDuelRankingPlayerInfoCtrl:OnDisable()
end
function TravelerDuelRankingPlayerInfoCtrl:OnDestroy()
end
function TravelerDuelRankingPlayerInfoCtrl:OnRelease()
end
function TravelerDuelRankingPlayerInfoCtrl:Refresh(mapSelfRanking)
self.gameObject:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.TMPPlayerName, PlayerData.Base:GetPlayerNickName())
NovaAPI.SetTMPText(self._mapNode.TMPPlayerLevel, tostring(PlayerData.Base:GetWorldClass()))
local nPre, nSuf = PlayerData.Base:GetPlayerTitle()
if nPre == 0 or nSuf == 0 then
NovaAPI.SetTMPText(self._mapNode.TMPPlayerTitle, "")
return
end
local sTitle = orderedFormat(ConfigTable.GetUIText("FriendPanel_PlayerTitle") or "", ConfigTable.GetData("Title", nPre).Desc, ConfigTable.GetData("Title", nSuf).Desc)
NovaAPI.SetTMPText(self._mapNode.TMPPlayerTitle, sTitle)
local nHeadId = PlayerData.Base:GetPlayerHeadId()
local mapCfg = ConfigTable.GetData("PlayerHead", nHeadId)
self:SetPngSprite(self._mapNode.imgHead, mapCfg.Icon)
if mapSelfRanking == nil then
self._mapNode.rtEmpty:SetActive(true)
self._mapNode.rtRankingInfo:SetActive(false)
return
end
self._mapNode.rtEmpty:SetActive(false)
self._mapNode.rtRankingInfo:SetActive(true)
self:SetAtlasSprite(self._mapNode.imgIconRank, "12_rare", "travelerduel_rank_" .. mapSelfRanking.nRewardIdx)
if mapSelfRanking.nRewardIdx == 4 then
local nRanking = ConfigTable.GetData("TravelerDuelChallengeRankReward", 4).RankUpper * ConfigData.IntFloatPrecision
NovaAPI.SetTMPText(self._mapNode.TMPRank, orderedFormat(ConfigTable.GetUIText("TravelerDuel_ChallengeRankTitle1"), nRanking))
else
NovaAPI.SetTMPText(self._mapNode.TMPRank, orderedFormat(ConfigTable.GetUIText("TravelerDuel_RankRewardTitle4"), mapSelfRanking.Rank))
end
NovaAPI.SetTMPText(self._mapNode.TMPScore, mapSelfRanking.Score)
end
return TravelerDuelRankingPlayerInfoCtrl
@@ -0,0 +1,65 @@
local TravelerDuelRankingUploadCtrl = class("TravelerDuelRankingUploadCtrl", BaseCtrl)
TravelerDuelRankingUploadCtrl._mapNodeConfig = {
TMPNewScoreTitle = {sComponentName = "TMP_Text"},
TMPOldScoreTitle = {sComponentName = "TMP_Text"},
TMPOldScore = {sComponentName = "TMP_Text"},
TMPNewScore = {sComponentName = "TMP_Text"},
TMPHintTimes = {sComponentName = "TMP_Text"},
TMPHint = {sComponentName = "TMP_Text"},
btnCancel = {
sComponentName = "UIButton",
callback = "OnBtnClick_Cancel"
},
btnConfirm1 = {
sComponentName = "UIButton",
callback = "OnBtnClick_Confirm"
},
btnClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Cancel"
}
}
TravelerDuelRankingUploadCtrl._mapEventConfig = {}
TravelerDuelRankingUploadCtrl._mapRedDotConfig = {}
function TravelerDuelRankingUploadCtrl:Awake()
end
function TravelerDuelRankingUploadCtrl:FadeIn()
end
function TravelerDuelRankingUploadCtrl:FadeOut()
end
function TravelerDuelRankingUploadCtrl:OnEnable()
local tbParam = self:GetPanelParam()
local nOldScore = tbParam[1]
local nNewScore = tbParam[2]
local nRemainTimes = tbParam[3]
local tbChar = tbParam[4]
self.tbChar = tbChar
self.nNewScore = nNewScore
NovaAPI.SetTMPText(self._mapNode.TMPOldScore, nOldScore)
NovaAPI.SetTMPText(self._mapNode.TMPNewScore, nNewScore)
NovaAPI.SetTMPText(self._mapNode.TMPHintTimes, orderedFormat(ConfigTable.GetUIText("TDRanking_UploadTimes"), nRemainTimes))
end
function TravelerDuelRankingUploadCtrl:OnDisable()
end
function TravelerDuelRankingUploadCtrl:OnDestroy()
end
function TravelerDuelRankingUploadCtrl:OnRelease()
end
function TravelerDuelRankingUploadCtrl:OnBtnClick_Confirm()
PlayerData.TravelerDuel:SendMsg_UplodeTravelerDuelRanking(self.tbChar, self.nNewScore, nil)
EventManager.Hit(EventId.ClosePanel, PanelId.TravelerDuelRankingUpload)
end
function TravelerDuelRankingUploadCtrl:OnBtnClick_Cancel()
local confirmCallback = function()
EventManager.Hit("TDUploadRankEnd")
EventManager.Hit(EventId.ClosePanel, PanelId.TravelerDuelRankingUpload)
end
local msg = {
nType = AllEnum.MessageBox.Confirm,
sContent = ConfigTable.GetUIText("TravelerDuel_UploadCancelHint"),
callbackConfirm = confirmCallback,
bBlur = false
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
return TravelerDuelRankingUploadCtrl
@@ -0,0 +1,21 @@
local TravelerDuelRankingUploadPanel = class("TravelerDuelRankingUploadPanel", BasePanel)
TravelerDuelRankingUploadPanel._bIsMainPanel = false
TravelerDuelRankingUploadPanel._tbDefine = {
{
sPrefabPath = "TravelerDuelLevelSelect/TDRankingUploadPanel.prefab",
sCtrlName = "Game.UI.TravelerDuelLevelSelect.TravelerDuelRanking.TravelerDuelRankingUploadCtrl"
}
}
function TravelerDuelRankingUploadPanel:Awake()
end
function TravelerDuelRankingUploadPanel:OnEnable()
end
function TravelerDuelRankingUploadPanel:OnAfterEnter()
end
function TravelerDuelRankingUploadPanel:OnDisable()
end
function TravelerDuelRankingUploadPanel:OnDestroy()
end
function TravelerDuelRankingUploadPanel:OnRelease()
end
return TravelerDuelRankingUploadPanel
@@ -0,0 +1,71 @@
local TravelerDuelRankUploadSuccessCtrl = class("TravelerDuelRankUploadSuccessCtrl", BaseCtrl)
TravelerDuelRankUploadSuccessCtrl._mapNodeConfig = {
TMPScoreTitle = {sComponentName = "TMP_Text"},
TMPRankingTitle = {sComponentName = "TMP_Text"},
TMPOldRanking = {sComponentName = "TMP_Text"},
TMPNewRanking = {sComponentName = "TMP_Text"},
TMPOldScore = {sComponentName = "TMP_Text"},
TMPNewScore = {sComponentName = "TMP_Text"},
imgRankIcon = {nCount = 4},
btnMaskClose = {
sComponentName = "Button",
callback = "OnBtnClick_Close"
},
imgArrowRanking = {},
imgArrowScore = {},
TMPFirstRanking = {sComponentName = "TMP_Text"},
TMPFirstScore = {sComponentName = "TMP_Text"},
imgFirstArrowRanking = {},
imgFirstArrowScore = {},
goNormalRanking = {},
goNormalScore = {}
}
TravelerDuelRankUploadSuccessCtrl._mapEventConfig = {}
TravelerDuelRankUploadSuccessCtrl._mapRedDotConfig = {}
function TravelerDuelRankUploadSuccessCtrl:Awake()
end
function TravelerDuelRankUploadSuccessCtrl:FadeIn()
end
function TravelerDuelRankUploadSuccessCtrl:FadeOut()
end
function TravelerDuelRankUploadSuccessCtrl:OnEnable()
local tbParam = self:GetPanelParam()
local nOldScore = tbParam[1]
local nNewScore = tbParam[2]
local nOldRank = tbParam[3]
local nNewRank = tbParam[4]
local nRewardIdx = tbParam[5]
if nOldRank == 0 and nOldScore == 0 then
NovaAPI.SetTMPText(self._mapNode.TMPFirstRanking, nNewRank)
NovaAPI.SetTMPText(self._mapNode.TMPFirstScore, nNewScore)
self._mapNode.imgFirstArrowRanking:SetActive(nOldRank < nNewRank)
self._mapNode.imgFirstArrowScore:SetActive(nOldScore < nNewScore)
self._mapNode.TMPFirstRanking.gameObject:SetActive(true)
self._mapNode.TMPFirstScore.gameObject:SetActive(true)
self._mapNode.goNormalRanking.gameObject:SetActive(false)
self._mapNode.goNormalScore.gameObject:SetActive(false)
self._mapNode.imgArrowScore:SetActive(false)
self._mapNode.imgArrowRanking:SetActive(false)
else
NovaAPI.SetTMPText(self._mapNode.TMPOldRanking, nOldRank)
NovaAPI.SetTMPText(self._mapNode.TMPNewRanking, nNewRank)
NovaAPI.SetTMPText(self._mapNode.TMPOldScore, nOldScore)
NovaAPI.SetTMPText(self._mapNode.TMPNewScore, nNewScore)
self._mapNode.imgArrowScore:SetActive(nOldScore < nNewScore)
self._mapNode.imgArrowRanking:SetActive(nOldRank > nNewRank)
end
for i = 1, 4 do
self._mapNode.imgRankIcon[i]:SetActive(nRewardIdx == i)
end
end
function TravelerDuelRankUploadSuccessCtrl:OnDisable()
end
function TravelerDuelRankUploadSuccessCtrl:OnDestroy()
end
function TravelerDuelRankUploadSuccessCtrl:OnRelease()
end
function TravelerDuelRankUploadSuccessCtrl:OnBtnClick_Close()
EventManager.Hit("TDUploadRankEnd")
EventManager.Hit(EventId.ClosePanel, PanelId.TravelerDuelRankUploadSuccess)
end
return TravelerDuelRankUploadSuccessCtrl
@@ -0,0 +1,21 @@
local TravelerDuelRankUploadSuccessPanel = class("TravelerDuelRankUploadSuccessPanel", BasePanel)
TravelerDuelRankUploadSuccessPanel._bIsMainPanel = false
TravelerDuelRankUploadSuccessPanel._tbDefine = {
{
sPrefabPath = "TravelerDuelLevelSelect/TDUploadSuccessPanel.prefab",
sCtrlName = "Game.UI.TravelerDuelLevelSelect.TravelerDuelRanking.TravelerDuelRankUploadSuccessCtrl"
}
}
function TravelerDuelRankUploadSuccessPanel:Awake()
end
function TravelerDuelRankUploadSuccessPanel:OnEnable()
end
function TravelerDuelRankUploadSuccessPanel:OnAfterEnter()
end
function TravelerDuelRankUploadSuccessPanel:OnDisable()
end
function TravelerDuelRankUploadSuccessPanel:OnDestroy()
end
function TravelerDuelRankUploadSuccessPanel:OnRelease()
end
return TravelerDuelRankUploadSuccessPanel
@@ -0,0 +1,62 @@
local TravelerDuelRewardGridCtrl = class("TravelerDuelRewardGridCtrl", BaseCtrl)
local ConfigData = require("GameCore.Data.ConfigData")
TravelerDuelRewardGridCtrl._mapNodeConfig = {
imgBg1 = {},
imgBg2 = {},
imgRankingIcon = {sComponentName = "Image"},
TMPRanking = {sComponentName = "TMP_Text"},
tcItem = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
nCount = 2
},
btnItem = {sComponentName = "UIButton", nCount = 2}
}
TravelerDuelRewardGridCtrl._mapEventConfig = {}
TravelerDuelRewardGridCtrl._mapRedDotConfig = {}
function TravelerDuelRewardGridCtrl:Awake()
end
function TravelerDuelRewardGridCtrl:FadeIn()
end
function TravelerDuelRewardGridCtrl:FadeOut()
end
function TravelerDuelRewardGridCtrl:OnEnable()
end
function TravelerDuelRewardGridCtrl:OnDisable()
end
function TravelerDuelRewardGridCtrl:OnDestroy()
end
function TravelerDuelRewardGridCtrl:OnRelease()
end
function TravelerDuelRewardGridCtrl:Refresh(nIdx, bSelfIdx)
self._mapNode.imgBg1:SetActive(bSelfIdx == nIdx)
self._mapNode.imgBg2:SetActive(bSelfIdx ~= nIdx)
local mapRewardCfgData = ConfigTable.GetData("TravelerDuelChallengeRankReward", nIdx)
if mapRewardCfgData == nil then
return
end
self:SetAtlasSprite(self._mapNode.imgRankingIcon, "12_rare", "travelerduel_rank_" .. nIdx)
local nRankingHigher = mapRewardCfgData.RankUpper * ConfigData.IntFloatPrecision
local nRankLower = 1
if ConfigTable.GetData("TravelerDuelChallengeRankReward", nIdx + 1) ~= nil then
nRankLower = ConfigTable.GetData("TravelerDuelChallengeRankReward", nIdx + 1).RankLower * ConfigData.IntFloatPrecision
end
if nIdx == 4 then
NovaAPI.SetTMPText(self._mapNode.TMPRanking, orderedFormat(ConfigTable.GetUIText("TravelerDuel_RankRewardTitle2"), nRankingHigher))
else
NovaAPI.SetTMPText(self._mapNode.TMPRanking, orderedFormat(ConfigTable.GetUIText("TravelerDuel_RankRewardTitle3"), nRankingHigher, nRankLower))
end
self._mapNode.tcItem[1]:SetItem(mapRewardCfgData.AwardItemTid1, nil, mapRewardCfgData.AwardItemNum1, nil, false, false, false, true, false, false)
self._mapNode.tcItem[2]:SetItem(mapRewardCfgData.AwardItemTid2, nil, mapRewardCfgData.AwardItemNum2, nil, false, false, false, true, false, false)
self._mapNode.btnItem[1].onClick:RemoveAllListeners()
self._mapNode.btnItem[2].onClick:RemoveAllListeners()
self._mapNode.btnItem[1].onClick:AddListener(function()
self:OnBtn_ClickItem(self._mapNode.btnItem[1], mapRewardCfgData.AwardItemTid1)
end)
self._mapNode.btnItem[2].onClick:AddListener(function()
self:OnBtn_ClickItem(self._mapNode.btnItem[2], mapRewardCfgData.AwardItemTid2)
end)
end
function TravelerDuelRewardGridCtrl:OnBtn_ClickItem(btn, itemId)
UTILS.ClickItemGridWithTips(itemId, btn.transform, true, true, false)
end
return TravelerDuelRewardGridCtrl