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,91 @@
local VampireFateCardInfo_fateCardPackageCtrl = class("VampireFateCardInfo_fateCardPackageCtrl", BaseCtrl)
VampireFateCardInfo_fateCardPackageCtrl._mapNodeConfig = {
TMPPackageName = {sComponentName = "TMP_Text"},
imgPackageIcon = {sComponentName = "Image"},
subIcon = {sComponentName = "Image"},
btnFateCard = {}
}
VampireFateCardInfo_fateCardPackageCtrl._mapEventConfig = {}
VampireFateCardInfo_fateCardPackageCtrl._mapRedDotConfig = {}
function VampireFateCardInfo_fateCardPackageCtrl:Awake()
self.mapFateCardCtrl = {}
self.rtContent = self.gameObject:GetComponent("Transform")
end
function VampireFateCardInfo_fateCardPackageCtrl:FadeIn()
end
function VampireFateCardInfo_fateCardPackageCtrl:FadeOut()
end
function VampireFateCardInfo_fateCardPackageCtrl:OnEnable()
self._mapNode.btnFateCard:SetActive(false)
end
function VampireFateCardInfo_fateCardPackageCtrl:Refresh(nBundleId, tbFateCard, tbExFateCard)
local sort = function(a, b)
return a.nId < b.nId
end
local sortEx = function(a, b)
return a < b
end
table.sort(tbFateCard, sort)
table.sort(tbExFateCard, sortEx)
self.mapBundleCfgData = ConfigTable.GetData("StarTowerBookFateCardBundle", nBundleId)
if self.mapBundleCfgData == nil then
self.gameObject:SetActive(false)
return
end
self:SetPngSprite(self._mapNode.imgPackageIcon, self.mapBundleCfgData.Icon .. AllEnum.FateCardBundleIcon.S)
self:SetAtlasSprite(self._mapNode.subIcon, "05_language", self.mapBundleCfgData.Text)
NovaAPI.SetImageNativeSize(self._mapNode.subIcon)
NovaAPI.SetTMPText(self._mapNode.TMPPackageName, self.mapBundleCfgData.Name)
local bFirst = true
local ret, retId
for _, nFateCardId in ipairs(tbExFateCard) do
local itemObj = instantiate(self._mapNode.btnFateCard, self.rtContent)
itemObj.gameObject:SetActive(true)
local itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.VampireSurvivor.Depot.DepotFateCardItemCtrl")
itemCtrl:InitFateCard(nFateCardId, 1, true)
if bFirst then
ret = itemCtrl
bFirst = false
retId = nFateCardId
end
self.mapFateCardCtrl[itemObj] = itemCtrl
local btnSelect = itemObj:GetComponent("UIButton")
btnSelect.onClick:RemoveAllListeners()
local func_select = function()
EventManager.Hit("VampireFardInfoSelectFateCard", nFateCardId, itemCtrl)
end
btnSelect.onClick:AddListener(func_select)
end
for _, mapInfo in ipairs(tbFateCard) do
local itemObj = instantiate(self._mapNode.btnFateCard, self.rtContent)
itemObj.gameObject:SetActive(true)
local itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.VampireSurvivor.Depot.DepotFateCardItemCtrl")
itemCtrl:InitFateCard(mapInfo.nId, 1, false)
if bFirst then
ret = itemCtrl
bFirst = false
retId = mapInfo.nId
end
self.mapFateCardCtrl[itemObj] = itemCtrl
local btnSelect = itemObj:GetComponent("UIButton")
btnSelect.onClick:RemoveAllListeners()
local func_select = function()
EventManager.Hit("VampireFardInfoSelectFateCard", mapInfo.nId, itemCtrl)
end
btnSelect.onClick:AddListener(func_select)
end
return ret, retId
end
function VampireFateCardInfo_fateCardPackageCtrl:OnDisable()
for go, ctrl in ipairs(self.mapFateCardCtrl) do
local btnSelect = go:GetComponent("UIButton")
btnSelect.onClick:RemoveAllListeners()
self:UnbindCtrlByNode(ctrl)
destroy(go)
end
end
function VampireFateCardInfo_fateCardPackageCtrl:OnDestroy()
end
function VampireFateCardInfo_fateCardPackageCtrl:OnRelease()
end
return VampireFateCardInfo_fateCardPackageCtrl
@@ -0,0 +1,167 @@
local VampireFateCardInfoCtrl = class("VampireFateCardInfoCtrl", BaseCtrl)
VampireFateCardInfoCtrl._mapNodeConfig = {
TMPFateCardTitleInfo = {
sComponentName = "TMP_Text",
sLanguageId = "Vampire_FateCardInfo_Title"
},
TMPAcqDesc = {sComponentName = "TMP_Text"},
tcFateCard = {
sCtrlName = "Game.UI.VampireSurvivor.FateCardItemCtrl"
},
TMPAcqTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Vampire_FateCardAcqTitle"
},
grid = {
sNodeName = "grid_",
nCount = 5,
sCtrlName = "Game.UI.VampireLevelSelect.VampireFateCardInfo.VampireFateCardInfo_fateCardPackageCtrl"
},
btnClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
btnScreenClose = {
sComponentName = "Button",
callback = "OnBtnClick_Close"
},
rtWindow = {},
ani = {sNodeName = "rtWindow", sComponentName = "Animator"},
snapshot = {}
}
VampireFateCardInfoCtrl._mapEventConfig = {
VampireFardInfoSelectFateCard = "OnEvent_SelectFateCard"
}
VampireFateCardInfoCtrl._mapRedDotConfig = {}
function VampireFateCardInfoCtrl:Awake()
self._canvas = self.gameObject:GetComponent("Canvas")
self.curFateCardItem = nil
end
function VampireFateCardInfoCtrl:FadeIn()
end
function VampireFateCardInfoCtrl:FadeOut()
end
function VampireFateCardInfoCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nLevelId = tbParam[1]
local initFateCard = 0
local mapVampireSurvivorCfgData = ConfigTable.GetData("VampireSurvivor", self.nLevelId)
if mapVampireSurvivorCfgData == nil then
return
end
self.tbBundle = {}
if mapVampireSurvivorCfgData.Type == GameEnum.vampireSurvivorType.Turn then
local nSeasonId = PlayerData.VampireSurvivor:GetCurSeason()
local mapSeason = ConfigTable.GetData("VampireRankSeason", nSeasonId)
if mapSeason ~= nil then
self.tbExFateCard = decodeJson(mapSeason.SpeciaFateCard)
self.tbBundle = mapSeason.FateCardBundle
end
else
self.tbExFateCard = decodeJson(mapVampireSurvivorCfgData.SpeciaFateCard)
self.tbBundle = mapVampireSurvivorCfgData.FateCardBundle
end
if self.tbExFateCard == nil then
self.tbExFateCard = {}
end
local mapBundle = PlayerData.StarTowerBook:GetAllFateCardBundle()
local mapFirstCtrl, nRetId
for i = 1, 5 do
if self.tbBundle[i] ~= nil then
local nBundleId = self.tbBundle[i]
local mapBundleInfo = mapBundle[nBundleId]
local tbFateCard = {}
if mapBundleInfo ~= nil then
tbFateCard = mapBundleInfo.tbCardList
end
local ret, retId = self._mapNode.grid[i]:Refresh(nBundleId, tbFateCard, self.tbExFateCard[i])
if i == 1 then
mapFirstCtrl = ret
nRetId = retId
end
else
self._mapNode.grid[i].gameObject:SetActive(false)
end
end
if mapFirstCtrl ~= nil then
self:OnEvent_SelectFateCard(nRetId, mapFirstCtrl)
end
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
NovaAPI.UIEffectSnapShotCapture(self._mapNode.snapshot)
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.rtWindow:SetActive(true)
self._mapNode.ani:Play("t_window_04_t_in")
end
cs_coroutine.start(wait)
end
function VampireFateCardInfoCtrl:OnDisable()
end
function VampireFateCardInfoCtrl:OnDestroy()
end
function VampireFateCardInfoCtrl:OnRelease()
end
function VampireFateCardInfoCtrl:OnBtnClick_Close()
self._mapNode.ani:Play("t_window_04_t_out")
self:AddTimer(1, 0.17, function()
EventManager.Hit(EventId.ClosePanel, PanelId.VampireSurvivorFateCardInfo)
end, true, true, true)
end
function VampireFateCardInfoCtrl:OnEvent_SelectFateCard(nFateCardId, mapCtrl)
self._mapNode.tcFateCard.gameObject:SetActive(true)
self._mapNode.tcFateCard:SetFateCardItem(nFateCardId, false)
if self.curFateCardItem ~= nil then
self.curFateCardItem:SetChoose(false)
end
mapCtrl:SetChoose(true)
self.curFateCardItem = mapCtrl
self:SetAcq(nFateCardId)
end
function VampireFateCardInfoCtrl:isExFateCard(nFateCardId)
for i, tbExFateCard in ipairs(self.tbExFateCard) do
if table.indexof(tbExFateCard, nFateCardId) > 0 then
return true, i
end
end
return false, 0
end
function VampireFateCardInfoCtrl:SetAcq(nFateCardId)
local bEx, nIdx = self:isExFateCard(nFateCardId)
if not bEx then
NovaAPI.SetTMPText(self._mapNode.TMPAcqDesc, ConfigTable.GetUIText("Vampire_FateCardAcqNormal"))
else
local nBundleId = self.tbBundle[nIdx]
if nBundleId == nil then
NovaAPI.SetTMPText(self._mapNode.TMPAcqDesc, ConfigTable.GetUIText("Vampire_FateCardAcqNormal"))
end
local mapBundle = ConfigTable.GetData("StarTowerBookFateCardBundle", nBundleId)
if mapBundle == nil then
NovaAPI.SetTMPText(self._mapNode.TMPAcqDesc, ConfigTable.GetUIText("Vampire_FateCardAcqNormal"))
end
local sName = mapBundle.Name
local mapVampireSurvivorCfgData = ConfigTable.GetData("VampireSurvivor", self.nLevelId)
if mapVampireSurvivorCfgData == nil then
return
end
local tbParam = {}
if mapVampireSurvivorCfgData.Type == GameEnum.vampireSurvivorType.Turn then
local nSeasonId = PlayerData.VampireSurvivor:GetCurSeason()
local mapSeason = ConfigTable.GetData("VampireRankSeason", nSeasonId)
if mapSeason ~= nil then
tbParam = decodeJson(mapSeason.SpeciaFateCardParam)
end
else
tbParam = decodeJson(mapVampireSurvivorCfgData.SpeciaFateCardParam)
end
if tbParam == nil then
NovaAPI.SetTMPText(self._mapNode.TMPAcqDesc, ConfigTable.GetUIText("Vampire_FateCardAcqNormal"))
end
local nParamIdx = table.indexof(self.tbExFateCard[nIdx], nFateCardId)
local nCount = 0
if tbParam[nIdx] ~= nil and tbParam[nIdx][nParamIdx] ~= nil then
nCount = tbParam[nIdx][nParamIdx]
end
NovaAPI.SetTMPText(self._mapNode.TMPAcqDesc, orderedFormat(ConfigTable.GetUIText("Vampire_FateCardAcqEx"), nCount, sName))
end
end
return VampireFateCardInfoCtrl
@@ -0,0 +1,22 @@
local VampireFateCardInfoPanel = class("VampireFateCardInfoPanel", BasePanel)
VampireFateCardInfoPanel._bIsMainPanel = false
VampireFateCardInfoPanel._bAddToBackHistory = false
VampireFateCardInfoPanel._tbDefine = {
{
sPrefabPath = "VampireLevelSelect/VampireFateCardInfoPanel.prefab",
sCtrlName = "Game.UI.VampireLevelSelect.VampireFateCardInfo.VampireFateCardInfoCtrl"
}
}
function VampireFateCardInfoPanel:Awake()
end
function VampireFateCardInfoPanel:OnEnable()
end
function VampireFateCardInfoPanel:OnAfterEnter()
end
function VampireFateCardInfoPanel:OnDisable()
end
function VampireFateCardInfoPanel:OnDestroy()
end
function VampireFateCardInfoPanel:OnRelease()
end
return VampireFateCardInfoPanel
@@ -0,0 +1,75 @@
local VampireLevelSelect_levelGridCtrl = class("VampireLevelSelect_levelGridCtrl", BaseCtrl)
VampireLevelSelect_levelGridCtrl._mapNodeConfig = {
TMPLevelName = {sComponentName = "TMP_Text", nCount = 2},
imgLevelImg = {sComponentName = "Image"},
rtRankRoot = {},
imgTimeBg = {},
TMPRemainTime = {sComponentName = "TMP_Text"},
txtRecommendLevel = {sComponentName = "TMP_Text"},
TMPUnlockCond = {sComponentName = "TMP_Text"},
rtNormalRoot = {},
imgLock = {},
imgElementInfo = {sComponentName = "Image", nCount = 3},
txtTitle = {
sComponentName = "TMP_Text",
sLanguageId = "InfinityTower_Recommend_Lv"
},
TMPRecommendBuildTitleChallenge = {
sComponentName = "TMP_Text",
sLanguageId = "InfinityTower_Recommend_Construct"
},
imgReconmendBuildChallenge = {sComponentName = "Image"},
btnStar = {nCount = 3, sComponentName = "Button"}
}
VampireLevelSelect_levelGridCtrl._mapEventConfig = {}
VampireLevelSelect_levelGridCtrl._mapRedDotConfig = {}
function VampireLevelSelect_levelGridCtrl:Refresh(mapLevelData)
if mapLevelData == nil then
self.gameObject:SetActive(false)
return
end
self.mapData = mapLevelData
NovaAPI.SetTMPText(self._mapNode.TMPLevelName[1], mapLevelData.Name)
NovaAPI.SetTMPText(self._mapNode.TMPLevelName[2], mapLevelData.Name)
if mapLevelData.Type == GameEnum.vampireSurvivorType.Turn then
self._mapNode.rtRankRoot:SetActive(true)
self._mapNode.rtNormalRoot:SetActive(false)
NovaAPI.SetTMPText(self._mapNode.TMPRemainTime, PlayerData.VampireSurvivor:GetRefreshTiem())
self._mapNode.imgTimeBg:SetActive(false)
else
self._mapNode.rtRankRoot:SetActive(false)
self._mapNode.rtNormalRoot:SetActive(true)
self._mapNode.imgTimeBg:SetActive(false)
local tbQuestId = CacheTable.GetData("_VampireQuestGroup", mapLevelData.FirstQuestGroupId)
if tbQuestId == nil then
tbQuestId = {}
end
for i = 1, 3 do
self._mapNode.btnStar[i].gameObject:SetActive(tbQuestId[i] ~= nil)
self._mapNode.btnStar[i].interactable = PlayerData.Quest:GetVampireQuestStatusById(tbQuestId[i]) > 0
end
end
for i = 1, 3 do
if mapLevelData.EET == nil or mapLevelData.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 .. mapLevelData.EET[i])
end
end
local sPath = self.mapData.CoverEpisode == nil and self.mapData.Episode or self.mapData.CoverEpisode
self:SetPngSprite(self._mapNode.imgLevelImg, sPath)
local bUnLock, nType, content = PlayerData.VampireSurvivor:CheckLevelUnlock(mapLevelData.Id)
if not bUnLock then
self._mapNode.imgLock:SetActive(true)
local sKey = "VampireTalent_LockCond" .. nType
NovaAPI.SetTMPText(self._mapNode.TMPUnlockCond, orderedFormat(ConfigTable.GetUIText(sKey), content))
else
self._mapNode.imgLock:SetActive(false)
end
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevel, mapLevelData.SuggestedPower)
local rBuildRank = mapLevelData.RecommendBuildRank
local sScore = "Icon/BuildRank/BuildRank_" .. rBuildRank
self:SetPngSprite(self._mapNode.imgReconmendBuildChallenge, sScore)
end
return VampireLevelSelect_levelGridCtrl
@@ -0,0 +1,100 @@
local VampireLevelSelect_levelGridCtrl = class("VampireLevelSelect_levelGridCtrl", BaseCtrl)
VampireLevelSelect_levelGridCtrl._mapNodeConfig = {
TMPLevelName = {sComponentName = "TMP_Text", nCount = 2},
imgLevelImg = {sComponentName = "Image"},
rtRankRoot = {},
imgTimeBg = {},
TMPRemainTime = {sComponentName = "TMP_Text"},
txtRecommendLevel = {sComponentName = "TMP_Text"},
TMPUnlockCond = {sComponentName = "TMP_Text"},
rtNormalRoot = {},
imgLock = {},
imgElementInfo = {sComponentName = "Image", nCount = 6},
TMPRecEZone1 = {
sComponentName = "TMP_Text",
sLanguageId = "VampireTitle_FirstHalf"
},
TMPRecEZone2 = {
sComponentName = "TMP_Text",
sLanguageId = "VampireTitle_SecondHalf"
},
txtTitle = {
sComponentName = "TMP_Text",
sLanguageId = "InfinityTower_Recommend_Lv"
},
TMPRecommendBuildTitleChallenge = {
sComponentName = "TMP_Text",
sLanguageId = "InfinityTower_Recommend_Construct"
},
imgReconmendBuildChallenge = {sComponentName = "Image"},
btnStar = {nCount = 3, sComponentName = "Button"},
TMPDisasterStar = {sComponentName = "TMP_Text"}
}
VampireLevelSelect_levelGridCtrl._mapEventConfig = {
VampireQuestRefresh = "OnEvent_VampireQuestRefresh"
}
VampireLevelSelect_levelGridCtrl._mapRedDotConfig = {}
function VampireLevelSelect_levelGridCtrl:Refresh(mapLevelData)
if mapLevelData == nil then
self.gameObject:SetActive(false)
return
end
self.mapData = mapLevelData
NovaAPI.SetTMPText(self._mapNode.TMPLevelName[1], mapLevelData.Name)
NovaAPI.SetTMPText(self._mapNode.TMPLevelName[2], mapLevelData.Name)
if mapLevelData.Type == GameEnum.vampireSurvivorType.Turn then
self._mapNode.rtRankRoot:SetActive(true)
self._mapNode.rtNormalRoot:SetActive(false)
NovaAPI.SetTMPText(self._mapNode.TMPRemainTime, PlayerData.VampireSurvivor:GetRefreshTiem())
self._mapNode.imgTimeBg:SetActive(false)
else
self._mapNode.rtRankRoot:SetActive(false)
self._mapNode.rtNormalRoot:SetActive(true)
self._mapNode.imgTimeBg:SetActive(false)
local tbQuestId = CacheTable.GetData("_VampireQuestGroup", mapLevelData.FirstQuestGroupId)
if tbQuestId == nil then
tbQuestId = {}
end
for i = 1, 3 do
self._mapNode.btnStar[i].gameObject:SetActive(tbQuestId[i] ~= nil)
self._mapNode.btnStar[i].interactable = PlayerData.Quest:GetVampireQuestStatusById(tbQuestId[i]) > 0
end
end
for i = 1, 3 do
if mapLevelData.EETScore1 == nil or mapLevelData.EETScore1[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 .. mapLevelData.EETScore1[i])
end
end
for i = 1, 3 do
if mapLevelData.EETScore2 == nil or mapLevelData.EETScore2[i] == nil then
self._mapNode.imgElementInfo[i + 3].gameObject:SetActive(false)
else
self._mapNode.imgElementInfo[i + 3].gameObject:SetActive(true)
self:SetAtlasSprite(self._mapNode.imgElementInfo[i + 3], "12_rare", AllEnum.ElementIconType.Icon .. mapLevelData.EETScore2[i])
end
end
local sPath = self.mapData.CoverEpisode == nil and self.mapData.Episode or self.mapData.CoverEpisode
self:SetPngSprite(self._mapNode.imgLevelImg, sPath)
local bUnLock, nType, content = PlayerData.VampireSurvivor:CheckLevelUnlock(mapLevelData.Id)
if not bUnLock then
self._mapNode.imgLock:SetActive(true)
local sKey = "VampireTalent_LockCond" .. nType
NovaAPI.SetTMPText(self._mapNode.TMPUnlockCond, orderedFormat(ConfigTable.GetUIText(sKey), content))
else
self._mapNode.imgLock:SetActive(false)
end
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevel, mapLevelData.SuggestedPower)
local rBuildRank = mapLevelData.RecommendBuildRank
local sScore = "Icon/BuildRank/BuildRank_" .. rBuildRank
self:SetPngSprite(self._mapNode.imgReconmendBuildChallenge, sScore)
local cur, total = PlayerData.VampireSurvivor:GetSeasonQuestCount(GameEnum.vampireSurvivorType.Turn)
NovaAPI.SetTMPText(self._mapNode.TMPDisasterStar, string.format("%d/%d", cur, total))
end
function VampireLevelSelect_levelGridCtrl:OnEvent_VampireQuestRefresh()
local cur, total = PlayerData.VampireSurvivor:GetSeasonQuestCount(GameEnum.vampireSurvivorType.Turn)
NovaAPI.SetTMPText(self._mapNode.TMPDisasterStar, string.format("%d/%d", cur, total))
end
return VampireLevelSelect_levelGridCtrl
@@ -0,0 +1,170 @@
local VampireLevelSelect_levelInfo = class("VampireLevelSelect_levelInfo", BaseCtrl)
VampireLevelSelect_levelInfo._mapNodeConfig = {
imgBgLevel = {
nCount = 3,
sCtrlName = "Game.UI.VampireLevelSelect.VampireLevelSelect_levelInfoGrid"
},
TMPLevelName = {sComponentName = "TMP_Text"},
TMPOpenTime = {sComponentName = "TMP_Text"},
imgTimeBg = {},
txtRecommendLevel = {sComponentName = "TMP_Text"},
TMPRecommendLevelTitleGrid = {
sComponentName = "TMP_Text",
sLanguageId = "InfinityTower_Recommend_Lv"
},
TMPRecommendBuildTitleGrid = {
sComponentName = "TMP_Text",
sLanguageId = "InfinityTower_Recommend_Construct"
},
imgReconmendBuildGrid = {sComponentName = "Image"},
imgCardPackage = {sComponentName = "Image", nCount = 5},
imgSubIcon = {
sNodeName = "imgSubIcon_",
sComponentName = "Image",
nCount = 5
},
TMPRecPartTitle = {
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Rank_Recommend_Level"
},
TMPFCPartTitle = {
sComponentName = "TMP_Text",
sLanguageId = "StarTower_RoomInfo_FateCard"
},
btnGo = {
sComponentName = "UIButton",
callback = "OnBtnClick_Go"
},
btnFateCardInfo = {
sComponentName = "UIButton",
callback = "OnBtnClick_FateCardInfo"
},
TMPBtnPassQuest = {
sComponentName = "TMP_Text",
sLanguageId = "Vampire_Pass_QuestTitle"
},
TMPGoTitle = {
sComponentName = "TMP_Text",
sLanguageId = "TD_Btn_Challenge"
},
goRedDotQuestLevelInfo = {},
rtQuest = {},
TMPQuest = {sComponentName = "TMP_Text", nCount = 3},
btnQuestStar = {sComponentName = "Button", nCount = 3}
}
VampireLevelSelect_levelInfo._mapEventConfig = {}
VampireLevelSelect_levelInfo._mapRedDotConfig = {
[RedDotDefine.VampireQuest] = {
sNodeName = "goRedDotQuestLevelInfo"
}
}
function VampireLevelSelect_levelInfo:Awake()
end
function VampireLevelSelect_levelInfo:FadeIn()
end
function VampireLevelSelect_levelInfo:FadeOut()
end
function VampireLevelSelect_levelInfo:OnEnable()
end
function VampireLevelSelect_levelInfo:OnDisable()
end
function VampireLevelSelect_levelInfo:OnDestroy()
end
function VampireLevelSelect_levelInfo:OnRelease()
end
function VampireLevelSelect_levelInfo:Refresh(nLevelId, mapBuild1, mapBuild2)
self.mapBuild1 = mapBuild1
self.mapBuild2 = mapBuild2
self.nLevelId = nLevelId
local mapLevelData = ConfigTable.GetData("VampireSurvivor", nLevelId)
if mapLevelData == nil then
return
end
self.bSingle = mapLevelData.Mode == GameEnum.vampireSurvivorMode.Single
self._mapNode.imgTimeBg:SetActive(mapLevelData.Type == GameEnum.vampireSurvivorType.Turn)
self._mapNode.rtQuest:SetActive(mapLevelData.Type ~= GameEnum.vampireSurvivorType.Turn)
if mapLevelData.Type ~= GameEnum.vampireSurvivorType.Turn then
local tbQuestId = CacheTable.GetData("_VampireQuestGroup", mapLevelData.FirstQuestGroupId)
if tbQuestId == nil then
tbQuestId = {}
end
for i = 1, 3 do
self._mapNode.TMPQuest[i].gameObject:SetActive(tbQuestId[i] ~= nil)
self._mapNode.btnQuestStar[i].interactable = PlayerData.Quest:GetVampireQuestStatusById(tbQuestId[i]) > 0
if tbQuestId[i] ~= nil then
local mapQuestCfgData = ConfigTable.GetData("VampireSurvivorQuest", tbQuestId[i])
if mapQuestCfgData == nil then
self._mapNode.TMPQuest[i].gameObject:SetActive(false)
else
NovaAPI.SetTMPText(self._mapNode.TMPQuest[i], mapQuestCfgData.Title)
end
end
end
end
NovaAPI.SetTMPText(self._mapNode.TMPOpenTime, orderedFormat(ConfigTable.GetUIText("Vampire_LevelOpenTime"), PlayerData.VampireSurvivor:GetRefreshTiem()))
NovaAPI.SetTMPText(self._mapNode.TMPLevelName, mapLevelData.Name)
if self.bSingle then
self._mapNode.imgBgLevel[3].gameObject:SetActive(true)
self._mapNode.imgBgLevel[3]:Refresh(mapLevelData, self.mapBuild1, true)
self._mapNode.imgBgLevel[1].gameObject:SetActive(false)
self._mapNode.imgBgLevel[2].gameObject:SetActive(false)
else
self._mapNode.imgBgLevel[1].gameObject:SetActive(true)
self._mapNode.imgBgLevel[2].gameObject:SetActive(true)
self._mapNode.imgBgLevel[1]:Refresh(mapLevelData, self.mapBuild1, true)
self._mapNode.imgBgLevel[2]:Refresh(mapLevelData, self.mapBuild2, false)
self._mapNode.imgBgLevel[3].gameObject:SetActive(false)
end
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevel, mapLevelData.SuggestedPower)
local rBuildRank = mapLevelData.RecommendBuildRank
local sScore = "Icon/BuildRank/BuildRank_" .. rBuildRank
self:SetPngSprite(self._mapNode.imgReconmendBuildGrid, sScore)
local tbBunldle = {}
if mapLevelData.Type == GameEnum.vampireSurvivorType.Turn then
local nSeasonId = PlayerData.VampireSurvivor:GetCurSeason()
local mapSeason = ConfigTable.GetData("VampireRankSeason", nSeasonId)
if mapSeason ~= nil then
tbBunldle = mapSeason.FateCardBundle
end
else
tbBunldle = mapLevelData.FateCardBundle
end
for i = 1, 5 do
if tbBunldle[i] ~= nil then
local mapBundleCfg = ConfigTable.GetData("StarTowerBookFateCardBundle", tbBunldle[i])
if mapBundleCfg == nil then
self._mapNode.imgCardPackage[i].gameObject:SetActive(false)
else
self._mapNode.imgCardPackage[i].gameObject:SetActive(true)
self:SetPngSprite(self._mapNode.imgCardPackage[i], mapBundleCfg.Icon .. AllEnum.FateCardBundleIcon.S)
self:SetAtlasSprite(self._mapNode.imgSubIcon[i], "05_language", mapBundleCfg.Text)
NovaAPI.SetImageNativeSize(self._mapNode.imgSubIcon[i])
end
else
self._mapNode.imgCardPackage[i].gameObject:SetActive(false)
end
end
end
function VampireLevelSelect_levelInfo:SetRefreshTime()
NovaAPI.SetTMPText(self._mapNode.TMPOpenTime, orderedFormat(ConfigTable.GetUIText("Vampire_LevelOpenTime"), PlayerData.VampireSurvivor:GetRefreshTiem()))
end
function VampireLevelSelect_levelInfo:OnBtnClick_Go()
if self.bSingle then
if self.mapBuild1 == nil then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Vampire_SingleBuildHint"))
return
end
PlayerData.VampireSurvivor:EnterVampireSurvivor(self.nLevelId, self.mapBuild1.nBuildId, -1)
else
if self.mapBuild1 == nil or self.mapBuild2 == nil then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("VampireBuild_Hint"))
return
end
PlayerData.VampireSurvivor:EnterVampireSurvivor(self.nLevelId, self.mapBuild1.nBuildId, self.mapBuild2.nBuildId)
end
EventManager.Hit("EnterVampireSurvivor")
end
function VampireLevelSelect_levelInfo:OnBtnClick_FateCardInfo()
EventManager.Hit(EventId.OpenPanel, PanelId.VampireSurvivorFateCardInfo, self.nLevelId)
end
return VampireLevelSelect_levelInfo
@@ -0,0 +1,169 @@
local VampireLevelSelect_levelInfoGrid = class("VampireLevelSelect_levelInfoGrid", BaseCtrl)
VampireLevelSelect_levelInfoGrid._mapNodeConfig = {
TMPTitleZone = {sComponentName = "TMP_Text"},
imgElementInfo = {sComponentName = "Image", nCount = 3},
txtLeader = {
sComponentName = "TMP_Text",
sLanguageId = "Build_Leader"
},
txtSub = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Build_Sub"
},
txtBtnEnemyInfo = {
sComponentName = "TMP_Text",
sLanguageId = "Equipment_Instance_EnemyInfo"
},
imgLevelImg = {sComponentName = "Image"},
tcChar = {nCount = 3},
Monster = {
sCtrlName = "Game.UI.TemplateEx.TemplateHeadCtrl",
nCount = 4
},
rtEmpty = {},
rtBuild = {},
TMPBuildSelectTitle = {
sComponentName = "TMP_Text",
sLanguageId = "RegionBoss_Manage_Title"
},
imgItemIcon = {sComponentName = "Image", nCount = 3},
imgItemRare = {sComponentName = "Image", nCount = 3},
txtRank = {sComponentName = "TMP_Text", nCount = 3},
txtLv = {sComponentName = "TMP_Text", nCount = 3},
TMPBuildRankTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Template_Score"
},
imgRankIcon = {sComponentName = "Image"},
btnChangeBuild = {
sComponentName = "UIButton",
callback = "OnBtnClick_ChangeBuild"
},
btnSelectBuild = {
sComponentName = "UIButton",
callback = "OnBtnClick_ChangeBuild"
},
btnRemoveBuild = {
sComponentName = "UIButton",
callback = "OnBtnClick_RemoveBuild"
},
btnExchangeBuild = {
sComponentName = "UIButton",
callback = "OnBtnClick_ExchangeBuild"
},
btnEnemyInfo = {
sComponentName = "UIButton",
callback = "OnBtnClick_EnemyInfo"
}
}
VampireLevelSelect_levelInfoGrid._mapEventConfig = {}
VampireLevelSelect_levelInfoGrid._mapRedDotConfig = {}
function VampireLevelSelect_levelInfoGrid:Awake()
end
function VampireLevelSelect_levelInfoGrid:FadeIn()
end
function VampireLevelSelect_levelInfoGrid:FadeOut()
end
function VampireLevelSelect_levelInfoGrid:OnEnable()
end
function VampireLevelSelect_levelInfoGrid:OnDisable()
end
function VampireLevelSelect_levelInfoGrid:OnDestroy()
end
function VampireLevelSelect_levelInfoGrid:OnRelease()
end
function VampireLevelSelect_levelInfoGrid:Refresh(mapLevelData, mapBuildData, bFirstHalf)
self.bFirstHalf = bFirstHalf
self.mapLevelData = mapLevelData
local nPreviewMonsterGroupId = bFirstHalf and mapLevelData.FHPreviewMonsterGroupId or mapLevelData.SHPreviewMonsterGroupId
self.nPreviewMonsterGroupId = nPreviewMonsterGroupId
local sKey = bFirstHalf and "VampireTitle_FirstHalf" or "VampireTitle_SecondHalf"
NovaAPI.SetTMPText(self._mapNode.TMPTitleZone, ConfigTable.GetUIText(sKey))
local tbMonsterGroup
if nPreviewMonsterGroupId ~= nil then
local mapGroupCfgData = ConfigTable.GetData("PreviewMonsterGroup", nPreviewMonsterGroupId)
if mapGroupCfgData ~= nil then
tbMonsterGroup = mapGroupCfgData.MonsterIds
end
end
if tbMonsterGroup == nil then
tbMonsterGroup = {}
end
local comp = function(a, b)
local previewMonsterCfgA = ConfigTable.GetData("Monster", a)
local previewMonsterCfgB = ConfigTable.GetData("Monster", b)
if previewMonsterCfgA == nil or previewMonsterCfgB == nil then
return a < b
end
if previewMonsterCfgA.EpicLv ~= previewMonsterCfgB.EpicLv then
return previewMonsterCfgA.EpicLv < previewMonsterCfgB.EpicLv
else
return a < b
end
end
table.sort(tbMonsterGroup, comp)
for i = 1, 4 do
if tbMonsterGroup[i] == nil then
self._mapNode.Monster[i].gameObject:SetActive(false)
else
self._mapNode.Monster[i].gameObject:SetActive(true)
self._mapNode.Monster[i]:SetMonsterHead(tbMonsterGroup[i])
end
end
local tbEET = self.bFirstHalf and mapLevelData.EETScore1 or mapLevelData.EETScore2
for i = 1, 3 do
if tbEET == nil or tbEET[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 .. tbEET[i])
end
end
local sEpisode = self.bFirstHalf and self.mapLevelData.Episode or self.mapLevelData.Episode2
self:SetPngSprite(self._mapNode.imgLevelImg, sEpisode)
if mapBuildData == nil then
self._mapNode.rtEmpty:SetActive(true)
self._mapNode.rtBuild:SetActive(false)
else
self._mapNode.rtEmpty:SetActive(false)
self._mapNode.rtBuild:SetActive(true)
for i = 1, 3 do
if mapBuildData.tbChar[i] ~= nil then
self._mapNode.tcChar[i].gameObject:SetActive(true)
local mapChar = ConfigTable.GetData_Character(mapBuildData.tbChar[i].nTid)
local mapCharData = PlayerData.Char:GetCharDataByTid(mapBuildData.tbChar[i].nTid)
NovaAPI.SetTMPText(self._mapNode.txtRank[i], mapCharData.nLevel)
local nCharSkinId = mapCharData.nSkinId
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[nRarity == GameEnum.characterGrade.R and GameEnum.characterGrade.SR or nRarity]
self:SetAtlasSprite(self._mapNode.imgItemRare[i], "12_rare", sFrame, true)
else
self._mapNode.tcChar[i].gameObject:SetActive(false)
end
end
local sScore = "Icon/BuildRank/BuildRank_" .. mapBuildData.mapRank.Id
self:SetPngSprite(self._mapNode.imgRankIcon, sScore)
end
end
function VampireLevelSelect_levelInfoGrid:OnBtnClick_ChangeBuild()
local nIdx = self.bFirstHalf and 1 or 2
EventManager.Hit(EventId.OpenPanel, PanelId.RogueBossBuildBrief, 7, self.mapLevelData.Id, nIdx, {})
end
function VampireLevelSelect_levelInfoGrid:OnBtnClick_ExchangeBuild()
PlayerData.VampireSurvivor:ExchangeBuild(self.mapLevelData.Id)
end
function VampireLevelSelect_levelInfoGrid:OnBtnClick_RemoveBuild()
local nIdx = self.bFirstHalf and 1 or 2
PlayerData.VampireSurvivor:CacheSelectedBuildId(self.mapLevelData.Id, nIdx, 0)
end
function VampireLevelSelect_levelInfoGrid:OnBtnClick_EnemyInfo()
local tbOverrideWeakEET
if self.mapLevelData.Type == GameEnum.vampireSurvivorType.Turn then
tbOverrideWeakEET = self.bFirstHalf and self.mapLevelData.EETScore1 or self.mapLevelData.EETScore2
end
EventManager.Hit("OpenVampireMonsterInfo", self.nPreviewMonsterGroupId, tbOverrideWeakEET)
end
return VampireLevelSelect_levelInfoGrid
@@ -0,0 +1,384 @@
local VampireLevelSelect_levelSelectCtrl = class("VampireLevelSelect_levelSelectCtrl", BaseCtrl)
VampireLevelSelect_levelSelectCtrl._mapNodeConfig = {
rtList = {},
rtListHard = {},
svLevelList = {
sComponentName = "LoopScrollView"
},
svLevelListHard = {
sComponentName = "LoopScrollView"
},
rtDisaster = {},
TMPTog = {sComponentName = "TMP_Text", nCount = 3},
TMPTogOpen = {sComponentName = "TMP_Text", nCount = 3},
imgTogLock = {nCount = 3},
imgTogOpen = {nCount = 3},
btnTogBtn = {
sComponentName = "UIButton",
nCount = 3,
callback = "OnBtnClick_Tog"
},
gridDisaster = {
sCtrlName = "Game.UI.VampireLevelSelect.VampireLevelSelect_levelGridCtrl_Disaster"
},
imgTimeBgLevelSelect = {},
TMPRemainTimeLevelSelect = {sComponentName = "TMP_Text"},
TMPWeekScoreTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Vampire_Season_Score"
},
TMPWeekScore = {sComponentName = "TMP_Text"}
}
VampireLevelSelect_levelSelectCtrl._mapEventConfig = {
VampireQuestRefresh = "OnEvent_VampireQuestRefresh"
}
VampireLevelSelect_levelSelectCtrl._mapRedDotConfig = {}
function VampireLevelSelect_levelSelectCtrl:Awake()
self.mapGrid = {}
self.tbNormalLevel = {}
self.tbHardLevel = {}
self.mapSeasonLevel = nil
self.curToggle = 0
self.tbTogUnlock = {}
local nCurSeasonId = PlayerData.VampireSurvivor:GetCurSeason()
local nCurSeasonLevel = 0
if nCurSeasonId ~= nil then
local mapSeasonData = ConfigTable.GetData("VampireRankSeason", nCurSeasonId)
if mapSeasonData ~= nil then
nCurSeasonLevel = mapSeasonData.MissionId
end
end
local forEachVampireLevel = function(mapData)
if mapData.Type == GameEnum.vampireSurvivorType.Normal then
table.insert(self.tbNormalLevel, mapData)
elseif mapData.Type == GameEnum.vampireSurvivorType.Hard then
table.insert(self.tbHardLevel, mapData)
elseif mapData.Id == nCurSeasonLevel then
self.mapSeasonLevel = mapData
end
end
ForEachTableLine(DataTable.VampireSurvivor, forEachVampireLevel)
local sort = function(a, b)
return a.Id < b.Id
end
table.sort(self.tbNormalLevel, sort)
table.sort(self.tbHardLevel, sort)
end
function VampireLevelSelect_levelSelectCtrl:FadeIn()
end
function VampireLevelSelect_levelSelectCtrl:FadeOut()
end
function VampireLevelSelect_levelSelectCtrl:OnEnable()
self._mapNode.imgTogOpen[1]:SetActive(true)
self._mapNode.imgTogOpen[2]:SetActive(false)
self._mapNode.imgTogOpen[3]:SetActive(false)
self._mapNode.rtList.gameObject:SetActive(true)
self._mapNode.rtListHard.gameObject:SetActive(false)
self._mapNode.rtDisaster:SetActive(false)
self:Refresh()
NovaAPI.SetTMPText(self._mapNode.TMPTog[1], ConfigTable.GetUIText("Vampire_Hard1"))
NovaAPI.SetTMPText(self._mapNode.TMPTog[2], ConfigTable.GetUIText("Vampire_Hard2"))
NovaAPI.SetTMPText(self._mapNode.TMPTog[3], ConfigTable.GetUIText("Vampire_Hard3"))
NovaAPI.SetTMPText(self._mapNode.TMPTogOpen[1], ConfigTable.GetUIText("Vampire_Hard1"))
NovaAPI.SetTMPText(self._mapNode.TMPTogOpen[2], ConfigTable.GetUIText("Vampire_Hard2"))
NovaAPI.SetTMPText(self._mapNode.TMPTogOpen[3], ConfigTable.GetUIText("Vampire_Hard3"))
local bUnlock1 = self:CheckHardUnlock(1)
local bUnlock2 = self:CheckHardUnlock(2)
local bUnlock3 = self:CheckHardUnlock(3)
self.bShowTog1 = false
self.bShowTog2 = false
self._mapNode.imgTogLock[1]:SetActive(not bUnlock1)
self._mapNode.imgTogLock[2]:SetActive(not bUnlock2)
self._mapNode.imgTogLock[3]:SetActive(not bUnlock3)
self.tbTogUnlock = {
bUnlock1,
bUnlock2,
bUnlock3
}
self._mapNode.imgTimeBgLevelSelect:SetActive(PlayerData.VampireSurvivor:GetCurSeason() ~= 0 and bUnlock3)
if self.curToggle == 0 then
if bUnlock3 then
self:OnBtnClick_Tog(nil, 3)
EventManager.Hit("VampireQuestTitle", 3)
elseif bUnlock2 then
self:OnBtnClick_Tog(nil, 2)
EventManager.Hit("VampireQuestTitle", 2)
else
self:OnBtnClick_Tog(nil, 1)
EventManager.Hit("VampireQuestTitle", 1)
end
else
local nIdx = self.curToggle
self.curToggle = 0
self:OnBtnClick_Tog(nil, nIdx)
EventManager.Hit("VampireQuestTitle", self.curToggle)
end
NovaAPI.SetTMPText(self._mapNode.TMPRemainTimeLevelSelect, PlayerData.VampireSurvivor:GetRefreshTiem())
NovaAPI.SetTMPText(self._mapNode.TMPWeekScore, string.formatnumberthousands(PlayerData.VampireSurvivor:GetCurScore()))
end
function VampireLevelSelect_levelSelectCtrl:Refresh()
self._mapNode.svLevelList:Init(#self.tbNormalLevel, self, self.OnGridRefresh, self.OnBtnClickGrid, false)
self._mapNode.svLevelListHard:Init(#self.tbHardLevel, self, self.OnGridRefreshHard, self.OnBtnClickGrid, false)
if self.mapSeasonLevel ~= nil then
self._mapNode.gridDisaster:Refresh(self.mapSeasonLevel)
end
end
function VampireLevelSelect_levelSelectCtrl:RefreshWithPosSet(nCurLevel)
self:Refresh()
local bUnlock1 = self:CheckHardUnlock(1)
local bUnlock2 = self:CheckHardUnlock(2)
local bUnlock3 = self:CheckHardUnlock(3)
self.bShowTog1 = true
self.bShowTog2 = true
self._mapNode.imgTogLock[1]:SetActive(not bUnlock1)
self._mapNode.imgTogLock[2]:SetActive(not bUnlock2)
self._mapNode.imgTogLock[3]:SetActive(not bUnlock3)
self.tbTogUnlock = {
bUnlock1,
bUnlock2,
bUnlock3
}
self._mapNode.imgTimeBgLevelSelect:SetActive(PlayerData.VampireSurvivor:GetCurSeason() ~= 0 and bUnlock3)
if self.curToggle == 0 then
if bUnlock3 then
self:OnBtnClick_Tog(nil, 3)
EventManager.Hit("VampireQuestTitle", 3)
elseif bUnlock2 then
self:OnBtnClick_Tog(nil, 2)
EventManager.Hit("VampireQuestTitle", 2)
else
self:OnBtnClick_Tog(nil, 1)
EventManager.Hit("VampireQuestTitle", 1)
end
else
self:OnBtnClick_Tog(nil, self.curToggle)
EventManager.Hit("VampireQuestTitle", self.curToggle)
end
if self.curToggle == 1 then
local nFirstLevel = 1
for index, value in ipairs(self.tbNormalLevel) do
if value.Id == nCurLevel then
nFirstLevel = index
end
end
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.svLevelList:SetScrollGridPos(nFirstLevel - 1, 0.5, 0)
end
cs_coroutine.start(wait)
self.bShowTog1 = true
end
if self.curToggle == 2 then
local nFirstLevel = 1
for index, value in ipairs(self.tbHardLevel) do
if value.Id == nCurLevel then
nFirstLevel = index
end
end
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.svLevelListHard:SetScrollGridPos(nFirstLevel - 1, 0.5, 0)
end
cs_coroutine.start(wait)
self.bShowTog2 = true
end
NovaAPI.SetTMPText(self._mapNode.TMPRemainTimeLevelSelect, PlayerData.VampireSurvivor:GetRefreshTiem())
NovaAPI.SetTMPText(self._mapNode.TMPWeekScore, string.formatnumberthousands(PlayerData.VampireSurvivor:GetCurScore()))
self.bShowTog1 = false
self.bShowTog2 = false
end
function VampireLevelSelect_levelSelectCtrl:NewSeason()
self.mapSeasonLevel = nil
local nCurSeasonId = PlayerData.VampireSurvivor:GetCurSeason()
local nCurSeasonLevel = 0
if nCurSeasonId ~= nil then
local mapSeasonData = ConfigTable.GetData("VampireRankSeason", nCurSeasonId)
if mapSeasonData ~= nil then
nCurSeasonLevel = mapSeasonData.MissionId
end
end
local forEachVampireLevel = function(mapData)
if mapData.Id == nCurSeasonLevel then
self.mapSeasonLevel = mapData
end
end
ForEachTableLine(DataTable.VampireSurvivor, forEachVampireLevel)
self:Refresh()
local bUnlock1 = self:CheckHardUnlock(1)
local bUnlock2 = self:CheckHardUnlock(2)
local bUnlock3 = self:CheckHardUnlock(3)
self.bShowTog1 = false
self.bShowTog2 = false
self._mapNode.imgTogLock[1]:SetActive(not bUnlock1)
self._mapNode.imgTogLock[2]:SetActive(not bUnlock2)
self._mapNode.imgTogLock[3]:SetActive(not bUnlock3)
self.tbTogUnlock = {
bUnlock1,
bUnlock2,
bUnlock3
}
self._mapNode.imgTimeBgLevelSelect:SetActive(PlayerData.VampireSurvivor:GetCurSeason() ~= 0 and bUnlock3)
if self.curToggle == 0 then
if bUnlock3 then
self:OnBtnClick_Tog(nil, 3)
EventManager.Hit("VampireQuestTitle", 3)
elseif bUnlock2 then
self:OnBtnClick_Tog(nil, 2)
EventManager.Hit("VampireQuestTitle", 2)
else
self:OnBtnClick_Tog(nil, 1)
EventManager.Hit("VampireQuestTitle", 1)
end
else
self:OnBtnClick_Tog(nil, self.curToggle)
EventManager.Hit("VampireQuestTitle", self.curToggle)
end
NovaAPI.SetTMPText(self._mapNode.TMPRemainTimeLevelSelect, PlayerData.VampireSurvivor:GetRefreshTiem())
NovaAPI.SetTMPText(self._mapNode.TMPWeekScore, string.formatnumberthousands(PlayerData.VampireSurvivor:GetCurScore()))
end
function VampireLevelSelect_levelSelectCtrl:CheckHardUnlock(nHard)
if nHard == 1 then
for _, mapData in ipairs(self.tbNormalLevel) do
local bUnLock, _, _ = PlayerData.VampireSurvivor:CheckLevelUnlock(mapData.Id)
if bUnLock then
return true
end
end
elseif nHard == 2 then
for _, mapData in ipairs(self.tbHardLevel) do
local bUnLock, _, _ = PlayerData.VampireSurvivor:CheckLevelUnlock(mapData.Id)
if bUnLock then
return true
end
end
elseif self.mapSeasonLevel ~= nil then
local bUnLock, _, _ = PlayerData.VampireSurvivor:CheckLevelUnlock(self.mapSeasonLevel.Id)
if bUnLock then
return true
end
end
return false
end
function VampireLevelSelect_levelSelectCtrl:OnGridRefresh(goGrid, gridIndex)
if self.mapGrid[goGrid] == nil then
local mapCtrl = self:BindCtrlByNode(goGrid, "Game.UI.VampireLevelSelect.VampireLevelSelect_levelGridCtrl")
self.mapGrid[goGrid] = mapCtrl
end
local nIdx = gridIndex
if nIdx == nil then
return
end
nIdx = nIdx + 1
local mapData = self.tbNormalLevel[nIdx]
self.mapGrid[goGrid]:Refresh(mapData)
end
function VampireLevelSelect_levelSelectCtrl:OnGridRefreshHard(goGrid, gridIndex)
if self.mapGrid[goGrid] == nil then
local mapCtrl = self:BindCtrlByNode(goGrid, "Game.UI.VampireLevelSelect.VampireLevelSelect_levelGridCtrl")
self.mapGrid[goGrid] = mapCtrl
end
local nIdx = gridIndex
if nIdx == nil then
return
end
nIdx = nIdx + 1
local mapData = self.tbHardLevel[nIdx]
self.mapGrid[goGrid]:Refresh(mapData)
end
function VampireLevelSelect_levelSelectCtrl:OnBtnClickGrid(goGrid, gridIndex)
local WwiseManger = CS.WwiseAudioManager.Instance
local nIdx = gridIndex
if nIdx == nil then
return
end
nIdx = nIdx + 1
local mapData = self.tbNormalLevel[nIdx]
if self.curToggle == 1 then
mapData = self.tbNormalLevel[nIdx]
elseif self.curToggle == 2 then
mapData = self.tbHardLevel[nIdx]
else
mapData = self.mapSeasonLevel
end
local bUnLock, nType, content = PlayerData.VampireSurvivor:CheckLevelUnlock(mapData.Id)
if not bUnLock then
local sKey = "VampireTalent_LockCond" .. nType
EventManager.Hit(EventId.OpenMessageBox, orderedFormat(ConfigTable.GetUIText(sKey), content))
else
EventManager.Hit("VampireLevelSelect_ClickLevelGrid", mapData)
WwiseManger:PostEvent("ui_vampire_level_select")
end
end
function VampireLevelSelect_levelSelectCtrl:UnbindAllCtrl()
for _, mapCtrl in pairs(self.mapGrid) do
self:UnbindCtrlByNode(mapCtrl)
end
self.mapGrid = {}
end
function VampireLevelSelect_levelSelectCtrl:OnDisable()
self:UnbindAllCtrl()
end
function VampireLevelSelect_levelSelectCtrl:OnDestroy()
end
function VampireLevelSelect_levelSelectCtrl:OnRelease()
end
function VampireLevelSelect_levelSelectCtrl:OnBtnClick_Tog(btn, nIdx)
if not self:CheckHardUnlock(nIdx) then
local sTip = ConfigTable.GetUIText("Vampire_Unlock")
if nIdx == 2 then
sTip = ConfigTable.GetUIText("Vampire_UnlockTipNormal")
elseif nIdx == 3 then
local nCurSeasonId = PlayerData.VampireSurvivor:GetCurSeason()
if nCurSeasonId == nil or nCurSeasonId == 0 then
sTip = ConfigTable.GetUIText("Vampire_NotOpenHint")
else
sTip = ConfigTable.GetUIText("Vampire_UnlockTipHard")
end
end
EventManager.Hit(EventId.OpenMessageBox, sTip)
return
end
self.curToggle = nIdx
self._mapNode.imgTogOpen[1]:SetActive(self.curToggle == 1)
self._mapNode.imgTogOpen[2]:SetActive(self.curToggle == 2)
self._mapNode.imgTogOpen[3]:SetActive(self.curToggle == 3)
self._mapNode.rtList.gameObject:SetActive(self.curToggle == 1)
self._mapNode.rtListHard.gameObject:SetActive(self.curToggle == 2)
self._mapNode.rtDisaster:SetActive(self.curToggle == 3)
EventManager.Hit("VampireQuestTitle", nIdx)
EventManager.Hit("VampireToggleChange", nIdx)
if not self.bShowTog1 and self.curToggle == 1 then
local nFirstLevel = 1
for index, value in ipairs(self.tbNormalLevel) do
local bUnLock, nType, content = PlayerData.VampireSurvivor:CheckLevelUnlock(value.Id)
if bUnLock then
nFirstLevel = index
end
end
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.svLevelList:SetScrollGridPos(nFirstLevel - 1, 0.5, 0)
end
cs_coroutine.start(wait)
self.bShowTog1 = true
end
if not self.bShowTog2 and self.curToggle == 2 then
local nFirstLevel = 1
for index, value in ipairs(self.tbHardLevel) do
local bUnLock, nType, content = PlayerData.VampireSurvivor:CheckLevelUnlock(value.Id)
if bUnLock then
nFirstLevel = index
end
end
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.svLevelListHard:SetScrollGridPos(nFirstLevel - 1, 0.5, 0)
end
cs_coroutine.start(wait)
self.bShowTog2 = true
end
end
function VampireLevelSelect_levelSelectCtrl:OnEvent_VampireQuestRefresh()
EventManager.Hit("VampireQuestTitle", self.curToggle)
end
return VampireLevelSelect_levelSelectCtrl
@@ -0,0 +1,327 @@
local VampireLevelSelect_questCtrl = class("VampireLevelSelect_questCtrl", BaseCtrl)
VampireLevelSelect_questCtrl._mapNodeConfig = {
rtWindow = {
sComponentName = "CanvasGroup"
},
rtWeekly = {},
rtPass = {},
rtPassHard = {},
lsvWeekly = {
sComponentName = "LoopScrollView"
},
lsvPass = {
sComponentName = "LoopScrollView"
},
listPassHard = {
sComponentName = "LoopScrollView"
},
TMPScoreQuest = {sComponentName = "TMP_Text"},
TMPTitleQuest = {sComponentName = "TMP_Text"},
btnClose = {sComponentName = "UIButton", callback = "ClosePanel"},
aniWindow = {sNodeName = "rtWindow", sComponentName = "Animator"},
btnReceiveWeekly = {
sComponentName = "UIButton",
callback = "OnBtnClick_ReceiveWeekly"
},
btnReceivePass = {
sComponentName = "UIButton",
callback = "OnBtnClick_ReceivePass"
},
btnReceivePassHard = {
sComponentName = "UIButton",
callback = "OnBtnClick_ReceivePassHard"
},
snapshot = {},
snapshotBtn = {
sNodeName = "snapshot",
sComponentName = "Button",
callback = "ClosePanel"
},
TMPReceiveTitle = {
nCount = 3,
sComponentName = "TMP_Text",
sLanguageId = "Quest_Fast_Receive_Btn_Text"
},
TMPScoreTitle = {
sComponentName = "TMP_Text",
sLanguageId = "VampireWeekScoreTitle"
},
TMPTogQuest = {sComponentName = "TMP_Text", nCount = 3},
TMPTogOpenQuest = {sComponentName = "TMP_Text", nCount = 3},
TMPRemainTimeQuest = {sComponentName = "TMP_Text"},
imgTogLockQuest = {nCount = 3},
imgTogOpenQuest = {nCount = 3},
btnTogBtnQuest = {
sComponentName = "UIButton",
nCount = 3,
callback = "OnBtnClick_Tog"
},
imgTimeBgQuest = {},
goRedDot1 = {},
goRedDot2 = {},
goRedDot3 = {}
}
VampireLevelSelect_questCtrl._mapEventConfig = {}
VampireLevelSelect_questCtrl._mapRedDotConfig = {
[RedDotDefine.VampireQuest_Normal] = {sNodeName = "goRedDot1"},
[RedDotDefine.VampireQuest_Hard] = {sNodeName = "goRedDot2"},
[RedDotDefine.VampireQuest_Season] = {sNodeName = "goRedDot3"}
}
function VampireLevelSelect_questCtrl:Awake()
self.tbCurQuest = {}
self.tbCurQuestSeason = {}
self.tbCurQuestHard = {}
self._mapGridCtrl = {}
self.tbLockTog = {}
end
function VampireLevelSelect_questCtrl:FadeIn()
end
function VampireLevelSelect_questCtrl:FadeOut()
end
function VampireLevelSelect_questCtrl:OnEnable()
NovaAPI.SetTMPText(self._mapNode.TMPTogQuest[1], ConfigTable.GetUIText("Vampire_Hard1"))
NovaAPI.SetTMPText(self._mapNode.TMPTogQuest[2], ConfigTable.GetUIText("Vampire_Hard2"))
NovaAPI.SetTMPText(self._mapNode.TMPTogQuest[3], ConfigTable.GetUIText("Vampire_Hard3"))
NovaAPI.SetTMPText(self._mapNode.TMPTogOpenQuest[1], ConfigTable.GetUIText("Vampire_Hard1"))
NovaAPI.SetTMPText(self._mapNode.TMPTogOpenQuest[2], ConfigTable.GetUIText("Vampire_Hard2"))
NovaAPI.SetTMPText(self._mapNode.TMPTogOpenQuest[3], ConfigTable.GetUIText("Vampire_Hard3"))
end
function VampireLevelSelect_questCtrl:OnDisable()
end
function VampireLevelSelect_questCtrl:OnDestroy()
end
function VampireLevelSelect_questCtrl:OnRelease()
end
function VampireLevelSelect_questCtrl:OpenPanel(nType, nLevelId, bAnim)
local sKey = nType == 1 and "VampireQuestTitle_Season" or "VampireQuestTitle_Pass"
NovaAPI.SetTMPText(self._mapNode.TMPTitleQuest, ConfigTable.GetUIText(sKey))
self.tbScore, self.tbPass = PlayerData.Quest:GetVampireQuestData()
self.nType = nType
self.nLevelId = nLevelId
self.gameObject:SetActive(true)
self._mapNode.rtWindow.gameObject:SetActive(false)
self.nScore = PlayerData.VampireSurvivor:GetCurScore()
self.tbCurQuestSeason = {}
self.tbCurQuest = {}
self.tbCurQuestHard = {}
self.nGroupIdSeason = 0
local nCurSeasonId = PlayerData.VampireSurvivor:GetCurSeason()
if nCurSeasonId ~= nil then
local mapSeasonData = ConfigTable.GetData("VampireRankSeason", nCurSeasonId)
if mapSeasonData ~= nil then
self.nGroupIdSeason = mapSeasonData.QuestGroup
end
end
for _, mapQuest in ipairs(self.tbScore) do
local mapQuestCfgData = ConfigTable.GetData("VampireSurvivorQuest", mapQuest.nTid)
if mapQuestCfgData ~= nil then
table.insert(self.tbCurQuestSeason, mapQuest)
end
end
self.tbCurQuest = {}
self.nGroupId = 0
if nLevelId ~= 0 and nLevelId ~= nil then
local mapLevelCfgData = ConfigTable.GetData("VampireSurvivor", nLevelId)
if mapLevelCfgData ~= nil then
self.nGroupId = mapLevelCfgData.FirstQuestGroupId
end
end
for _, mapQuest in ipairs(self.tbPass) do
local mapQuestCfgData = ConfigTable.GetData("VampireSurvivorQuest", mapQuest.nTid)
if mapQuestCfgData ~= nil then
if mapQuestCfgData.Type == GameEnum.vampireSurvivorType.Normal then
table.insert(self.tbCurQuest, mapQuest)
elseif mapQuestCfgData.Type == GameEnum.vampireSurvivorType.Hard then
table.insert(self.tbCurQuestHard, mapQuest)
end
end
end
local statusOrder = {
[0] = 1,
[1] = 2,
[2] = 0
}
local sort = function(a, b)
local mapQuestACfg = ConfigTable.GetData("VampireSurvivorQuest", a.nTid)
local mapQuestBCfg = ConfigTable.GetData("VampireSurvivorQuest", b.nTid)
if a.nStatus ~= b.nStatus then
return statusOrder[a.nStatus] > statusOrder[b.nStatus]
elseif mapQuestACfg.GroupId ~= mapQuestBCfg.GroupId and (mapQuestACfg.GroupId == self.nGroupId or mapQuestBCfg.GroupId == self.nGroupId) then
return mapQuestBCfg.GroupId ~= self.nGroupId
else
return a.nTid < b.nTid
end
end
table.sort(self.tbCurQuestSeason, sort)
table.sort(self.tbCurQuest, sort)
table.sort(self.tbCurQuestHard, sort)
self._mapNode.lsvWeekly:Init(#self.tbCurQuestSeason, self, self.OnGridRefreshSeason)
self._mapNode.lsvPass:Init(#self.tbCurQuest, self, self.OnGridRefreshNormal)
self._mapNode.listPassHard:Init(#self.tbCurQuestHard, self, self.OnGridRefreshHard)
NovaAPI.SetTMPText(self._mapNode.TMPScoreQuest, self.nScore)
self.tbLockTog = PlayerData.VampireSurvivor:GetHardUnlock()
self._mapNode.imgTogLockQuest[1]:SetActive(not self.tbLockTog[1])
self._mapNode.imgTogLockQuest[2]:SetActive(not self.tbLockTog[2])
self._mapNode.imgTogLockQuest[3]:SetActive(not self.tbLockTog[3])
self._mapNode.imgTimeBgQuest:SetActive(self.tbLockTog[3])
if not self.tbLockTog[3] then
NovaAPI.SetTMPText(self._mapNode.TMPRemainTimeQuest, PlayerData.VampireSurvivor:GetRefreshTiem())
end
if nLevelId ~= 0 and nLevelId ~= nil then
local mapLevelCfgData = ConfigTable.GetData("VampireSurvivor", nLevelId)
if mapLevelCfgData ~= nil then
if mapLevelCfgData.Type == GameEnum.vampireSurvivorType.Normal then
self:OnBtnClick_Tog(nil, 1)
elseif mapLevelCfgData.Type == GameEnum.vampireSurvivorType.Hard then
self:OnBtnClick_Tog(nil, 2)
else
self:OnBtnClick_Tog(nil, 3)
end
end
elseif self.nType == 1 then
self:OnBtnClick_Tog(nil, 1)
elseif self.nType == 2 then
self:OnBtnClick_Tog(nil, 2)
elseif self.nType == 3 then
self:OnBtnClick_Tog(nil, 3)
end
local wait = function()
NovaAPI.UIEffectSnapShotCapture(self._mapNode.snapshot)
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.rtWindow.gameObject:SetActive(true)
if bAnim ~= false then
self._mapNode.aniWindow:Play("t_window_04_t_in")
end
end
cs_coroutine.start(wait)
end
function VampireLevelSelect_questCtrl:ClosePanel()
self.gameObject:SetActive(false)
self:UnbindAllGrids()
self.tbCurQuestSeason = {}
self.tbCurQuest = {}
self.tbCurQuestHard = {}
end
function VampireLevelSelect_questCtrl:OnGridRefreshSeason(goGrid, nIdx)
local nIdx = nIdx + 1
if self._mapGridCtrl[goGrid] == nil then
local gridCtrl = self:BindCtrlByNode(goGrid, "Game.UI.VampireLevelSelect.VampireLevelSelect_questGridCtrl")
self._mapGridCtrl[goGrid] = gridCtrl
end
local mapQuestData
mapQuestData = self.tbCurQuestSeason[nIdx]
self._mapGridCtrl[goGrid]:Refresh(mapQuestData, -1)
end
function VampireLevelSelect_questCtrl:OnGridRefreshNormal(goGrid, nIdx)
local nIdx = nIdx + 1
if self._mapGridCtrl[goGrid] == nil then
local gridCtrl = self:BindCtrlByNode(goGrid, "Game.UI.VampireLevelSelect.VampireLevelSelect_questGridCtrl")
self._mapGridCtrl[goGrid] = gridCtrl
end
local mapQuestData
mapQuestData = self.tbCurQuest[nIdx]
self._mapGridCtrl[goGrid]:Refresh(mapQuestData, self.nGroupId)
end
function VampireLevelSelect_questCtrl:OnGridRefreshHard(goGrid, nIdx)
local nIdx = nIdx + 1
if self._mapGridCtrl[goGrid] == nil then
local gridCtrl = self:BindCtrlByNode(goGrid, "Game.UI.VampireLevelSelect.VampireLevelSelect_questGridCtrl")
self._mapGridCtrl[goGrid] = gridCtrl
end
local mapQuestData
mapQuestData = self.tbCurQuestHard[nIdx]
self._mapGridCtrl[goGrid]:Refresh(mapQuestData, self.nGroupId)
end
function VampireLevelSelect_questCtrl:UnbindAllGrids()
for go, ctrl in pairs(self._mapGridCtrl) do
self:UnbindCtrlByNode(ctrl)
end
self._mapGridCtrl = {}
end
function VampireLevelSelect_questCtrl:OnBtnClick_ReceiveWeekly()
local tbQuestList = {}
for _, mapData in ipairs(self.tbCurQuestSeason) do
if mapData.nStatus == 1 then
table.insert(tbQuestList, mapData.nTid)
end
end
if #tbQuestList == 0 then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("InfinityTower_Reward_Tips") or "")
return
end
local callback = function(changeInfo)
local RewardCallback = function()
self.tbScore, self.tbPass = PlayerData.Quest:GetVampireQuestData()
self:OpenPanel(3, self.nLevelId, false)
end
UTILS.OpenReceiveByChangeInfo(changeInfo, RewardCallback)
end
PlayerData.Quest:ReceiveVampireQuest(10, tbQuestList, callback)
end
function VampireLevelSelect_questCtrl:OnBtnClick_ReceivePass()
local tbQuestList = {}
for _, mapData in ipairs(self.tbCurQuest) do
if mapData.nStatus == 1 then
table.insert(tbQuestList, mapData.nTid)
end
end
if #tbQuestList == 0 then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("InfinityTower_Reward_Tips") or "")
return
end
local callback = function(changeInfo)
local RewardCallback = function()
self.tbScore, self.tbPass = PlayerData.Quest:GetVampireQuestData()
self:OpenPanel(1, self.nLevelId, false)
end
UTILS.OpenReceiveByChangeInfo(changeInfo, RewardCallback)
end
PlayerData.Quest:ReceiveVampireQuest(8, tbQuestList, callback)
end
function VampireLevelSelect_questCtrl:OnBtnClick_ReceivePassHard()
local tbQuestList = {}
for _, mapData in ipairs(self.tbCurQuestHard) do
if mapData.nStatus == 1 then
table.insert(tbQuestList, mapData.nTid)
end
end
if #tbQuestList == 0 then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("InfinityTower_Reward_Tips") or "")
return
end
local callback = function(changeInfo)
local RewardCallback = function()
self.tbScore, self.tbPass = PlayerData.Quest:GetVampireQuestData()
self:OpenPanel(2, self.nLevelId, false)
end
UTILS.OpenReceiveByChangeInfo(changeInfo, RewardCallback)
end
PlayerData.Quest:ReceiveVampireQuest(9, tbQuestList, callback)
end
function VampireLevelSelect_questCtrl:OnBtnClick_Tog(_, nIdx)
if not self.tbLockTog[nIdx] then
local sTip = ConfigTable.GetUIText("Vampire_Unlock")
if nIdx == 2 then
sTip = ConfigTable.GetUIText("Vampire_UnlockTipNormal")
elseif nIdx == 3 then
local nCurSeasonId = PlayerData.VampireSurvivor:GetCurSeason()
if nCurSeasonId == nil or nCurSeasonId == 0 then
sTip = ConfigTable.GetUIText("Vampire_NotOpenHint")
else
sTip = ConfigTable.GetUIText("Vampire_UnlockTipHard")
end
end
EventManager.Hit(EventId.OpenMessageBox, sTip)
return
end
self._mapNode.rtWeekly:SetActive(nIdx == 3)
self._mapNode.rtPassHard:SetActive(nIdx == 2)
self._mapNode.rtPass:SetActive(nIdx == 1)
self._mapNode.imgTogOpenQuest[1].gameObject:SetActive(nIdx == 1)
self._mapNode.imgTogOpenQuest[2].gameObject:SetActive(nIdx == 2)
self._mapNode.imgTogOpenQuest[3].gameObject:SetActive(nIdx == 3)
self._mapNode.btnReceivePassHard.gameObject:SetActive(nIdx == 2)
self._mapNode.btnReceivePass.gameObject:SetActive(nIdx == 1)
self._mapNode.btnReceiveWeekly.gameObject:SetActive(nIdx == 3)
end
return VampireLevelSelect_questCtrl
@@ -0,0 +1,71 @@
local VampireLevelSelect_questGridCtrl = class("VampireLevelSelect_questGridCtrl", BaseCtrl)
VampireLevelSelect_questGridCtrl._mapNodeConfig = {
imgComplete = {},
imgInComplete = {},
TMPDesc = {sComponentName = "TMP_Text"},
item = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
nCount = 3
},
btnItem = {
sNodeName = "btnItem_",
sComponentName = "UIButton",
callback = "OnBtnClick_Item",
nCount = 3
},
maskComplete = {},
TMPCurLevelTitle = {
sComponentName = "TMP_Text",
sLanguageId = "VampireQuest_CurTag"
},
goCurTag = {}
}
VampireLevelSelect_questGridCtrl._mapEventConfig = {}
VampireLevelSelect_questGridCtrl._mapRedDotConfig = {}
function VampireLevelSelect_questGridCtrl:Awake()
end
function VampireLevelSelect_questGridCtrl:FadeIn()
end
function VampireLevelSelect_questGridCtrl:FadeOut()
end
function VampireLevelSelect_questGridCtrl:OnEnable()
end
function VampireLevelSelect_questGridCtrl:OnDisable()
end
function VampireLevelSelect_questGridCtrl:OnDestroy()
end
function VampireLevelSelect_questGridCtrl:OnRelease()
end
function VampireLevelSelect_questGridCtrl:Refresh(mapQuestData, nGroupId)
local mapQuestCfgData = ConfigTable.GetData("VampireSurvivorQuest", mapQuestData.nTid)
if mapQuestCfgData == nil then
return
end
self.cfgData = mapQuestCfgData
self._mapNode.goCurTag:SetActive(mapQuestCfgData.FirstQuestGroupId == nGroupId)
NovaAPI.SetTMPText(self._mapNode.TMPDesc, mapQuestCfgData.Title)
self._mapNode.imgComplete:SetActive(mapQuestData.nStatus >= 1)
self._mapNode.imgInComplete:SetActive(mapQuestData.nStatus == 0)
self._mapNode.maskComplete:SetActive(mapQuestData.nStatus == 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, false, nil, nil, true)
else
self._mapNode.btnItem[i].gameObject:SetActive(false)
end
end
self._mapNode.goCurTag:SetActive(self.cfgData.GroupId == nGroupId)
end
function VampireLevelSelect_questGridCtrl: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
return VampireLevelSelect_questGridCtrl
@@ -0,0 +1,44 @@
local VampireLevelSelect_talent_iconGridCtrl = class("VampireLevelSelect_talent_iconGridCtrl", BaseCtrl)
VampireLevelSelect_talent_iconGridCtrl._mapNodeConfig = {
Node = {
sNodeName = "imgTalentBg_",
nCount = 3
},
anim = {
sNodeName = "imgTalentBg_1",
sComponentName = "Animator"
},
Icon = {
sComponentName = "Image",
sNodeName = "imgCurTalentIcon_",
nCount = 3
},
imgSelect = {}
}
VampireLevelSelect_talent_iconGridCtrl._mapEventConfig = {}
VampireLevelSelect_talent_iconGridCtrl._mapRedDotConfig = {}
function VampireLevelSelect_talent_iconGridCtrl:SetTalent(nId)
self.nTalentId = nId
local mapTalent = ConfigTable.GetData("VampireTalent", nId)
if mapTalent ~= nil then
self:SetPngSprite(self._mapNode.Icon[1], mapTalent.Icon)
self:SetPngSprite(self._mapNode.Icon[2], mapTalent.Icon)
self:SetPngSprite(self._mapNode.Icon[3], mapTalent.Icon)
end
end
function VampireLevelSelect_talent_iconGridCtrl:SetState(nState)
self._mapNode.Node[1]:SetActive(nState == 1)
self._mapNode.Node[2]:SetActive(nState == 2)
self._mapNode.Node[3]:SetActive(nState == 3)
end
function VampireLevelSelect_talent_iconGridCtrl:SetSelect(bSelect)
self._mapNode.imgSelect:SetActive(bSelect)
end
function VampireLevelSelect_talent_iconGridCtrl:PlayActiveAnim()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.anim:Play("VampireTalentBg_in")
end
cs_coroutine.start(wait)
end
return VampireLevelSelect_talent_iconGridCtrl
@@ -0,0 +1,258 @@
local VampireLevelSelect_talentCtrl = class("VampireLevelSelect_talentCtrl", BaseCtrl)
VampireLevelSelect_talentCtrl._mapNodeConfig = {
TMPTalentTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Vampire_Talent_Point"
},
TMPEmptyTitle = {
sComponentName = "TMP_Text",
sLanguageId = "VampireTalent_EmptyAttr"
},
TMPTalentPointHint = {sComponentName = "TMP_Text"},
imgTitleTalentBg = {},
TMPAttrTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Vampire_Talent_Attr"
},
txtBtnResetTalent = {
sComponentName = "TMP_Text",
sLanguageId = "Vampire_Talent_Reset"
},
rtTalentIcon = {
sCtrlName = "Game.UI.VampireLevelSelect.VampireLevelSelect_talent_iconGridCtrl"
},
lsvTalentNodes = {
sCtrlName = "Game.UI.VampireLevelSelect.VampireLevelSelect_talentListCtrl"
},
svAttrList = {sComponentName = "ScrollRect"},
TMPTitle1 = {
sComponentName = "TMP_Text",
sLanguageId = "VampireTalent_State1"
},
TMPTitle2 = {sComponentName = "TMP_Text"},
TMPTitle3 = {sComponentName = "TMP_Text"},
TMPTitle4 = {
sComponentName = "TMP_Text",
sLanguageId = "VampireTalent_State4"
},
TMPTitle5 = {
sComponentName = "TMP_Text",
sLanguageId = "VampireTalent_State5"
},
rtLock = {},
rtActive = {},
rtActived = {},
TMPTalentName = {sComponentName = "TMP_Text"},
TMPFateCardInfo = {sComponentName = "TMP_Text"},
TMPTalentPoint = {sComponentName = "TMP_Text"},
btnActiveTalent = {
sComponentName = "UIButton",
callback = "OnBtnClick_ActiveTalent"
},
btnResetTalent = {
sComponentName = "UIButton",
callback = "OnBtnClick_ResetTalent"
},
gridText = {},
ContentAttr = {sComponentName = "Transform"},
btnTalentTips = {
sComponentName = "UIButton",
callback = "OnBtnClick_TalentTips"
},
rtTalentPointHint = {
sCtrlName = "Game.UI.VampireLevelSelect.VampireLevelSelect_TalentPointHintCtrl"
}
}
VampireLevelSelect_talentCtrl._mapEventConfig = {
VampireTalent_ClickNode = "OnEvent_ClickNode"
}
VampireLevelSelect_talentCtrl._mapRedDotConfig = {}
function VampireLevelSelect_talentCtrl:Awake()
end
function VampireLevelSelect_talentCtrl:FadeIn()
end
function VampireLevelSelect_talentCtrl:FadeOut()
end
function VampireLevelSelect_talentCtrl:OnEnable()
self._mapNode.rtTalentPointHint.gameObject:SetActive(false)
self._mapNode.lsvTalentNodes:InitList()
local nFateCardPoint = ConfigTable.GetConfigNumber("FateCardBookToVampireTalentPoint")
if nFateCardPoint == nil then
nFateCardPoint = 1
end
if PlayerData.VampireSurvivor:GetIsTalentPointMax() then
NovaAPI.SetTMPText(self._mapNode.TMPTalentPointHint, ConfigTable.GetUIText("VampireTalent_FateCardTrans_TalentPointMaxCount"))
else
NovaAPI.SetTMPText(self._mapNode.TMPTalentPointHint, orderedFormat(ConfigTable.GetUIText("VampireTalent_FateCardHint") or "", nFateCardPoint))
end
end
function VampireLevelSelect_talentCtrl:OnDisable()
end
function VampireLevelSelect_talentCtrl:OnDestroy()
end
function VampireLevelSelect_talentCtrl:OnRelease()
end
function VampireLevelSelect_talentCtrl:Refresh(nTalentId)
local nCur = PlayerData.VampireSurvivor:GetCurTalentPoint()
NovaAPI.SetTMPText(self._mapNode.TMPTalentPoint, tostring(nCur))
local tbActivedTalent = PlayerData.VampireSurvivor:GetActivedTalent()
local tbAttr, nAnimIdx = self:SubTalentDesc(tbActivedTalent, nTalentId)
delChildren(self._mapNode.ContentAttr)
self._mapNode.TMPEmptyTitle.gameObject:SetActive(#tbAttr == 0)
self._mapNode.btnResetTalent.gameObject:SetActive(0 < #tbAttr)
self._mapNode.imgTitleTalentBg:SetActive(0 < #tbAttr)
for nIdx, tbString in ipairs(tbAttr) do
local go = instantiate(self._mapNode.gridText, self._mapNode.ContentAttr)
go:SetActive(true)
local goTMP = go.transform:Find("TMPText"):GetComponent("TMP_Text")
if nIdx == nAnimIdx then
local fx = go.transform:Find("FX")
fx.gameObject:SetActive(true)
end
NovaAPI.SetTMPText(goTMP, tbString[2])
end
if nAnimIdx ~= nil then
if nAnimIdx > #tbAttr * 0.5 then
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.svAttrList, 0)
else
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.svAttrList, 1)
end
end
end
function VampireLevelSelect_talentCtrl:SubTalentDesc(tbAllActivedTalent, nAnimTalentId)
local ret = {}
local mapDic = {}
local nAnimTag = 0
for _, nTalentId in ipairs(tbAllActivedTalent) do
local mapData = ConfigTable.GetData("VampireTalent", nTalentId)
if mapData ~= nil then
local nTagId = mapData.DescTag
if nTalentId == nAnimTalentId then
nAnimTag = nTagId
end
if mapDic[nTagId] == nil then
mapDic[nTagId] = 0
end
if 0 <= mapData.Param then
mapDic[nTagId] = mapDic[nTagId] + mapData.Param
elseif mapDic[nTagId] > mapData.Param then
mapDic[nTagId] = mapData.Param
end
end
end
local retIdx = 0
for nTagId, nParam in pairs(mapDic) do
if 0 <= nParam then
local mapDesc = ConfigTable.GetData("VampireTalentDesc", nTagId)
local nStr = string.format(mapDesc.Num, nParam)
table.insert(ret, {nTagId, nStr})
else
local mapDesc = ConfigTable.GetData("VampireTalentDesc", nTagId * 100 - nParam)
table.insert(ret, {
nTagId,
mapDesc.Num
})
end
end
local srot = function(tbDataA, tbDataB)
return tbDataA[1] < tbDataB[1]
end
table.sort(ret, srot)
for idx, tbData in ipairs(ret) do
if nAnimTag == tbData[1] then
retIdx = idx
end
end
return ret, retIdx
end
function VampireLevelSelect_talentCtrl:SubSingleDesc(nTalentId)
local mapData = ConfigTable.GetData("VampireTalent", nTalentId)
if mapData ~= nil then
if mapData.Param >= 0 then
local nTagId = mapData.DescTag
local mapDesc = ConfigTable.GetData("VampireTalentDesc", nTagId)
if mapDesc ~= nil then
local Str = string.format(mapDesc.Num, mapData.Param)
return Str
end
else
local nTagId = mapData.DescTag
local mapDesc = ConfigTable.GetData("VampireTalentDesc", nTagId * 100 - mapData.Param)
if mapDesc ~= nil then
local Str = mapDesc.Num
return Str
end
end
end
return ""
end
function VampireLevelSelect_talentCtrl:OpenHint(nCard, nExp)
self._mapNode.rtTalentPointHint:OpenHint(nCard, nExp)
end
function VampireLevelSelect_talentCtrl:OnEvent_ClickNode(nTalentId)
self.nCurTalent = nTalentId
local mapTalentData = ConfigTable.GetData("VampireTalent", nTalentId)
local nState = PlayerData.VampireSurvivor:IsActiveTalent(nTalentId)
self._mapNode.rtTalentIcon:SetTalent(nTalentId)
self._mapNode.rtTalentIcon:SetState(nState)
NovaAPI.SetTMPText(self._mapNode.TMPTalentName, mapTalentData.Name)
NovaAPI.SetTMPText(self._mapNode.TMPFateCardInfo, self:SubSingleDesc(nTalentId))
if nState == 3 then
NovaAPI.SetTMPText(self._mapNode.TMPTitle2, ConfigTable.GetUIText("VampireTalent_State6"))
self._mapNode.rtLock:SetActive(true)
self._mapNode.rtActive:SetActive(false)
self._mapNode.rtActived:SetActive(false)
elseif nState == 2 then
local nCost = mapTalentData.Point
local nCur = PlayerData.VampireSurvivor:GetCurTalentPoint()
if nCost <= nCur then
self._mapNode.rtLock:SetActive(false)
self._mapNode.rtActive:SetActive(true)
self._mapNode.rtActived:SetActive(false)
local str = orderedFormat(ConfigTable.GetUIText("VampireTalent_State3"), nCost)
NovaAPI.SetTMPText(self._mapNode.TMPTitle3, str)
else
self._mapNode.rtLock:SetActive(true)
self._mapNode.rtActive:SetActive(false)
self._mapNode.rtActived:SetActive(false)
local str = orderedFormat(ConfigTable.GetUIText("VampireTalent_State2"), nCur, nCost)
NovaAPI.SetTMPText(self._mapNode.TMPTitle2, str)
end
else
self._mapNode.rtLock:SetActive(false)
self._mapNode.rtActive:SetActive(false)
self._mapNode.rtActived:SetActive(true)
end
end
function VampireLevelSelect_talentCtrl:OnBtnClick_ActiveTalent()
if self.nCurTalent ~= nil then
local callback = function(nTalentId)
self:Refresh(nTalentId)
self._mapNode.lsvTalentNodes:RefreshList(nTalentId)
self:OnEvent_ClickNode(self.nCurTalent)
local WwiseManger = CS.WwiseAudioManager.Instance
WwiseManger:PostEvent("ui_vampire_talent_refresh")
end
PlayerData.VampireSurvivor:ActiveTalent(self.nCurTalent, callback)
end
end
function VampireLevelSelect_talentCtrl:OnBtnClick_ResetTalent()
local callback = function()
self:Refresh()
self._mapNode.lsvTalentNodes:RefreshList(0)
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Vampire_Talent_Reset_Tips"))
self:OnEvent_ClickNode(1)
end
local msg = {
nType = AllEnum.MessageBox.Confirm,
sContent = ConfigTable.GetUIText("VampireTalent_ResetConfirm"),
callbackConfirm = function()
PlayerData.VampireSurvivor:ResetTalent(callback)
end
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
function VampireLevelSelect_talentCtrl:OnBtnClick_TalentTips()
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Vampire_Talent_Tips"))
end
return VampireLevelSelect_talentCtrl
@@ -0,0 +1,75 @@
local VampireLevelSelect_talentList_listFloorCtrl = class("VampireLevelSelect_talentList_listFloorCtrl", BaseCtrl)
VampireLevelSelect_talentList_listFloorCtrl._mapNodeConfig = {
talentNode = {
sCtrlName = "Game.UI.VampireLevelSelect.VampireLevelSelect_talent_iconGridCtrl",
nCount = 3
},
activeLine1_ = {nCount = 3},
talentNodeBtn = {
nCount = 3,
sNodeName = "talentNode",
sComponentName = "UIButton",
callback = "OnBtnClick_Node"
},
active = {},
inactive = {}
}
VampireLevelSelect_talentList_listFloorCtrl._mapEventConfig = {
VampireTalent_ClickNode = "OnEvent_ClickNode"
}
VampireLevelSelect_talentList_listFloorCtrl._mapRedDotConfig = {}
function VampireLevelSelect_talentList_listFloorCtrl:OnEnable()
self.gameObject:SetActive(true)
end
function VampireLevelSelect_talentList_listFloorCtrl:Refresh(tbNodeId, tbPrevId, nSelctId, nAnimId)
local bPrevActive = self:CheckPrevActive(tbPrevId)
self._mapNode.active:SetActive(bPrevActive)
self._mapNode.inactive:SetActive(true)
self.tbNodeId = tbNodeId
local nMinUnlock = 0
for i = 1, 3 do
if tbNodeId[i] ~= nil then
local nState = PlayerData.VampireSurvivor:IsActiveTalent(tbNodeId[i])
if nState == 2 and (nMinUnlock == 0 or nMinUnlock > tbNodeId[i]) then
nMinUnlock = tbNodeId[i]
end
self._mapNode.talentNode[i].gameObject:SetActive(true)
self._mapNode.talentNode[i]:SetTalent(tbNodeId[i])
self._mapNode.talentNode[i]:SetState(nState)
self._mapNode.talentNode[i]:SetSelect(tbNodeId[i] == nSelctId)
if tbNodeId[i] == nAnimId then
self._mapNode.talentNode[i]:PlayActiveAnim()
end
else
self._mapNode.talentNode[i].gameObject:SetActive(false)
end
end
return nMinUnlock
end
function VampireLevelSelect_talentList_listFloorCtrl:CheckPrevActive(tbPrevId)
local ret = false
for i, nNodeId in ipairs(tbPrevId) do
local nState = PlayerData.VampireSurvivor:IsActiveTalent(nNodeId)
if nState == 1 then
self._mapNode.activeLine1_[i].gameObject:SetActive(true)
ret = true
else
self._mapNode.activeLine1_[i].gameObject:SetActive(false)
end
end
return ret
end
function VampireLevelSelect_talentList_listFloorCtrl:OnBtnClick_Node(btn, nIdx)
local nNodeId = self.tbNodeId[nIdx]
if nNodeId ~= nil then
EventManager.Hit("VampireTalent_ClickNode", nNodeId)
end
end
function VampireLevelSelect_talentList_listFloorCtrl:OnEvent_ClickNode(nId)
for i = 1, 3 do
if self.tbNodeId[i] ~= nil then
self._mapNode.talentNode[i]:SetSelect(self.tbNodeId[i] == nId)
end
end
end
return VampireLevelSelect_talentList_listFloorCtrl
@@ -0,0 +1,136 @@
local VampireLevelSelect_talentListCtrl = class("VampireLevelSelect_talentListCtrl", BaseCtrl)
VampireLevelSelect_talentListCtrl._mapNodeConfig = {
Content = {sComponentName = "Transform"},
goTop = {},
go1to3 = {},
go3to3 = {},
go3to1 = {},
go1to1 = {},
go1to2 = {},
go2to2 = {},
go2to1 = {}
}
VampireLevelSelect_talentListCtrl._mapEventConfig = {}
VampireLevelSelect_talentListCtrl._mapRedDotConfig = {}
function VampireLevelSelect_talentListCtrl:Awake()
self.mapGoDic = {
[0] = {
[1] = self._mapNode.goTop
},
[1] = {
[1] = self._mapNode.go1to1,
[2] = self._mapNode.go1to2,
[3] = self._mapNode.go1to3
},
[2] = {
[1] = self._mapNode.go2to1,
[2] = self._mapNode.go2to2
},
[3] = {
[1] = self._mapNode.go3to1,
[3] = self._mapNode.go3to3
}
}
self.mapHeightDic = {
[0] = {
[1] = 195.05
},
[1] = {
[1] = 276.14,
[2] = 284.1,
[3] = 284.1
},
[2] = {
[1] = 308.6,
[2] = 211.89
},
[3] = {
[1] = 308.6,
[3] = 211.89
}
}
self._mapFloorCtrl = {}
self.tbFloor = {}
local ForEachTalentFloor = function(mapData)
table.insert(self.tbFloor, mapData)
end
ForEachTableLine(DataTable.VampireTalentFloor, ForEachTalentFloor)
function SortFloor(mapDataA, mapDataB)
return mapDataA.Id > mapDataB.Id
end
self.topId = self.tbFloor[1].TalentId[1]
end
function VampireLevelSelect_talentListCtrl:FadeIn()
end
function VampireLevelSelect_talentListCtrl:FadeOut()
end
function VampireLevelSelect_talentListCtrl:OnEnable()
self.lsv = self.gameObject:GetComponent("ScrollRect")
end
function VampireLevelSelect_talentListCtrl:OnDisable()
self:ClearAllFloor()
end
function VampireLevelSelect_talentListCtrl:OnDestroy()
end
function VampireLevelSelect_talentListCtrl:OnRelease()
end
function VampireLevelSelect_talentListCtrl:InitList()
self:ClearAllFloor()
local nCurId = 0
local totalHeight = 0
local targetHeight = 0
for nFloor, mapFloorData in ipairs(self.tbFloor) do
local nPrevCount = 0
local tbPrevId = {}
if self.tbFloor[nFloor - 1] ~= nil then
nPrevCount = self.tbFloor[nFloor - 1].Num
tbPrevId = self.tbFloor[nFloor - 1].TalentId
end
local nCurCount = mapFloorData.Num
if self.mapGoDic[nPrevCount] == nil or self.mapGoDic[nPrevCount][nCurCount] == nil then
printError("层数错误 无对应预制体:" .. nFloor)
return
end
local go = instantiate(self.mapGoDic[nPrevCount][nCurCount], self._mapNode.Content)
totalHeight = totalHeight + self.mapHeightDic[nPrevCount][nCurCount]
local mapCtrl = self:BindCtrlByNode(go, "Game.UI.VampireLevelSelect.VampireLevelSelect_talentList_listFloorCtrl")
table.insert(self._mapFloorCtrl, mapCtrl)
local floorMin = mapCtrl:Refresh(mapFloorData.TalentId, tbPrevId, self.topId)
if 0 < floorMin and (nCurId == 0 or nCurId > floorMin) then
nCurId = floorMin
targetHeight = totalHeight
end
end
local nViewPortHeight = Settings.CURRENT_CANVAS_FULL_RECT_HEIGHT - 210
if nViewPortHeight > totalHeight - targetHeight then
self._mapNode.Content.anchoredPosition = Vector2(0, totalHeight - nViewPortHeight)
elseif targetHeight < nViewPortHeight / 2 then
self._mapNode.Content.anchoredPosition = Vector2(0, 0)
else
self._mapNode.Content.anchoredPosition = Vector2(0, targetHeight - nViewPortHeight * 0.5)
end
EventManager.Hit("VampireTalent_ClickNode", nCurId == 0 and self.topId or nCurId)
end
function VampireLevelSelect_talentListCtrl:RefreshList(nAminId)
for nFloor, mapFloorData in ipairs(self.tbFloor) do
local tbPrevId = {}
if self.tbFloor[nFloor - 1] ~= nil then
tbPrevId = self.tbFloor[nFloor - 1].TalentId
end
local mapCtrl = self._mapFloorCtrl[nFloor]
if mapCtrl ~= nil then
mapCtrl:Refresh(mapFloorData.TalentId, tbPrevId, nAminId == 0 and self.topId or nAminId, nAminId)
end
end
if nAminId == 0 then
NovaAPI.SetVerticalNormalizedPosition(self.lsv, 1)
end
end
function VampireLevelSelect_talentListCtrl:ClearAllFloor()
for index, mapCtrl in ipairs(self._mapFloorCtrl) do
self:UnbindCtrlByNode(mapCtrl)
end
self._mapFloorCtrl = {}
delChildren(self._mapNode.Content)
end
return VampireLevelSelect_talentListCtrl
@@ -0,0 +1,61 @@
local VampireLevelSelect_TalentPointHintCtrl = class("VampireLevelSelect_TalentPointHintCtrl", BaseCtrl)
VampireLevelSelect_TalentPointHintCtrl._mapNodeConfig = {
rtProperty = {sComponentName = "Animator"},
TMPFateCardCount = {sComponentName = "TMP_Text"},
TMPTalentPointCount = {sComponentName = "TMP_Text"},
TMPFateCardHintTitle1 = {
sComponentName = "TMP_Text",
sLanguageId = "VampireTalent_FateCardTrans_NewCardTitle"
},
TMPFateCardHintTitle2 = {
sComponentName = "TMP_Text",
sLanguageId = "VampireTalent_FateCardTrans_TalentTitle"
},
TMPPointMaxHint = {
sComponentName = "TMP_Text",
sLanguageId = "VampireTalent_FateCardTrans_TalentPointMaxCount"
},
btnHIntClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
SuccessBar = {
sNodeName = "imgBg",
sCtrlName = "Game.UI.SuccessBarEx.SuccessBarCtrl"
}
}
VampireLevelSelect_TalentPointHintCtrl._mapEventConfig = {}
VampireLevelSelect_TalentPointHintCtrl._mapRedDotConfig = {}
function VampireLevelSelect_TalentPointHintCtrl:Awake()
end
function VampireLevelSelect_TalentPointHintCtrl:FadeIn()
end
function VampireLevelSelect_TalentPointHintCtrl:FadeOut()
end
function VampireLevelSelect_TalentPointHintCtrl:OnEnable()
end
function VampireLevelSelect_TalentPointHintCtrl:OnDisable()
end
function VampireLevelSelect_TalentPointHintCtrl:OnDestroy()
end
function VampireLevelSelect_TalentPointHintCtrl:OnRelease()
end
function VampireLevelSelect_TalentPointHintCtrl:OpenHint(nFateCardCount, nPoint)
local nFateCardPoint = ConfigTable.GetConfigNumber("FateCardBookToVampireTalentPoint")
if nFateCardPoint == nil then
nFateCardPoint = 1
end
local nTotalPoint = nFateCardCount * nFateCardPoint
self._mapNode.TMPPointMaxHint.gameObject:SetActive(nPoint < nTotalPoint)
local nFateCardCount = math.floor(nPoint / nFateCardPoint)
NovaAPI.SetTMPText(self._mapNode.TMPFateCardCount, nFateCardCount)
NovaAPI.SetTMPText(self._mapNode.TMPTalentPointCount, nPoint)
self.gameObject:SetActive(true)
self._mapNode.SuccessBar:PlayAni(AllEnum.SuccessBar.Purple, {
self._mapNode.rtProperty
})
end
function VampireLevelSelect_TalentPointHintCtrl:OnBtnClick_Close()
self.gameObject:SetActive(false)
end
return VampireLevelSelect_TalentPointHintCtrl
@@ -0,0 +1,405 @@
local VampireLevelSelectCtrl = class("VampireLevelSelectCtrl", BaseCtrl)
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local PlayerBoardData = PlayerData.Board
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 WwiseAudioMgr = CS.WwiseAudioManager.Instance
local BubbleVoiceManager = require("Game.Actor2D.BubbleVoiceManager")
VampireLevelSelectCtrl._mapNodeConfig = {
imgBgTalent = {},
imgBgLevelInfo = {},
TMPScoreTitleQuest = {
sComponentName = "TMP_Text",
sLanguageId = "Vampire_Season_Score"
},
TMPScore = {sComponentName = "TMP_Text"},
TMPRemainTimeQuest = {sComponentName = "TMP_Text"},
rtLevelSelect = {
sCtrlName = "Game.UI.VampireLevelSelect.VampireLevelSelect_levelSelectCtrl"
},
rtLevelInfo = {
sCtrlName = "Game.UI.VampireLevelSelect.VampireLevelSelect_levelInfo"
},
rtTalent = {
sCtrlName = "Game.UI.VampireLevelSelect.VampireLevelSelect_talentCtrl"
},
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
btnTalent = {
sComponentName = "UIButton",
callback = "OnBtnClick_Talent"
},
btnQuest = {
sComponentName = "UIButton",
callback = "OnBtnClick_Quest"
},
btnShop = {
sComponentName = "UIButton",
callback = "OnBtnClick_Shop"
},
btnNote = {
sComponentName = "UIButton",
callback = "OnBtnClick_Note"
},
btnNpc = {
sComponentName = "UIButton",
callback = "OnBtnClick_Npc"
},
btnPassQuest = {
sComponentName = "UIButton",
callback = "OnBtnClick_PassQuest"
},
VampireQuestPanel = {
sCtrlName = "Game.UI.VampireLevelSelect.VampireLevelSelect_questCtrl"
},
goEnemyInfo = {
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
},
imgDisasterEffect = {},
goBubbleRoot = {
sNodeName = "----fixed_bubble----"
},
TMPBtnNote = {
sComponentName = "TMP_Text",
sLanguageId = "Vampire_Talent"
},
TMPBtnShop = {
sComponentName = "TMP_Text",
sLanguageId = "Vampire_Shop"
},
TMPBtnCodex = {
sComponentName = "TMP_Text",
sLanguageId = "Vampire_Book"
},
TMPBtnQuest = {sComponentName = "TMP_Text"},
goImgBgLevelSelect = {
sNodeName = "imgBgLevelSelect"
},
imgBgLevelSelect = {
sNodeName = "----Actor2D----",
sComponentName = "RawImage"
},
trActor2D_PNG = {
sNodeName = "----Actor2D_PNG----",
sComponentName = "Transform"
},
goRedDotQuest = {},
goRedDotTalent = {}
}
VampireLevelSelectCtrl._mapEventConfig = {
VampireLevelSelect_ClickLevelGrid = "OnEvent_ClickLevelGrid",
VampireSurvivorChangeBuild = "OnEvent_VampireSurvivorChangeBuild",
EnterVampireSurvivor = "OnEvent_EnterVampireSurvivor",
VampireQuestTitle = "SetQuestTitle",
VampireToggleChange = "OnEvent_VampireToggleChange",
VampireSeasonRefresh = "OnEvent_VampireSeasonRefresh",
[EventId.UIHomeConfirm] = "OnEvent_Home",
[EventId.UIBackConfirm] = "OnEvent_Back",
[EventId.ShowBubbleVoiceText] = "OnEvent_ShowBubbleVoiceText"
}
VampireLevelSelectCtrl._mapRedDotConfig = {
[RedDotDefine.VampireQuest] = {
sNodeName = "goRedDotQuest"
},
[RedDotDefine.VampireTalent] = {
sNodeName = "goRedDotTalent"
}
}
function VampireLevelSelectCtrl:OnEnable()
EventManager.Hit(EventId.SetTransition)
self.animator = self.gameObject:GetComponent("Animator")
local bUseL2D = LocalSettingData.mapData.UseLive2D
self._mapNode.imgBgLevelSelect.transform.localScale = bUseL2D == true and Vector3.one or Vector3.zero
self._mapNode.trActor2D_PNG.localScale = bUseL2D == true and Vector3.zero or Vector3.one
if bUseL2D == true then
Actor2DManager.SetBoardNPC2D(self:GetPanelId(), self._mapNode.imgBgLevelSelect, 910202)
else
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.trActor2D_PNG, self:GetPanelId(), 910202)
end
local nScore = PlayerData.VampireSurvivor:GetCurScore()
NovaAPI.SetTMPText(self._mapNode.TMPScore, nScore)
NovaAPI.SetTMPText(self._mapNode.TMPRemainTimeQuest, ConfigTable.GetUIText("Vampire_Season_ScoreTime") .. PlayerData.VampireSurvivor:GetRefreshTiem())
self.bRefreshLevelSelect = false
if self._panel.nLevelId ~= nil and self._panel.nLevelId > 0 then
local mapData = ConfigTable.GetData("VampireSurvivor", self._panel.nLevelId)
self._mapNode.rtTalent.gameObject:SetActive(false)
if mapData ~= nil then
self:OnEvent_ClickLevelGrid(mapData, true)
end
elseif self._panel.bTalent then
self:OnBtnClick_Talent()
self._mapNode.rtLevelInfo.gameObject:SetActive(false)
else
self._mapNode.imgBgTalent:SetActive(false)
self._mapNode.rtLevelInfo.gameObject:SetActive(false)
self._mapNode.rtTalent.gameObject:SetActive(false)
self._mapNode.rtLevelSelect.gameObject:SetActive(true)
self._mapNode.goBubbleRoot:SetActive(true)
self._mapNode.rtLevelSelect:Refresh()
self.bRefreshLevelSelect = true
self.animator:Play("VampireLevelSelectPanel_in")
self:NpcVoice()
end
self._mapNode.rtTalent:Refresh()
local nQuestCur, nQuestTotal = PlayerData.VampireSurvivor:GetSeasonQuestCount()
NovaAPI.SetTMPText(self._mapNode.TMPBtnQuest, orderedFormat(ConfigTable.GetUIText("Vampire_Quest_Btn_Title") or "", nQuestCur, nQuestTotal))
local imgBg1 = self.gameObject.transform:Find("imgBgLevelInfo"):GetComponent("Image")
local imgBg2 = self.gameObject.transform:Find("imgBgLevelInfo1"):GetComponent("Image")
local imgBg3 = self.gameObject.transform:Find("imgDisasterEffect/imgBgLevelInfo"):GetComponent("Image")
local imgBg4 = self.gameObject.transform:Find("imgDisasterEffect/imgBgLevelInfo1"):GetComponent("Image")
local imgBg5 = self.gameObject.transform:Find("imgBgTalent"):GetComponent("Image")
self:SetPngSprite(imgBg1, "Image/UIBG/bg_survivor_entrance")
self:SetPngSprite(imgBg2, "Image/UIBG/bg_survivor_entrance_01")
self:SetPngSprite(imgBg3, "Image/UIBG/bg_survivor_entrance_02")
self:SetPngSprite(imgBg4, "Image/UIBG/bg_survivor_entrance_03")
self:SetPngSprite(imgBg5, "Image/UIBG/bg_survivor_talentbg")
end
function VampireLevelSelectCtrl:OnDisable()
Actor2DManager.UnsetBoardNPC2D()
PlayerData.Voice:StopCharVoice()
PlayerData.Voice:ClearTimer()
BubbleVoiceManager.StopBubbleAnim()
end
function VampireLevelSelectCtrl:SetQuestTitle(nHard)
local nQuestCur, nQuestTotal = PlayerData.VampireSurvivor:GetSeasonQuestCount(nHard)
NovaAPI.SetTMPText(self._mapNode.TMPBtnQuest, orderedFormat(ConfigTable.GetUIText("Vampire_Quest_Btn_Title") or "", nQuestCur, nQuestTotal))
end
function VampireLevelSelectCtrl:OnEvent_ClickLevelGrid(mapData, bNoAnim)
local nId = mapData.Id
local cachedBuild = PlayerData.VampireSurvivor:GetCachedBuildId(nId)
local mapBuild1, mapBuild2
local GetBuildCallback = function(tbBuild, mapBuild)
local bDeleteBuild = false
if cachedBuild[1] ~= nil and cachedBuild[1] ~= 0 then
mapBuild1 = mapBuild[cachedBuild[1]]
bDeleteBuild = mapBuild1 == nil
if mapBuild1 == nil then
cachedBuild[1] = 0
end
end
if cachedBuild[2] ~= nil and cachedBuild[2] ~= 0 then
mapBuild2 = mapBuild[cachedBuild[2]]
bDeleteBuild = bDeleteBuild or mapBuild2 == nil
if mapBuild2 == nil then
cachedBuild[2] = 0
end
end
if bDeleteBuild then
local sTip = ConfigTable.GetUIText("RegionBoss_Team_Delete")
EventManager.Hit(EventId.OpenMessageBox, sTip)
end
self._mapNode.rtLevelInfo.gameObject:SetActive(true)
self._mapNode.rtLevelSelect.gameObject:SetActive(false)
self._mapNode.goBubbleRoot:SetActive(false)
BubbleVoiceManager.StopBubbleAnim()
self._panel.nLevelId = nId
self._mapNode.rtLevelInfo:Refresh(nId, mapBuild1, mapBuild2)
if bNoAnim then
self.animator:Play("VampireLevelSelectPanel_loop1")
else
self.animator:Play("VampireLevelSelectPanel_in1")
end
end
if cachedBuild == nil then
self._mapNode.rtLevelInfo.gameObject:SetActive(true)
self._mapNode.rtLevelSelect.gameObject:SetActive(false)
self._mapNode.goBubbleRoot:SetActive(false)
BubbleVoiceManager.StopBubbleAnim()
self._panel.nLevelId = nId
self._mapNode.rtLevelInfo:Refresh(nId, nil, nil)
if bNoAnim then
self.animator:Play("VampireLevelSelectPanel_loop1")
else
self.animator:Play("VampireLevelSelectPanel_in1")
end
else
PlayerData.Build:GetAllBuildBriefData(GetBuildCallback)
end
NovaAPI.SetTMPText(self._mapNode.TMPRemainTimeQuest, ConfigTable.GetUIText("Vampire_Season_ScoreTime") .. PlayerData.VampireSurvivor:GetRefreshTiem())
end
function VampireLevelSelectCtrl:OnEvent_EnterVampireSurvivor()
self._mapNode.goImgBgLevelSelect:SetActive(false)
self._mapNode.goBubbleRoot:SetActive(false)
BubbleVoiceManager.StopBubbleAnim()
end
function VampireLevelSelectCtrl:OnEvent_Back(nPanelId)
if self._panel.nLevelId ~= nil and self._panel.nLevelId > 0 or self._panel.bTalent then
local nCurLevel = self._panel.nLevelId
self._mapNode.imgBgTalent:SetActive(false)
self._mapNode.rtLevelInfo.gameObject:SetActive(false)
self._mapNode.rtTalent.gameObject:SetActive(false)
self._mapNode.rtLevelSelect.gameObject:SetActive(true)
self._mapNode.goBubbleRoot:SetActive(true)
self._panel.nLevelId = 0
self._panel.bTalent = false
self.animator:Play("VampireLevelSelectPanel_in")
self._mapNode.goImgBgLevelSelect:SetActive(true)
local sKey = table.keyof(PanelId, self._panel._nPanelId)
local mapTopBar = ConfigTable.GetData("TopBar", sKey, true)
local sTitle = mapTopBar == nil and "" or mapTopBar.Title
if type(sTitle) == "string" and sTitle ~= "" then
self._mapNode.TopBar:SetTitleTxt(sTitle)
end
if not self.bRefreshLevelSelect then
self._mapNode.rtLevelSelect:RefreshWithPosSet(nCurLevel)
self.bRefreshLevelSelect = true
end
EventManager.Hit(EventId.SetCoinVisible, true)
NovaAPI.SetTMPText(self._mapNode.TMPRemainTimeQuest, ConfigTable.GetUIText("Vampire_Season_ScoreTime") .. PlayerData.VampireSurvivor:GetRefreshTiem())
if PlayerData.VampireSurvivor:CheckBattleSuccess() == true then
self:PlayNpcVoice("clear")
PlayerData.Voice:StartBoardFreeTimer(9102)
end
else
EventManager.Hit(EventId.CloesCurPanel)
end
end
function VampireLevelSelectCtrl:OnEvent_Home(nPanelId)
if self._panel._nPanelId ~= nPanelId then
return
end
PanelManager.Home()
end
function VampireLevelSelectCtrl:OnEvent_VampireSurvivorChangeBuild()
local nId = self._panel.nLevelId
local cachedBuild = PlayerData.VampireSurvivor:GetCachedBuildId(nId)
local mapBuild1, mapBuild2
local GetBuildCallback = function(tbBuild, mapBuild)
if cachedBuild[1] ~= 0 then
mapBuild1 = mapBuild[cachedBuild[1]]
end
if cachedBuild[2] ~= 0 then
mapBuild2 = mapBuild[cachedBuild[2]]
end
self._mapNode.rtLevelInfo.gameObject:SetActive(true)
self._mapNode.rtLevelSelect.gameObject:SetActive(false)
self._mapNode.goBubbleRoot:SetActive(false)
BubbleVoiceManager.StopBubbleAnim()
self._panel.nLevelId = nId
self._mapNode.rtLevelInfo:Refresh(nId, mapBuild1, mapBuild2)
end
if cachedBuild == nil then
self._mapNode.rtLevelInfo.gameObject:SetActive(true)
self._mapNode.rtLevelSelect.gameObject:SetActive(false)
self._mapNode.goBubbleRoot:SetActive(false)
BubbleVoiceManager.StopBubbleAnim()
self._panel.nLevelId = nId
self._mapNode.rtLevelInfo:Refresh(nId, nil, nil)
else
PlayerData.Build:GetAllBuildBriefData(GetBuildCallback)
end
end
function VampireLevelSelectCtrl:OnBtnClick_Talent()
self._panel.bTalent = true
self._mapNode.imgBgTalent:SetActive(true)
self._mapNode.rtLevelSelect.gameObject:SetActive(false)
self._mapNode.goBubbleRoot:SetActive(false)
BubbleVoiceManager.StopBubbleAnim()
self._mapNode.rtTalent.gameObject:SetActive(true)
self.animator:Play("VampireLevelSelectPanel_rtTalent")
local animTime = NovaAPI.GetAnimClipLength(self.animator, {
"VampireLevelSelectPanel_rtTalent"
})
self:AddTimer(1, animTime, function()
local bHint, nCard, nExp = PlayerData.VampireSurvivor:CheckOpenHint()
if bHint then
self._mapNode.rtTalent:OpenHint(nCard, nExp)
end
end, true, true, true)
NovaAPI.SetTMPText(self._mapNode.TMPRemainTimeQuest, ConfigTable.GetUIText("Vampire_Season_ScoreTime") .. PlayerData.VampireSurvivor:GetRefreshTiem())
self._mapNode.TopBar:SetTitleTxt(ConfigTable.GetUIText("Vampire_TalentPanel_Title"))
EventManager.Hit(EventId.SetCoinVisible, false)
end
function VampireLevelSelectCtrl:OnBtnClick_Quest()
NovaAPI.SetTMPText(self._mapNode.TMPRemainTimeQuest, ConfigTable.GetUIText("Vampire_Season_ScoreTime") .. PlayerData.VampireSurvivor:GetRefreshTiem())
self._mapNode.rtLevelInfo:SetRefreshTime()
self._mapNode.VampireQuestPanel:OpenPanel(self._mapNode.rtLevelSelect.curToggle)
end
function VampireLevelSelectCtrl:OnBtnClick_PassQuest()
NovaAPI.SetTMPText(self._mapNode.TMPRemainTimeQuest, ConfigTable.GetUIText("Vampire_Season_ScoreTime") .. PlayerData.VampireSurvivor:GetRefreshTiem())
self._mapNode.rtLevelInfo:SetRefreshTime()
self._mapNode.VampireQuestPanel:OpenPanel(2, self._panel.nLevelId)
end
function VampireLevelSelectCtrl:OnBtnClick_Note()
local callback = function()
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerBook, AllEnum.StarTowerBookPanelType.FateCard)
end
PlayerData.StarTowerBook:TryGetFateCardBook(callback)
end
function VampireLevelSelectCtrl:OnBtnClick_Shop()
EventManager.Hit(EventId.OpenPanel, PanelId.ShopPanel, 2)
end
function VampireLevelSelectCtrl:OnBtnClick_Npc()
if self.bBlockNpc == true then
return
end
PlayerData.Voice:PlayBoardNPCClickVoice(9102)
end
function VampireLevelSelectCtrl:OnEvent_VampireToggleChange(nIdx)
self._mapNode.imgDisasterEffect:SetActive(nIdx == 3)
end
function VampireLevelSelectCtrl:PlayNpcVoice(sType)
local sVoiceRes = PlayerData.Voice:PlayCharVoice(sType, 9102, nil, true)
end
function VampireLevelSelectCtrl:OnEvent_ShowBubbleVoiceText(nCharId, nId)
local mapVoDirectoryData = ConfigTable.GetData("VoDirectory", nId)
if mapVoDirectoryData == nil then
printError("VoDirectory未找到数据id:" .. nId)
return
end
if nil ~= mapVoDirectoryData then
BubbleVoiceManager.PlayFixedBubbleAnim(self._mapNode.goBubbleRoot, mapVoDirectoryData.voResource)
end
end
function VampireLevelSelectCtrl:OnEvent_VampireSeasonRefresh()
local nScore = PlayerData.VampireSurvivor:GetCurScore()
local nQuestCur, nQuestTotal = PlayerData.VampireSurvivor:GetSeasonQuestCount()
self._mapNode.rtLevelSelect:NewSeason()
if self._panel.nLevelId ~= nil and self._panel.nLevelId > 0 then
self._mapNode.imgBgTalent:SetActive(false)
self._mapNode.rtLevelInfo.gameObject:SetActive(false)
self._mapNode.rtTalent.gameObject:SetActive(false)
self._mapNode.rtLevelSelect.gameObject:SetActive(true)
self._mapNode.goBubbleRoot:SetActive(true)
self._panel.nLevelId = 0
self._panel.bTalent = false
self.animator:Play("VampireLevelSelectPanel_in")
self._mapNode.goImgBgLevelSelect:SetActive(true)
self._mapNode.goBubbleRoot:SetActive(true)
local sKey = table.keyof(PanelId, self._panel._nPanelId)
local mapTopBar = ConfigTable.GetData("TopBar", sKey, true)
local sTitle = mapTopBar == nil and "" or mapTopBar.Title
if type(sTitle) == "string" and sTitle ~= "" then
self._mapNode.TopBar:SetTitleTxt(sTitle)
end
EventManager.Hit(EventId.SetCoinVisible, true)
end
end
function VampireLevelSelectCtrl:BlockNpc(nTime)
self.bBlockNpc = true
local unBlockJump = function()
self.bBlockNpc = false
end
self:AddTimer(1, nTime, unBlockJump, true, true, nil, nil)
end
function VampireLevelSelectCtrl:NpcVoice()
local currentTimeTable = os.date("*t")
local nHour = currentTimeTable.hour
local sType = "greet_npc"
PlayerData.VampireSurvivor:CheckBattleSuccess()
if 6 < nHour and nHour <= 12 then
sType = "greetmorn_npc"
elseif 12 < nHour and nHour <= 18 then
sType = "greetnoon_npc"
elseif 18 < nHour or nHour <= 6 then
sType = "greetnight_npc"
end
self:PlayNpcVoice(sType)
PlayerData.Voice:StartBoardFreeTimer(9102)
end
return VampireLevelSelectCtrl
@@ -0,0 +1,20 @@
local VampireLevelSelectPanel = class("VampireLevelSelectPanel", BasePanel)
VampireLevelSelectPanel._tbDefine = {
{
sPrefabPath = "VampireLevelSelect/VampireLevelSelectPanel.prefab",
sCtrlName = "Game.UI.VampireLevelSelect.VampireLevelSelectCtrl"
}
}
function VampireLevelSelectPanel:Awake()
end
function VampireLevelSelectPanel:OnEnable()
end
function VampireLevelSelectPanel:OnAfterEnter()
end
function VampireLevelSelectPanel:OnDisable()
end
function VampireLevelSelectPanel:OnDestroy()
end
function VampireLevelSelectPanel:OnRelease()
end
return VampireLevelSelectPanel
@@ -0,0 +1,20 @@
local VampireLevelSelectPanel = class("VampireLevelSelectPanel", BasePanel)
VampireLevelSelectPanel._tbDefine = {
{
sPrefabPath = "VampireLevelSelect/VampireLevelSelectPanel.prefab",
sCtrlName = "Game.UI.VampireLevelSelect.VampireLevelSelectCtrl"
}
}
function VampireLevelSelectPanel:Awake()
end
function VampireLevelSelectPanel:OnEnable()
end
function VampireLevelSelectPanel:OnAfterEnter()
end
function VampireLevelSelectPanel:OnDisable()
end
function VampireLevelSelectPanel:OnDestroy()
end
function VampireLevelSelectPanel:OnRelease()
end
return VampireLevelSelectPanel