Initial version - 1.2.0.60
EN: 1.2.0.60 CN: 1.2.0.61 JP: 1.2.0.63 KR: 1.2.0.67
This commit is contained in:
@@ -0,0 +1,272 @@
|
||||
local TrialFormationCtrl = class("TrialFormationCtrl", BaseCtrl)
|
||||
local Animator = CS.UnityEngine.Animator
|
||||
local CustomModelMaterialVariantComponent = CS.CustomModelMaterialVariantComponent
|
||||
local GameCameraStackManager = CS.GameCameraStackManager
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ResType = GameResourceLoader.ResType
|
||||
local typeof = typeof
|
||||
TrialFormationCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goChar = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.FormationEx.FormationCharCtrl"
|
||||
},
|
||||
Mask = {},
|
||||
btnStartBattle = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Start"
|
||||
},
|
||||
txtStartBattle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_Btn_StartBattle"
|
||||
},
|
||||
UIParallax3DStage = {
|
||||
sComponentName = "UIParallaxStageCameraController"
|
||||
},
|
||||
BGbackup = {
|
||||
sNodeName = "----BGbackup----"
|
||||
},
|
||||
btnInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Info"
|
||||
},
|
||||
charCanvasGroup = {
|
||||
sNodeName = "----Char----",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
txtBtnInfo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_Btn_FormationInfo"
|
||||
},
|
||||
goLoadMask = {},
|
||||
txtCurTrial = {
|
||||
nCount = 3,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_CurTrialChar"
|
||||
},
|
||||
goCurTrial = {nCount = 3}
|
||||
}
|
||||
TrialFormationCtrl._mapEventConfig = {
|
||||
[EventId.FormationLoadModel] = "OnEvent_LoadModel",
|
||||
OnEvent_SelectRefresh = "Refresh",
|
||||
[EventId.UIBackConfirm] = "OnEvent_Back",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_BackHome"
|
||||
}
|
||||
function TrialFormationCtrl:InitData()
|
||||
local mapLevelCfg = ConfigTable.GetData("TrialFloor", self.nFloorId)
|
||||
if not mapLevelCfg then
|
||||
return
|
||||
end
|
||||
self.mapBuildData = PlayerData.Build:GetTrialBuild(mapLevelCfg.TrialBuild)
|
||||
self.tbCharId, self.tbCharTrialToId, self.curTeam, self.mapCharData, self.mapTalentAddLevel, self.tbCharTrialId = {}, {}, {}, {}, {}, {}
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
table.insert(self.curTeam, mapChar.nTrialId)
|
||||
self.tbCharTrialToId[mapChar.nTrialId] = mapChar.nTid
|
||||
self.tbCharTrialId[mapChar.nTid] = mapChar.nTrialId
|
||||
self.mapCharData[mapChar.nTid] = PlayerData.Char:GetTrialCharById(mapChar.nTrialId)
|
||||
self.mapTalentAddLevel[mapChar.nTid] = PlayerData.Talent:GetTrialEnhancedPotential(mapChar.nTrialId)
|
||||
if mapLevelCfg.TrialChar == mapChar.nTid then
|
||||
self.nCurTrialId = mapChar.nTrialId
|
||||
end
|
||||
end
|
||||
self.tbDiscId, self.mapDiscData = {}, {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if 0 < nDiscId then
|
||||
table.insert(self.tbDiscId, nDiscId)
|
||||
local mapCfg = ConfigTable.GetData("TrialDisc", nDiscId)
|
||||
if mapCfg then
|
||||
self.mapDiscData[mapCfg.DiscId] = PlayerData.Disc:GetTrialDiscById(nDiscId)
|
||||
end
|
||||
end
|
||||
end
|
||||
self.tbDepotPotential = {}
|
||||
for nCharId, tbPerk in pairs(self.mapBuildData.tbPotentials) do
|
||||
if self.tbCharTrialId[nCharId] then
|
||||
if not self.tbDepotPotential[nCharId] then
|
||||
self.tbDepotPotential[nCharId] = {}
|
||||
end
|
||||
for _, v in ipairs(tbPerk) do
|
||||
self.tbDepotPotential[nCharId][v.nPotentialId] = v.nLevel
|
||||
end
|
||||
else
|
||||
printError("体验build内,有多余角色的潜能" .. nCharId)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TrialFormationCtrl:Refresh(nDirection)
|
||||
self:RefreshChar(nDirection)
|
||||
end
|
||||
function TrialFormationCtrl:RefreshChar(nDirection)
|
||||
for i = 1, 3 do
|
||||
if self.curTeam[i] == nil then
|
||||
self.curTeam[i] = 0
|
||||
end
|
||||
self._mapNode.goChar[i].gameObject:SetActive(self.curTeam[i] ~= 0)
|
||||
self._mapNode.goCurTrial[i]:SetActive(self.curTeam[i] == self.nCurTrialId)
|
||||
if self.curTeam[i] ~= 0 then
|
||||
self._mapNode.goChar[i]:OnRender(self.curTeam, i, true, nDirection)
|
||||
if self.mapCurModel[i] == nil or self.mapCurModel[i].nCharId ~= self.curTeam[i] then
|
||||
self:LoadCharacter(self.curTeam[i], self.bOpen or nDirection ~= nil)
|
||||
end
|
||||
elseif self.mapCurModel[i] ~= nil then
|
||||
NovaAPI.UnbindUIParallaxStageCameraControllerModel(self._mapNode.UIParallax3DStage, i - 1)
|
||||
destroy(self.mapCurModel[i].model)
|
||||
self.mapCurModel[i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
function TrialFormationCtrl:LoadCharacter(nCharId, bOpen)
|
||||
local mapTrialChar = PlayerData.Char:GetTrialCharById(nCharId)
|
||||
if not mapTrialChar then
|
||||
return
|
||||
end
|
||||
local nSkinId = mapTrialChar.nSkinId
|
||||
local mapSkin = ConfigTable.GetData_CharacterSkin(nSkinId)
|
||||
if not mapSkin then
|
||||
printLog("没有找到皮肤配置" .. nCharId)
|
||||
return
|
||||
end
|
||||
local sFullPath = string.format("%s.prefab", mapSkin.Model_Show)
|
||||
local LoadModelCallback = function(obj)
|
||||
if self._mapNode == nil then
|
||||
return
|
||||
end
|
||||
local idx = table.indexof(self.curTeam, nCharId)
|
||||
if 0 < idx then
|
||||
if self.mapCurModel[idx] ~= nil then
|
||||
NovaAPI.UnbindUIParallaxStageCameraControllerModel(self._mapNode.UIParallax3DStage, idx - 1)
|
||||
destroy(self.mapCurModel[idx].model)
|
||||
self.mapCurModel[idx] = nil
|
||||
end
|
||||
local go = instantiate(obj, self.rtSceneOriginPos)
|
||||
self.mapCurModel[idx] = {nCharId = nCharId, model = go}
|
||||
NovaAPI.BindUIParallaxStageCameraControllerModel(self._mapNode.UIParallax3DStage, idx - 1, go)
|
||||
if self.rtSceneOriginPos ~= nil then
|
||||
go.transform.position = self.rtSceneOriginPos.position
|
||||
go.transform.localEulerAngles = Vector3(0, 180, 0)
|
||||
go.transform.localScale = Vector3.one * (mapSkin.ModelShowScale / 10000)
|
||||
local animator = go:GetComponent(typeof(Animator))
|
||||
if animator ~= nil and animator:IsNull() == false then
|
||||
animator:SetBool("standby", true)
|
||||
end
|
||||
GameUIUtils.SetCustomModelMaterialVariant(go, CS.CustomModelMaterialVariantComponent.VariantNames.FormationView)
|
||||
end
|
||||
if not bOpen then
|
||||
self._mapNode.goChar[idx]:PlayChangeFx()
|
||||
end
|
||||
if PlayerData.Guide:GetGuideState() then
|
||||
EventManager.Hit("Guide_LoadCharacterSuccess")
|
||||
end
|
||||
end
|
||||
end
|
||||
self:LoadAssetAsync(sFullPath, typeof(GameObject), LoadModelCallback)
|
||||
end
|
||||
function TrialFormationCtrl:LoadScene()
|
||||
local sSceneName = ConfigTable.GetConfigValue("SelectRole_Main")
|
||||
self.mapCurModel = {}
|
||||
local callbak = function(bSuccess)
|
||||
self.bOpen = true
|
||||
if bSuccess == true then
|
||||
local sceneRoot = CS.MainMenuModuleHelper.GetMainMenuSceneRoot(sSceneName)
|
||||
self.rtSceneOriginPos = sceneRoot.transform:Find("==== Scene ====")
|
||||
self.goSelectRolePrefab = self:CreatePrefabInstance("UI/MainlineFormationEx/SelectRolePrefab.prefab", self.rtSceneOriginPos)
|
||||
local goSelectRoleCam = self.goSelectRolePrefab.transform:Find("Camera"):GetComponent("Camera")
|
||||
NovaAPI.SetupUIParallaxStageCameraControllerForModelView(self._mapNode.UIParallax3DStage, goSelectRoleCam)
|
||||
self:Refresh()
|
||||
if self.curTeam[1] ~= 0 then
|
||||
PlayerData.Voice:PlayCharVoice("swap", self.tbCharTrialToId[self.curTeam[1]])
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goLoadMask:SetActive(false)
|
||||
if PlayerData.Guide:GetGuideState() then
|
||||
EventManager.Hit("Guide_LoadFormationSuccess")
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
else
|
||||
self._mapNode.goLoadMask:SetActive(false)
|
||||
self._mapNode.UIParallax3DStage.gameObject:SetActive(false)
|
||||
self._mapNode.BGbackup:SetActive(true)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
for i = 1, 3 do
|
||||
self._mapNode.goChar[i]:OpenList(false)
|
||||
end
|
||||
self._mapNode.btnStartBattle.transform.localScale = Vector3.one
|
||||
self.bOpen = false
|
||||
end
|
||||
CS.MainMenuModuleHelper.GetActiveScene(sSceneName, callbak)
|
||||
end
|
||||
function TrialFormationCtrl:Awake()
|
||||
end
|
||||
function TrialFormationCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.nFloorId = tbParam[1]
|
||||
end
|
||||
self:InitData()
|
||||
self._mapNode.goLoadMask:SetActive(true)
|
||||
self._mapNode.btnStartBattle.enabled = true
|
||||
self:LoadScene()
|
||||
end
|
||||
function TrialFormationCtrl:OnDisable()
|
||||
local sSceneName = ConfigTable.GetConfigValue("SelectRole_Main")
|
||||
local callback = function()
|
||||
end
|
||||
CS.MainMenuModuleHelper.DeActiveScene(sSceneName, callback)
|
||||
for i, mapModel in pairs(self.mapCurModel) do
|
||||
if mapModel.model ~= nil then
|
||||
NovaAPI.UnbindUIParallaxStageCameraControllerModel(self._mapNode.UIParallax3DStage, i - 1)
|
||||
destroy(mapModel.model)
|
||||
end
|
||||
end
|
||||
for i = 1, 3 do
|
||||
self._mapNode.goChar[i].nCharId = nil
|
||||
end
|
||||
if self.goSelectRolePrefab ~= nil then
|
||||
destroy(self.goSelectRolePrefab)
|
||||
end
|
||||
self.mapCurModel = {}
|
||||
end
|
||||
function TrialFormationCtrl:OnDestroy()
|
||||
end
|
||||
function TrialFormationCtrl:OnBtnClick_Info(btn)
|
||||
local tbDisc = {}
|
||||
for _, v in ipairs(self.tbDiscId) do
|
||||
local mapCfg = ConfigTable.GetData("TrialDisc", v)
|
||||
if mapCfg then
|
||||
table.insert(tbDisc, mapCfg.DiscId)
|
||||
end
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TrialDepot, self.tbCharId, tbDisc, self.mapCharData, self.mapDiscData, self.mapTalentAddLevel, self.tbDepotPotential, self.mapBuildData.tbNotes)
|
||||
end
|
||||
function TrialFormationCtrl:OnBtnClick_Start(btn)
|
||||
self._mapNode.btnStartBattle.enabled = false
|
||||
PlayerData.Trial:EnterTrial(self.nFloorId)
|
||||
NovaAPI.SetEntryLevelFade(true)
|
||||
end
|
||||
function TrialFormationCtrl:OnEvent_LoadModel(bLoadFinish)
|
||||
self._mapNode.Mask:SetActive(not bLoadFinish)
|
||||
end
|
||||
function TrialFormationCtrl:OnEvent_Back(nPanelId)
|
||||
if self._panel._nPanelId ~= nPanelId then
|
||||
return
|
||||
end
|
||||
CS.AdventureModuleHelper.ExitSelectTeam()
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
PlayerData.Build:DeleteTrialBuild()
|
||||
end
|
||||
function TrialFormationCtrl:OnEvent_BackHome(nPanelId)
|
||||
if self._panel._nPanelId ~= nPanelId then
|
||||
return
|
||||
end
|
||||
CS.AdventureModuleHelper.ExitSelectTeam()
|
||||
PlayerData.Build:DeleteTrialBuild()
|
||||
PanelManager.Home()
|
||||
end
|
||||
return TrialFormationCtrl
|
||||
@@ -0,0 +1,16 @@
|
||||
local TrialFormationPanel = class("TrialFormationPanel", BasePanel)
|
||||
TrialFormationPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_TrialLevelSelect/TrialFormationScenePanel.prefab",
|
||||
sCtrlName = "Game.UI.TrialLevelSelect.TrialFormationCtrl"
|
||||
}
|
||||
}
|
||||
function TrialFormationPanel:Awake()
|
||||
end
|
||||
function TrialFormationPanel:OnEnable(bPlayFadeIn)
|
||||
end
|
||||
function TrialFormationPanel:OnDisable()
|
||||
end
|
||||
function TrialFormationPanel:OnDestroy()
|
||||
end
|
||||
return TrialFormationPanel
|
||||
@@ -0,0 +1,323 @@
|
||||
local TrialLevelSelectCtrl = class("TrialLevelSelectCtrl", BaseCtrl)
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
TrialLevelSelectCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
aniRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
rawImgActor2D = {
|
||||
sNodeName = "----Actor2D----",
|
||||
sComponentName = "RawImage"
|
||||
},
|
||||
txtRewardTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_RewardReceiveTips"
|
||||
},
|
||||
imgReceived = {},
|
||||
imgTips = {},
|
||||
imgRecommend = {nCount = 2},
|
||||
imgOn = {nCount = 2},
|
||||
imgOff = {nCount = 2},
|
||||
txtMain = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_MasterGroup"
|
||||
},
|
||||
txtSub = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_AssistGroup"
|
||||
},
|
||||
btnTab = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Tab"
|
||||
},
|
||||
txtPotentialTitle = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
txtPotentialTip = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
btnLevel = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Level"
|
||||
},
|
||||
txtBtnLevel = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_Btn_TrialFormation"
|
||||
},
|
||||
sv = {
|
||||
nCount = 2,
|
||||
sComponentName = "LoopScrollView"
|
||||
}
|
||||
}
|
||||
TrialLevelSelectCtrl._mapEventConfig = {
|
||||
SelectDepotPotential = "OnEvent_Select"
|
||||
}
|
||||
function TrialLevelSelectCtrl:RefreshSelectTrial()
|
||||
local nActId = PlayerData.Trial:GetTrialAct()
|
||||
local nGroupId = PlayerData.Trial:GetSelectTrialGroup()
|
||||
local bActIdChange = nActId ~= self.nActId
|
||||
local bGroupIdChange = nGroupId ~= self.nGroupId
|
||||
if not bActIdChange and not bGroupIdChange then
|
||||
return
|
||||
end
|
||||
self.nTab = 1
|
||||
if bActIdChange then
|
||||
self.nActId = nActId
|
||||
end
|
||||
if bGroupIdChange then
|
||||
self.nGroupId = nGroupId
|
||||
end
|
||||
end
|
||||
function TrialLevelSelectCtrl:RefreshData()
|
||||
if self.nTab == nil then
|
||||
self.nTab = 1
|
||||
end
|
||||
self.tbPotentialList = {}
|
||||
self.tbPotentialList.master = {}
|
||||
self.tbPotentialList.assist = {}
|
||||
self.tbBuildGroup = {}
|
||||
self.tbBuildGroup.master = {}
|
||||
self.tbBuildGroup.assist = {}
|
||||
self.tbBuild1GridCtrl = {}
|
||||
self.tbBuild2GridCtrl = {}
|
||||
local mapGroupCfg = ConfigTable.GetData("TrialGroup", self.nGroupId)
|
||||
if not mapGroupCfg then
|
||||
return
|
||||
end
|
||||
PlayerData.Char:CreateTrialChar({
|
||||
mapGroupCfg.TrialChar
|
||||
})
|
||||
local addPotential = function(tbPotentials, insertTb, nIndex)
|
||||
for Tid, Level in pairs(tbPotentials) do
|
||||
local mapCfg = ConfigTable.GetData("Potential", Tid)
|
||||
local mapItemCfg = ConfigTable.GetData("Item", Tid)
|
||||
if mapCfg ~= nil and mapItemCfg ~= nil then
|
||||
if insertTb[nIndex] == nil then
|
||||
insertTb[nIndex] = {}
|
||||
end
|
||||
local data = {
|
||||
nId = Tid,
|
||||
nSpecial = mapItemCfg.Stype == GameEnum.itemStype.SpecificPotential and 1 or 0,
|
||||
nRarity = mapItemCfg.Rarity,
|
||||
nLevel = Level
|
||||
}
|
||||
table.insert(insertTb[nIndex], data)
|
||||
end
|
||||
end
|
||||
end
|
||||
local mapTrial = ConfigTable.GetData("TrialCharacter", mapGroupCfg.TrialChar)
|
||||
if not mapTrial then
|
||||
return
|
||||
end
|
||||
self.nCharId = mapTrial.CharId
|
||||
local mapDes = ConfigTable.GetData("CharacterDes", self.nCharId)
|
||||
if not mapDes then
|
||||
return
|
||||
end
|
||||
for i, v in ipairs(mapGroupCfg.MasterPotential) do
|
||||
local mapCfg = ConfigTable.GetData("TrialPotential", v)
|
||||
if mapCfg then
|
||||
table.insert(self.tbBuildGroup.master, {
|
||||
nId = v,
|
||||
nFloorId = mapCfg.FloorId,
|
||||
sTitle = mapDes[mapCfg.Title],
|
||||
sDesc = mapDes[mapCfg.Desc]
|
||||
})
|
||||
local tbPotentialId = mapCfg.Potential
|
||||
local mapId = {}
|
||||
for _, nId in ipairs(tbPotentialId) do
|
||||
mapId[nId] = 1
|
||||
end
|
||||
local mapFloor = ConfigTable.GetData("TrialFloor", mapCfg.FloorId)
|
||||
if mapFloor then
|
||||
local mapBuild = ConfigTable.GetData("TrialBuild", mapFloor.TrialBuild)
|
||||
if mapBuild then
|
||||
local tbAllPotential = decodeJson(mapBuild.Potential)
|
||||
for _, mapPotential in pairs(tbAllPotential) do
|
||||
if mapId[mapPotential.Tid] then
|
||||
mapId[mapPotential.Tid] = mapPotential.Level
|
||||
end
|
||||
end
|
||||
addPotential(mapId, self.tbPotentialList.master, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for i, v in ipairs(mapGroupCfg.AssistPotential) do
|
||||
local mapCfg = ConfigTable.GetData("TrialPotential", v)
|
||||
if mapCfg then
|
||||
table.insert(self.tbBuildGroup.assist, {
|
||||
nId = v,
|
||||
nFloorId = mapCfg.FloorId,
|
||||
sTitle = mapDes[mapCfg.Title],
|
||||
sDesc = mapDes[mapCfg.Desc]
|
||||
})
|
||||
local tbPotentialId = mapCfg.Potential
|
||||
local mapId = {}
|
||||
for _, nId in ipairs(tbPotentialId) do
|
||||
mapId[nId] = 1
|
||||
end
|
||||
local mapFloor = ConfigTable.GetData("TrialFloor", mapCfg.FloorId)
|
||||
if mapFloor then
|
||||
local mapBuild = ConfigTable.GetData("TrialBuild", mapFloor.TrialBuild)
|
||||
if mapBuild then
|
||||
local tbAllPotential = decodeJson(mapBuild.Potential)
|
||||
for _, mapPotential in pairs(tbAllPotential) do
|
||||
if mapId[mapPotential.Tid] then
|
||||
mapId[mapPotential.Tid] = mapPotential.Level
|
||||
end
|
||||
end
|
||||
addPotential(mapId, self.tbPotentialList.assist, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local sort = function(a, b)
|
||||
if a.nSpecial ~= b.nSpecial then
|
||||
return a.nSpecial > b.nSpecial
|
||||
else
|
||||
return a.nRarity < b.nRarity
|
||||
end
|
||||
end
|
||||
for i = 1, 2 do
|
||||
table.sort(self.tbPotentialList.master[i], sort)
|
||||
table.sort(self.tbPotentialList.assist[i], sort)
|
||||
end
|
||||
end
|
||||
function TrialLevelSelectCtrl:RefreshContent()
|
||||
self:RefreshData()
|
||||
self:RefreshTab()
|
||||
self:RefreshList()
|
||||
self:RefreshRecommend()
|
||||
self:RefreshChar()
|
||||
end
|
||||
function TrialLevelSelectCtrl:RefreshChar()
|
||||
local nCharSkinId = ConfigTable.GetData_Character(self.nCharId).AdvanceSkinId
|
||||
Actor2DManager.SetActor2D(self:GetPanelId(), self._mapNode.rawImgActor2D, self.nCharId, nCharSkinId)
|
||||
local bReceived = PlayerData.Trial:CheckGroupReceived()
|
||||
self._mapNode.imgReceived:SetActive(bReceived)
|
||||
self._mapNode.imgTips:SetActive(not bReceived)
|
||||
end
|
||||
function TrialLevelSelectCtrl:RefreshTab()
|
||||
local tbBuildGroup = self.nTab == 1 and self.tbBuildGroup.master or self.tbBuildGroup.assist
|
||||
for i = 1, 2 do
|
||||
self._mapNode.imgOn[i]:SetActive(i == self.nTab)
|
||||
self._mapNode.imgOff[i]:SetActive(i ~= self.nTab)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPotentialTitle[i], tbBuildGroup[i].sTitle)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPotentialTip[i], tbBuildGroup[i].sDesc)
|
||||
end
|
||||
end
|
||||
function TrialLevelSelectCtrl:RefreshRecommend()
|
||||
local mapChar = ConfigTable.GetData_Character(self.nCharId)
|
||||
if mapChar == nil then
|
||||
return
|
||||
end
|
||||
self._mapNode.imgRecommend[1]:SetActive(mapChar.Class == GameEnum.characterJobClass.Vanguard)
|
||||
self._mapNode.imgRecommend[2]:SetActive(mapChar.Class == GameEnum.characterJobClass.Support)
|
||||
end
|
||||
function TrialLevelSelectCtrl:RefreshList()
|
||||
for nInstanceId, objCtrl in pairs(self.tbBuild1GridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbBuild1GridCtrl[nInstanceId] = nil
|
||||
end
|
||||
for nInstanceId, objCtrl in pairs(self.tbBuild2GridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbBuild2GridCtrl[nInstanceId] = nil
|
||||
end
|
||||
local tbPotentialList = self.nTab == 1 and self.tbPotentialList.master or self.tbPotentialList.assist
|
||||
self.tbBuild1 = tbPotentialList[GameEnum.potentialBuild.PotentialBuild1] or {}
|
||||
self.tbBuild2 = tbPotentialList[GameEnum.potentialBuild.PotentialBuild2] or {}
|
||||
self._mapNode.sv[1].gameObject:SetActive(#self.tbBuild1 > 0)
|
||||
self._mapNode.sv[2].gameObject:SetActive(#self.tbBuild2 > 0)
|
||||
if #self.tbBuild1 > 0 then
|
||||
self._mapNode.sv[1]:SetAnim(0.04)
|
||||
self._mapNode.sv[1]:Init(#self.tbBuild1, self, self.OnGridRefresh1)
|
||||
end
|
||||
if #self.tbBuild2 > 0 then
|
||||
self._mapNode.sv[2]:SetAnim(0.04)
|
||||
self._mapNode.sv[2]:Init(#self.tbBuild2, self, self.OnGridRefresh2)
|
||||
end
|
||||
end
|
||||
function TrialLevelSelectCtrl:OnGridRefresh1(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local mapData = self.tbBuild1[nIndex]
|
||||
local nInstanceID = goGrid:GetInstanceID()
|
||||
if not self.tbBuild1GridCtrl[nInstanceID] then
|
||||
self.tbBuild1GridCtrl[nInstanceID] = self:BindCtrlByNode(goGrid, "Game.UI.StarTower.Depot.DepotPotentialItemCtrl")
|
||||
end
|
||||
self.tbBuild1GridCtrl[nInstanceID]:InitItem(mapData.nId, mapData.nLevel, 0, false, true)
|
||||
end
|
||||
function TrialLevelSelectCtrl:OnGridRefresh2(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local mapData = self.tbBuild2[nIndex]
|
||||
local nInstanceID = goGrid:GetInstanceID()
|
||||
if not self.tbBuild1GridCtrl[nInstanceID] then
|
||||
self.tbBuild1GridCtrl[nInstanceID] = self:BindCtrlByNode(goGrid, "Game.UI.StarTower.Depot.DepotPotentialItemCtrl")
|
||||
end
|
||||
self.tbBuild1GridCtrl[nInstanceID]:InitItem(mapData.nId, mapData.nLevel, 0, false, true)
|
||||
end
|
||||
function TrialLevelSelectCtrl:FadeIn()
|
||||
end
|
||||
function TrialLevelSelectCtrl:Awake()
|
||||
end
|
||||
function TrialLevelSelectCtrl:OnEnable()
|
||||
self:RefreshSelectTrial()
|
||||
self:RefreshContent()
|
||||
end
|
||||
function TrialLevelSelectCtrl:OnDisable()
|
||||
Actor2DManager.UnsetActor2D()
|
||||
PlayerData.Char:DeleteTrialChar()
|
||||
if self.tbBuild2GridCtrl then
|
||||
for k, objCtrl in pairs(self.tbBuild2GridCtrl) do
|
||||
local obj = objCtrl.gameObject
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbBuild2GridCtrl[k] = nil
|
||||
destroyImmediate(obj)
|
||||
end
|
||||
self.tbBuild2GridCtrl = {}
|
||||
end
|
||||
if self.tbBuild1GridCtrl then
|
||||
for k, objCtrl in pairs(self.tbBuild1GridCtrl) do
|
||||
local obj = objCtrl.gameObject
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbBuild1GridCtrl[k] = nil
|
||||
destroyImmediate(obj)
|
||||
end
|
||||
self.tbBuild1GridCtrl = {}
|
||||
end
|
||||
end
|
||||
function TrialLevelSelectCtrl:OnDestroy()
|
||||
end
|
||||
function TrialLevelSelectCtrl:OnBtnClick_Tab(btn, nIndex)
|
||||
if nIndex == self.nTab then
|
||||
return
|
||||
end
|
||||
self.nTab = nIndex
|
||||
self:RefreshTab()
|
||||
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.svPotential, 1)
|
||||
self:RefreshList()
|
||||
end
|
||||
function TrialLevelSelectCtrl:OnBtnClick_Level(btn, nIndex)
|
||||
local nFloorId, sTitle
|
||||
if self.nTab == 1 then
|
||||
nFloorId = self.tbBuildGroup.master[nIndex].nFloorId
|
||||
sTitle = self.tbBuildGroup.master[nIndex].sTitle
|
||||
else
|
||||
nFloorId = self.tbBuildGroup.assist[nIndex].nFloorId
|
||||
sTitle = self.tbBuildGroup.assist[nIndex].sTitle
|
||||
end
|
||||
PlayerData.Trial:SetLevelTitle(sTitle)
|
||||
local OpenPanel = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TrialFormation, nFloorId)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
|
||||
end
|
||||
function TrialLevelSelectCtrl:OnEvent_Select(nPotentialId, nLevel)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PotentialDetail, nPotentialId, nLevel, 0)
|
||||
end
|
||||
return TrialLevelSelectCtrl
|
||||
@@ -0,0 +1,16 @@
|
||||
local TrialLevelSelectPanel = class("TrialLevelSelectPanel", BasePanel)
|
||||
TrialLevelSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_TrialLevelSelect/TrialLevelSelectPanel.prefab",
|
||||
sCtrlName = "Game.UI.TrialLevelSelect.TrialLevelSelectCtrl"
|
||||
}
|
||||
}
|
||||
function TrialLevelSelectPanel:Awake()
|
||||
end
|
||||
function TrialLevelSelectPanel:OnEnable()
|
||||
end
|
||||
function TrialLevelSelectPanel:OnDisable()
|
||||
end
|
||||
function TrialLevelSelectPanel:OnDestroy()
|
||||
end
|
||||
return TrialLevelSelectPanel
|
||||
Reference in New Issue
Block a user