Update - 1.13.0.124

EN: 1.13.0.124
CN: 1.13.0.124
JP: 1.13.0.128
KR: 1.13.0.130
This commit is contained in:
SL1900
2026-07-21 12:30:00 +09:00
parent a12087abad
commit 8c4bd41668
1334 changed files with 873026 additions and 95164 deletions
@@ -0,0 +1,420 @@
local TDBattleResultCtrl = class("TDBattleResultCtrl", BaseCtrl)
local WwiseManger = CS.WwiseAudioManager.Instance
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
TDBattleResultCtrl._mapNodeConfig = {
imgBlurredBg = {},
goComplete = {sComponentName = "GameObject"},
goFailed = {sComponentName = "GameObject"},
Mask = {
sComponentName = "CanvasGroup"
},
goMainlineNameSuc = {
sComponentName = "RectTransform"
},
txtMainlineName = {nCount = 2, sComponentName = "TMP_Text"},
ButtonClose = {
nCount = 2,
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
btnDamageResult = {
nCount = 2,
sComponentName = "UIButton",
callback = "OnBtnClick_ShowDamageResult"
},
goRoot = {
sNodeName = "----SafeAreaRoot----"
},
animatorRoot = {sNodeName = "goComplete", sComponentName = "Animator"},
goWorldLevel = {},
imgExp = {sComponentName = "Image"},
txtRank = {sComponentName = "TMP_Text"},
txtRankEn = {
sComponentName = "TMP_Text",
sLanguageId = "MainView_RANK"
},
txtWorldExp = {sComponentName = "TMP_Text"},
imgExpBg = {},
txtGetWorldExp = {sComponentName = "TMP_Text"},
goRankArrow = {},
imgBlack = {},
txtTip = {
sComponentName = "TMP_Text",
sLanguageId = "Battle_Result_Fail_Tip"
},
txtTipShadow = {
sComponentName = "TMP_Text",
sLanguageId = "Battle_Result_Fail_Tip"
},
txtExp = {
sComponentName = "TMP_Text",
sLanguageId = "WorldClass_ExpTips"
},
goGacha = {},
animGacha = {
sNodeName = "goGachaItem",
sComponentName = "Animator"
},
imgFull = {sComponentName = "Image"},
imgSplitB = {sComponentName = "Image"},
imgSplitC = {sComponentName = "Image"},
imgSplitD = {sComponentName = "Image"},
goAffixes = {},
TMPTitleAffix = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_Affixes_Title"
},
goAffix = {sComponentName = "Transform", nCount = 25},
TMPHardTitle = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_Result_Difficulty"
},
txtRankTimeTitle = {
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Battle_Time"
},
TMPHard = {sComponentName = "TMP_Text"},
txtRankTime = {sComponentName = "TMP_Text"},
imgNewRecord = {},
imgHardTitleBg = {},
imgHardScoreTitleBg = {},
imgTimeScoreTitleBg = {},
TMPFinalScoreTitle = {
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Result_FinalScore_Title"
},
TMPFinalScore = {sComponentName = "TMP_Text"},
TMPTimeScoreTitle = {
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Result_TimeScore_Title"
},
TMPTimeScore = {sComponentName = "TMP_Text"},
TMPHardScore = {sComponentName = "TMP_Text"},
TMPHardScoreTitle = {
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Result_BaseScore_Title"
},
txtClickToContinue = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Tips_Continue"
}
}
TDBattleResultCtrl._mapEventConfig = {}
local starGachaCfg = {
[1] = {
iconPath = "icon_roguegacha_03%s",
animName = "BattleResultgoGacha_r"
},
[2] = {
iconPath = "icon_roguegacha_02%s",
animName = "BattleResultgoGacha_sr"
},
[3] = {
iconPath = "icon_roguegacha_01%s",
animName = "BattleResultgoGacha_ssr"
}
}
local name_bg_pos_y_1 = 220
local name_bg_pos_y_2 = 119
local time_bg_pos_y_1 = -4.1
local time_bg_pos_y_2 = -113
function TDBattleResultCtrl:Awake()
self.canvas = self.gameObject:GetComponent("Canvas")
EventManager.Hit(EventId.AvgBubbleShutDown)
NovaAPI.SetComponentEnable(self.canvas, false)
self._mapNode.goGacha.gameObject:SetActive(false)
end
function TDBattleResultCtrl:OnEnable()
self.bAnimEnd = false
local tbParam = self:GetPanelParam()
self.nResultState = 0
if tbParam[1] == false then
self.nResultState = 3
elseif tbParam[1] then
self.nResultState = 1
end
local tbStar = tbParam[2]
local GenerRewardItems = tbParam[3]
local FirstRewardItems = tbParam[4]
local ChestRewardItems = tbParam[5]
local nExp = tbParam[6] or 0
local bPureAvg = tbParam[7]
local nTime = tbParam[8]
local nTDLevelId = tbParam[9]
local tbChar = tbParam[10]
local tbAffixes = tbParam[11]
local nTimeScore = tbParam[12]
local nHardScore = tbParam[13]
local nFinalScore = tbParam[14]
local bNewRecord = tbParam[15]
self.mapChangeInfo = tbParam[16]
local SurpriseItems = tbParam[17]
local CustomItems = tbParam[18]
self.tbCharDamage = tbParam[19] or {}
local nHard = 0
for i = 1, 2 do
self._mapNode.btnDamageResult[i].gameObject:SetActive(self.tbCharDamage ~= nil and 0 < #self.tbCharDamage)
end
self.bNewRecord = bNewRecord
self.nFinalScore = nFinalScore
self.tbChar = tbChar
for _, nAffixesId in ipairs(tbAffixes) do
local mapAffixCfgData = ConfigTable.GetData("TravelerDuelChallengeAffix", nAffixesId)
if mapAffixCfgData ~= nil then
nHard = nHard + mapAffixCfgData.Difficulty
end
end
for index = 1, 25 do
self:SetAffixIcon(self._mapNode.goAffix[index], tbAffixes[index])
end
NovaAPI.SetTMPText(self._mapNode.TMPHard, nHard)
NovaAPI.SetTMPText(self._mapNode.txtRankTime, nTime .. ConfigTable.GetUIText("Talent_Sec"))
NovaAPI.SetTMPText(self._mapNode.TMPFinalScore, nFinalScore)
NovaAPI.SetTMPText(self._mapNode.TMPTimeScore, nTimeScore)
NovaAPI.SetTMPText(self._mapNode.TMPHardScore, nHardScore)
self._mapNode.imgNewRecord:SetActive(bNewRecord)
self.mapTravelerDuelLevel = ConfigTable.GetData("TravelerDuelBossLevel", nTDLevelId)
local sTravelerDuelLevelName = ""
if self.mapTravelerDuelLevel ~= nil then
if self.nResultState == 1 then
sTravelerDuelLevelName = self.mapTravelerDuelLevel.Name
else
sTravelerDuelLevelName = self.mapTravelerDuelLevel.Name .. "<space=9>" .. orderedFormat(ConfigTable.GetUIText("TD_BattleResultDifficulty"), nHard)
end
end
local nStar = 0
for i = 0, 2 do
if tbStar[i] then
nStar = nStar + 1
end
end
self.nLevelStar = nStar
self.bSuccess = 0 < nStar
self.mapReward = {}
if SurpriseItems ~= nil then
for _, v in pairs(SurpriseItems) do
v.rewardType = AllEnum.RewardType.Extra
table.insert(self.mapReward, v)
end
end
for _, v in pairs(GenerRewardItems) do
table.insert(self.mapReward, v)
end
if CustomItems ~= nil then
for _, v in pairs(CustomItems) do
table.insert(self.mapReward, v)
end
end
for _, v in pairs(FirstRewardItems) do
v.rewardType = AllEnum.RewardType.First
table.insert(self.mapReward, v)
end
for _, v in pairs(ChestRewardItems) do
v.rewardType = AllEnum.RewardType.Three
table.insert(self.mapReward, v)
end
for _, v in ipairs(self._mapNode.txtMainlineName) do
NovaAPI.SetTMPText(v, sTravelerDuelLevelName)
end
self:RefreshWorldClass(nExp)
local nCurTeam = 5
if PlayerData.nCurGameType == AllEnum.WorldMapNodeType.Mainline then
nCurTeam = PlayerData.Mainline.nCurTeamIndex
end
local tbTeamMemberId, nCaptain
if tbChar == nil then
nCaptain, tbTeamMemberId = PlayerData.Team:GetTeamData(nCurTeam)
else
tbTeamMemberId = tbChar
end
local tbRoleId = {}
for i = 1, #tbTeamMemberId do
if tbTeamMemberId[i] ~= nil and 0 < tbTeamMemberId[i] then
table.insert(tbRoleId, tbTeamMemberId[i])
end
end
if #tbRoleId == 0 then
table.insert(tbRoleId, 112)
end
self.tbRoleList = tbRoleId
self._mapNode.imgHardTitleBg:SetActive(true)
self._mapNode.imgHardScoreTitleBg:SetActive(false)
self._mapNode.imgTimeScoreTitleBg:SetActive(false)
self._mapNode.TMPFinalScoreTitle.gameObject:SetActive(false)
WwiseManger:PostEvent("ui_loading_combatSFX_mute", nil, false)
WwiseManger:PostEvent("char_common_all_pause")
WwiseManger:PostEvent("mon_common_all_pause")
WwiseManger:SetState("level", "None")
WwiseManger:SetState("combat", "None")
local nAnimTime
if self.nResultState == 1 then
self._mapNode.goRoot.gameObject:SetActive(true)
self._mapNode.imgBlurredBg.gameObject:SetActive(false)
self._mapNode.goFailed:SetActive(false)
self._mapNode.goComplete:SetActive(true)
WwiseManger:PlaySound("ui_roguelike_victory")
WwiseManger:SetState("system", "victory2")
if 0 < #tbAffixes then
nAnimTime = 4.2
self._mapNode.animatorRoot:Play("TravelerDuelBattleResultPanel_victory_out")
self._mapNode.imgBlack:SetActive(true)
else
nAnimTime = 4
self._mapNode.imgBlack:SetActive(false)
end
else
WwiseManger:SetState("system", "defeat")
CS.AdventureModuleHelper.PauseLogic()
self._mapNode.goRoot.gameObject:SetActive(false)
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
self._mapNode.goFailed:SetActive(true)
self._mapNode.goComplete:SetActive(false)
nAnimTime = 3
end
self._mapNode.Mask.gameObject:SetActive(false)
self._mapNode.ButtonClose[1].gameObject:SetActive(false)
self._mapNode.ButtonClose[2].gameObject:SetActive(false)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.goRoot.gameObject:SetActive(true)
self._mapNode.ButtonClose[1].gameObject:SetActive(true)
self._mapNode.ButtonClose[2].gameObject:SetActive(true)
NovaAPI.SetComponentEnable(self.canvas, true)
if bPureAvg then
self:OpenReward()
end
end
self._coroutine = cs_coroutine.start(wait)
nAnimTime = nAnimTime + 1.5
self:AddTimer(1, nAnimTime, "PlayAnim", true, true, true)
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
self._mapNode.txtClickToContinue[1].gameObject:SetActive(false)
self._mapNode.txtClickToContinue[2].gameObject:SetActive(false)
local sType = self.nResultState == 1 and "TrekkerVersus_victory" or "TrekkerVersus_fail"
local sVoiceRes = PlayerData.Voice:PlayCharVoice(sType, 917202, nil, true)
self.bProcessingClose = false
end
function TDBattleResultCtrl:OnDisable()
if self._sequence ~= nil then
self._sequence:Kill()
self._sequence = nil
end
if self._coroutine ~= nil then
cs_coroutine.stop(self._coroutine)
self._coroutine = nil
end
if self._coroutineOpen ~= nil then
cs_coroutine.stop(self._coroutineOpen)
self._coroutineOpen = nil
end
PlayerData.Voice:StopCharVoice()
end
function TDBattleResultCtrl:SetAffixIcon(trIcon, nAffixId)
local rtIconRoot = trIcon:Find("rtIcon")
local imgIcon = trIcon:Find("rtIcon/imgIcon"):GetComponent("Image")
local TMPLevel = trIcon:Find("rtIcon/imgBgLevel/TMPLevel"):GetComponent("TMP_Text")
if nAffixId == nil then
rtIconRoot.gameObject:SetActive(false)
return
end
local mapAffixCfgData = ConfigTable.GetData("TravelerDuelChallengeAffix", nAffixId)
if mapAffixCfgData == nil then
rtIconRoot.gameObject:SetActive(false)
return
end
NovaAPI.SetTMPText(TMPLevel, mapAffixCfgData.Difficulty)
self:SetPngSprite(imgIcon, mapAffixCfgData.Icon)
end
function TDBattleResultCtrl:PlayAnim()
self.bAnimEnd = true
PlayerData.SideBanner:TryOpenSideBanner()
self._mapNode.txtClickToContinue[1].gameObject:SetActive(true)
self._mapNode.txtClickToContinue[2].gameObject:SetActive(true)
end
function TDBattleResultCtrl:RefreshWorldClass(nExp)
local nWorldClass = PlayerData.Base:GetWorldClass()
local nCurExp = PlayerData.Base:GetWorldExp()
local mapCfg = ConfigTable.GetData("WorldClass", nWorldClass + 1, true)
local nFullExp = 1
if mapCfg then
nFullExp = mapCfg.Exp or 1
end
NovaAPI.SetTMPText(self._mapNode.txtRank, nWorldClass)
NovaAPI.SetTMPText(self._mapNode.txtWorldExp, nCurExp .. "/" .. nFullExp)
local nfillAmount = nCurExp / nFullExp
NovaAPI.SetImageFillAmount(self._mapNode.imgExp, 1 < nfillAmount and 1 or nfillAmount)
self._mapNode.imgExpBg.gameObject:SetActive(0 < nExp)
NovaAPI.SetTMPText(self._mapNode.txtGetWorldExp, "+" .. nExp)
self._mapNode.goRankArrow.gameObject:SetActive(false)
end
function TDBattleResultCtrl:ClosePanel()
if self.bProcessingClose then
return
end
self.bProcessingClose = true
if self.nResultState ~= 1 then
CS.AdventureModuleHelper.ResumeLogic()
end
NovaAPI.SetCanvasGroupAlpha(self._mapNode.Mask, 0)
self._mapNode.Mask.gameObject:SetActive(true)
self._sequence = DOTween.Sequence()
self._sequence:Append(self._mapNode.Mask:DOFade(1, 0.5):SetUpdate(true))
self._sequence:AppendCallback(dotween_callback_handler(self, self.OnFadeComplete))
self._sequence:SetUpdate(true)
end
function TDBattleResultCtrl:OnFadeComplete()
if self.bSuccess then
NovaAPI.EnterModule("MainMenuModuleScene", true, 17)
self._mapNode.imgBlurredBg:SetActive(false)
else
local function levelEndCallback()
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
NovaAPI.EnterModule("MainMenuModuleScene", true, 17)
self._mapNode.imgBlurredBg:SetActive(false)
end
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
CS.AdventureModuleHelper.LevelStateChanged(true, 0, true)
end
end
function TDBattleResultCtrl:RefreshGacha()
local sIconPath = "UI/big_sprites/"
local gachaCfg = starGachaCfg[self.nLevelStar]
if nil ~= gachaCfg then
self:SetPngSprite(self._mapNode.imgFull, sIconPath .. string.format(gachaCfg.iconPath, "a"))
self:SetPngSprite(self._mapNode.imgSplitB, sIconPath .. string.format(gachaCfg.iconPath, "b"))
self:SetPngSprite(self._mapNode.imgSplitC, sIconPath .. string.format(gachaCfg.iconPath, "c"))
self:SetPngSprite(self._mapNode.imgSplitD, sIconPath .. string.format(gachaCfg.iconPath, "d"))
self._mapNode.animGacha:Play(gachaCfg.animName)
end
end
function TDBattleResultCtrl:OnBtnClick_Close(btn)
if not self.bAnimEnd then
return
end
self:ClosePanel()
end
function TDBattleResultCtrl:OpenReward()
if #self.mapReward > 0 then
local nAnimTime = 2
self._mapNode.goGacha.gameObject:SetActive(true)
WwiseManger:PlaySound("ui_roguelike_gacha_specialOpen")
self:RefreshGacha()
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForSeconds(nAnimTime))
local callback = function()
self:ClosePanel()
end
UTILS.OpenReceiveByDisplayItem(self.mapReward, self.mapChangeInfo, callback)
end
self._coroutineOpen = cs_coroutine.start(wait)
else
self:ClosePanel()
end
end
function TDBattleResultCtrl:OnBtnClick_ShowDamageResult()
EventManager.Hit(EventId.OpenPanel, PanelId.BattleDamage, self.tbCharDamage)
end
return TDBattleResultCtrl
@@ -0,0 +1,17 @@
local TDBattleResultPanel = class("TDBattleResultPanel", BasePanel)
TDBattleResultPanel._bAddToBackHistory = false
TDBattleResultPanel._tbDefine = {
{
sPrefabPath = "BattleResult/TravelerDuelBattleResultPanel.prefab",
sCtrlName = "Game.UI.TrekkerVersus_600003.TDBattleResultCtrl"
}
}
function TDBattleResultPanel:Awake()
end
function TDBattleResultPanel:OnEnable()
end
function TDBattleResultPanel:OnDisable()
end
function TDBattleResultPanel:OnDestroy()
end
return TDBattleResultPanel
@@ -0,0 +1,53 @@
local TravelerDuelChallengeAffixGrid = class("TravelerDuelChallengeAffixGrid", BaseCtrl)
TravelerDuelChallengeAffixGrid._mapNodeConfig = {
imgSelect = {},
imgGroupMask = {sComponentName = "Image"},
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, mapActData)
self.nAffixId = nAffixId
if nAffixId == 0 then
self._mapNode.btnGrid.gameObject:SetActive(false)
return
else
self._mapNode.btnGrid.gameObject:SetActive(true)
end
local bUnlock, nType, nCond = mapActData:GetTravelerDuelAffixUnlock(nAffixId)
self.bUnlock = bUnlock
self.nType = nType
self.nCond = nCond
local mapAffixCfgData = ConfigTable.GetData("TravelerDuelChallengeAffix", nAffixId)
self._mapNode.imgLine:SetActive(bLine)
self:SetPngSprite(self._mapNode.imgAffixIcon, mapAffixCfgData.Icon)
self:SetPngSprite(self._mapNode.imgGroupMask, mapAffixCfgData.Icon)
NovaAPI.SetTMPText(self._mapNode.TMPHard, mapAffixCfgData.Difficulty)
NovaAPI.SetTMPText(self._mapNode.TMPHardMask, mapAffixCfgData.Difficulty)
self._mapNode.imgSelect:SetActive(bSelect)
self._mapNode.imgGroupMask.gameObject: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), nCond))
end
end
function TravelerDuelChallengeAffixGrid:SetSelect(bSelect)
self._mapNode.imgSelect:SetActive(bSelect)
end
function TravelerDuelChallengeAffixGrid:GetAffixId()
return self.nAffixId
end
function TravelerDuelChallengeAffixGrid:SetGroupMask(bGroupSelect)
self._mapNode.imgGroupMask.gameObject: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)
end
return TravelerDuelChallengeAffixGrid
@@ -0,0 +1,714 @@
local TravelerDuelChallengeInfoCtrl = class("TravelerDuelChallengeInfoCtrl", BaseCtrl)
local ConfigData = require("GameCore.Data.ConfigData")
local _, colorWhite = ColorUtility.TryParseHtmlString("#FFFFFF")
local _, colorGreen = ColorUtility.TryParseHtmlString("#ebffc3")
TravelerDuelChallengeInfoCtrl._mapNodeConfig = {
txtTitleHard = {
sComponentName = "TMP_Text",
sLanguageId = "TD_AffixHardLevelTitle"
},
txtTitleAffix = {
sComponentName = "TMP_Text",
sLanguageId = "TD_SelectedAffixTitle"
},
gridAffix = {},
rtAffixListContent = {sComponentName = "Transform"},
ScrollView = {
sNodeName = "svAffixSelect",
sComponentName = "ScrollRect"
},
AffixPrefab = {},
txtAffixSelectTitle = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_AffixSelectTitle"
},
txtAffixSelfSelectTitle = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_AffixSelfSelectTitle"
},
ContentAffixSelect = {sComponentName = "Transform"},
ContentAffixSelfSelect = {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"},
txtTitleRecommendTrekkerLevel = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_RecommendLevelTitle"
},
imgElementInfoChallenge = {sComponentName = "Image", nCount = 3},
imgChallengeCover = {sComponentName = "Transform"},
btnGoChallenge = {
sComponentName = "UIButton",
callback = "OnBtnClick_Go"
},
txtBtnGoChallenge = {
sComponentName = "TMP_Text",
sLanguageId = "Maninline_Btn_Go"
},
btnClearSelect = {
sComponentName = "UIButton",
callback = "OnBtnClick_ClearAllAffix"
},
txtClearSelect = {
sComponentName = "TMP_Text",
sLanguageId = "TD_ClearAffixTitle"
},
srAffixList = {
sComponentName = "UIScrollToClick"
},
goEmpty = {},
txtEmpty = {
sComponentName = "TMP_Text",
sLanguageId = "TDEmptyAffix"
},
TMPRecEleTitle = {
sComponentName = "TMP_Text",
sLanguageId = "InfinityTower_Recommend"
},
TMPRecommendBuildTitleChallenge = {
sComponentName = "TMP_Text",
sLanguageId = "InfinityTower_Recommend_Construct"
},
imgReconmendBuildChallenge = {sComponentName = "Image"},
btnEnemyInfoChallengeInfo = {
sComponentName = "UIButton",
callback = "OnBtnClick_EnemyInfo"
}
}
TravelerDuelChallengeInfoCtrl._mapEventConfig = {}
TravelerDuelChallengeInfoCtrl._mapRedDotConfig = {}
function TravelerDuelChallengeInfoCtrl:Awake()
end
function TravelerDuelChallengeInfoCtrl:FadeIn()
end
function TravelerDuelChallengeInfoCtrl:FadeOut()
end
function TravelerDuelChallengeInfoCtrl:OnEnable()
end
function TravelerDuelChallengeInfoCtrl:OnDisable()
if self._coroutineScroll ~= nil then
cs_coroutine.stop(self._coroutineScroll)
self._coroutineScroll = nil
end
self:ClearListGrids()
end
function TravelerDuelChallengeInfoCtrl:OnDestroy()
end
function TravelerDuelChallengeInfoCtrl:OnRelease()
end
function TravelerDuelChallengeInfoCtrl:Refresh(nLevelId, tbAllAffix, mapActData)
self.mapActData = mapActData
self.tbAllAffix = tbAllAffix
self.tbEnemyAffix = {}
self.tbSelfAffix = {}
self:InitAffixData()
self:ClearListGrids()
local mapBossLevelData = ConfigTable.GetData("TravelerDuelBossLevel", nLevelId)
if mapBossLevelData == nil then
return
end
self.nLevelId = nLevelId
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.TMPChallengeAttr, string.format("%d%%", mapLevel.Attr))
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevelChallenge, mapLevel.RecommendLevel)
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")
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.lastSelAffixId = nil
self:CreateAffixGrid()
self:RefreshAffixGrid()
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.ScrollView, 1)
self:InitCachedSelectedGridState()
end
function TravelerDuelChallengeInfoCtrl:ClearAffixContentChildren(trContent)
if trContent == nil then
return
end
for i = trContent.childCount - 1, 0, -1 do
local trChild = trContent:GetChild(i)
if trChild ~= nil and trChild:IsNull() == false then
trChild.gameObject.name = " "
destroy(trChild.gameObject)
end
end
end
function TravelerDuelChallengeInfoCtrl:CreateAffixGrid()
local tr_enemy = self._mapNode.ContentAffixSelect
local tr_self = self._mapNode.ContentAffixSelfSelect
for nIdx, tbData in ipairs(self.tbEnemyAffix) do
local go_affix = instantiate(self._mapNode.AffixPrefab, tr_enemy)
go_affix.gameObject.name = tostring(nIdx - 1)
self.mapAffixGrid[go_affix] = self:BindCtrlByNode(go_affix, "Game.UI.TrekkerVersus_600003.TravelerDuelChallengeAffixGrid")
go_affix:SetActive(true)
end
for nIdx, tbData in ipairs(self.tbSelfAffix) do
local go_affix = instantiate(self._mapNode.AffixPrefab, tr_self)
go_affix.gameObject.name = tostring(nIdx - 1)
self.mapAffixGrid[go_affix] = self:BindCtrlByNode(go_affix, "Game.UI.TrekkerVersus_600003.TravelerDuelChallengeAffixGrid")
go_affix:SetActive(true)
end
end
function TravelerDuelChallengeInfoCtrl:RefreshAffixGrid()
local tr_enemy = self._mapNode.ContentAffixSelect
local tr_self = self._mapNode.ContentAffixSelfSelect
for nIdx, tbData in ipairs(self.tbEnemyAffix) do
local go_affix = tr_enemy:Find(tostring(nIdx - 1)).gameObject
local bLine = self.tbEnemyAffix[nIdx + 1] ~= nil and self.tbEnemyAffix[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 = go_affix.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 >= go_affix.transform.parent.childCount then
go_affix.transform:SetAsLastSibling()
else
go_affix.transform:SetSiblingIndex(nIdx)
end
self.mapAffixGrid[go_affix]:Refresh(tbData[1], bSelect, bGroupMask, bLine, self.mapActData)
local btn_grid = go_affix.transform:Find("btnGrid"):GetComponent("UIButton")
btn_grid.onClick:RemoveAllListeners()
btn_grid.onClick:AddListener(function()
self:OnBtnClickGrid(go_affix, nIdx - 1)
end)
end
for nIdx, tbData in ipairs(self.tbSelfAffix) do
local go_affix = tr_self:Find(tostring(nIdx - 1)).gameObject
local bLine = self.tbSelfAffix[nIdx + 1] ~= nil and self.tbSelfAffix[nIdx + 1][2] == tbData[2]
local bSelect = 0 < table.indexof(self.selectedAffixIds, tbData[1])
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 = go_affix.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 >= go_affix.transform.parent.childCount then
go_affix.transform:SetAsLastSibling()
else
go_affix.transform:SetSiblingIndex(nIdx)
end
self.mapAffixGrid[go_affix]:Refresh(tbData[1], bSelect, bGroupMask, bLine, self.mapActData)
local btn_grid = go_affix.transform:Find("btnGrid"):GetComponent("UIButton")
btn_grid.onClick:RemoveAllListeners()
btn_grid.onClick:AddListener(function()
self:OnBtnClickGrid(go_affix, nIdx - 1)
end)
end
end
function TravelerDuelChallengeInfoCtrl:InitAffixData()
for _, tbData in ipairs(self.tbAllAffix) do
local config = ConfigTable.GetData("TravelerDuelChallengeAffix", tbData[1])
if config ~= nil then
if table.indexof(config.AddCamp, 3) > 0 then
table.insert(self.tbEnemyAffix, tbData)
else
if table.indexof(config.AddCamp, 1) > 0 then
table.insert(self.tbSelfAffix, tbData)
else
end
end
end
end
end
function TravelerDuelChallengeInfoCtrl:InitCachedSelectedGridState()
local cachedAffixes = self.mapActData: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: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")
local imgBg = grid.transform:Find("Bg"):GetComponent("Image")
if textComp ~= nil then
local text = NovaAPI.GetText(textComp)
if text == strId then
selNode.gameObject:SetActive(bSelect)
imgBg.color = bSelect and colorGreen or colorWhite
if bSelect then
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.srAffixList:ScrollToClick(grid)
end
self._coroutineScroll = cs_coroutine.start(wait)
end
else
selNode.gameObject:SetActive(false)
imgBg.color = colorWhite
end
end
end
end
end
end
function TravelerDuelChallengeInfoCtrl:GetGridByDataID(dataID)
local grid
for index, tbData in ipairs(self.tbEnemyAffix) do
if dataID == tbData[1] then
local rtGrid = self._mapNode.ContentAffixSelect:Find(tostring(index - 1))
return rtGrid.gameObject
end
end
for index, tbData in ipairs(self.tbSelfAffix) do
if dataID == tbData[1] then
local rtGrid = self._mapNode.ContentAffixSelfSelect:Find(tostring(index - 1))
return rtGrid.gameObject
end
end
return nil
end
function TravelerDuelChallengeInfoCtrl:OnBtnClickGrid(goGrid, gridIndex)
local nAffixId = self.mapAffixGrid[goGrid]:GetAffixId()
if not self.mapAffixGrid[goGrid].bUnlock then
EventManager.Hit(EventId.OpenMessageBox, orderedFormat(ConfigTable.GetUIText("TD_AffixCondTips" .. self.mapAffixGrid[goGrid].nType), self.mapAffixGrid[goGrid].nCond))
return
end
local bClick = true
if not gridIndex then
gridIndex = tonumber(goGrid.name)
bClick = false
end
local bIsEnemy = false
for index, tbData in ipairs(self.tbEnemyAffix) do
if tbData[1] == nAffixId then
bIsEnemy = true
break
end
end
local nIdx = gridIndex + 1
local tbData
if bIsEnemy then
tbData = self.tbEnemyAffix[nIdx]
else
tbData = self.tbSelfAffix[nIdx]
end
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(bIsEnemy and self.tbEnemyAffix or self.tbSelfAffix) do
if index ~= nIdx and Data[2] == tbData[2] then
local goGridAffix = bIsEnemy and self._mapNode.ContentAffixSelect:Find(tostring(index - 1)).gameObject or self._mapNode.ContentAffixSelfSelect: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
local bGroupExchange = false
local nLastGroupId = 0
for index, Data in ipairs(bIsEnemy and self.tbEnemyAffix or self.tbSelfAffix) do
if index ~= nIdx and Data[2] == tbData[2] and table.indexof(self.selectedAffixIds, Data[1]) > 0 then
bGroupExchange = true
nLastGroupId = Data[1]
end
end
self.mapAffixGrid[goGrid]:SetSelect(true)
self.mapAffixGrid[goGrid]:SetGroupMask(false)
for index, Data in ipairs(bIsEnemy and self.tbEnemyAffix or self.tbSelfAffix) do
if index ~= nIdx and Data[2] == tbData[2] then
local goGridAffix = bIsEnemy and self._mapNode.ContentAffixSelect:Find(tostring(index - 1)).gameObject or self._mapNode.ContentAffixSelfSelect:Find(tostring(index - 1)).gameObject
if goGridAffix ~= nil and self.mapAffixGrid[goGridAffix] ~= nil then
self.mapAffixGrid[goGridAffix]:SetGroupMask(true)
self.mapAffixGrid[goGridAffix]:SetSelect(false)
end
end
end
if bGroupExchange then
table.removebyvalue(self.selectedAffixIds, nLastGroupId)
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, tbData[1])
table.sort(self.selectedAffixIds, Sort)
self:RefreshAffixList()
else
self:AddAffixGrid(tbData[1])
end
if bClick then
local nCurLevel = 0
for _, nAffixId in ipairs(self.selectedAffixIds) do
local mapAffixCfgData = ConfigTable.GetData("TravelerDuelChallengeAffix", nAffixId)
if mapAffixCfgData ~= nil then
nCurLevel = nCurLevel + mapAffixCfgData.Difficulty
end
end
EventManager.Hit("TrekkerVersusSelectAffix", nCurLevel)
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 pairs(self.mapAffixGrid) do
self:UnbindCtrlByNode(mapCtrl)
end
end
self:ClearAffixContentChildren(self._mapNode.ContentAffixSelect)
self:ClearAffixContentChildren(self._mapNode.ContentAffixSelfSelect)
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:AddJumptoAffixes(tbAffixes)
if self.lastSelAffixId ~= nil then
local lastGrid = self:GetGridByDataID(self.lastSelAffixId)
self:RefreshGridSelectState(lastGrid, self.lastSelAffixId, false)
self.lastSelAffixId = nil
end
local nAffixCountChange = 0
local tbLockedAffix = {}
for _, nAffixId in ipairs(tbAffixes) do
local bUnlock, nType, nCond = self.mapActData:GetTravelerDuelAffixUnlock(nAffixId)
local bIsEnemy = false
for index, tbData in ipairs(self.tbEnemyAffix) do
if nAffixId == tbData[1] then
bIsEnemy = true
break
end
end
if not bUnlock then
table.insert(tbLockedAffix, nAffixId)
elseif 1 > table.indexof(self.selectedAffixIds, nAffixId) then
local tbData
local nAffixIdx = 0
for idx, tbAffixData in ipairs(bIsEnemy and self.tbEnemyAffix or self.tbSelfAffix) do
if nAffixId == tbAffixData[1] then
tbData = tbAffixData
nAffixIdx = idx
break
end
end
if tbData ~= nil then
local bGroupExchange = false
local nLastAffixId = 0
for index, Data in ipairs(bIsEnemy and self.tbEnemyAffix or self.tbSelfAffix) do
if index ~= nAffixIdx and Data[2] == tbData[2] and 0 < table.indexof(self.selectedAffixIds, Data[1]) then
bGroupExchange = true
nLastAffixId = Data[1]
end
end
if not bGroupExchange then
nAffixCountChange = nAffixCountChange + 1
else
table.removebyvalue(self.selectedAffixIds, nLastAffixId)
local goGrid = self:GetGridByDataID(nLastAffixId)
if goGrid ~= nil then
self.mapAffixGrid[goGrid]:SetSelect(false)
end
end
table.insert(self.selectedAffixIds, nAffixId)
end
end
end
if 0 < nAffixCountChange then
for i = 1, nAffixCountChange do
local goAffix = instantiate(self._mapNode.gridAffix, self._mapNode.rtAffixListContent)
goAffix:SetActive(true)
table.insert(self.tbAffixGrid, goAffix)
end
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 < b
end
table.sort(self.selectedAffixIds, Sort)
self:RefreshAffixList()
self:RefreshAffixGrid()
if 0 < #tbLockedAffix then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("TravelerDuel_JumptoAffixUnlock"))
end
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
local imgBg = grid.transform:Find("Bg"):GetComponent("Image")
imgBg.color = colorWhite
node.gameObject:SetActive(false)
end
end
local bIsEnemy = false
for index, tbData in ipairs(self.tbEnemyAffix) do
if nAffixId == tbData[1] then
bIsEnemy = true
break
end
end
local selNode = goGrid.transform:Find("selNode")
if selNode ~= nil then
local imgBg = goGrid.transform:Find("Bg"):GetComponent("Image")
selNode.gameObject:SetActive(true)
imgBg.color = colorGreen
local selIndex
for index, Data in ipairs(bIsEnemy and self.tbEnemyAffix or self.tbSelfAffix) do
local id = Data[1]
if id == affixId then
selIndex = index - 1
end
end
if selIndex ~= nil then
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
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(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("UIButton")
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)
local sDesc = orderedFormat(ConfigTable.GetUIText("TravelerDuel_AffixDescFormat") or "", mapAffixCfgData.Name, UTILS.ParseDesc(mapAffixCfgData))
sDesc = UTILS.ParseNoBrokenDesc(sDesc)
NovaAPI.SetTMPText(TMPAffixDesc, sDesc)
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.RecommendLevel)
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)
self.mapActData:SetCacheAffixids(clone(self.selectedAffixIds))
end
function TravelerDuelChallengeInfoCtrl:OnBtnClick_ClearAllAffix()
self.selectedAffixIds = {}
if self.tbAffixGrid ~= nil then
for _, goAffixGrid in ipairs(self.tbAffixGrid) do
destroy(goAffixGrid)
end
end
self:RefreshAffixGrid()
if self.lastSelAffixId ~= nil then
local lastGrid = self:GetGridByDataID(self.lastSelAffixId)
self:RefreshGridSelectState(lastGrid, self.lastSelAffixId, false)
self.lastSelAffixId = nil
end
self.tbAffixGrid = {}
self:RefreshAffixList()
end
function TravelerDuelChallengeInfoCtrl:OnBtnClick_Go()
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.TravelerDuel, self.nLevelId, {
self.mapActData.nActId,
self.selectedAffixIds
})
end
self:CacheAffixes()
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
end
function TravelerDuelChallengeInfoCtrl:OnBtnClick_EnemyInfo()
EventManager.Hit("OpenTravelerDuelMonsterInfo", self.nLevelId)
end
return TravelerDuelChallengeInfoCtrl
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,142 @@
local TrekkerVersusDifficultyCtrl = class("TrekkerVersusDifficultyCtrl", BaseCtrl)
TrekkerVersusDifficultyCtrl._mapNodeConfig = {
rtWindow = {
sComponentName = "RectTransform"
},
aniWindow = {sNodeName = "rtWindow", sComponentName = "Animator"},
lsvDifficulty = {
sComponentName = "LoopScrollView"
},
txtWindowTitleDifficulty = {
sComponentName = "TMP_Text",
sLanguageId = "TD_DifficultyPreviewTitle"
},
btn_Close = {sComponentName = "UIButton", callback = "ClosePanel"},
btnClose_difficulty = {sComponentName = "UIButton", callback = "ClosePanel"}
}
TrekkerVersusDifficultyCtrl._mapEventConfig = {}
TrekkerVersusDifficultyCtrl._mapRedDotConfig = {}
function TrekkerVersusDifficultyCtrl:RefreshDuelDifficulty()
self.nCurDifficulty = self._mapActData:GetRecordLevel()
self.tbIdleRewards = {}
local foreachIdleRewards = function(mapData)
self.tbIdleRewards[mapData.Difficulty] = mapData
end
ForEachTableLine(DataTable.TravelerDuelIdleRewards, foreachIdleRewards)
self.tbDuelDifficulty = {}
local foreachDifficulty = function(mapDifficultyData)
table.insert(self.tbDuelDifficulty, mapDifficultyData)
end
ForEachTableLine(DataTable.TravelerDuelChallengeDifficulty, foreachDifficulty)
table.sort(self.tbDuelDifficulty, function(a, b)
return a.Id < b.Id
end)
self._mapNode.lsvDifficulty:Init(#self.tbDuelDifficulty, self, self.OnDuelDifficultyGridRefresh)
self._mapNode.lsvDifficulty:SetScrollGridPos(self.nCurDifficulty - 1 > 0 and self.nCurDifficulty - 1 or 0, 0)
end
function TrekkerVersusDifficultyCtrl:OnDuelDifficultyGridRefresh(goGrid, nIdx)
local nIndex = nIdx + 1
local mapDifficultyData = self.tbDuelDifficulty[nIndex]
local mapDifficultyRewardData = self.tbIdleRewards[mapDifficultyData.Id]
local goAnimRoot = goGrid.transform:Find("btnGrid"):Find("AnimRoot")
if goAnimRoot == nil then
return
end
local imgHalf = goAnimRoot:Find("imgHalo").gameObject
imgHalf:SetActive(mapDifficultyData.Id == self.nCurDifficulty)
local imgArrow = goAnimRoot:Find("imgArrow").gameObject
imgArrow:SetActive(mapDifficultyData.Id == self.nCurDifficulty)
local txtGridHighestRecordNum = goAnimRoot:Find("txtGridHighestRecordNum").gameObject:GetComponent("TMP_Text")
NovaAPI.SetTMPText(txtGridHighestRecordNum, mapDifficultyData.Id)
local txtHourReward = goAnimRoot:Find("txtHourReward").gameObject:GetComponent("TMP_Text")
NovaAPI.SetTMPText(txtHourReward, ConfigTable.GetUIText("TD_HourReward"))
local txtEnemyEffect = goAnimRoot:Find("imgEnemyEffect"):Find("txtEnemyEffect").gameObject:GetComponent("TMP_Text")
NovaAPI.SetTMPText(txtEnemyEffect, ConfigTable.GetUIText("TD_EnemyEffect"))
local txtEnemyEffectNum = goAnimRoot:Find("imgEnemyEffect"):Find("txtEnemyEffectNum").gameObject:GetComponent("TMP_Text")
NovaAPI.SetTMPText(txtEnemyEffectNum, mapDifficultyData.Attr .. "%")
local nCount = 0
local nItemGridCount = 4
local foreachIdleReward = function(mapData)
nCount = nCount + 1
nItemGridCount = nItemGridCount - 1
local nEveryMinuteAccumulateValue = 0
if nCount == 1 then
nEveryMinuteAccumulateValue = mapDifficultyRewardData.TypeAValue
elseif nCount == 2 then
nEveryMinuteAccumulateValue = mapDifficultyRewardData.TypeBValue
elseif nCount == 3 then
nEveryMinuteAccumulateValue = mapDifficultyRewardData.TypeCValue
end
local nItemCount = math.floor(nEveryMinuteAccumulateValue * 60 / mapData.CumulativeValue)
local btnItem = goAnimRoot:Find("rtItem"):Find("btnItem_" .. nItemGridCount).gameObject:GetComponent("UIButton")
if 0 < nItemCount then
btnItem.gameObject:SetActive(true)
btnItem.onClick:RemoveAllListeners()
btnItem.onClick:AddListener(function()
UTILS.ClickItemGridWithTips(mapData.Id, btnItem.transform, true, true, false)
end)
local objItem = btnItem.transform:Find("GameObject"):Find("item" .. nItemGridCount).gameObject
local itemCtrl = self:BindCtrlByNode(objItem, "Game.UI.TemplateEx.TemplateItemCtrl")
if itemCtrl ~= nil then
itemCtrl:SetItem(mapData.Id, nil, nItemCount)
if self.tbObjCtrl[goGrid] ~= nil then
self:UnbindCtrlByNode(self.tbObjCtrl[goGrid])
self.tbObjCtrl[goGrid] = nil
end
self.tbObjCtrl[goGrid] = itemCtrl
end
else
btnItem.gameObject:SetActive(false)
end
end
ForEachTableLine(DataTable.TravelerDuelHotValueItem, foreachIdleReward)
end
function TrekkerVersusDifficultyCtrl:Awake()
self._mapGridCtrl = {}
end
function TrekkerVersusDifficultyCtrl:FadeIn()
end
function TrekkerVersusDifficultyCtrl:FadeOut()
end
function TrekkerVersusDifficultyCtrl:OnEnable()
self._mapAllQuestCfgData = {}
self._mapNode.rtWindow.gameObject:SetActive(false)
self.tbObjCtrl = {}
end
function TrekkerVersusDifficultyCtrl:OnDisable()
if self._coroutineOpen ~= nil then
cs_coroutine.stop(self._coroutineOpen)
self._coroutineOpen = nil
end
self:UnbindAllGrids()
end
function TrekkerVersusDifficultyCtrl:OnDestroy()
end
function TrekkerVersusDifficultyCtrl:OnRelease()
end
function TrekkerVersusDifficultyCtrl:ClosePanel()
self._mapNode.aniWindow:Play("t_window_04_t_out")
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
self:AddTimer(1, 0.3, function()
self.gameObject:SetActive(false)
self._mapNode.rtWindow.gameObject:SetActive(false)
end, true, true, true, nil)
end
function TrekkerVersusDifficultyCtrl:UnbindAllGrids()
for go, ctrl in pairs(self.tbObjCtrl) do
self:UnbindCtrlByNode(ctrl)
end
self.tbObjCtrl = {}
end
function TrekkerVersusDifficultyCtrl:OpenPanel(mapActData)
self.gameObject:SetActive(true)
self._mapActData = mapActData
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.rtWindow.gameObject:SetActive(true)
self._mapNode.aniWindow:Play("t_window_04_t_in")
self:RefreshDuelDifficulty()
end
self._coroutineOpen = cs_coroutine.start(wait)
end
return TrekkerVersusDifficultyCtrl
@@ -0,0 +1,109 @@
local TrekkerVersusDuelHistoryGridCtrl = class("TrekkerVersusDuelHistoryGridCtrl", BaseCtrl)
TrekkerVersusDuelHistoryGridCtrl._mapNodeConfig = {
imgHeadStreamerGrid = {nCount = 2, sComponentName = "Image"},
txtNameStreamerGrid = {nCount = 2, sComponentName = "TMP_Text"},
txtHeatStreamerGrid = {nCount = 2, sComponentName = "TMP_Text"},
txtDuelWinReward = {
sComponentName = "TMP_Text",
sLanguageId = "TD_DuelWinReward"
},
itemReward = {
nCount = 3,
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
btnItemReward = {
nCount = 3,
sComponentName = "UIButton",
callback = "OnBtnClick_Item"
},
imgDuelEnd = {},
txtDuelOnGoing = {
sComponentName = "TMP_Text",
sLanguageId = "TD_DuelOnGoing"
},
btnReceive = {
sComponentName = "UIButton",
callback = "OnBtnClick_Receive"
},
TMPReceiveGrid = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_Receive"
},
imgWin = {}
}
TrekkerVersusDuelHistoryGridCtrl._mapEventConfig = {
TrekkerVersusDuelQuestRefresh = "OnEvent_TrekkerVersusDuelQuestRefresh"
}
TrekkerVersusDuelHistoryGridCtrl._mapRedDotConfig = {}
function TrekkerVersusDuelHistoryGridCtrl:Awake()
end
function TrekkerVersusDuelHistoryGridCtrl:FadeIn()
end
function TrekkerVersusDuelHistoryGridCtrl:FadeOut()
end
function TrekkerVersusDuelHistoryGridCtrl:OnEnable()
end
function TrekkerVersusDuelHistoryGridCtrl:OnDisable()
end
function TrekkerVersusDuelHistoryGridCtrl:OnDestroy()
end
function TrekkerVersusDuelHistoryGridCtrl:OnRelease()
end
function TrekkerVersusDuelHistoryGridCtrl:Refresh(mapDuelHistoryData, bMain, mapActData, nActId)
self._mapNode.imgWin:SetActive(not bMain)
self._mapNode.imgDuelEnd:SetActive(not bMain)
self._mapNode.txtDuelOnGoing.gameObject:SetActive(bMain)
self.bMain = bMain
self.nActId = nActId
self.mapDuelHistoryData = mapDuelHistoryData
self.mapActData = mapActData
self.bReceived = not bMain
self._mapNode.btnReceive.gameObject:SetActive(not bMain)
self._mapNode.imgDuelEnd:SetActive(not bMain)
if mapDuelHistoryData.TargetId ~= nil then
self.mapDuelData = ConfigTable.GetData("TravelerDuelTarget", mapDuelHistoryData.TargetId)
local tbDuelRewardReceived = self.mapActData:GetDuelRewardTable()
self.bReceived = table.indexof(tbDuelRewardReceived, mapDuelHistoryData.TargetId) > 0
if not bMain then
self._mapNode.btnReceive.gameObject:SetActive(not self.bReceived)
self._mapNode.imgDuelEnd:SetActive(self.bReceived)
end
end
local sHeatStr = (ConfigTable.GetUIText("TD_HeatQuestTab") or "") .. ":"
NovaAPI.SetTMPText(self._mapNode.txtHeatStreamerGrid[1], sHeatStr .. "<space=9>" .. mapDuelHistoryData.SelfHotValue)
NovaAPI.SetTMPText(self._mapNode.txtHeatStreamerGrid[2], sHeatStr .. "<space=9>" .. mapDuelHistoryData.RivalHotValue)
local sSelfName = ConfigTable.GetUIText(AllEnum.TrekkerVersusDuelSelfInfo.NameKey) or ""
NovaAPI.SetTMPText(self._mapNode.txtNameStreamerGrid[1], sSelfName)
if self.mapDuelData ~= nil then
NovaAPI.SetTMPText(self._mapNode.txtNameStreamerGrid[2], self.mapDuelData.RivalName)
self:SetPngSprite(self._mapNode.imgHeadStreamerGrid[2], self.mapDuelData.RivalIcon or "")
for i = 1, 3 do
local nItemId = self.mapDuelData["ItemId" .. i]
local nCount = self.mapDuelData["ItemQty" .. i]
if nItemId ~= nil and 0 < nItemId then
self._mapNode.itemReward[i].gameObject:SetActive(true)
self._mapNode.itemReward[i]:SetItem(nItemId, nil, nCount, false, self.bReceived)
else
self._mapNode.itemReward[i].gameObject:SetActive(false)
end
end
end
end
function TrekkerVersusDuelHistoryGridCtrl:OnBtnClick_Item(btn, nIdx)
local sFieldName1 = "ItemId" .. nIdx
local sFieldName2 = "ItemQty" .. nIdx
if self.mapDuelData ~= nil then
local nItemTid = self.mapDuelData[sFieldName1]
local nCount = self.mapDuelData[sFieldName2]
UTILS.ClickItemGridWithTips(nItemTid, btn.transform, true, true, false)
end
end
function TrekkerVersusDuelHistoryGridCtrl:OnBtnClick_JumpTo(btn)
EventManager.Hit("TrekkerVersusAffixJump", self.cfgData.AffixJumpTo)
end
function TrekkerVersusDuelHistoryGridCtrl:OnBtnClick_Receive(btn)
EventManager.Hit("TrekkerVersusReceiveHeatQuest", self.nActId, 2)
end
function TrekkerVersusDuelHistoryGridCtrl:OnEvent_TrekkerVersusDuelQuestRefresh()
end
return TrekkerVersusDuelHistoryGridCtrl
@@ -0,0 +1,93 @@
local TrekkerVersusGiftQuestGridCtrl = class("TrekkerVersusGiftQuestGridCtrl", BaseCtrl)
TrekkerVersusGiftQuestGridCtrl._mapNodeConfig = {
TMPDesc = {sComponentName = "TMP_Text"},
TMPIncomplete = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_undone"
},
txtBtnJump = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_JumpTo"
},
TMPReceiveGrid = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_Receive"
},
item = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
nCount = 3
},
btnItem = {
sNodeName = "btnItem_",
sComponentName = "UIButton",
callback = "OnBtnClick_Item",
nCount = 3
},
maskComplete = {},
imgComplete = {},
btnReceive = {
sComponentName = "UIButton",
callback = "OnBtnClick_Receive"
},
btnJump = {
sComponentName = "UIButton",
callback = "OnBtnClick_JumpTo"
}
}
TrekkerVersusGiftQuestGridCtrl._mapEventConfig = {}
TrekkerVersusGiftQuestGridCtrl._mapRedDotConfig = {}
function TrekkerVersusGiftQuestGridCtrl:Awake()
end
function TrekkerVersusGiftQuestGridCtrl:FadeIn()
end
function TrekkerVersusGiftQuestGridCtrl:FadeOut()
end
function TrekkerVersusGiftQuestGridCtrl:OnEnable()
end
function TrekkerVersusGiftQuestGridCtrl:OnDisable()
end
function TrekkerVersusGiftQuestGridCtrl:OnDestroy()
end
function TrekkerVersusGiftQuestGridCtrl:OnRelease()
end
function TrekkerVersusGiftQuestGridCtrl:Refresh(mapQuestData, actData, nActId)
self._mapActData = actData
self.nActId = nActId
local mapQuestCfgData = ConfigTable.GetData("TravelerDuelChallengeQuest", mapQuestData.Id)
if mapQuestCfgData == nil then
return
end
self.cfgData = mapQuestCfgData
NovaAPI.SetTMPText(self._mapNode.TMPDesc, mapQuestCfgData.Title)
self._mapNode.btnReceive.gameObject:SetActive(mapQuestData.Status == 1)
self._mapNode.btnJump.gameObject:SetActive(mapQuestData.Status == 0 and 0 < #self.cfgData.AffixJumpTo)
self._mapNode.TMPIncomplete.gameObject:SetActive(mapQuestData.Status == 0)
self._mapNode.imgComplete:SetActive(mapQuestData.Status == 2)
self._mapNode.maskComplete:SetActive(mapQuestData.Status == 2)
for i = 1, 3 do
local sFieldName1 = "AwardItemTid" .. i
local sFieldName2 = "AwardItemNum" .. i
local nItemTid = mapQuestCfgData[sFieldName1]
local nCount = mapQuestCfgData[sFieldName2]
if 0 < nItemTid then
self._mapNode.btnItem[i].gameObject:SetActive(true)
self._mapNode.item[i]:SetItem(nItemTid, nil, nCount, nil, mapQuestData.Status == 2, nil, nil, true)
else
self._mapNode.btnItem[i].gameObject:SetActive(false)
end
end
end
function TrekkerVersusGiftQuestGridCtrl:OnBtnClick_Item(btn, nIdx)
local sFieldName1 = "AwardItemTid" .. nIdx
local sFieldName2 = "AwardItemNum" .. nIdx
local nItemTid = self.cfgData[sFieldName1]
local nCount = self.cfgData[sFieldName2]
UTILS.ClickItemGridWithTips(nItemTid, btn.transform, true, true, false)
end
function TrekkerVersusGiftQuestGridCtrl:OnBtnClick_JumpTo(btn)
EventManager.Hit("TrekkerVersusAffixJump", self.cfgData.AffixJumpTo)
end
function TrekkerVersusGiftQuestGridCtrl:OnBtnClick_Receive()
self._mapActData:ReceiveQuestReward(self.nActId)
end
return TrekkerVersusGiftQuestGridCtrl
@@ -0,0 +1,21 @@
local TrekkerVersusPanel = class("TrekkerVersusPanel", BasePanel)
TrekkerVersusPanel._sUIResRootPath = "UI_Activity/"
TrekkerVersusPanel._tbDefine = {
{
sPrefabPath = "_600003/TrekkerVersus/TrekkerVersuslLevelSelect.prefab",
sCtrlName = "Game.UI.TrekkerVersus_600003.TrekkerVersusCtrl"
}
}
function TrekkerVersusPanel:Awake()
end
function TrekkerVersusPanel:OnEnable()
end
function TrekkerVersusPanel:OnAfterEnter()
end
function TrekkerVersusPanel:OnDisable()
end
function TrekkerVersusPanel:OnDestroy()
end
function TrekkerVersusPanel:OnRelease()
end
return TrekkerVersusPanel
@@ -0,0 +1,479 @@
local TrekkerVersusQuestCtrl = class("TrekkerVersusQuestCtrl", BaseCtrl)
TrekkerVersusQuestCtrl._mapNodeConfig = {
btn_Close = {sComponentName = "Button", callback = "ClosePanel"},
btnClose_quest = {sComponentName = "UIButton", callback = "ClosePanel"},
aniWindow = {sNodeName = "rtWindow", sComponentName = "Animator"},
TMPReceiveAll = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Quest_Btn_ReceiveAll"
},
rtWindow = {},
btnHeatQuestReceiveAll = {
sComponentName = "UIButton",
callback = "OnBtnClick_Receive"
},
btnHeatQuestUnReceiveAll = {},
txtWindowTitleQuest = {
sComponentName = "TMP_Text",
sLanguageId = "TD_QusetTitle"
},
btnRewardTab = {
nCount = 4,
sComponentName = "UIButton",
callback = "OnBtnClick_RewardTab"
},
txtTabHeat = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "TD_HeatQuestTab"
},
txtTabDuel = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "TD_DuelQuestTab"
},
txtTabGift = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "TD_GiftQuestTab"
},
txtTabBattle = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "TD_BattleQuestTab"
},
rtHeatQuest = {},
lsvHeatQuest = {
sComponentName = "LoopScrollView"
},
txtCurHeatTitle = {
sComponentName = "TMP_Text",
sLanguageId = "TD_HeatQuestTitle"
},
txtCurHeatNum = {sComponentName = "TMP_Text"},
rtDuelHistory = {},
rtListHasCurDuel = {},
rtListNoCurDuel = {},
txtDuelHistoryTitle = {
sComponentName = "TMP_Text",
sLanguageId = "TD_DuelHistoryTitle"
},
lsvDuelHistory = {
sComponentName = "LoopScrollView"
},
lsvDuelHistoryNoCurDuel = {
sComponentName = "LoopScrollView"
},
goHasCurDuel = {},
goGridMain = {
sCtrlName = "Game.UI.TrekkerVersus_600003.TrekkerVersusDuelHistoryGridCtrl"
},
txtNoDuelHistory = {
sComponentName = "TMP_Text",
sLanguageId = "TD_NoDuelHistory"
},
btnDuelHistoryReceiveAll = {
sComponentName = "UIButton",
callback = "OnBtnClick_DuelHistoryReceiveAll"
},
btnDuelHistoryUnReceiveAll = {},
TMPDuelHistoryReceiveAll = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Quest_Btn_ReceiveAll"
},
rtGiftQuest = {},
lsvGiftQuest = {
sComponentName = "LoopScrollView"
},
rtBattleQuest = {},
lsvBattleQuest = {
sComponentName = "LoopScrollView"
},
txtGetHighestReward = {
sComponentName = "TMP_Text",
sLanguageId = "TD_GetHighestReward"
},
btnReceiveAllQuest = {
sComponentName = "UIButton",
callback = "OnBtnClick_ReceiveAll"
},
btnUnReceiveAllQuest = {},
TMPReceiveAllQuest = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Quest_Btn_ReceiveAll"
},
goRedDotRewardTab1 = {},
goRedDotRewardTab2 = {},
goRedDotRewardTab3 = {},
goRedDotRewardTab4 = {}
}
TrekkerVersusQuestCtrl._mapEventConfig = {
TrekkerVersusAffixJump = "OnEvent_TrekkerVersusAffixJump",
TrekkerVersusHeatQuestRefresh = "OnEvent_TrekkerVersusHeatQuestRefresh",
UpdateTrekkerVersusHotValue = "OnEvent_UpdateTrekkerVersusHotValue",
TrekkerVersusQuestRefresh = "OnEvent_TrekkerVersusQuestRefresh",
TrekkerVersusDuelQuestRefresh = "OnEvent_TrekkerVersusDuelQuestRefresh"
}
TrekkerVersusQuestCtrl._mapRedDotConfig = {}
function TrekkerVersusQuestCtrl:RefreshHeatQuestTab()
if self.tbHeatQuest == nil then
self.tbHeatQuest = {}
local foreachQuestData = function(mapQuestData)
if mapQuestData.GroupId == self.nActId then
table.insert(self.tbHeatQuest, mapQuestData)
end
end
ForEachTableLine(DataTable.TravelerDuelHotValueRewards, foreachQuestData)
end
local mapHotValue = self._mapActData:GetCurHeatValue()
local nSelfHotValue = mapHotValue.nSelfHotValue
NovaAPI.SetTMPText(self._mapNode.txtCurHeatNum, nSelfHotValue)
local tbHotValueRewardIds = self._mapActData:GetHotValueRewardTable() or {}
table.sort(self.tbHeatQuest, function(a, b)
local aStatus = 2
local bStatus = 2
if a.TargetValue <= nSelfHotValue then
if table.indexof(tbHotValueRewardIds, a.Id) <= 0 then
aStatus = 1
else
aStatus = 3
end
end
if b.TargetValue <= nSelfHotValue then
if table.indexof(tbHotValueRewardIds, b.Id) <= 0 then
bStatus = 1
else
bStatus = 3
end
end
if aStatus ~= bStatus then
return aStatus < bStatus
else
return a.Id < b.Id
end
end)
local bHasCom = false
for k, v in ipairs(self.tbHeatQuest) do
if nSelfHotValue >= v.TargetValue and table.indexof(tbHotValueRewardIds, v.Id) <= 0 then
bHasCom = true
break
end
end
self._mapNode.btnHeatQuestUnReceiveAll.gameObject:SetActive(not bHasCom)
self._mapNode.btnHeatQuestReceiveAll.gameObject:SetActive(bHasCom)
self._mapNode.lsvHeatQuest:SetAnim(0.05)
self._mapNode.lsvHeatQuest:Init(#self.tbHeatQuest, self, self.OnGridRefresh)
end
function TrekkerVersusQuestCtrl:RefreshDuelHistoryTab()
self._mapNode.lsvDuelHistory:SetAnim(0.05)
local mapCurDuelData = self._mapActData:GetCurHeatValue()
self._mapNode.rtListHasCurDuel:SetActive(self.bOpen)
self._mapNode.rtListNoCurDuel:SetActive(not self.bOpen)
self._mapNode.goGridMain.gameObject:SetActive(self.bOpen)
self._mapNode.goHasCurDuel:SetActive(self.bOpen)
if self.bOpen == false then
self._mapNode.lsvDuelHistoryNoCurDuel:Init(#self.tbDuelHistory, self, self.OnDuelHistoryGridRefresh)
self:RefreshDuelHistoryBtn()
return
end
local nCurDay = self._mapActData:GetCurDayNum()
local foreachDuelHistory = function(mapDuelHistoryData)
if mapDuelHistoryData.GroupId == self.nActId and mapDuelHistoryData.DayNum == nCurDay then
self.nCurDuelId = mapDuelHistoryData.Id
end
end
ForEachTableLine(DataTable.TravelerDuelTarget, foreachDuelHistory)
local mapInfo = {
TargetId = self.nCurDuelId,
SelfHotValue = mapCurDuelData.nSelfHotValue,
RivalHotValue = mapCurDuelData.nRivalHotValue
}
self._mapNode.goGridMain:Refresh(mapInfo, true, self._mapActData, self.nActId)
self._mapNode.lsvDuelHistory:Init(#self.tbDuelHistory, self, self.OnDuelHistoryGridRefresh)
self._mapNode.lsvDuelHistory.gameObject:SetActive(#self.tbDuelHistory > 0)
self._mapNode.txtNoDuelHistory.gameObject:SetActive(#self.tbDuelHistory <= 0)
self:RefreshDuelHistoryBtn()
end
function TrekkerVersusQuestCtrl:RefreshDuelHistoryBtn()
local nChallengeStartTime = self._mapActData:GetChallengeStartTime()
local bStreamerDuelOpen = self._mapActData:IsOpenStreamerDuel(nChallengeStartTime)
local nRivalCount = self._mapActData:GetRivalCount()
local nDayNum = self._mapActData:GetCurDayNum()
local nPassedDuelCount = bStreamerDuelOpen and nDayNum - 1 or nRivalCount
if nDayNum == 0 then
nPassedDuelCount = nRivalCount
end
local nReceivedDuelReward = #self._mapActData:GetDuelRewardTable()
local bCanReceive = nPassedDuelCount > nReceivedDuelReward
self._mapNode.btnDuelHistoryUnReceiveAll.gameObject:SetActive(not bCanReceive)
self._mapNode.btnDuelHistoryReceiveAll.gameObject:SetActive(bCanReceive)
end
function TrekkerVersusQuestCtrl:OnDuelHistoryGridRefresh(goGrid, nIdx)
local nIndex = nIdx + 1
if self._mapGridCtrl[goGrid] ~= nil then
self:UnbindCtrlByNode(self._mapGridCtrl[goGrid])
self._mapGridCtrl[goGrid] = nil
end
local gridCtrl = self:BindCtrlByNode(goGrid, "Game.UI.TrekkerVersus_600003.TrekkerVersusDuelHistoryGridCtrl")
self._mapGridCtrl[goGrid] = gridCtrl
local mapDuelHistoryData = self.tbDuelHistory[nIndex]
self._mapGridCtrl[goGrid]:Refresh(mapDuelHistoryData, false, self._mapActData, self.nActId)
end
function TrekkerVersusQuestCtrl:RefreshGiftQuestTab()
self._mapNode.lsvGiftQuest:SetAnim(0.05)
self._mapNode.lsvGiftQuest:Init(#self.tbGiftQuest, self, self.OnGiftQuestGridRefresh)
self:RefreshReceiveAllQuestButton()
end
function TrekkerVersusQuestCtrl:OnGiftQuestGridRefresh(goGrid, nIdx)
local nIndex = nIdx + 1
if self._mapGridCtrl[goGrid] ~= nil then
self:UnbindCtrlByNode(self._mapGridCtrl[goGrid])
self._mapGridCtrl[goGrid] = nil
end
local gridCtrl = self:BindCtrlByNode(goGrid, "Game.UI.TrekkerVersus_600003.TrekkerVersusGiftQuestGridCtrl")
self._mapGridCtrl[goGrid] = gridCtrl
local mapGiftQuestData = self.tbGiftQuest[nIndex]
self._mapGridCtrl[goGrid]:Refresh(mapGiftQuestData, self._mapActData, self.nActId)
end
function TrekkerVersusQuestCtrl:RefreshBattleQuestTab()
self._mapNode.lsvBattleQuest:SetAnim(0.05)
self._mapNode.lsvBattleQuest:Init(#self.tbBattleQuest, self, self.OnBattleQuestGridRefresh)
self:RefreshReceiveAllQuestButton()
end
function TrekkerVersusQuestCtrl:OnBattleQuestGridRefresh(goGrid, nIdx)
local nIndex = nIdx + 1
if self._mapGridCtrl[goGrid] ~= nil then
self:UnbindCtrlByNode(self._mapGridCtrl[goGrid])
self._mapGridCtrl[goGrid] = nil
end
local gridCtrl = self:BindCtrlByNode(goGrid, "Game.UI.TrekkerVersus_600003.TrekkerVersusGiftQuestGridCtrl")
self._mapGridCtrl[goGrid] = gridCtrl
local mapBattleQuestData = self.tbBattleQuest[nIndex]
self._mapGridCtrl[goGrid]:Refresh(mapBattleQuestData, self._mapActData, self.nActId)
end
function TrekkerVersusQuestCtrl:GetBattleGiftQuestTable()
self.tbBattleQuest = {}
self.tbGiftQuest = {}
for k, mapQuestData in pairs(self._tbAllQuestData) do
local mapQuestCfgData = ConfigTable.GetData("TravelerDuelChallengeQuest", mapQuestData.Id)
if mapQuestCfgData ~= nil then
if mapQuestCfgData.CompleteCond ~= GameEnum.questCompleteCond.TrekkerVersusFansWithSpecificLevel then
table.insert(self.tbBattleQuest, mapQuestData)
else
table.insert(self.tbGiftQuest, mapQuestData)
end
end
end
end
function TrekkerVersusQuestCtrl:Awake()
self._mapGridCtrl = {}
end
function TrekkerVersusQuestCtrl:FadeIn()
end
function TrekkerVersusQuestCtrl:FadeOut()
end
function TrekkerVersusQuestCtrl:OnEnable()
self._mapAllQuestCfgData = {}
self._mapNode.rtWindow.gameObject:SetActive(false)
end
function TrekkerVersusQuestCtrl:OnDisable()
if self._coroutineOpen ~= nil then
cs_coroutine.stop(self._coroutineOpen)
self._coroutineOpen = nil
end
self:UnbindAllGrids()
end
function TrekkerVersusQuestCtrl:OnDestroy()
end
function TrekkerVersusQuestCtrl:OnRelease()
end
function TrekkerVersusQuestCtrl:ClosePanel()
self._mapNode.aniWindow:Play("t_window_04_t_out")
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
self:AddTimer(1, 0.3, function()
self.gameObject:SetActive(false)
self._mapNode.rtWindow.gameObject:SetActive(false)
end, true, true, true, nil)
end
function TrekkerVersusQuestCtrl:UnbindAllGrids()
for go, ctrl in pairs(self._mapGridCtrl) do
self:UnbindCtrlByNode(ctrl)
end
self._mapGridCtrl = {}
end
function TrekkerVersusQuestCtrl:OpenPanel(mapActData, nTab, bOpen, nActId)
self.gameObject:SetActive(true)
self._mapActData = mapActData
self.bOpen = bOpen
self.nActId = nActId
self._tbAllQuestData = self._mapActData:GetAllQuestData()
if self._tbAllQuestData ~= nil then
self:GetBattleGiftQuestTable()
end
self.tbDuelHistory = self._mapActData:GetDuelHistory()
if self.tbDuelHistory == nil then
self.tbDuelHistory = {}
end
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(nActId)
if bInActGroup then
RedDotManager.RegisterNode(RedDotDefine.TrekkerVersusHeatQuest, {nActGroupId, nActId}, self._mapNode.goRedDotRewardTab1)
RedDotManager.RegisterNode(RedDotDefine.TrekkerVersusDuelQuest, {nActGroupId, nActId}, self._mapNode.goRedDotRewardTab2)
RedDotManager.RegisterNode(RedDotDefine.TrekkerVersusGiftQuest, {nActGroupId, nActId}, self._mapNode.goRedDotRewardTab3)
RedDotManager.RegisterNode(RedDotDefine.TrekkerVersusBattleQuest, {nActGroupId, nActId}, self._mapNode.goRedDotRewardTab4)
end
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.rtWindow.gameObject:SetActive(true)
self._mapNode.aniWindow:Play("t_window_04_t_in")
self:OnBtnClick_RewardTab(nil, nTab)
if nTab == self.nRewardTabIndex then
if nTab == 1 then
self:RefreshHeatQuestTab()
elseif nTab == 2 then
self:RefreshDuelHistoryTab()
elseif nTab == 3 then
self:RefreshGiftQuestTab()
elseif nTab == 4 then
self:RefreshBattleQuestTab()
end
end
end
if nTab == 3 or nTab == 4 then
self:RefreshReceiveAllQuestButton()
else
self._mapNode.btnReceiveAllQuest.gameObject:SetActive(false)
self._mapNode.btnUnReceiveAllQuest.gameObject:SetActive(false)
end
self._coroutineOpen = cs_coroutine.start(wait)
end
function TrekkerVersusQuestCtrl:OnGridRefresh(goGrid, nIdx)
local nIndex = nIdx + 1
if self._mapGridCtrl[goGrid] ~= nil then
self:UnbindCtrlByNode(self._mapGridCtrl[goGrid])
self._mapGridCtrl[goGrid] = nil
end
local gridCtrl = self:BindCtrlByNode(goGrid, "Game.UI.TrekkerVersus_600003.TrekkerVersusQuestGridCtrl")
self._mapGridCtrl[goGrid] = gridCtrl
local mapQuestData = self.tbHeatQuest[nIndex]
self._mapGridCtrl[goGrid]:Refresh(mapQuestData, self._mapActData, self.nActId)
end
function TrekkerVersusQuestCtrl:OnBtnClick_RewardTab(btn, index)
if self.nRewardTabIndex == index then
return
end
self.nRewardTabIndex = index
for i = 1, #self._mapNode.btnRewardTab do
local objAnimRoot = self._mapNode.btnRewardTab[i].transform:Find("AnimRoot")
local imgOn = objAnimRoot:Find("imgTabOnBg")
local imgOff = objAnimRoot:Find("imgTabOffBg")
imgOn.gameObject:SetActive(i == index)
imgOff.gameObject:SetActive(i ~= index)
end
self._mapNode.rtHeatQuest:SetActive(index == 1)
self._mapNode.rtDuelHistory:SetActive(index == 2)
self._mapNode.rtGiftQuest:SetActive(index == 3)
self._mapNode.rtBattleQuest:SetActive(index == 4)
if index == 3 or index == 4 then
self:RefreshReceiveAllQuestButton()
else
self._mapNode.btnReceiveAllQuest.gameObject:SetActive(false)
self._mapNode.btnUnReceiveAllQuest.gameObject:SetActive(false)
end
if index == 1 then
self:RefreshHeatQuestTab()
elseif index == 2 then
self:RefreshDuelHistoryTab()
elseif index == 3 then
self:RefreshGiftQuestTab()
elseif index == 4 then
self:RefreshBattleQuestTab()
end
end
function TrekkerVersusQuestCtrl:RefreshReceiveAllQuestButton()
local bCanReceiveAllQuestReward = self._mapActData:GetCanReceiveAllQuestReward()
self._mapNode.btnReceiveAllQuest.gameObject:SetActive(bCanReceiveAllQuestReward)
self._mapNode.btnUnReceiveAllQuest.gameObject:SetActive(not bCanReceiveAllQuestReward)
end
function TrekkerVersusQuestCtrl:OnBtnClick_Receive()
local mapCurHotValue = self._mapActData:GetCurHeatValue()
local nCurSelfHotValue = mapCurHotValue.nSelfHotValue
local tbHotValueRewardIds = self._mapActData:GetHotValueRewardTable()
local bHeatQuestVisible = false
local foreachHeatReward = function(mapData)
if mapData.TargetValue <= nCurSelfHotValue and table.indexof(tbHotValueRewardIds, mapData.Id) <= 0 then
bHeatQuestVisible = true
end
end
ForEachTableLine(DataTable.TravelerDuelHotValueRewards, foreachHeatReward)
if bHeatQuestVisible then
EventManager.Hit("TrekkerVersusReceiveHeatQuest", self.nActId, 1)
else
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Quest_ReceiveNone"))
end
end
function TrekkerVersusQuestCtrl:OnBtnClick_DuelHistoryReceiveAll()
local nChallengeStartTime = self._mapActData:GetChallengeStartTime()
local bStreamerDuelOpen = self._mapActData:IsOpenStreamerDuel(nChallengeStartTime)
local nRivalCount = self._mapActData:GetRivalCount()
local nDayNum = self._mapActData:GetCurDayNum()
local nPassedDuelCount = bStreamerDuelOpen and nDayNum - 1 or nRivalCount
if nDayNum == 0 then
nPassedDuelCount = nRivalCount
end
local nReceivedDuelReward = #self._mapActData:GetDuelRewardTable()
local bCanReceive = nPassedDuelCount > nReceivedDuelReward
if bCanReceive then
EventManager.Hit("TrekkerVersusReceiveHeatQuest", self.nActId, 2)
else
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Quest_ReceiveNone"))
end
end
function TrekkerVersusQuestCtrl:OnBtnClick_ReceiveAll()
local bCanReceive = false
for k, v in pairs(self._tbAllQuestData) do
if v.Status == 1 then
bCanReceive = true
break
end
end
if bCanReceive then
self._mapActData:ReceiveQuestReward(self.nActId)
else
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Quest_ReceiveNone"))
end
end
function TrekkerVersusQuestCtrl:OnEvent_TrekkerVersusAffixJump()
self:ClosePanel()
end
function TrekkerVersusQuestCtrl:OnEvent_TrekkerVersusHeatQuestRefresh()
if self._mapActData == nil then
return
end
self:RefreshHeatQuestTab()
end
function TrekkerVersusQuestCtrl:OnEvent_UpdateTrekkerVersusHotValue(nSelfHotValue, nRivalHotValue)
if self._mapActData == nil then
return
end
NovaAPI.SetTMPText(self._mapNode.txtCurHeatNum, nSelfHotValue)
local mapInfo = {
TargetId = self.nCurDuelId,
SelfHotValue = nSelfHotValue,
RivalHotValue = nRivalHotValue
}
self._mapNode.goGridMain:Refresh(mapInfo, true, self._mapActData, self.nActId)
self:RefreshHeatQuestTab()
end
function TrekkerVersusQuestCtrl:OnEvent_TrekkerVersusQuestRefresh()
self._tbAllQuestData = self._mapActData:GetAllQuestData()
self:GetBattleGiftQuestTable()
self:RefreshGiftQuestTab()
self:RefreshBattleQuestTab()
end
function TrekkerVersusQuestCtrl:OnEvent_TrekkerVersusDuelQuestRefresh()
self:RefreshDuelHistoryTab()
end
return TrekkerVersusQuestCtrl
@@ -0,0 +1,102 @@
local TrekkerVersusQuestGridCtrl = class("TrekkerVersusQuestGridCtrl", BaseCtrl)
TrekkerVersusQuestGridCtrl._mapNodeConfig = {
TMPDesc = {sComponentName = "TMP_Text"},
TMPIncomplete = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_undone"
},
txtBtnJump = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_JumpTo"
},
TMPReceiveGrid = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_Receive"
},
item = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
nCount = 3
},
btnItem = {
sNodeName = "btnItem_",
sComponentName = "UIButton",
callback = "OnBtnClick_Item",
nCount = 3
},
maskComplete = {},
imgComplete = {},
btnReceive = {
sComponentName = "UIButton",
callback = "OnBtnClick_Receive"
},
btnJump = {
sComponentName = "UIButton",
callback = "OnBtnClick_JumpTo"
}
}
TrekkerVersusQuestGridCtrl._mapEventConfig = {}
TrekkerVersusQuestGridCtrl._mapRedDotConfig = {}
function TrekkerVersusQuestGridCtrl:Awake()
end
function TrekkerVersusQuestGridCtrl:FadeIn()
end
function TrekkerVersusQuestGridCtrl:FadeOut()
end
function TrekkerVersusQuestGridCtrl:OnEnable()
end
function TrekkerVersusQuestGridCtrl:OnDisable()
end
function TrekkerVersusQuestGridCtrl:OnDestroy()
end
function TrekkerVersusQuestGridCtrl:OnRelease()
end
function TrekkerVersusQuestGridCtrl:Refresh(mapQuestData, actData, nActId)
self.nActId = nActId
self._mapActData = actData
self.mapQuestData = mapQuestData
local sHeatReachText = ConfigTable.GetUIText("TD_DuelHeatReach")
NovaAPI.SetTMPText(self._mapNode.TMPDesc, sHeatReachText .. "<space=9>" .. mapQuestData.TargetValue)
local nStatus = 0
local nCurHeat = self._mapActData:GetCurHeatValue().nSelfHotValue
if nCurHeat >= mapQuestData.TargetValue then
nStatus = 1
end
local tbHeatRewardIds = self._mapActData:GetHotValueRewardTable()
for k, v in pairs(tbHeatRewardIds) do
if v == mapQuestData.Id then
nStatus = 2
break
end
end
self._mapNode.btnReceive.gameObject:SetActive(nStatus == 1)
self._mapNode.btnJump.gameObject:SetActive(nStatus == 0)
self._mapNode.TMPIncomplete.gameObject:SetActive(nStatus == 0)
self._mapNode.imgComplete:SetActive(nStatus == 2)
self._mapNode.maskComplete:SetActive(nStatus == 2)
for i = 1, 3 do
local sFieldName1 = "ItemId" .. i
local sFieldName2 = "ItemQty" .. i
local nItemTid = mapQuestData[sFieldName1]
local nCount = mapQuestData[sFieldName2]
if 0 < nItemTid then
self._mapNode.btnItem[i].gameObject:SetActive(true)
self._mapNode.item[i]:SetItem(nItemTid, nil, nCount, nil, nStatus == 2, nil, nil, true)
else
self._mapNode.btnItem[i].gameObject:SetActive(false)
end
end
end
function TrekkerVersusQuestGridCtrl:OnBtnClick_Item(btn, nIdx)
local sFieldName1 = "ItemId" .. nIdx
local sFieldName2 = "ItemQty" .. nIdx
local nItemTid = self.mapQuestData[sFieldName1]
local nCount = self.mapQuestData[sFieldName2]
UTILS.ClickItemGridWithTips(nItemTid, btn.transform, true, true, false)
end
function TrekkerVersusQuestGridCtrl:OnBtnClick_JumpTo(btn)
EventManager.Hit("TrekkerVersusHeatQuestJump", 1)
end
function TrekkerVersusQuestGridCtrl:OnBtnClick_Receive()
EventManager.Hit("TrekkerVersusReceiveHeatQuest", self.nActId, 1)
end
return TrekkerVersusQuestGridCtrl