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,501 @@
local RegionBossBuildCtrl = class("RegionBossBuildCtrl", BaseCtrl)
RegionBossBuildCtrl._mapNodeConfig = {
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
aniPanel = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "Animator"
},
BuildList = {
sComponentName = "LoopScrollView"
},
btn_sort_time = {
sComponentName = "UIButton",
callback = "OnBtnClick_SortTime"
},
btn_sort_score = {
sComponentName = "UIButton",
callback = "OnBtnClick_SortScore"
},
btn_Filter = {
sComponentName = "UIButton",
callback = "OnBtnClick_OpenFilter"
},
txt_srot_timeTitle = {
sComponentName = "TMP_Text",
sLanguageId = "RoguelikeBuild_Manage_SortTime"
},
txt_srot_ScoreTitle = {
sComponentName = "TMP_Text",
sLanguageId = "RoguelikeBuild_Manage_SortScore"
},
txt_BuildCount = {sComponentName = "TMP_Text"},
btnPreview = {
sComponentName = "UIButton",
callback = "OnBtnClick_Preview"
},
txtBtnPreview = {
sComponentName = "TMP_Text",
sLanguageId = "Build_Btn_AttributePreview"
},
txt_Empty = {sComponentName = "TMP_Text"},
EmptyContent = {},
ExistContent = {},
animExistContent = {
sNodeName = "ExistContent",
sComponentName = "Animator"
},
ListContent = {}
}
RegionBossBuildCtrl._mapEventConfig = {
[EventId.UIHomeConfirm] = "OnEvent_BackHome",
[EventId.UIBackConfirm] = "OnEvent_Back"
}
local SortType = {Time = 1, Score = 2}
local SortOrder = {Descending = true, Ascending = false}
local PanelState = {
Normal = 1,
Delete = 2,
Preference = 3
}
local BtnTextColor = {
[true] = Color(0.3288888888888889, 0.43555555555555553, 0.5422222222222223, 1),
[false] = Color(0.7288888888888889, 0.8, 0.8711111111111111, 1)
}
local FilterGradeIdx = {
btn_FilterGradeS = 3,
btn_FilterGradeA = 2,
btn_FilterGradeB = 1,
btn_FilterGradeC = 0
}
function RegionBossBuildCtrl:RefreshList()
if #self._tbAllBuild == 0 then
self._mapNode.ExistContent:SetActive(false)
self._mapNode.EmptyContent:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.txt_Empty, ConfigTable.GetUIText("RoguelikeBuild_Manage_EmptyList"))
return
else
self._mapNode.ExistContent:SetActive(true)
end
self.tbCurShow = self:FilterAndSortBuildData()
if self.nType == AllEnum.RegionBossFormationType.InfinityTower then
for i, v in pairs(self.tbCurShow) do
local tmpChar = {}
for i = 1, 3 do
table.insert(tmpChar, v.tbChar[i].nTid)
end
v.isCanUse = PlayerData.InfinityTower:JudgeInfinityTowerBuildCanUse(tmpChar, self.selLvId)
end
table.sort(self.tbCurShow, function(a, b)
if self.nSortype == SortType.Time then
if self.nSortOrder == SortOrder.Descending then
if a.isCanUse ~= b.isCanUse then
return a.isCanUse and not b.isCanUse
end
return a.nBuildId > b.nBuildId
else
if a.isCanUse ~= b.isCanUse then
return a.isCanUse and not b.isCanUse
end
return a.nBuildId < b.nBuildId
end
elseif self.nSortOrder == SortOrder.Descending then
if a.isCanUse ~= b.isCanUse then
return a.isCanUse and not b.isCanUse
end
if a.nScore ~= b.nScore then
return a.nScore > b.nScore
else
return a.nBuildId > b.nBuildId
end
else
if a.isCanUse ~= b.isCanUse then
return a.isCanUse and not b.isCanUse
end
if a.nScore ~= b.nScore then
return a.nScore < b.nScore
else
return a.nBuildId > b.nBuildId
end
end
end)
elseif self.nType == AllEnum.RegionBossFormationType.Vampire then
for _, v in pairs(self.tbCurShow) do
local judgeBuildCanUse = function(v)
for i = 1, 3 do
if table.indexof(self.tbSelChar, v.tbChar[i].nTid) > 0 then
v.isCanUse = false
return
end
end
v.isCanUse = true
end
judgeBuildCanUse(v)
end
elseif self.nType == AllEnum.RegionBossFormationType.JointDrill then
for _, data in ipairs(self.tbUsedBuildList) do
for k, v in pairs(self.tbCurShow) do
if data.BuildId == v.nBuildId then
v.bBuildUsed = true
else
local bCharUsed = false
for i = 1, 3 do
if table.indexof(self.tbSelChar, v.tbChar[i].nTid) > 0 then
bCharUsed = true
break
end
end
if bCharUsed then
v.bCharUsed = true
end
end
end
end
end
if #self.tbCurShow == 0 then
self._mapNode.EmptyContent:SetActive(true)
self._mapNode.ListContent:SetActive(false)
NovaAPI.SetTMPText(self._mapNode.txt_Empty, ConfigTable.GetUIText("RoguelikeBuild_Manage_EmptyFilter"))
return
else
self._mapNode.EmptyContent:SetActive(false)
self._mapNode.ListContent:SetActive(true)
end
self._mapNode.BuildList:Init(#self.tbCurShow, self, self.RefreshBuildGrid)
NovaAPI.SetTMPText(self._mapNode.txt_BuildCount, string.format("%d/%d", #self._tbAllBuild, ConfigTable.GetConfigNumber("StarTowerBuildNumberMax")))
end
function RegionBossBuildCtrl:FilterAndSortBuildData()
local ret = {}
local filterBuild = function(mapBuild)
if self.nPanelState == PanelState.Delete and self.mapDelete[mapBuild.nBuildId] ~= nil then
table.insert(ret, clone(mapBuild))
return
end
if self.nPanelState == PanelState.Preference then
local bCheckIn = self.mapPreferenceCheckIn[mapBuild.nBuildId] ~= nil
local bCheckOut = self.mapPreferenceCheckOut[mapBuild.nBuildId] ~= nil
if not (not mapBuild.bPreference or bCheckOut) or not mapBuild.bPreference and bCheckIn then
table.insert(ret, mapBuild)
return
end
end
if #self.FilterGrade > 0 and 0 >= table.indexof(self.FilterGrade, mapBuild.nGrade) then
return
end
if self.FiterPreference ~= self.FilterUnpreference and (not (not self.FiterPreference or mapBuild.bPreference) or self.FilterUnpreference and mapBuild.bPreference) then
return
end
if self.FilterPass ~= self.FilterUnpass and (not (not self.FilterPass or mapBuild.bPass) or self.FilterUnpass and mapBuild.bPass) then
return
end
table.insert(ret, mapBuild)
end
for _, mapBuild in ipairs(self._tbAllBuild) do
filterBuild(mapBuild)
end
if self.nSortype == SortType.Time then
local sortByTime = function(a, b)
if self.nPanelState == PanelState.Delete then
local bSelecta = self.mapDelete[a.nBuildId] ~= nil
local bSelectb = self.mapDelete[b.nBuildId] ~= nil
if bSelecta ~= bSelectb then
return bSelecta
end
end
if self.nPanelState == PanelState.Preference then
local bCheckInA = self.mapPreferenceCheckIn[a.nBuildId] ~= nil
local bCheckOutA = self.mapPreferenceCheckOut[a.nBuildId] ~= nil
local bSelectA = a.bPreference and not bCheckOutA or not a.bPreference and bCheckInA
local bCheckInB = self.mapPreferenceCheckIn[b.nBuildId] ~= nil
local bCheckOutB = self.mapPreferenceCheckOut[b.nBuildId] ~= nil
local bSelectB = b.bPreference and not bCheckOutB or not b.bPreference and bCheckInB
if bSelectA ~= bSelectB then
return bSelectA
end
end
if self.nSortOrder == SortOrder.Descending then
return a.nBuildId > b.nBuildId
else
return a.nBuildId < b.nBuildId
end
end
table.sort(ret, sortByTime)
else
local sortByScore = function(a, b)
if self.nPanelState == PanelState.Delete then
local bSelecta = self.mapDelete[a.nBuildId] ~= nil
local bSelectb = self.mapDelete[b.nBuildId] ~= nil
if bSelecta ~= bSelectb then
return bSelecta
end
end
if self.nPanelState == PanelState.Preference then
local bCheckInA = self.mapPreferenceCheckIn[a.nBuildId] ~= nil
local bCheckOutA = self.mapPreferenceCheckOut[a.nBuildId] ~= nil
local bSelectA = a.bPreference and not bCheckOutA or not a.bPreference and bCheckInA
local bCheckInB = self.mapPreferenceCheckIn[b.nBuildId] ~= nil
local bCheckOutB = self.mapPreferenceCheckOut[b.nBuildId] ~= nil
local bSelectB = b.bPreference and not bCheckOutB or not b.bPreference and bCheckInB
if bSelectA ~= bSelectB then
return bSelectA
end
end
if self.nSortOrder == SortOrder.Descending then
if a.nScore ~= b.nScore then
return a.nScore > b.nScore
else
return a.nBuildId > b.nBuildId
end
elseif a.nScore ~= b.nScore then
return a.nScore < b.nScore
else
return a.nBuildId > b.nBuildId
end
end
table.sort(ret, sortByScore)
end
return ret
end
function RegionBossBuildCtrl:RefreshBuildGrid(goGrid, gridIndex)
local nIndex = gridIndex + 1
local mapData = self.tbCurShow[nIndex]
local bSelectDelete = self.mapDelete[mapData.nBuildId] ~= nil
local bCheckOut = self.mapPreferenceCheckOut[mapData.nBuildId] ~= nil
local bCheckIn = self.mapPreferenceCheckIn[mapData.nBuildId] ~= nil
if self.mapListItemCtrl[goGrid] == nil then
self.mapListItemCtrl[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.StarTower.Build.StarTowerBuildBriefItem")
self.mapListItemCtrl[goGrid]:Init(self)
end
self.mapListItemCtrl[goGrid]:RefreshGrid(mapData, self.nPanelState, bSelectDelete, bCheckOut, bCheckIn, self.nType)
end
function RegionBossBuildCtrl:OnBuildGridLock(nIdx, itemCtrl)
local mapBuild = self.tbCurShow[nIdx]
local callback = function()
mapBuild.bLock = not mapBuild.bLock
itemCtrl:SetLockState(mapBuild.bLock)
if self.nPanelState == PanelState.Delete and mapBuild.bLock and self.mapDelete[mapBuild.nBuildId] ~= nil then
self.mapDelete[mapBuild.nBuildId] = nil
self.nSelectedDeleteCount = self.nSelectedDeleteCount - 1
itemCtrl:SetSelectDeleteState(false)
self:SetDeleteResult()
end
end
PlayerData.Build:ChangeBuildLock(mapBuild.nBuildId, not mapBuild.bLock, callback)
end
function RegionBossBuildCtrl:OnBuildGridPreference(nIdx, itemCtrl)
if self.nPanelState ~= PanelState.Normal then
self:OnBtnClickGrid(nIdx, itemCtrl)
return
end
local mapBuild = self.tbCurShow[nIdx]
local tbPreferenceCheckIn = {}
local tbPreferenceCheckOut = {}
local callback = function()
itemCtrl:SetPreferenceState(mapBuild.bPreference)
end
if mapBuild.bPreference then
table.insert(tbPreferenceCheckOut, mapBuild.nBuildId)
else
table.insert(tbPreferenceCheckIn, mapBuild.nBuildId)
end
PlayerData.Build:SetBuildPreference(tbPreferenceCheckIn, tbPreferenceCheckOut, callback)
end
function RegionBossBuildCtrl:OnBtnClickGrid(nIdx, itemCtrl)
if self.nType == AllEnum.RegionBossFormationType.RegionBoss then
PlayerData.RogueBoss:SetSelBuildId(self.tbCurShow[nIdx].nBuildId)
elseif self.nType == AllEnum.RegionBossFormationType.TravelerDuel then
PlayerData.TravelerDuel:SetSelBuildId(self.tbCurShow[nIdx].nBuildId)
elseif self.nType == AllEnum.RegionBossFormationType.DailyInstance then
PlayerData.DailyInstance:SetSelBuildId(self.tbCurShow[nIdx].nBuildId)
elseif self.nType == AllEnum.RegionBossFormationType.InfinityTower then
PlayerData.InfinityTower:SetSelBuildId(self.tbCurShow[nIdx].nBuildId, self.selLvId)
elseif self.nType == AllEnum.RegionBossFormationType.EquipmentInstance then
PlayerData.EquipmentInstance:SetSelBuildId(self.tbCurShow[nIdx].nBuildId)
EventManager.Hit("SelectEquipmentBuild")
elseif self.nType == AllEnum.RegionBossFormationType.Story then
PlayerData.Avg:SetSelBuildId(self.tbCurShow[nIdx].nBuildId)
elseif self.nType == AllEnum.RegionBossFormationType.Vampire then
PlayerData.VampireSurvivor:CacheSelectedBuildId(self.selLvId, self.nIdx, self.tbCurShow[nIdx].nBuildId)
elseif self.nType == AllEnum.RegionBossFormationType.ScoreBoss then
PlayerData.ScoreBoss:SetSelBuildId(self.tbCurShow[nIdx].nBuildId, self.selLvId)
elseif self.nType == AllEnum.RegionBossFormationType.SkillInstance then
PlayerData.SkillInstance:SetSelBuildId(self.tbCurShow[nIdx].nBuildId, self.selLvId)
elseif self.nType == AllEnum.RegionBossFormationType.WeeklyCopies then
PlayerData.RogueBoss:SetSelBuildId(self.tbCurShow[nIdx].nBuildId)
elseif self.nType == AllEnum.RegionBossFormationType.JointDrill then
PlayerData.JointDrill:SetSelBuildId(self.tbCurShow[nIdx].nBuildId)
elseif self.nType == AllEnum.RegionBossFormationType.ActivityLevels then
local nActId = PlayerData.Activity:GetActivityLevelActId()
local activityLevelsData = PlayerData.Activity:GetActivityDataById(nActId)
activityLevelsData:SetCachedSelBuildId(self.tbCurShow[nIdx].nBuildId, self.selLvId)
end
local tbChar = self.tbCurShow[nIdx].tbChar
local nRandomIdx = math.random(1, #tbChar)
PlayerData.Voice:PlayCharVoice("buildPick", tbChar[nRandomIdx].nTid)
EventManager.Hit(EventId.ClosePanel, PanelId.RogueBossBuildBrief)
end
function RegionBossBuildCtrl:OnBuildGridDetail(nIdx, itemCtrl)
local mapBuild = self.tbCurShow[nIdx]
local callback = function(mapData)
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerBuildDetail, mapData)
end
PlayerData.Build:GetBuildDetailData(callback, mapBuild.nBuildId)
end
function RegionBossBuildCtrl:InitSort()
NovaAPI.SetTMPColor(self._mapNode.txt_srot_timeTitle, BtnTextColor[self.nSortype == SortType.Time])
NovaAPI.SetTMPColor(self._mapNode.txt_srot_ScoreTitle, BtnTextColor[self.nSortype == SortType.Score])
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Score and self.nSortOrder == SortOrder.Ascending
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Score and self.nSortOrder == SortOrder.Descending
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Time and self.nSortOrder == SortOrder.Ascending
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Time and self.nSortOrder == SortOrder.Descending
end
function RegionBossBuildCtrl:FadeIn(bPlayFadeIn)
if self._panel._nFadeInType == 1 then
EventManager.Hit(EventId.SetTransition)
self._mapNode.animExistContent:SetTrigger("tIn")
if #self._tbAllBuild > 0 then
EventManager.Hit(EventId.TemporaryBlockInput, 0.4)
end
end
end
function RegionBossBuildCtrl:Awake()
self._tbAllBuild = {}
self.tbCurShow = {}
self.mapPreferenceCheckIn = {}
self.mapPreferenceCheckOut = {}
self.mapDelete = {}
self.nSelectedDeleteCount = 0
self.FilterGrade = {}
self.FiterPreference = false
self.FilterUnpreference = false
self.FilterPass = false
self.FilterUnpass = false
self.nSortype = SortType.Score
self.nSortOrder = SortOrder.Descending
self.nPanelState = PanelState.Normal
self:InitSort()
self.mapListItemCtrl = {}
self.tbCoinRate = ConfigTable.GetConfigArray("StarTowerBuildTransformParas")
end
function RegionBossBuildCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nType = tbParam[1]
self.selLvId = 0
self.nIdx = 1
self.tbSelChar = {}
if tbParam[2] ~= nil then
self.selLvId = tbParam[2]
end
if self.nType == AllEnum.RegionBossFormationType.Vampire then
self.nIdx = tbParam[3]
elseif self.nType == AllEnum.RegionBossFormationType.JointDrill then
self.tbUsedBuildList = PlayerData.JointDrill:GetJointDrillBuildList()
end
local GetDataCallback = function(tbBuildData, mapAllBuild)
self._mapAllBuild = mapAllBuild
self._tbAllBuild = clone(tbBuildData)
if self.nType == AllEnum.RegionBossFormationType.Vampire then
local tbBuildId = PlayerData.VampireSurvivor:GetCachedBuildId(self.selLvId)
if tbBuildId ~= nil then
local nOtherBuildId = tbBuildId[2 / self.nIdx]
local mapBuildData = mapAllBuild[nOtherBuildId]
if mapBuildData ~= nil then
for _, mapChar in ipairs(mapBuildData.tbChar) do
table.insert(self.tbSelChar, mapChar.nTid)
end
end
end
elseif self.nType == AllEnum.RegionBossFormationType.JointDrill then
for _, v in ipairs(self.tbUsedBuildList) do
for _, char in ipairs(v.Chars) do
if table.indexof(self.tbSelChar, char.CharId) == 0 then
table.insert(self.tbSelChar, char.CharId)
end
end
end
end
self:RefreshList()
EventManager.Hit("Guide_RegionBossRefresh")
end
PlayerData.Build:GetAllBuildBriefData(GetDataCallback)
end
function RegionBossBuildCtrl:OnDisable()
self.mapPreferenceCheckIn = {}
self.mapPreferenceCheckOut = {}
self.mapDelete = {}
self.nSelectedDeleteCount = 0
for nInstanceId, objCtrl in pairs(self.mapListItemCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.mapListItemCtrl[nInstanceId] = nil
end
self.mapListItemCtrl = {}
end
function RegionBossBuildCtrl:OnDestroy()
end
function RegionBossBuildCtrl:OnRelease()
end
function RegionBossBuildCtrl:FadeOut(callback)
local Callback = function()
if type(callback) == "function" then
callback()
end
end
EventManager.Hit(EventId.TemporaryBlockInput, 0.03, Callback)
end
function RegionBossBuildCtrl:OnBtnClick_SortTime(btn)
if self.nSortype == SortType.Time then
self.nSortOrder = not self.nSortOrder
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Ascending
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Descending
else
self.nSortype = SortType.Time
self.nSortOrder = SortOrder.Descending
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = true
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = false
NovaAPI.SetTMPColor(self._mapNode.txt_srot_timeTitle, BtnTextColor[self.nSortype == SortType.Time])
NovaAPI.SetTMPColor(self._mapNode.txt_srot_ScoreTitle, BtnTextColor[self.nSortype == SortType.Score])
end
self:RefreshList()
end
function RegionBossBuildCtrl:OnBtnClick_SortScore(btn)
if self.nSortype == SortType.Score then
self.nSortOrder = not self.nSortOrder
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Ascending
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Descending
else
self.nSortype = SortType.Score
self.nSortOrder = SortOrder.Descending
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = true
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = false
NovaAPI.SetTMPColor(self._mapNode.txt_srot_timeTitle, BtnTextColor[self.nSortype == SortType.Time])
NovaAPI.SetTMPColor(self._mapNode.txt_srot_ScoreTitle, BtnTextColor[self.nSortype == SortType.Score])
end
self:RefreshList()
end
function RegionBossBuildCtrl:OnBtnClick_OpenFilter(btn)
end
function RegionBossBuildCtrl:OnBtnClick_Preview()
EventManager.Hit(EventId.OpenPanel, PanelId.BuildAttrPreview)
end
function RegionBossBuildCtrl:OnEvent_BackHome(nPanelId)
if self._panel._nPanelId ~= nPanelId then
return
end
if self.nType == AllEnum.RegionBossFormationType.InfinityTower then
PlayerData.InfinityTower:SetPageState(1)
end
PanelManager.Home()
end
function RegionBossBuildCtrl:OnEvent_Back(nPanelId)
if self._panel._nPanelId ~= nPanelId then
return
end
EventManager.Hit(EventId.ClosePanel, PanelId.RogueBossBuildBrief)
end
return RegionBossBuildCtrl
@@ -0,0 +1,25 @@
local RegionBossBuildPanel = class("RegionBossBuildPanel", BasePanel)
RegionBossBuildPanel._tbDefine = {
{
sPrefabPath = "RegionBossFormationEx/RegionBossBuildPanel.prefab",
sCtrlName = "Game.UI.RegionBossFormationEx.RegionBossBuildCtrl"
}
}
function RegionBossBuildPanel:Awake()
EventManager.Add("EnterModule", self, self.OnEvent_EnterModule)
end
function RegionBossBuildPanel:OnEnable()
end
function RegionBossBuildPanel:OnDisable()
end
function RegionBossBuildPanel:OnDestroy()
EventManager.Remove("EnterModule", self, self.OnEvent_EnterModule)
end
function RegionBossBuildPanel:OnRelease()
end
function RegionBossBuildPanel:OnEvent_EnterModule(moduleMgr, sExitModuleName, sEnterModuleName)
if sEnterModuleName == "AdventureModuleScene" then
self.bAddBuild = false
end
end
return RegionBossBuildPanel
@@ -0,0 +1,97 @@
local RegionBossFormationCharCtrl = class("RegionBossFormationCharCtrl", BaseCtrl)
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local ResType = GameResourceLoader.ResType
local typeof = typeof
RegionBossFormationCharCtrl._mapNodeConfig = {
trParent = {sComponentName = "Transform"},
rtInfo = {
sCtrlName = "Game.UI.TemplateEx.TemplateCharInfoCtrl"
},
btnSelect = {
sComponentName = "UIButton",
callback = "OnBtnClick_Select"
},
btnAdd = {
sComponentName = "UIButton",
callback = "OnBtnClick_Select"
},
Animator = {sNodeName = "rtInfo", sComponentName = "Animator"},
btnDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
txtBtnDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Formation_Btn_Info"
},
txtBtnEmpty = {
sComponentName = "TMP_Text",
sLanguageId = "MainlineFormationDisc_HintEmpty"
},
txtLeader = {
sComponentName = "TMP_Text",
sLanguageId = "Build_Leader"
},
txtSub = {sComponentName = "TMP_Text", sLanguageId = "Build_Sub"}
}
RegionBossFormationCharCtrl._mapEventConfig = {}
function RegionBossFormationCharCtrl:OnRender(tbTeamMemberId, index)
if tbTeamMemberId[index] == nil then
self._mapNode.btnAdd.gameObject:SetActive(false)
self._mapNode.rtInfo.gameObject:SetActive(false)
return
end
self.mIndex = index
self.nCharId = tbTeamMemberId[index].nTid
self._mapNode.btnAdd.gameObject:SetActive(self.nCharId <= 0)
self._mapNode.rtInfo.gameObject:SetActive(self.nCharId > 0)
if self.nCharId > 0 then
local tbTeamId = {}
for _, v in pairs(tbTeamMemberId) do
table.insert(tbTeamId, v.nTid)
end
self.tbTeamId = tbTeamId
local mapCharData = PlayerData.Char:GetCharDataByTid(self.nCharId)
local mapCharCfgData = ConfigTable.GetData_Character(self.nCharId)
local nTrialId = tbTeamMemberId[index].nTrialId
local mapTrailCfg
if nTrialId then
mapTrailCfg = ConfigTable.GetData("TrialCharacter", nTrialId)
end
self._mapNode.rtInfo:Refresh(mapCharData, mapCharCfgData, mapTrailCfg)
self._mapNode.Animator:Play("rtInfo_up")
end
end
function RegionBossFormationCharCtrl:ShowRawImage(nCharId)
local mapSkin = ConfigTable.GetData_CharacterSkin(PlayerData.Char:GetCharSkinId(nCharId))
if not mapSkin then
self.mData = nil
return
else
self.mData = mapSkin
end
local callback = function(obj)
if not self.mActive then
return
end
self:showModel(obj)
end
local sFullPath = string.format("%s.prefab", GameResourceLoader.RootPath, mapSkin.Model)
self:LoadAssetAsync(sFullPath, typeof(GameObject), callback)
end
function RegionBossFormationCharCtrl:OnEnable()
self.mActive = true
end
function RegionBossFormationCharCtrl:OnDisable()
self.mActive = false
end
function RegionBossFormationCharCtrl:OnBtnClick_Select(btn)
local sTip = ConfigTable.GetUIText("RegionBoss_Member_CannotBeChanged")
EventManager.Hit(EventId.OpenMessageBox, sTip)
end
function RegionBossFormationCharCtrl:OnBtnClick_Detail(btn)
if self.tbTeamId ~= nil then
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, PanelId.CharInfo, self.nCharId, self.tbTeamId, false)
end
end
return RegionBossFormationCharCtrl
@@ -0,0 +1,776 @@
local RegionBossFormationCtrl = class("RegionBossFormationCtrl", BaseCtrl)
local CustomModelMaterialVariantComponent = CS.CustomModelMaterialVariantComponent
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local LocalData = require("GameCore.Data.LocalData")
local typeof = typeof
local GameCameraStackManager = CS.GameCameraStackManager
local ResType = GameResourceLoader.ResType
local Animator = CS.UnityEngine.Animator
RegionBossFormationCtrl._mapNodeConfig = {
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
goNoneTeam = {sNodeName = "---None---"},
txtNoneTeam = {
sComponentName = "TMP_Text",
sLanguageId = "RogueBoss_SelectTeam_NoneTeam"
},
txtSelectTeam = {
sComponentName = "TMP_Text",
sLanguageId = "RegionBoss_Manage_Title"
},
btnAddBuild = {
sComponentName = "UIButton",
callback = "OnBtnClick_AddBuild"
},
goHaveTeam = {sNodeName = "---Team---"},
goChar = {
nCount = 3,
sCtrlName = "Game.UI.RegionBossFormationEx.RegionBossFormationCharCtrl"
},
btnStartBattle = {
sComponentName = "UIButton",
callback = "OnBtnClick_Start"
},
txtStartBattle = {
sComponentName = "TMP_Text",
sLanguageId = "RegionBoss_SelectTeam_GoWar"
},
aniBuildDetail = {
sNodeName = "BuildDetail",
sComponentName = "Animator"
},
btnChangeTeam = {
sComponentName = "UIButton",
callback = "OnBtnClick_ChangeTeam"
},
txtChangeTeam = {
sComponentName = "TMP_Text",
sLanguageId = "RegionBoss_SelectTeam_Change"
},
btnTeamDetails = {
sComponentName = "UIButton",
callback = "OnBtnClick_TeamDetails"
},
txtTeamDetails = {
sComponentName = "TMP_Text",
sLanguageId = "RegionBoss_SelectTeam_Details"
},
btnAttr = {
sComponentName = "UIButton",
callback = "OnBtnClick_Attr"
},
txtAttr = {sComponentName = "TMP_Text"},
imgRareFrame = {sComponentName = "Image"},
imgRareScore = {sComponentName = "Image"},
txtScoreCn = {
sComponentName = "TMP_Text",
sLanguageId = "Build_Score"
},
txtBuildScore = {sComponentName = "TMP_Text"},
txtBuildName = {sComponentName = "TMP_Text"},
UIParallax3DStage = {
sComponentName = "UIParallaxStageCameraController"
},
BGbackup = {
sNodeName = "----BGbackup----"
},
goLoadMask = {},
txtStoryModel = {
sComponentName = "TMP_Text",
sLanguageId = "Build_StoryModel"
},
txtBasicModel = {
sComponentName = "TMP_Text",
sLanguageId = "Build_BasicModel"
},
txtStoryTip = {
sComponentName = "TMP_Text",
sLanguageId = "Build_StoryTip"
},
btnSwitch = {
sComponentName = "UIButton",
callback = "OnBtnClick_StorySwitch"
},
imgStoryModel = {},
imgBasicModel = {}
}
RegionBossFormationCtrl._mapEventConfig = {
[EventId.UIBackConfirm] = "OnEvent_Back",
[EventId.UIHomeConfirm] = "OnEvent_BackHome",
[EventId.OpenMessageBox] = "OnEvent_OpenMessageBox"
}
function RegionBossFormationCtrl:Refresh()
if self.isHaveTeam then
local GetDataCallback = function(tbBuildData, mapAllBuild)
self._mapAllBuild = mapAllBuild
self._tbAllBuild = tbBuildData
if self._mapAllBuild[self.mbuildId] then
self._mapNode.goNoneTeam.transform.localScale = Vector3.zero
self._mapNode.goHaveTeam.transform.localScale = Vector3.one
self._mapNode.aniBuildDetail:Play("BuildDetail_in", 0, 0)
self._mapNode.btnStartBattle.gameObject:SetActive(true)
self:RefreshChar()
else
self.isHaveTeam = false
self._mapNode.goHaveTeam.transform.localScale = Vector3.zero
self._mapNode.goNoneTeam.transform.localScale = Vector3.one
self._mapNode.btnStartBattle.gameObject:SetActive(false)
local sTip = ConfigTable.GetUIText("RegionBoss_Team_Delete")
EventManager.Hit(EventId.OpenMessageBox, sTip)
self:UnbindAllChar()
end
self._mapNode.goLoadMask:SetActive(false)
end
if self.bTrial then
local mapAllBuild = {}
mapAllBuild[self.mapTrialBuild.nBuildId] = self.mapTrialBuild
GetDataCallback({
self.mapTrialBuild
}, mapAllBuild)
else
self._mapNode.goLoadMask:SetActive(true)
PlayerData.Build:GetAllBuildBriefData(GetDataCallback)
end
else
self._mapNode.goHaveTeam.transform.localScale = Vector3.zero
self._mapNode.goNoneTeam.transform.localScale = Vector3.one
self._mapNode.btnStartBattle.gameObject:SetActive(false)
self:UnbindAllChar()
end
end
function RegionBossFormationCtrl:UnbindAllChar()
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
self.mapCurModel = {}
end
function RegionBossFormationCtrl:RefreshChar()
if self.nType == AllEnum.RegionBossFormationType.RegionBoss or self.nType == AllEnum.RegionBossFormationType.WeeklyCopies then
PlayerData.RogueBoss:SetSelBuildId(self.mbuildId)
end
local mapData = self._mapAllBuild[self.mbuildId]
for i = 1, 3 do
self._mapNode.goChar[i]:OnRender(mapData.tbChar, i)
if mapData.tbChar[i] and mapData.tbChar[i] ~= 0 then
if self.mapCurModel[i] == nil or self.mapCurModel[i].nCharId ~= mapData.tbChar[i] then
self:LoadCharacter(mapData.tbChar[i].nTid, i)
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
NovaAPI.SetTMPText(self._mapNode.txtBuildScore, mapData.nScore)
if mapData.sName == "" or mapData.sName == nil then
NovaAPI.SetTMPText(self._mapNode.txtBuildName, ConfigTable.GetUIText("RoguelikeBuild_EmptyBuildName"))
else
NovaAPI.SetTMPText(self._mapNode.txtBuildName, mapData.sName)
end
local sScore = "Icon/BuildRank/BuildRank_" .. mapData.mapRank.Id
local sFrame = AllEnum.FrameType_New.BuildFormation .. AllEnum.FrameColor_New[mapData.mapRank.Rarity]
self:SetPngSprite(self._mapNode.imgRareScore, sScore)
self:SetAtlasSprite(self._mapNode.imgRareFrame, "12_rare", sFrame)
NovaAPI.SetTMPText(self._mapNode.txtAttr, UTILS.ParseParamDesc(ConfigTable.GetUIText(mapData.mapRank.Desc), mapData.mapRank))
if PlayerData.Guide:GetGuideState() then
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit("Guide_RegionBossFormationCtrl_RefreshChar")
end
cs_coroutine.start(wait)
end
end
function RegionBossFormationCtrl:LoadCharacter(nCharId, idx)
local mapSkin = ConfigTable.GetData_CharacterSkin(PlayerData.Char:GetCharSkinId(nCharId))
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
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 PlayerData.Guide:GetGuideState() and not self.bSendGuide then
self.bSendGuide = true
EventManager.Hit("Guide_LoadCharacterSuccess")
end
end
end
self:LoadAssetAsync(sFullPath, typeof(GameObject), LoadModelCallback)
end
function RegionBossFormationCtrl:SetModelPos(nCharId, objModel, nPos)
local mapSkin = ConfigTable.GetData_CharacterSkin(PlayerData.Char:GetCharSkinId(nCharId))
if not mapSkin then
printLog("没有找到皮肤配置" .. nCharId)
return
end
if self.mapCurModel[nPos] ~= nil then
NovaAPI.UnbindUIParallaxStageCameraControllerModel(self._mapNode.UIParallax3DStage, nPos - 1)
destroy(self.mapCurModel[nPos].model)
self.mapCurModel[nPos] = nil
end
self.mapCurModel[nPos] = {nCharId = nCharId, model = objModel}
if self.rtSceneOriginPos ~= nil then
objModel.transform.position = self.rtSceneOriginPos.position
objModel.transform.localScale = Vector3.one * (mapSkin.ModelShowScale / 10000)
local animator = objModel:GetComponent(typeof(Animator))
if animator ~= nil then
animator:SetBool("standby", true)
end
local matVariantComp = objModel:GetComponent(typeof(CustomModelMaterialVariantComponent))
if matVariantComp ~= nil then
matVariantComp:SetVariant(CS.CustomModelMaterialVariantComponent.VariantNames.FormationView)
end
end
end
function RegionBossFormationCtrl:OpenRegionBoss()
if self.isHaveTeam then
local islock = true
local worldClass = PlayerData.Base:GetWorldClass()
local tempData = ConfigTable.GetData("RegionBossLevel", self.selLvId)
if worldClass >= tempData.NeedWorldClass then
if tempData.PreLevelId ~= 0 then
local cachePreData = PlayerData.RogueBoss:GetCacheBossLevelMsg(tempData.PreLevelId)
if cachePreData and cachePreData.maxStar and cachePreData.maxStar >= tempData.PreLevelStar then
islock = false
end
else
islock = false
end
else
islock = true
end
if islock then
return
end
local CheckItemCountExceededLimitCb = function(isExceeded)
if not isExceeded then
local func_cbRegionBossLevelApplyAck = function(_, msgChangeInfo)
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(msgChangeInfo)
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
end
local mapSendMsg = {}
mapSendMsg.Id = self.selLvId
mapSendMsg.BuildId = self.mbuildId
HttpNetHandler.SendMsg(NetMsgId.Id.region_boss_level_apply_req, mapSendMsg, nil, func_cbRegionBossLevelApplyAck)
end
end
PlayerData.Item:CheckItemCountExceededLimit(CheckItemCountExceededLimitCb)
else
local sTip = ConfigTable.GetUIText("RegionBoss_NoneTeam")
EventManager.Hit(EventId.OpenMessageBox, sTip)
end
end
function RegionBossFormationCtrl:OpenWeeklyCopies()
if self.isHaveTeam then
local islock = true
local worldClass = PlayerData.Base:GetWorldClass()
local tempData = ConfigTable.GetData("WeekBossLevel", self.selLvId)
if worldClass >= tempData.NeedWorldClass then
if tempData.PreLevelId ~= 0 then
local cachePreData = PlayerData.RogueBoss:GetCacheWeeklyBossMsg(tempData.PreLevelId)
if cachePreData ~= nil then
islock = false
end
else
islock = false
end
else
islock = true
end
if islock then
print("未解锁")
return
end
local CheckItemCountExceededLimitCb = function(isExceeded)
if not isExceeded then
local func_cbRegionBossLevelApplyAck = function(_, msgChangeInfo)
end
local mapSendMsg = {}
mapSendMsg.Id = self.selLvId
mapSendMsg.BuildId = self.mbuildId
HttpNetHandler.SendMsg(NetMsgId.Id.week_boss_apply_req, mapSendMsg, nil, func_cbRegionBossLevelApplyAck)
end
end
PlayerData.Item:CheckItemCountExceededLimit(CheckItemCountExceededLimitCb)
else
local sTip = ConfigTable.GetUIText("RegionBoss_NoneTeam")
EventManager.Hit(EventId.OpenMessageBox, sTip)
end
end
function RegionBossFormationCtrl:OpenDailyInstance()
PlayerData.DailyInstance:SetSelBuildId(0)
if self.isHaveTeam then
local CheckItemCountExceededLimitCb = function(isExceeded)
if not isExceeded then
PlayerData.DailyInstance:MsgEnterDailyInstance(self.selLvId, self.mbuildId)
end
end
PlayerData.Item:CheckItemCountExceededLimit(CheckItemCountExceededLimitCb)
end
end
function RegionBossFormationCtrl:OpenTravelerDuel()
if self.isHaveTeam then
local CheckItemCountExceededLimitCb = function(isExceeded)
if not isExceeded then
PlayerData.TravelerDuel:SetSelBuildId(0)
PlayerData.TravelerDuel:SendMsg_EnterTravelerDuel(self.selLvId, self.mbuildId, self.Other)
end
end
PlayerData.Item:CheckItemCountExceededLimit(CheckItemCountExceededLimitCb)
end
end
function RegionBossFormationCtrl:OpenInfinityTower()
if self.isHaveTeam then
local mapData = self._mapAllBuild[self.mbuildId]
local tbC = mapData.tbChar
local tmpTab = {}
for i, v in pairs(tbC) do
table.insert(tmpTab, v.nTid)
end
if not PlayerData.InfinityTower:JudgeInfinityTowerBuildCanUse(tmpTab, self.selLvId) then
local strTips = ConfigTable.GetUIText("InfinityTower_Build_NotMeetingCond")
EventManager.Hit(EventId.OpenMessageBox, strTips)
return
end
local CheckItemCountExceededLimitCb = function(isExceeded)
if not isExceeded then
PlayerData.InfinityTower:EnterITApplyReq(self.selLvId, self.mbuildId, true)
end
end
PlayerData.Item:CheckItemCountExceededLimit(CheckItemCountExceededLimitCb)
end
end
function RegionBossFormationCtrl:OpenEquipmentInstance()
PlayerData.EquipmentInstance:SetSelBuildId(0)
if self.isHaveTeam then
local CheckItemCountExceededLimitCb = function(isExceeded)
if not isExceeded then
PlayerData.EquipmentInstance:MsgEnterEquipmentInstance(self.selLvId, self.mbuildId)
end
end
PlayerData.Item:CheckItemCountExceededLimit(CheckItemCountExceededLimitCb)
end
end
function RegionBossFormationCtrl:OpenSkillInstance()
PlayerData.SkillInstance:SetSelBuildId(0)
if self.isHaveTeam then
local CheckItemCountExceededLimitCb = function(isExceeded)
if not isExceeded then
PlayerData.SkillInstance:MsgEnterSkillInstance(self.selLvId, self.mbuildId)
end
end
PlayerData.Item:CheckItemCountExceededLimit(CheckItemCountExceededLimitCb)
end
end
function RegionBossFormationCtrl:OpenStoryBattle()
if self.isHaveTeam then
local nBuildId = self.bTrial and 0 or self.mbuildId
PlayerData.Avg:SendMsg_STORY_ENTER(self.Other, nBuildId)
end
end
function RegionBossFormationCtrl:OpenScoreBossBattle()
if self.isHaveTeam then
local nCurTime = CS.ClientManager.Instance.serverTimeStamp
if nCurTime > PlayerData.ScoreBoss.EndTime then
return
end
PlayerData.ScoreBoss:SendEnterScoreBossApplyReq(self.selLvId, self.mbuildId)
end
end
function RegionBossFormationCtrl:OpenActivityLevelsBattle()
if self.isHaveTeam then
local nCurTime = CS.ClientManager.Instance.serverTimeStamp
local activityLevelsData = PlayerData.Activity:GetActivityDataById(self.Other[1])
if nCurTime > activityLevelsData.nEndTime then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
return
end
activityLevelsData:SendEnterActivityLevelsApplyReq(self.Other[1], self.selLvId, self.mbuildId)
end
end
function RegionBossFormationCtrl:SwitchStoryType(bTrial)
self._mapNode.imgStoryModel:SetActive(bTrial)
self._mapNode.imgBasicModel:SetActive(not bTrial)
self._mapNode.txtStoryTip.gameObject:SetActive(bTrial)
self._mapNode.btnChangeTeam.gameObject:SetActive(not bTrial)
self._mapNode.btnTeamDetails.gameObject:SetActive(not bTrial)
for i = 1, 3 do
self._mapNode.goChar[i].gameObject.transform:Find("rtInfo/goInfo/btnDetail").gameObject:SetActive(not bTrial)
end
end
function RegionBossFormationCtrl:Awake()
end
function RegionBossFormationCtrl:OnEnable()
self.bStartBattle = false
local tbParam = self:GetPanelParam()
self.nType = tbParam[1]
self.selLvId = tbParam[2]
self.Other = tbParam[3]
self._mapNode.goLoadMask:SetActive(true)
self._mapNode.btnSwitch.gameObject:SetActive(false)
self:SwitchStoryType(false)
if self.nType == AllEnum.RegionBossFormationType.RegionBoss then
self.selLvId = PlayerData.RogueBoss:GetSelLvId()
self.cacheData = PlayerData.RogueBoss:GetCacheBossLevelMsg(self.selLvId)
self.isHaveTeam = false
local tempBuildId = PlayerData.RogueBoss:GetSelBuildId()
self.mbuildId = 0
if tempBuildId ~= 0 then
self.mbuildId = tempBuildId
elseif self.cacheData then
self.mbuildId = self.cacheData.BuildId
elseif self.cacheData == nil then
local tempTab = ConfigTable.GetData("RegionBossLevel", self.selLvId)
if 1 < tempTab.Difficulty then
local tempCacheData = PlayerData.RogueBoss:GetCacheBossLevelMsg(tempTab.PreLevelId)
if tempCacheData then
self.mbuildId = tempCacheData.BuildId
end
end
end
if self.cacheData or tempBuildId ~= 0 or self.mbuildId ~= 0 then
self.isHaveTeam = true
end
elseif self.nType == AllEnum.RegionBossFormationType.TravelerDuel then
self.mbuildId = PlayerData.TravelerDuel:GetCachedBuildId(self.selLvId)
if self.mbuildId == 0 then
local tempTab = ConfigTable.GetData("TravelerDuelBossLevel", self.selLvId)
if 1 < tempTab.Difficulty then
local tempId = PlayerData.TravelerDuel:GetCachedBuildId(tempTab.PreLevelId)
if tempId then
self.mbuildId = tempId
end
end
end
if self.mbuildId ~= 0 then
self.isHaveTeam = true
end
elseif self.nType == AllEnum.RegionBossFormationType.DailyInstance then
self.mbuildId = PlayerData.DailyInstance:GetCachedBuildId(self.selLvId)
if self.mbuildId == 0 then
local tempTab = ConfigTable.GetData("DailyInstance", self.selLvId)
if 1 < tempTab.Difficulty then
local tempId = PlayerData.DailyInstance:GetCachedBuildId(tempTab.PreLevelId)
if tempId then
self.mbuildId = tempId
end
end
end
if self.mbuildId ~= 0 then
self.isHaveTeam = true
end
if not self.bSendGuideMsg then
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_OpenDailyInstanceFormation")
self.bSendGuideMsg = true
end
elseif self.nType == AllEnum.RegionBossFormationType.InfinityTower then
self.mbuildId = 0
local tempBuildId = PlayerData.InfinityTower:GetCachedBuildId(self.selLvId)
if tempBuildId ~= 0 then
self.mbuildId = tempBuildId
else
self.mbuildId = PlayerData.InfinityTower:GetSaveBuildId(self.selLvId)
end
if self.mbuildId == 0 then
end
if self.mbuildId ~= 0 then
self.isHaveTeam = true
end
elseif self.nType == AllEnum.RegionBossFormationType.EquipmentInstance then
self.mbuildId = PlayerData.EquipmentInstance:GetCachedBuildId(self.selLvId)
if self.mbuildId == 0 then
local tempTab = ConfigTable.GetData("CharGemInstance", self.selLvId)
if 1 < tempTab.Difficulty then
local tempId = PlayerData.EquipmentInstance:GetCachedBuildId(tempTab.PreLevelId)
if tempId then
self.mbuildId = tempId
end
end
end
if self.mbuildId ~= 0 then
self.isHaveTeam = true
end
elseif self.nType == AllEnum.RegionBossFormationType.Story then
local mapStoryCfg = PlayerData.Avg:GetStoryCfgData(self.Other)
local bHasTrial = 0 < mapStoryCfg.TrialBuild
self.bTrial = LocalData.GetPlayerLocalData("StoryTrialModel")
if self.bTrial == nil then
self.bTrial = true
end
if bHasTrial == false then
self.bTrial = false
end
LocalData.SetPlayerLocalData("StoryTrialModel", self.bTrial)
self._mapNode.btnSwitch.gameObject:SetActive(bHasTrial)
self:SwitchStoryType(self.bTrial)
if bHasTrial then
self.mapTrialBuild = PlayerData.Build:CreateTrialBuild(mapStoryCfg.TrialBuild)
end
if self.bTrial then
self.mbuildId = self.mapTrialBuild.nBuildId
else
self.mbuildId = PlayerData.Avg:GetCachedBuildId()
end
if self.mbuildId and self.mbuildId ~= 0 then
self.isHaveTeam = true
else
self.isHaveTeam = false
end
elseif self.nType == AllEnum.RegionBossFormationType.ScoreBoss then
self.mbuildId = 0
local tempBuildId = PlayerData.ScoreBoss:GetCachedBuild(self.selLvId)
if tempBuildId ~= 0 then
self.mbuildId = tempBuildId
else
self.mbuildId = PlayerData.ScoreBoss:GetLevelBuild(self.selLvId)
end
if self.mbuildId == 0 then
end
if self.mbuildId ~= 0 then
self.isHaveTeam = true
end
elseif self.nType == AllEnum.RegionBossFormationType.SkillInstance then
self.mbuildId = PlayerData.SkillInstance:GetCachedBuildId(self.selLvId)
if self.mbuildId == 0 then
local tempTab = ConfigTable.GetData("SkillInstance", self.selLvId)
if 1 < tempTab.Difficulty then
local tempId = PlayerData.SkillInstance:GetCachedBuildId(tempTab.PreLevelId)
if tempId then
self.mbuildId = tempId
end
end
end
if self.mbuildId ~= 0 then
self.isHaveTeam = true
end
elseif self.nType == AllEnum.RegionBossFormationType.WeeklyCopies then
self.selLvId = PlayerData.RogueBoss:GetSelLvId()
self.cacheData = PlayerData.RogueBoss:GetCacheWeeklyBossMsg(self.selLvId)
self.isHaveTeam = false
local tempBuildId = PlayerData.RogueBoss:GetSelBuildId()
self.mbuildId = 0
if tempBuildId ~= 0 then
self.mbuildId = tempBuildId
elseif self.cacheData then
self.mbuildId = self.cacheData.BuildId
elseif self.cacheData == nil then
local tempTab = ConfigTable.GetData("WeekBossLevel", self.selLvId)
if 1 < tempTab.Difficulty then
local tempCacheData = PlayerData.RogueBoss:GetCacheWeeklyBossMsg(tempTab.PreLevelId)
if tempCacheData then
self.mbuildId = tempCacheData.BuildId
end
end
end
if self.cacheData or tempBuildId ~= 0 or self.mbuildId ~= 0 then
self.isHaveTeam = true
end
elseif self.nType == AllEnum.RegionBossFormationType.ActivityLevels then
local activityLevelsData = PlayerData.Activity:GetActivityDataById(self.Other[1])
self.mbuildId = 0
local tempBuildId = activityLevelsData:GetCachedBuildId(self.selLvId)
if tempBuildId ~= 0 then
self.mbuildId = tempBuildId
else
self.mbuildId = activityLevelsData:GetLevelBuild(self.selLvId)
end
if self.mbuildId == 0 then
end
if self.mbuildId ~= 0 then
self.isHaveTeam = true
end
end
self.mapCurModel = {}
local sSceneName = ConfigTable.GetConfigValue("SelectRole_Main")
if self.nType == AllEnum.RegionBossFormationType.InfinityTower then
local mapInfLevel = ConfigTable.GetData("InfinityTowerLevel", self.selLvId)
if mapInfLevel ~= nil then
local mapDifficuly = ConfigTable.GetData("InfinityTowerDifficulty", mapInfLevel.DifficultyId)
if mapDifficuly ~= nil then
local mapInfTower = ConfigTable.GetData("InfinityTower", mapDifficuly.TowerId)
if mapInfTower ~= nil then
sSceneName = mapInfTower.FormationSceneName
end
end
end
end
local callbak = function(bSuccess)
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._mapNode.goLoadMask:SetActive(false)
self:Refresh()
else
self._mapNode.goLoadMask:SetActive(false)
self._mapNode.UIParallax3DStage.gameObject:SetActive(false)
self._mapNode.BGbackup:SetActive(true)
end
EventManager.Hit(EventId.SetTransition)
end
CS.MainMenuModuleHelper.GetActiveScene(sSceneName, callbak)
end
function RegionBossFormationCtrl:OnDisable()
local sSceneName = ConfigTable.GetConfigValue("SelectRole_Main")
if self.nType == AllEnum.RegionBossFormationType.InfinityTower then
local mapInfLevel = ConfigTable.GetData("InfinityTowerLevel", self.selLvId)
if mapInfLevel ~= nil then
local mapDifficuly = ConfigTable.GetData("InfinityTowerDifficulty", mapInfLevel.DifficultyId)
if mapDifficuly ~= nil then
local mapInfTower = ConfigTable.GetData("InfinityTower", mapDifficuly.TowerId)
if mapInfTower ~= nil then
sSceneName = mapInfTower.FormationSceneName
end
end
end
end
local callback = function()
EventManager.Hit(EventId.SetTransition)
end
CS.MainMenuModuleHelper.DeActiveScene(sSceneName, callback)
self:UnbindAllChar()
if self.goSelectRolePrefab ~= nil then
destroy(self.goSelectRolePrefab)
end
end
function RegionBossFormationCtrl:OnDestroy()
end
function RegionBossFormationCtrl:OnBtnClick_AddBuild()
EventManager.Hit(EventId.OpenPanel, PanelId.RogueBossBuildBrief, self.nType, self.selLvId)
end
function RegionBossFormationCtrl:OnBtnClick_ChangeTeam()
EventManager.Hit(EventId.OpenPanel, PanelId.RogueBossBuildBrief, self.nType, self.selLvId)
end
function RegionBossFormationCtrl:OnBtnClick_TeamDetails()
local callback = function(mapData)
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerBuildDetail, mapData)
end
PlayerData.Build:GetBuildDetailData(callback, self.mbuildId)
end
function RegionBossFormationCtrl:OnBtnClick_Attr()
local mapBuild = self._mapAllBuild[self.mbuildId]
EventManager.Hit(EventId.OpenPanel, PanelId.BuildAttrPreview, mapBuild.mapRank.Id, mapBuild.nScore)
end
function RegionBossFormationCtrl:OnBtnClick_StorySwitch()
self.bTrial = not self.bTrial
LocalData.SetPlayerLocalData("StoryTrialModel", self.bTrial)
self:SwitchStoryType(self.bTrial)
if self.bTrial then
self.mbuildId = self.mapTrialBuild.nBuildId
else
self.mbuildId = PlayerData.Avg:GetCachedBuildId()
end
if self.mbuildId and self.mbuildId ~= 0 then
self.isHaveTeam = true
else
self.isHaveTeam = false
end
self:Refresh()
end
function RegionBossFormationCtrl:OnBtnClick_Start(btn)
if self.bStartBattle == true then
return
end
self.bStartBattle = true
if self.nType == AllEnum.RegionBossFormationType.RegionBoss then
self:OpenRegionBoss()
elseif self.nType == AllEnum.RegionBossFormationType.TravelerDuel then
self:OpenTravelerDuel()
elseif self.nType == AllEnum.RegionBossFormationType.DailyInstance then
self:OpenDailyInstance()
elseif self.nType == AllEnum.RegionBossFormationType.InfinityTower then
self:OpenInfinityTower()
elseif self.nType == AllEnum.RegionBossFormationType.EquipmentInstance then
self:OpenEquipmentInstance()
elseif self.nType == AllEnum.RegionBossFormationType.Story then
self:OpenStoryBattle()
elseif self.nType == AllEnum.RegionBossFormationType.ScoreBoss then
local callBack = function(otherLevelId)
if #otherLevelId == 0 then
self:OpenScoreBossBattle()
NovaAPI.SetEntryLevelFade(true)
else
local ConfirmCb = function()
self:OpenScoreBossBattle()
NovaAPI.SetEntryLevelFade(true)
end
local CancelCb = function()
end
EventManager.Hit(EventId.OpenPanel, PanelId.ScoreBossClearBD, otherLevelId, ConfirmCb, CancelCb)
return
end
end
PlayerData.ScoreBoss:JudgeOtherLevelHaveSameChar(self.selLvId, self.mbuildId, callBack)
elseif self.nType == AllEnum.RegionBossFormationType.SkillInstance then
self:OpenSkillInstance()
elseif self.nType == AllEnum.RegionBossFormationType.WeeklyCopies then
self:OpenWeeklyCopies()
elseif self.nType == AllEnum.RegionBossFormationType.ActivityLevels then
self:OpenActivityLevelsBattle()
end
NovaAPI.SetEntryLevelFade(true)
end
function RegionBossFormationCtrl:OnEvent_Back(nPanelId)
if self._panel._nPanelId ~= nPanelId then
return
end
PlayerData.TravelerDuel:SetSelBuildId(0)
PlayerData.DailyInstance:SetSelBuildId(0)
if self.mapTrialBuild then
PlayerData.Build:DeleteTrialBuild()
end
local OpenCallback = function()
EventManager.Hit(EventId.CloesCurPanel)
end
EventManager.Hit(EventId.SetTransition, 5, OpenCallback)
end
function RegionBossFormationCtrl:OnEvent_BackHome(nPanelId)
if self._panel._nPanelId ~= nPanelId then
return
end
if self.nType == AllEnum.RegionBossFormationType.InfinityTower then
PlayerData.InfinityTower:SetPageState(1)
end
PlayerData.TravelerDuel:SetSelBuildId(0)
PlayerData.DailyInstance:SetSelBuildId(0)
if self.mapTrialBuild then
PlayerData.Build:DeleteTrialBuild()
end
local OpenCallback = function()
PanelManager.Home()
end
EventManager.Hit(EventId.SetTransition, 5, OpenCallback)
end
function RegionBossFormationCtrl:OnEvent_OpenMessageBox()
self.bStartBattle = false
end
return RegionBossFormationCtrl
@@ -0,0 +1,17 @@
local RegionBossFormationPanel = class("RegionBossFormationPanel", BasePanel)
RegionBossFormationPanel._tbDefine = {
{
sPrefabPath = "RegionBossFormationEx/RegionBossFormationPanel.prefab",
sCtrlName = "Game.UI.RegionBossFormationEx.RegionBossFormationCtrl"
}
}
function RegionBossFormationPanel:Awake()
local nId = PlayerData.RogueBoss:GetRegionBossId()
end
function RegionBossFormationPanel:OnEnable(bPlayFadeIn)
end
function RegionBossFormationPanel:OnDisable()
end
function RegionBossFormationPanel:OnDestroy()
end
return RegionBossFormationPanel