Major Update - 2.0.0.143

EN: 2.0.0.143
CN: 2.0.0.142
JP: 2.0.0.145
KR: 2.0.0.150
This commit is contained in:
SL1900
2026-10-20 13:00:00 +09:00
parent 4bcada6061
commit 08b515afd9
1773 changed files with 1095195 additions and 65670 deletions
@@ -7,7 +7,16 @@ BuildSimpleDiscItem._mapNodeConfig = {
BuildSimpleDiscItem._mapEventConfig = {}
BuildSimpleDiscItem._mapRedDotConfig = {}
function BuildSimpleDiscItem:Init(nDiscId)
local mapData = ConfigTable.GetData("Disc", nDiscId)
local mapData = ConfigTable.GetData("Disc", nDiscId, true)
if mapData == nil then
mapData = ConfigTable.GetData("TrialDisc", nDiscId)
if mapData ~= nil then
nDiscId = mapData.DiscId
mapData = ConfigTable.GetData("Disc", nDiscId)
else
return
end
end
local mapCfg = ConfigTable.GetData_Item(nDiscId)
self:SetPngSprite(self._mapNode.imgIcon, mapCfg.Icon .. AllEnum.OutfitIconSurfix.ListGrid)
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[mapCfg.Rarity]
@@ -47,10 +47,10 @@ function PotentialListItemCtrl:GetAllPotentialCount(nCharId, bMain)
end
return nAllCount
end
function PotentialListItemCtrl:Init(nCharId, nCount, tbPotential, goPotential, bMain, bRankPreview)
function PotentialListItemCtrl:Init(nCharId, nCount, tbPotential, goPotential, bMain, bRankPreview, nSkinId)
self.nCharId = nCharId
local charCfg = ConfigTable.GetData_Character(nCharId)
local nCharSkinId = PlayerData.Char:GetCharSkinId(nCharId)
local nCharSkinId = nSkinId or PlayerData.Char:GetCharSkinId(nCharId)
local charSkinCfg = ConfigTable.GetData_CharacterSkin(nCharSkinId)
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[charCfg.Grade]
self:SetPngSprite(self._mapNode.imgHead, charSkinCfg.Icon, AllEnum.CharHeadIconSurfix.XXL)
@@ -155,6 +155,15 @@ local FilterGradeIdx = {
btn_FilterGradeB = 1,
btn_FilterGradeC = 0
}
function StarTowerBuildBriefCtrl:GetEditableBuildCount()
local nCount = 0
for _, mapBuild in ipairs(self._tbAllBuild) do
if PlayerData.Build:IsBuildEditable(mapBuild.nBuildId) then
nCount = nCount + 1
end
end
return nCount
end
function StarTowerBuildBriefCtrl:RefreshList()
local isDirty = PlayerData.Filter:IsDirtyByOption(self._panel.tbOption)
self._mapNode.imgFilterChoose:SetActive(isDirty)
@@ -177,7 +186,7 @@ function StarTowerBuildBriefCtrl:RefreshList()
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")))
NovaAPI.SetTMPText(self._mapNode.txt_BuildCount, string.format("%d/%d", self:GetEditableBuildCount(), ConfigTable.GetConfigNumber("StarTowerBuildNumberMax")))
end
function StarTowerBuildBriefCtrl:FilterAndSortBuildData()
local ret = {}
@@ -273,6 +282,18 @@ function StarTowerBuildBriefCtrl:FilterAndSortBuildData()
end
table.sort(ret, sortByScore)
end
if self.nSortype == SortType.Score then
PlayerData.Build:PrioritizeLimitedTrialBuilds(ret, function(mapBuild)
if self.nPanelState == PanelState.Delete then
return self.mapDelete[mapBuild.nBuildId] ~= nil and 1 or 0
elseif self.nPanelState == PanelState.Preference then
local bCheckIn = self.mapPreferenceCheckIn[mapBuild.nBuildId] ~= nil
local bCheckOut = self.mapPreferenceCheckOut[mapBuild.nBuildId] ~= nil
return (not (not mapBuild.bPreference or bCheckOut) or not mapBuild.bPreference and bCheckIn) and 1 or 0
end
return 0
end)
end
return ret
end
function StarTowerBuildBriefCtrl:RefreshBuildGrid(goGrid, gridIndex)
@@ -289,6 +310,9 @@ function StarTowerBuildBriefCtrl:RefreshBuildGrid(goGrid, gridIndex)
end
function StarTowerBuildBriefCtrl:OnBuildGridLock(nIdx, itemCtrl)
local mapBuild = self.tbCurShow[nIdx]
if not PlayerData.Build:IsBuildEditable(mapBuild.nBuildId) then
return
end
local callback = function()
itemCtrl:SetLockState(mapBuild.bLock)
if self.nPanelState == PanelState.Delete and mapBuild.bLock and self.mapDelete[mapBuild.nBuildId] ~= nil then
@@ -306,6 +330,9 @@ function StarTowerBuildBriefCtrl:OnBuildGridPreference(nIdx, itemCtrl)
return
end
local mapBuild = self.tbCurShow[nIdx]
if not PlayerData.Build:IsBuildEditable(mapBuild.nBuildId) then
return
end
local tbPreferenceCheckIn = {}
local tbPreferenceCheckOut = {}
local callback = function()
@@ -320,6 +347,9 @@ function StarTowerBuildBriefCtrl:OnBuildGridPreference(nIdx, itemCtrl)
end
function StarTowerBuildBriefCtrl:OnBtnClickGrid(nIdx, itemCtrl)
local mapBuild = self.tbCurShow[nIdx]
if self.nPanelState ~= PanelState.Normal and not PlayerData.Build:IsBuildEditable(mapBuild.nBuildId) then
return
end
if self.nPanelState == PanelState.Delete then
if mapBuild.bLock then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BUILD_01"))
@@ -356,7 +386,7 @@ function StarTowerBuildBriefCtrl:OnBtnClickGrid(nIdx, itemCtrl)
itemCtrl:SetSelectPreferenceState(true)
self.nPreferenceCount = self.nPreferenceCount + 1
end
NovaAPI.SetTMPText(self._mapNode.txt_PreferenceCount, string.format("%d/%d", self.nPreferenceCount, #self._tbAllBuild))
NovaAPI.SetTMPText(self._mapNode.txt_PreferenceCount, string.format("%d/%d", self.nPreferenceCount, self:GetEditableBuildCount()))
else
local callback = function(mapData)
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerBuildDetail, mapData)
@@ -386,12 +416,12 @@ function StarTowerBuildBriefCtrl:SetDeleteResult()
self._mapNode.rtResultTitle.gameObject:SetActive(true)
self._mapNode.result1:SetItem(self.nDeleteReturnId, nil, nCoin, nil, nil, nil, nil, true)
end
NovaAPI.SetTMPText(self._mapNode.txt_SelectCount, string.format("%d/%d", self.nSelectedDeleteCount, #self._tbAllBuild))
NovaAPI.SetTMPText(self._mapNode.txt_SelectCount, string.format("%d/%d", self.nSelectedDeleteCount, self:GetEditableBuildCount()))
end
function StarTowerBuildBriefCtrl:CalPreferenceCount()
local ret = 0
for _, mapBuild in ipairs(self._tbAllBuild) do
if mapBuild.bPreference then
if PlayerData.Build:IsBuildEditable(mapBuild.nBuildId) and mapBuild.bPreference then
ret = ret + 1
end
end
@@ -428,7 +458,7 @@ function StarTowerBuildBriefCtrl:OpenConfirmHint()
end
end
self:OnBtnClick_CloseDelete()
PlayerData.Build:GetAllBuildBriefData(GetDataCallback)
PlayerData.Build:GetSelectableBuildBriefData(GetDataCallback, nil, true)
end
local tbDelete = {}
for key, _ in pairs(self.mapDelete) do
@@ -507,7 +537,7 @@ function StarTowerBuildBriefCtrl:OnEnable()
self._tbAllBuild = tbBuildData
self:RefreshList()
end
PlayerData.Build:GetAllBuildBriefData(GetDataCallback)
PlayerData.Build:GetSelectableBuildBriefData(GetDataCallback, nil, true)
end
function StarTowerBuildBriefCtrl:OnDisable()
self.mapPreferenceCheckIn = {}
@@ -581,7 +611,7 @@ function StarTowerBuildBriefCtrl:OnBtnClick_SelectPreference()
self.mapPreferenceCheckIn = {}
self.mapPreferenceCheckOut = {}
self.nPreferenceCount = self:CalPreferenceCount()
NovaAPI.SetTMPText(self._mapNode.txt_PreferenceCount, string.format("%d/%d", self.nPreferenceCount, #self._tbAllBuild))
NovaAPI.SetTMPText(self._mapNode.txt_PreferenceCount, string.format("%d/%d", self.nPreferenceCount, self:GetEditableBuildCount()))
self:RefreshList()
self._mapNode.PreferenceContent:SetActive(true)
end
@@ -639,7 +669,7 @@ function StarTowerBuildBriefCtrl:OnBtnClick_FastSelectDeleteBuild(btn)
return
end
for _, mapBuild in ipairs(self.tbCurShow) do
if mapBuild.mapRank.Rarity >= 4 - filterGrade and not mapBuild.bLock and self.mapDelete[mapBuild.nBuildId] == nil then
if PlayerData.Build:IsBuildEditable(mapBuild.nBuildId) and mapBuild.mapRank.Rarity >= 4 - filterGrade and not mapBuild.bLock and self.mapDelete[mapBuild.nBuildId] == nil then
self.mapDelete[mapBuild.nBuildId] = 0
self.nSelectedDeleteCount = self.nSelectedDeleteCount + 1
end
@@ -55,6 +55,10 @@ StarTowerBuildBriefItem._mapNodeConfig = {
},
btnExport = {sComponentName = "UIButton"},
objUnavailable = {},
imgUnavailableMask = {
sNodeName = "objUnavailable",
sComponentName = "Image"
},
objUnavailableIcon = {sComponentName = "Image"},
imgRareScoreMask = {sComponentName = "Image"},
texUnavailable = {
@@ -79,14 +83,15 @@ StarTowerBuildBriefItem._mapNodeConfig = {
}
}
StarTowerBuildBriefItem._mapEventConfig = {}
function StarTowerBuildBriefItem:RefreshGrid(mapData, nPanelState, bSelectDelete, bCheckOut, bCheckIn, nType, bTrial)
function StarTowerBuildBriefItem:RefreshGrid(mapData, nPanelState, bSelectDelete, bCheckOut, bCheckIn, nType)
self._mapData = mapData
self._nType = nType
self._bTrial = bTrial
self._bLimitedTrialBuild = mapData.nBuildSource == AllEnum.BuildSource.LimitedTrial
self._bLimitedTrialBuildLocked = self._bLimitedTrialBuild and not PlayerData.Build:IsLimitedTrialBuildAllowedType(self._nType)
self:RefreshInfo()
self:RefreshChar()
self:RefreshDisc()
self._mapNode.imgLabel2:SetActive(bTrial == true)
self._mapNode.imgLabel2:SetActive(self._bLimitedTrialBuild)
if nPanelState == PanelState.Delete then
self._mapNode.img_SelectDelete:SetActive(bSelectDelete)
self._mapNode.img_SelectPreference:SetActive(false)
@@ -115,7 +120,7 @@ function StarTowerBuildBriefItem:RefreshGrid(mapData, nPanelState, bSelectDelete
bShowUnavailable = self._mapData.bBuildUsed or self._mapData.bCharUsed
end
self._mapNode.objUnavailable:SetActive(bShowUnavailable)
self._mapNode.imgUnavailable:SetActive(self._mapData.isCanUse)
self._mapNode.imgUnavailable:SetActive(false)
self._mapNode.imgBuildUsed:SetActive(self._mapData.bBuildUsed)
self._mapNode.imgCharUsed:SetActive(self._mapData.bCharUsed and not self._mapData.bBuildUsed)
local sKey = self._nType == AllEnum.RegionBossFormationType.InfinityTower and "InfinityTower_Build_NotAvailable" or "VampireFormation_Unable"
@@ -123,12 +128,31 @@ function StarTowerBuildBriefItem:RefreshGrid(mapData, nPanelState, bSelectDelete
else
self._mapNode.objUnavailable:SetActive(false)
end
if self._bLimitedTrialBuildLocked then
self._mapNode.objUnavailable:SetActive(true)
self._mapNode.imgUnavailable:SetActive(true)
self._mapNode.imgBuildUsed:SetActive(false)
self._mapNode.imgCharUsed:SetActive(false)
NovaAPI.SetTMPText(self._mapNode.texUnavailable, ConfigTable.GetUIText("LimitedTrialBuild_UnableTip"))
end
end
function StarTowerBuildBriefItem:RefreshInfo()
local sScore = "Icon/BuildRank/BuildRank_" .. self._mapData.mapRank.Id
local sFrame = AllEnum.FrameType_New.BuildRankDB .. AllEnum.FrameColor_New[self._mapData.mapRank.Rarity]
self:SetPngSprite(self._mapNode.imgRareScore, sScore)
self:SetAtlasSprite(self._mapNode.imgRareFrame, "12_rare", sFrame)
local nBuildRank = self._mapData.mapRank.Id
local nMaskIndex = 1
if 31 <= nBuildRank then
nMaskIndex = 5
elseif 21 <= nBuildRank then
nMaskIndex = 4
elseif 11 <= nBuildRank then
nMaskIndex = 3
elseif 6 <= nBuildRank then
nMaskIndex = 2
end
self:SetAtlasSprite(self._mapNode.imgUnavailableMask, "08_db", "db_common_bd_mask_0" .. nMaskIndex)
if self._mapData.sName == "" or self._mapData.sName == nil then
NovaAPI.SetTMPText(self._mapNode.txtBuildName, ConfigTable.GetUIText("RoguelikeBuild_EmptyBuildName"))
else
@@ -140,7 +164,7 @@ end
function StarTowerBuildBriefItem:RefreshChar()
for i = 1, 3 do
local nCharTid = self._mapData.tbChar[i].nTid
local nCharSkinId = PlayerData.Char:GetCharSkinId(nCharTid)
local nCharSkinId = PlayerData.Build:GetBuildCharSkinId(self._mapData, self._mapData.tbChar[i])
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
local mapCharCfg = ConfigTable.GetData_Character(nCharTid)
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[mapCharCfg.Grade]
@@ -186,6 +210,10 @@ end
function StarTowerBuildBriefItem:OnRelease()
end
function StarTowerBuildBriefItem:OnBtnClick_Grid(btn)
if self._bLimitedTrialBuildLocked then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("LimitedTrialBuild_UnableTip"))
return
end
if self._nType then
if self._nType == AllEnum.RegionBossFormationType.InfinityTower or self._nType == AllEnum.RegionBossFormationType.Vampire then
if not self._mapData.isCanUse then
@@ -39,8 +39,8 @@ StarTowerBuildContentCtrl._mapNodeConfig = {
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Build_DiscSkill_Title"
},
imgNote = {nCount = 12, sComponentName = "Image"},
txtNoteCount = {nCount = 12, sComponentName = "TMP_Text"},
imgNote = {nCount = 13, sComponentName = "Image"},
txtNoteCount = {nCount = 13, sComponentName = "TMP_Text"},
imgSkillEmpty = {},
rtSkill = {},
txtSkillEmpty = {
@@ -96,14 +96,17 @@ StarTowerBuildContentCtrl._mapEventConfig = {
SelectDepotPotential = "OnEvent_SelectDepotPotential"
}
StarTowerBuildContentCtrl._mapRedDotConfig = {}
function StarTowerBuildContentCtrl:Refresh(mapBuild)
function StarTowerBuildContentCtrl:Refresh(mapBuild, nDefaultTab)
self.mapBuild = mapBuild
self:InitDisc()
self:InitPotential()
self:SetDefaultTab()
if nDefaultTab == nil then
nDefaultTab = 1
end
self:SetDefaultTab(nDefaultTab)
end
function StarTowerBuildContentCtrl:SetDefaultTab()
self.nCurTab = 1
function StarTowerBuildContentCtrl:SetDefaultTab(nDefaultTab)
self.nCurTab = nDefaultTab
for i = 1, 2 do
self._mapNode.imgOn[i]:SetActive(i == self.nCurTab)
self._mapNode.imgOff[i]:SetActive(i ~= self.nCurTab)
@@ -120,7 +123,8 @@ function StarTowerBuildContentCtrl:InitPotential()
v.gameObject:SetActive(0 < nCount)
if 0 < nCount then
bEmpty = false
v:Init(tbChar[k].nTid, tbChar[k].nPotentialCount, tbPotential[tbChar[k].nTid], self._mapNode.PotentialDepotItem, k == 1, self.mapBuild.bRankPreview)
local nCharSkinId = PlayerData.Build:GetBuildCharSkinId(self.mapBuild, tbChar[k])
v:Init(tbChar[k].nTid, tbChar[k].nPotentialCount, tbPotential[tbChar[k].nTid], self._mapNode.PotentialDepotItem, k == 1, self.mapBuild.bRankPreview, nCharSkinId)
end
end
self._mapNode.goEmptyPotential.gameObject:SetActive(bEmpty)
@@ -153,7 +157,7 @@ function StarTowerBuildContentCtrl:InitDisc()
end
local nNoteCount = #tbNote
self.tbShowNote = {}
for i = 1, 12 do
for i = 1, 13 do
self._mapNode.imgNote[i].gameObject:SetActive(i <= nNoteCount)
if i <= nNoteCount then
self.tbShowNote[tbNote[i]] = self.mapBuild.tbNotes[tbNote[i]] or 0
@@ -168,13 +172,7 @@ function StarTowerBuildContentCtrl:InitDisc()
local tbDisc = self.mapBuild.tbDisc
for k, nId in ipairs(tbDisc) do
if k <= 3 then
local mapDisc = PlayerData.Disc:GetDiscById(nId)
if mapDisc == nil then
mapDisc = PlayerData.Disc:GetTrialDiscById(nId)
end
if mapDisc == nil then
mapDisc = PlayerData.Disc:GetRankDetailDisc(nId)
end
local mapDisc = PlayerData.Build:GetBuildDiscByData(self.mapBuild, nId)
if mapDisc ~= nil then
local tbSubSkill = mapDisc:GetAllSubSkill(self.mapBuild.tbNotes)
for nSkillIndex, v in ipairs(tbSubSkill) do
@@ -233,6 +231,7 @@ function StarTowerBuildContentCtrl:ChangeTab(nIndex)
self.nCurTab = nIndex
self._mapNode.svPotential:SetActive(self.nCurTab == 1)
self._mapNode.svDisc:SetActive(self.nCurTab == 2)
EventManager.Hit("StarTowerBuildContent_ChangeTab", nIndex)
end
function StarTowerBuildContentCtrl:Awake()
self._mapNode.PotentialDepotItem.gameObject:SetActive(false)
@@ -41,21 +41,33 @@ StarTowerBuildDetailCtrl._mapNodeConfig = {
},
ContentList = {
sCtrlName = "Game.UI.StarTower.Build.StarTowerBuildContentCtrl"
},
txtEdit = {sComponentName = "TMP_Text"},
BtnEntrance = {sComponentName = "Transform"},
EditNml = {
sComponentName = "UIButton",
callback = "OnBtnClick_EditBuild"
},
EditInvalid = {
sComponentName = "UIButton",
callback = "OnBtnClick_EditBuild"
}
}
StarTowerBuildDetailCtrl._mapEventConfig = {}
StarTowerBuildDetailCtrl._mapEventConfig = {
StarTowerBuildContent_ChangeTab = "OnEvent_ContentChangeTab"
}
function StarTowerBuildDetailCtrl:InitPanel()
if not self.mapBuild.bDetail then
print("build数据错误 无详细数据")
return
end
self._mapNode.BuildDetail:Refresh(self.mapBuild)
self._mapNode.ContentList:Refresh(self.mapBuild)
self._mapNode.btn_Preference.gameObject:SetActive(self.mapBuild.bTrial ~= true)
self._mapNode.btn_Lock.gameObject:SetActive(self.mapBuild.bTrial ~= true)
self._mapNode.TMPBuildSaveTime.gameObject:SetActive(self.mapBuild.bTrial ~= true)
self._mapNode.btnDelete.gameObject:SetActive(self.mapBuild.bTrial ~= true)
self._mapNode.btnRename.gameObject:SetActive(self.mapBuild.bTrial ~= true)
local bEditable = PlayerData.Build:IsBuildEditable(self.mapBuild.nBuildId)
self._mapNode.btn_Preference.gameObject:SetActive(bEditable)
self._mapNode.btn_Lock.gameObject:SetActive(bEditable)
self._mapNode.TMPBuildSaveTime.gameObject:SetActive(bEditable)
self._mapNode.btnDelete.gameObject:SetActive(bEditable)
self._mapNode.btnRename.gameObject:SetActive(bEditable)
self._mapNode.BtnEntrance.gameObject:SetActive(not PlayerData.Build:IsLimitedTrialBuild(self.mapBuild.nBuildId))
if self.mapBuild.bPreference ~= nil then
self._mapNode.btn_PreferenceIcon.interactable = self.mapBuild.bPreference
NovaAPI.SetTMPColor(self._mapNode.txtLike, self.mapBuild.bPreference and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
@@ -65,9 +77,13 @@ function StarTowerBuildDetailCtrl:InitPanel()
NovaAPI.SetTMPText(self._mapNode.txtBuildLock, self.mapBuild.bLock and ConfigTable.GetUIText("RoguelikeBuild_Save_Lock") or ConfigTable.GetUIText("RoguelikeBuild_Save_Unlock"))
NovaAPI.SetTMPColor(self._mapNode.txtBuildLock, self.mapBuild.bLock and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
end
if self.mapBuild.bTrial ~= true then
if bEditable then
NovaAPI.SetTMPText(self._mapNode.TMPBuildSaveTime, string.format("<color=#5e89b4>保存时间:</color>%s", os.date("%Y/%m/%d %H:%M", math.floor(self.mapBuild.nBuildId / 1.0E9))))
end
self._panel.nCachedIdx = (self._panel.nCachedIdx == nil or self._panel.nCachedIdx == 0) and 1 or self._panel.nCachedIdx
self:OnEvent_ContentChangeTab(self._panel.nCachedIdx)
self._mapNode.BuildDetail:Refresh(self.mapBuild)
self._mapNode.ContentList:Refresh(self.mapBuild, self._panel.nCachedIdx)
end
function StarTowerBuildDetailCtrl:OpenConfirmHint()
local nCoin = math.floor(math.min(math.max(self.mapBuild.nScore / tonumber(self.tbCoinRate[1]), tonumber(self.tbCoinRate[2])), tonumber(self.tbCoinRate[3])))
@@ -127,6 +143,9 @@ end
function StarTowerBuildDetailCtrl:OnRelease()
end
function StarTowerBuildDetailCtrl:OnBtnClick_Preference(btn)
if not PlayerData.Build:IsBuildEditable(self.mapBuild.nBuildId) then
return
end
local tbPreferenceCheckIn = {}
local tbPreferenceCheckOut = {}
local callback = function()
@@ -141,6 +160,9 @@ function StarTowerBuildDetailCtrl:OnBtnClick_Preference(btn)
PlayerData.Build:SetBuildPreference(tbPreferenceCheckIn, tbPreferenceCheckOut, callback)
end
function StarTowerBuildDetailCtrl:OnBtnClick_Lock(btn)
if not PlayerData.Build:IsBuildEditable(self.mapBuild.nBuildId) then
return
end
local callback = function()
self._mapNode.btn_LockIcon.interactable = self.mapBuild.bLock
NovaAPI.SetTMPText(self._mapNode.txtBuildLock, self.mapBuild.bLock and ConfigTable.GetUIText("RoguelikeBuild_Save_Lock") or ConfigTable.GetUIText("RoguelikeBuild_Save_Unlock"))
@@ -149,6 +171,9 @@ function StarTowerBuildDetailCtrl:OnBtnClick_Lock(btn)
PlayerData.Build:ChangeBuildLock(self.mapBuild.nBuildId, not self.mapBuild.bLock, callback)
end
function StarTowerBuildDetailCtrl:OnBtnClick_DeleteBuild(btn)
if not PlayerData.Build:IsBuildEditable(self.mapBuild.nBuildId) then
return
end
if self.mapBuild.bLock then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BUILD_01"))
return
@@ -156,6 +181,9 @@ function StarTowerBuildDetailCtrl:OnBtnClick_DeleteBuild(btn)
self:OpenConfirmHint()
end
function StarTowerBuildDetailCtrl:OnBtnClick_Rename(btn)
if not PlayerData.Build:IsBuildEditable(self.mapBuild.nBuildId) then
return
end
local callback = function(sName)
self._mapNode.BuildDetail:SetName(sName)
end
@@ -170,4 +198,66 @@ function StarTowerBuildDetailCtrl:OnBtnClick_CharInfo(btn, nIndex)
}
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, PanelId.CharInfo, nCharTid, tbChar)
end
function StarTowerBuildDetailCtrl:OnBtnClick_EditBuild()
if PlayerData.Build:IsLimitedTrialBuild(self.mapBuild.nBuildId) then
return
end
if self.mapBuild.bLock then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BuildModifier_ValidTips5"))
return
end
local nScoreFixedable = ConfigTable.GetConfigNumber("BuildModifierScoreMin")
if nScoreFixedable > self.mapBuild.nScore then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BuildModifier_ValidTips2"))
return
end
local nIdx = self._mapNode.ContentList.nCurTab
if nIdx == 1 then
local nModifierState = self.mapBuild and self.mapBuild.nModifierState
local bPotentialModifiable = nModifierState == AllEnum.BuildModifierState.NotModified or nModifierState == AllEnum.BuildModifierState.NoteModified
local nModifiyCount = bPotentialModifiable and 1 or 0
if nModifiyCount < 1 then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BuildModifier_ValidTips3"))
return
end
EventManager.Hit(EventId.OpenPanel, PanelId.BuildModifierPotentialPanel, self.mapBuild.nBuildId)
else
local nModifierState = self.mapBuild and self.mapBuild.nModifierState
local bNoteModifiable = nModifierState == AllEnum.BuildModifierState.NotModified or nModifierState == AllEnum.BuildModifierState.PotentialModified
local nModifiyCount = bNoteModifiable and 1 or 0
if nModifiyCount < 1 then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BuildModifier_ValidTips4"))
return
end
EventManager.Hit(EventId.OpenPanel, PanelId.BuildModifierMusicPanel, self.mapBuild.nBuildId)
end
end
function StarTowerBuildDetailCtrl:OnEvent_ContentChangeTab(nIdx)
self._panel.nCachedIdx = nIdx
local sEdit = ""
local nScoreFixedable = ConfigTable.GetConfigNumber("BuildModifierScoreMin")
if nScoreFixedable > self.mapBuild.nScore then
self._mapNode.EditNml.gameObject:SetActive(false)
self._mapNode.EditInvalid.gameObject:SetActive(true)
sEdit = ConfigTable.GetUIText("BuildModifier_ValidTips1")
NovaAPI.SetTMPText(self._mapNode.txtEdit, sEdit)
return
end
if nIdx == 1 then
local nModifierState = self.mapBuild and self.mapBuild.nModifierState
local bPotentialModifiable = nModifierState == AllEnum.BuildModifierState.NotModified or nModifierState == AllEnum.BuildModifierState.NoteModified
local nModifiyCount = bPotentialModifiable and 1 or 0
self._mapNode.EditNml.gameObject:SetActive(0 < nModifiyCount)
self._mapNode.EditInvalid.gameObject:SetActive(nModifiyCount == 0)
sEdit = orderedFormat(ConfigTable.GetUIText("BuildDetail_PotentialModifiyTitle"), nModifiyCount)
else
local nModifierState = self.mapBuild and self.mapBuild.nModifierState
local bNoteModifiable = nModifierState == AllEnum.BuildModifierState.NotModified or nModifierState == AllEnum.BuildModifierState.PotentialModified
local nModifiyCount = bNoteModifiable and 1 or 0
self._mapNode.EditNml.gameObject:SetActive(0 < nModifiyCount)
self._mapNode.EditInvalid.gameObject:SetActive(nModifiyCount == 0)
sEdit = orderedFormat(ConfigTable.GetUIText("BuildDetail_NoteModifiyTitle"), nModifiyCount)
end
NovaAPI.SetTMPText(self._mapNode.txtEdit, sEdit)
end
return StarTowerBuildDetailCtrl
@@ -61,14 +61,15 @@ StarTowerBuildDetailItemCtrl._mapEventConfig = {}
StarTowerBuildDetailItemCtrl._mapRedDotConfig = {}
function StarTowerBuildDetailItemCtrl:Refresh(mapData)
self.mapBuild = mapData
if self.mapBuild.bTrial == true then
self._mapNode.btnLeader.interactable = false
for k, v in pairs(self._mapNode.btnSub) do
v.interactable = false
end
for k, v in pairs(self._mapNode.btnDiscItem) do
v.interactable = false
end
local nBuildSource = PlayerData.Build:GetBuildSourceByData(mapData)
self.bTrialBuild = nBuildSource == AllEnum.BuildSource.Trial or nBuildSource == AllEnum.BuildSource.LimitedTrial or mapData.bTrial == true
local bInteractable = self.mapBuild.bTrial ~= true
self._mapNode.btnLeader.interactable = not self.bTrialBuild
for _, btnSub in pairs(self._mapNode.btnSub) do
btnSub.interactable = not self.bTrialBuild
end
for _, btnDiscItem in pairs(self._mapNode.btnDiscItem) do
btnDiscItem.interactable = bInteractable
end
self:RefreshInfo()
self:RefreshChar()
@@ -92,7 +93,7 @@ function StarTowerBuildDetailItemCtrl:RefreshChar()
local nCharTid = self.mapBuild.tbChar[i].nTid
local mapCharCfg = ConfigTable.GetData_Character(nCharTid)
if mapCharCfg ~= nil then
local nCharSkinId = PlayerData.Char:GetCharSkinId(nCharTid)
local nCharSkinId = PlayerData.Build:GetBuildCharSkinId(self.mapBuild, self.mapBuild.tbChar[i])
if self.mapBuild.bRankPreview then
nCharSkinId = mapCharCfg.DefaultSkinId
end
@@ -137,93 +138,54 @@ function StarTowerBuildDetailItemCtrl:OnBtnClick_Attr()
end
function StarTowerBuildDetailItemCtrl:OnBtnClick_Disc(btn, nIndex)
local nDiscId = self.mapBuild.tbDisc[nIndex]
if nDiscId == nil or nDiscId == 0 then
return
end
if self.mapBuild.bRankPreview == true then
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSample, nDiscId)
elseif self.mapBuild.bTrial == true then
local mapDiscData = PlayerData.Disc:GetDiscById(nDiscId)
if mapDiscData == nil then
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSample, nDiscId)
else
EventManager.Hit(EventId.OpenPanel, PanelId.Disc, nDiscId, {nDiscId})
end
elseif self.bTrialBuild then
self:OnBtnClick_DiscDetail(btn, nIndex)
elseif PlayerData.Disc:GetDiscById(nDiscId) ~= nil then
EventManager.Hit(EventId.OpenPanel, PanelId.Disc, nDiscId, self.mapBuild.tbDisc)
end
end
function StarTowerBuildDetailItemCtrl:OpenCharDetail(nIndex)
if self.bTrialBuild then
return
end
local nCharTid = self.mapBuild.tbChar[nIndex].nTid
if self.mapBuild.bRankPreview == true then
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, nCharTid)
else
local nIdx = 0
local nDiscId = 0
local tbAllDisc = {}
for _, nId in ipairs(self.mapBuild.tbDisc) do
nIdx = nIdx + 1
if nIdx == nIndex then
nDiscId = nId
end
table.insert(tbAllDisc, nId)
end
if nDiscId ~= 0 then
local mapDisc = PlayerData.Disc:GetDiscById(nDiscId)
if mapDisc ~= nil then
EventManager.Hit(EventId.OpenPanel, PanelId.Disc, nDiscId, tbAllDisc)
end
local tbCharId = {}
for _, mapChar in ipairs(self.mapBuild.tbChar) do
table.insert(tbCharId, mapChar.nTid)
end
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, PanelId.CharInfo, nCharTid, tbCharId, true)
end
end
function StarTowerBuildDetailItemCtrl:OnBtnClick_Leader()
local nCharTid = self.mapBuild.tbChar[1].nTid
if self.mapBuild.bRankPreview == true then
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, nCharTid)
elseif self.mapBuild.bTrial == true then
local mapCharCfg = PlayerData.Char:GetCharDataByTid(nCharTid)
if mapCharCfg == nil then
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, nCharTid)
else
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, PanelId.CharInfo, nCharTid, {nCharTid})
end
else
local tbCharId = {}
for _, v in ipairs(self.mapBuild.tbChar) do
table.insert(tbCharId, v.nTid)
end
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, PanelId.CharInfo, tbCharId[1], tbCharId, true)
end
self:OpenCharDetail(1)
end
function StarTowerBuildDetailItemCtrl:OnBtnClick_Sub(btn, nIndex)
local nCharTid = self.mapBuild.tbChar[nIndex + 1].nTid
if self.mapBuild.bRankPreview == true then
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, nCharTid)
elseif self.mapBuild.bTrial == true then
local mapCharCfg = PlayerData.Char:GetCharDataByTid(nCharTid)
if mapCharCfg == nil then
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, nCharTid)
else
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, PanelId.CharInfo, nCharTid, {nCharTid})
end
else
local tbCharId = {}
for _, v in ipairs(self.mapBuild.tbChar) do
table.insert(tbCharId, v.nTid)
end
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, PanelId.CharInfo, tbCharId[nIndex + 1], tbCharId, true)
end
self:OpenCharDetail(nIndex + 1)
end
function StarTowerBuildDetailItemCtrl:OnBtnClick_DiscDetail(btn, nIndex)
if self.mapBuild.bTrial == true then
local nDiscId = self.mapBuild.tbDisc[nIndex]
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSample, nDiscId)
return
end
local tbDisc = {}
local mapDiscData = {}
for i = 1, 6 do
tbDisc[i] = self.mapBuild.tbDisc[i] or 0
if 0 ~= tbDisc[i] then
local mapDisc = PlayerData.Disc:GetDiscById(tbDisc[i])
for nDiscIndex = 1, 6 do
local nDiscId = self.mapBuild.tbDisc[nDiscIndex] or 0
tbDisc[nDiscIndex] = nDiscId
if nDiscId ~= 0 then
local mapDisc = PlayerData.Build:GetBuildDiscByData(self.mapBuild, nDiscId)
if mapDisc == nil then
mapDisc = PlayerData.Disc:GetTrialDiscById(tbDisc[i])
printError("Build disc data missing: " .. tostring(self.mapBuild.nBuildId) .. ", " .. nDiscId)
return
end
if mapDisc == nil then
mapDisc = PlayerData.Disc:GetRankDetailDisc(tbDisc[i])
end
mapDiscData[tbDisc[i]] = mapDisc
mapDiscData[nDiscId] = mapDisc
end
end
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSkill, tbDisc, self.mapBuild.tbNotes, mapDiscData)
local nSelectedDiscId = nIndex and tbDisc[nIndex] or nil
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSkill, tbDisc, self.mapBuild.tbNotes, mapDiscData, nSelectedDiscId)
end
return StarTowerBuildDetailItemCtrl
@@ -160,7 +160,11 @@ function StarTowerBuildSaveCtrl:Awake()
if type(tbParam) == "table" then
self.bSuccess = tbParam[1]
self.mapBuild = tbParam[2]
self.bSweep = tbParam[4]
if type(tbParam[3]) == "function" then
self._fnCloseCallback = tbParam[3]
else
self.bSweep = tbParam[4]
end
end
end
function StarTowerBuildSaveCtrl:OnEnable()
@@ -182,6 +186,11 @@ function StarTowerBuildSaveCtrl:OnEnable()
cs_coroutine.start(wait)
end
function StarTowerBuildSaveCtrl:OnDisable()
if self._fnCloseCallback ~= nil then
local fnCloseCallback = self._fnCloseCallback
self._fnCloseCallback = nil
fnCloseCallback()
end
end
function StarTowerBuildSaveCtrl:OnDestroy()
end