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,639 @@
|
||||
local FormationDisc_ListCtrl = class("FormationDisc_ListCtrl", BaseCtrl)
|
||||
local newDayTime = UTILS.GetDayRefreshTimeOffset()
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
FormationDisc_ListCtrl._mapNodeConfig = {
|
||||
svListRoot = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
imgFilterEmpty = {},
|
||||
rtDiscContent = {sComponentName = "Transform"},
|
||||
txtFilterEmpty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Disc_Filter_Empty"
|
||||
},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ClearFormation"
|
||||
},
|
||||
txtCancel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "ClearFormation"
|
||||
},
|
||||
btnSure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Sure"
|
||||
},
|
||||
txtSure = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainLine_Select_Btn_Confirm"
|
||||
},
|
||||
btnFilter = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Filter"
|
||||
},
|
||||
btnSwitchSub = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SwitchSub"
|
||||
},
|
||||
txtSwitchSub = {sComponentName = "TMP_Text"},
|
||||
imgFilterChoose = {},
|
||||
goSortDropdown = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDropdownCtrl"
|
||||
},
|
||||
btnOrder = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Order"
|
||||
},
|
||||
imgArrowUpEnable = {},
|
||||
imgArrowUpDisable = {},
|
||||
imgArrowDownEnable = {},
|
||||
imgArrowDownDisable = {}
|
||||
}
|
||||
FormationDisc_ListCtrl._mapEventConfig = {
|
||||
[EventId.FilterConfirm] = "RefreshByFilter",
|
||||
ForamtionDown = "OnEvent_ForamtionDown",
|
||||
SelectTemplateDD = "OnEvent_SortRuleChange"
|
||||
}
|
||||
FormationDisc_ListCtrl._mapRedDotConfig = {}
|
||||
function FormationDisc_ListCtrl:Awake()
|
||||
self.tmpSelectDiscIdList = {}
|
||||
self.tbSortedDisc = {}
|
||||
self.tbDiscIdMain = {}
|
||||
self.tbDiscIdSub = {}
|
||||
self.tbGridCtrl = {}
|
||||
self.bOpen = false
|
||||
end
|
||||
function FormationDisc_ListCtrl:FadeIn()
|
||||
end
|
||||
function FormationDisc_ListCtrl:FadeOut()
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnEnable()
|
||||
self.tbSortCfg = {
|
||||
nSortType = PlayerData.Filter.nFormationDiscSrotType,
|
||||
bOrder = PlayerData.Filter.bFormationDiscOrder
|
||||
}
|
||||
local curSortIdx = 1
|
||||
local tbSortType = PlayerData.Char:GetCharSortType()
|
||||
for nIdx, nSortType in ipairs(tbSortType) do
|
||||
if self.tbSortCfg.nSortType == nSortType then
|
||||
curSortIdx = nIdx
|
||||
end
|
||||
end
|
||||
self._mapNode.goSortDropdown:SetList(PlayerData.Disc:GetDiscSortNameTextCfg(), curSortIdx - 1)
|
||||
self.tbAllDisc = PlayerData.Disc:GetAllDisc()
|
||||
self.tbCharId = PlayerData.Team:GetTeamCharId(self._panel.nTeamIndex)
|
||||
self.bOpen = true
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnDisable()
|
||||
self.bOpen = false
|
||||
self:UnBindAllGrids()
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnDestroy()
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnRelease()
|
||||
end
|
||||
function FormationDisc_ListCtrl:SortDisc()
|
||||
self.tbDiscId = {}
|
||||
self.selectMainDiscIdList = {}
|
||||
self.selectSubDiscIdList = {}
|
||||
local tbDiscIdMap = {}
|
||||
for k, v in pairs(self.tbSortedDisc) do
|
||||
tbDiscIdMap[v.nId] = v
|
||||
end
|
||||
for i = 1, #self.tbMainDisc do
|
||||
table.insert(self.selectMainDiscIdList, tbDiscIdMap[self.tbMainDisc[i]])
|
||||
end
|
||||
for i = 1, #self.tbSubDisc do
|
||||
table.insert(self.selectSubDiscIdList, tbDiscIdMap[self.tbSubDisc[i]])
|
||||
end
|
||||
UTILS.SortByPriority(self.tbSortedDisc, {
|
||||
AllEnum.DiscSortField[self.tbSortCfg.nSortType]
|
||||
}, PlayerData.Disc:GetDiscSortField(), self.tbSortCfg.bOrder)
|
||||
local tbMoveToFront = self._panel.nListType == 2 and self.selectSubDiscIdList or self.selectMainDiscIdList
|
||||
local tbMoveToBack = self._panel.nListType == 2 and self.selectMainDiscIdList or self.selectSubDiscIdList
|
||||
self.tbSortedDisc = self:MoveElementsToFront(self.tbSortedDisc, tbMoveToFront)
|
||||
self.tbSortedDisc = self:MoveElementsToBack(self.tbSortedDisc, tbMoveToBack)
|
||||
for i = 1, #self.tbSortedDisc do
|
||||
table.insert(self.tbDiscId, self.tbSortedDisc[i].nId)
|
||||
end
|
||||
end
|
||||
function FormationDisc_ListCtrl:MoveElementsToFront(sortedList, elementsToMove)
|
||||
local lookup = {}
|
||||
for i = 1, #elementsToMove do
|
||||
lookup[elementsToMove[i].nId] = true
|
||||
end
|
||||
local keep = {}
|
||||
for i = 1, #sortedList do
|
||||
if not lookup[sortedList[i].nId] then
|
||||
table.insert(keep, sortedList[i])
|
||||
end
|
||||
end
|
||||
for i = #elementsToMove, 1, -1 do
|
||||
table.insert(keep, 1, elementsToMove[i])
|
||||
end
|
||||
return keep
|
||||
end
|
||||
function FormationDisc_ListCtrl:MoveElementsToBack(sortedList, elementsToMove)
|
||||
local lookup = {}
|
||||
for i = 1, #elementsToMove do
|
||||
lookup[elementsToMove[i].nId] = true
|
||||
end
|
||||
local keep = {}
|
||||
for i = 1, #sortedList do
|
||||
if not lookup[sortedList[i].nId] then
|
||||
table.insert(keep, sortedList[i])
|
||||
end
|
||||
end
|
||||
for i = #elementsToMove, 1, -1 do
|
||||
table.insert(keep, elementsToMove[i])
|
||||
end
|
||||
return keep
|
||||
end
|
||||
function FormationDisc_ListCtrl:FilterDisc()
|
||||
self.tbSortedDisc = {}
|
||||
for _, data in pairs(self.tbAllDisc) do
|
||||
local mapCfg = ConfigTable.GetData("Disc", data.nId)
|
||||
if mapCfg.Available then
|
||||
local isSelect = table.indexof(self.tbMainDisc, data.nId) > 0 or 0 < table.indexof(self.tbSubDisc, data.nId)
|
||||
if isSelect then
|
||||
table.insert(self.tbSortedDisc, data)
|
||||
end
|
||||
if not isSelect then
|
||||
local isFilter = PlayerData.Filter:CheckFilterByDisc(data.nId)
|
||||
if isFilter then
|
||||
table.insert(self.tbSortedDisc, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function FormationDisc_ListCtrl:UnBindAllGrids()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function FormationDisc_ListCtrl:Refresh()
|
||||
local isDirty = PlayerData.Filter:IsDirty(AllEnum.OptionType.Disc)
|
||||
self._mapNode.imgFilterChoose:SetActive(isDirty)
|
||||
self:FilterDisc()
|
||||
self:SortDisc()
|
||||
self:RefreshOrderState()
|
||||
local nCurCount = #self.tbSortedDisc
|
||||
self._mapNode.imgFilterEmpty.gameObject:SetActive(isDirty and nCurCount == 0)
|
||||
if 0 < nCurCount then
|
||||
self._mapNode.svListRoot.gameObject:SetActive(true)
|
||||
self._mapNode.svListRoot:Init(nCurCount, self, self.OnGridRefresh, self.OnGridBtnClick, self.bFirstIn == false)
|
||||
else
|
||||
self._mapNode.svListRoot.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function FormationDisc_ListCtrl:SwitchRefresh()
|
||||
self:FilterDisc()
|
||||
self:SortDisc()
|
||||
EventManager.Hit("UploadDiscFormation", self.tbMainDisc, self.tbSubDisc)
|
||||
self.tbBeforeMain = clone(self.tbMainDisc)
|
||||
self.tbBeforeSub = clone(self.tbSubDisc)
|
||||
local nCurCount = #self.tbSortedDisc
|
||||
self._mapNode.svListRoot:Init(nCurCount, self, self.OnGridRefresh, self.OnGridBtnClick, self.bFirstIn == false)
|
||||
end
|
||||
function FormationDisc_ListCtrl:OpenList(nType, tbMainDisc, tbSubDisc, nSubCount)
|
||||
self.tbMainDisc = clone(tbMainDisc)
|
||||
self.tbSubDisc = clone(tbSubDisc)
|
||||
self.tbBeforeMain = tbMainDisc
|
||||
self.tbBeforeSub = tbSubDisc
|
||||
self.nSubCount = nSubCount
|
||||
self._panel.nListType = nType
|
||||
local sKey = self._panel.nListType == 1 and "DiscFormation_SwitchSub" or "DiscFormation_SwitchMain"
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSwitchSub, ConfigTable.GetUIText(sKey))
|
||||
self.mapNoteNeed = {}
|
||||
for _, nMainDiscId in ipairs(tbMainDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nMainDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSkillNeedNote
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteNeed[mapNeedNote.nId] == nil then
|
||||
self.mapNoteNeed[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteNeed[mapNeedNote.nId] = self.mapNoteNeed[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
self.mapNoteCur = {}
|
||||
for _, nMainDiscId in ipairs(tbSubDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nMainDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSubNoteSkills
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteCur[mapNeedNote.nId] == nil then
|
||||
self.mapNoteCur[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteCur[mapNeedNote.nId] = self.mapNoteCur[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
self:Refresh()
|
||||
end
|
||||
function FormationDisc_ListCtrl:SyncFormation()
|
||||
local tbTeamMemberId = PlayerData.Team:GetTeamCharId(self._panel.nTeamIndex)
|
||||
local tbBeforeDiscId = PlayerData.Team:GetTeamDiscData(self._panel.nTeamIndex)
|
||||
local tbDisc = {}
|
||||
for i = 1, 3 do
|
||||
table.insert(tbDisc, self.tbMainDisc[i] == nil and 0 or self.tbMainDisc[i])
|
||||
end
|
||||
for i = 1, 3 do
|
||||
table.insert(tbDisc, self.tbSubDisc[i] == nil and 0 or self.tbSubDisc[i])
|
||||
end
|
||||
local bChange = false
|
||||
for i = 1, 6 do
|
||||
if tbBeforeDiscId[i] ~= tbDisc[i] then
|
||||
bChange = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not bChange then
|
||||
return
|
||||
end
|
||||
PlayerData.Team:UpdateFormationInfo(self._panel.nTeamIndex, tbTeamMemberId, tbDisc)
|
||||
end
|
||||
function FormationDisc_ListCtrl:RefreshOrderState()
|
||||
self._mapNode.imgArrowUpEnable:SetActive(self.tbSortCfg.bOrder)
|
||||
self._mapNode.imgArrowUpDisable:SetActive(not self.tbSortCfg.bOrder)
|
||||
self._mapNode.imgArrowDownEnable:SetActive(not self.tbSortCfg.bOrder)
|
||||
self._mapNode.imgArrowDownDisable:SetActive(self.tbSortCfg.bOrder)
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnBtnClick_ClearFormation()
|
||||
for i = 1, 3 do
|
||||
self.tbMainDisc[i] = 0
|
||||
self.tbSubDisc[i] = 0
|
||||
end
|
||||
self.mapNoteNeed = {}
|
||||
self.mapNoteCur = {}
|
||||
for _, mapCtrl in pairs(self.tbGridCtrl) do
|
||||
mapCtrl:SetSelect(0, 0)
|
||||
end
|
||||
EventManager.Hit("DiscFormation_GridClick", self.tbMainDisc, self.tbSubDisc)
|
||||
end
|
||||
function FormationDisc_ListCtrl:CloseList()
|
||||
local cancelCallback = function()
|
||||
self:OnBtnClick_Sure()
|
||||
end
|
||||
local confirmCallback = function()
|
||||
self:OnBtnClick_Cancel()
|
||||
end
|
||||
local bDirty = false
|
||||
for i = 1, 3 do
|
||||
if self.tbMainDisc[i] ~= self.tbBeforeMain[i] or self.tbSubDisc[i] ~= self.tbBeforeSub[i] then
|
||||
bDirty = true
|
||||
end
|
||||
end
|
||||
if bDirty then
|
||||
local TipsTime = LocalData.GetPlayerLocalData("FormationListTipDay")
|
||||
local _tipDay = 0
|
||||
if TipsTime ~= nil then
|
||||
_tipDay = tonumber(TipsTime)
|
||||
end
|
||||
local curTimeStamp = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
local fixedTimeStamp = curTimeStamp + newDayTime * 3600
|
||||
local nYear = tonumber(os.date("!%Y", fixedTimeStamp))
|
||||
local nMonth = tonumber(os.date("!%m", fixedTimeStamp))
|
||||
local nDay = tonumber(os.date("!%d", fixedTimeStamp))
|
||||
local nowD = nYear * 366 + nMonth * 31 + nDay
|
||||
if nowD == _tipDay then
|
||||
confirmCallback()
|
||||
else
|
||||
local isSelectAgain = false
|
||||
local confirmTipCallback = function()
|
||||
if isSelectAgain then
|
||||
local _curTimeStamp = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
local _fixedTimeStamp = _curTimeStamp + newDayTime * 3600
|
||||
local _nYear = tonumber(os.date("!%Y", _fixedTimeStamp))
|
||||
local _nMonth = tonumber(os.date("!%m", _fixedTimeStamp))
|
||||
local _nDay = tonumber(os.date("!%d", _fixedTimeStamp))
|
||||
local _nowD = _nYear * 366 + _nMonth * 31 + _nDay
|
||||
LocalData.SetPlayerLocalData("FormationListTipDay", tostring(_nowD))
|
||||
end
|
||||
confirmCallback()
|
||||
end
|
||||
local againCallback = function(isSelect)
|
||||
isSelectAgain = isSelect
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = orderedFormat(ConfigTable.GetUIText("FormationChangeTips")),
|
||||
callbackConfirm = confirmTipCallback,
|
||||
callbackAgain = againCallback,
|
||||
callbackCancel = cancelCallback,
|
||||
bDisableSnap = true
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
else
|
||||
cancelCallback()
|
||||
end
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnGridRefresh(goGrid, nIdx)
|
||||
nIdx = nIdx + 1
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceId] then
|
||||
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.MainlineFormationDiscEx.FormationDisc_ListGridCtrl")
|
||||
end
|
||||
local mapDisc = self.tbSortedDisc[nIdx]
|
||||
if mapDisc == nil then
|
||||
return
|
||||
end
|
||||
self.tbGridCtrl[nInstanceId]:OnGridRefresh(mapDisc, self.mapNoteNeed, self.mapNoteCur, self._panel.nListType, table.indexof(self.tbMainDisc, mapDisc.nId), table.indexof(self.tbSubDisc, mapDisc.nId))
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnGridBtnClick(goGrid, nIdx)
|
||||
local mapDisc = self.tbSortedDisc[nIdx + 1]
|
||||
if self._panel.nListType == 1 then
|
||||
if self:GetFormationDiscCount(self.tbMainDisc) == 3 and table.indexof(self.tbMainDisc, mapDisc.nId) <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("DiscFormation_HintMainFull"))
|
||||
return
|
||||
end
|
||||
if 0 < table.indexof(self.tbSubDisc, mapDisc.nId) then
|
||||
local callback = function()
|
||||
self:SetFormationDisc(self.tbSubDisc, mapDisc.nId)
|
||||
self:SetFormationDisc(self.tbMainDisc, mapDisc.nId)
|
||||
self.mapNoteNeed = {}
|
||||
for _, nMainDiscId in ipairs(self.tbMainDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nMainDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSkillNeedNote
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteNeed[mapNeedNote.nId] == nil then
|
||||
self.mapNoteNeed[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteNeed[mapNeedNote.nId] = self.mapNoteNeed[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
self.mapNoteCur = {}
|
||||
for _, nMainDiscId in ipairs(self.tbSubDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nMainDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSubNoteSkills
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteCur[mapNeedNote.nId] == nil then
|
||||
self.mapNoteCur[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteCur[mapNeedNote.nId] = self.mapNoteCur[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
self.tbGridCtrl[nInstanceId]:OnGridRefresh(mapDisc, self.mapNoteNeed, self.mapNoteCur, self._panel.nListType, table.indexof(self.tbMainDisc, mapDisc.nId), table.indexof(self.tbSubDisc, mapDisc.nId))
|
||||
EventManager.Hit("DiscFormation_GridClick", self.tbMainDisc, self.tbSubDisc)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("DiscFormation_MsgNeedSwitch"),
|
||||
callbackConfirm = callback
|
||||
})
|
||||
return
|
||||
end
|
||||
self:SetFormationDisc(self.tbMainDisc, mapDisc.nId)
|
||||
else
|
||||
if self:GetFormationDiscCount(self.tbSubDisc) >= self.nSubCount and table.indexof(self.tbSubDisc, mapDisc.nId) <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("DiscFormation_HintSubFull"))
|
||||
return
|
||||
end
|
||||
if table.indexof(self.tbMainDisc, mapDisc.nId) > 0 then
|
||||
local callback = function()
|
||||
self:SetFormationDisc(self.tbMainDisc, mapDisc.nId)
|
||||
self:SetFormationDisc(self.tbSubDisc, mapDisc.nId)
|
||||
self.mapNoteNeed = {}
|
||||
for _, nMainDiscId in ipairs(self.tbMainDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nMainDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSkillNeedNote
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteNeed[mapNeedNote.nId] == nil then
|
||||
self.mapNoteNeed[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteNeed[mapNeedNote.nId] = self.mapNoteNeed[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
self.mapNoteCur = {}
|
||||
for _, nMainDiscId in ipairs(self.tbSubDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nMainDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSubNoteSkills
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteCur[mapNeedNote.nId] == nil then
|
||||
self.mapNoteCur[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteCur[mapNeedNote.nId] = self.mapNoteCur[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
self.tbGridCtrl[nInstanceId]:OnGridRefresh(mapDisc, self.mapNoteNeed, self.mapNoteCur, self._panel.nListType, table.indexof(self.tbMainDisc, mapDisc.nId), table.indexof(self.tbSubDisc, mapDisc.nId))
|
||||
EventManager.Hit("DiscFormation_GridClick", self.tbMainDisc, self.tbSubDisc)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("DiscFormation_MsgNeedSwitchMain"),
|
||||
callbackConfirm = callback
|
||||
})
|
||||
return
|
||||
end
|
||||
self:SetFormationDisc(self.tbSubDisc, mapDisc.nId)
|
||||
end
|
||||
self.mapNoteNeed = {}
|
||||
for _, nMainDiscId in ipairs(self.tbMainDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nMainDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSkillNeedNote
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteNeed[mapNeedNote.nId] == nil then
|
||||
self.mapNoteNeed[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteNeed[mapNeedNote.nId] = self.mapNoteNeed[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
self.mapNoteCur = {}
|
||||
for _, nMainDiscId in ipairs(self.tbSubDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nMainDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSubNoteSkills
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteCur[mapNeedNote.nId] == nil then
|
||||
self.mapNoteCur[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteCur[mapNeedNote.nId] = self.mapNoteCur[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
self.tbGridCtrl[nInstanceId]:OnGridRefresh(mapDisc, self.mapNoteNeed, self.mapNoteCur, self._panel.nListType, table.indexof(self.tbMainDisc, mapDisc.nId), table.indexof(self.tbSubDisc, mapDisc.nId))
|
||||
EventManager.Hit("DiscFormation_GridClick", self.tbMainDisc, self.tbSubDisc)
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnBtnClick_Filter(btn)
|
||||
local tbOption = {
|
||||
AllEnum.ChooseOption.Star_Rarity,
|
||||
AllEnum.ChooseOption.Star_Element,
|
||||
AllEnum.ChooseOption.Star_Tag,
|
||||
AllEnum.ChooseOption.Star_Note
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.FilterPopupPanel, tbOption)
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnBtnClick_SwitchSub(btn)
|
||||
self._panel.nListType = self._panel.nListType == 1 and 2 or 1
|
||||
local sKey = self._panel.nListType == 1 and "DiscFormation_SwitchSub" or "DiscFormation_SwitchMain"
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSwitchSub, ConfigTable.GetUIText(sKey))
|
||||
EventManager.Hit("DiscFormationSwitchCur", self._panel.nListType)
|
||||
self:SwitchRefresh()
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnBtnClick_Switch1()
|
||||
if self._panel.nListType == 1 then
|
||||
return
|
||||
end
|
||||
self._panel.nListType = 1
|
||||
local sKey = self._panel.nListType == 1 and "DiscFormation_SwitchSub" or "DiscFormation_SwitchMain"
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSwitchSub, ConfigTable.GetUIText(sKey))
|
||||
EventManager.Hit("DiscFormationSwitchCur", self._panel.nListType)
|
||||
self:SwitchRefresh()
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnBtnClick_Switch2()
|
||||
if self._panel.nListType == 2 then
|
||||
return
|
||||
end
|
||||
self._panel.nListType = 2
|
||||
local sKey = self._panel.nListType == 1 and "DiscFormation_SwitchSub" or "DiscFormation_SwitchMain"
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSwitchSub, ConfigTable.GetUIText(sKey))
|
||||
EventManager.Hit("DiscFormationSwitchCur", self._panel.nListType)
|
||||
self:SwitchRefresh()
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnBtnClick_Sure()
|
||||
local bDirty = false
|
||||
for i = 1, 3 do
|
||||
if self.tbMainDisc[i] ~= self.tbBeforeMain[i] or self.tbSubDisc[i] ~= self.tbBeforeSub[i] then
|
||||
bDirty = true
|
||||
end
|
||||
end
|
||||
if bDirty then
|
||||
EventManager.Hit("ConfirmDiscFormationChoose", true, self.tbMainDisc, self.tbSubDisc)
|
||||
else
|
||||
EventManager.Hit("ConfirmDiscFormationChoose", false)
|
||||
end
|
||||
self:PlayDiscBGM(nil, self.tbMainDisc, self.tbSubDisc)
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnBtnClick_Cancel()
|
||||
EventManager.Hit("ConfirmDiscFormationChoose", false)
|
||||
end
|
||||
function FormationDisc_ListCtrl:RefreshByFilter()
|
||||
self:Refresh()
|
||||
end
|
||||
function FormationDisc_ListCtrl:GetFormationDiscCount(tbDisc)
|
||||
local nCount = 0
|
||||
for _, nDiscId in ipairs(tbDisc) do
|
||||
if nDiscId ~= 0 then
|
||||
nCount = nCount + 1
|
||||
end
|
||||
end
|
||||
return nCount
|
||||
end
|
||||
function FormationDisc_ListCtrl:SetFormationDisc(tbDisc, nDiscId)
|
||||
local nIdx = table.indexof(tbDisc, nDiscId)
|
||||
if 0 < nIdx then
|
||||
tbDisc[nIdx] = 0
|
||||
else
|
||||
self:PlayDiscBGM(nDiscId)
|
||||
for idx, nId in ipairs(tbDisc) do
|
||||
if nId == 0 then
|
||||
tbDisc[idx] = nDiscId
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function FormationDisc_ListCtrl:PlayDiscBGM(nDiscId, tbMain, tbSub)
|
||||
local tbDisc = {}
|
||||
local nCharId = 0
|
||||
local sVoiceKey = "music"
|
||||
if self.nLastBGMCharId == nil then
|
||||
self.nLastBGMCharId = 0
|
||||
end
|
||||
local getRandomCharId = function(tbDiscId)
|
||||
local tbCharInDisc = {}
|
||||
local nRandomIndex = math.random(1, #tbDiscId)
|
||||
local mapDiscCfg = ConfigTable.GetData("DiscIP", tbDiscId[nRandomIndex])
|
||||
if mapDiscCfg ~= nil then
|
||||
tbCharInDisc = mapDiscCfg.CharId
|
||||
end
|
||||
local nRandomCharId = self.tbCharId[math.random(1, #self.tbCharId)]
|
||||
local bInTeam = false
|
||||
for _, v in ipairs(tbCharInDisc) do
|
||||
if nRandomCharId == v then
|
||||
bInTeam = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not bInTeam then
|
||||
sVoiceKey = "music"
|
||||
else
|
||||
sVoiceKey = "uniMusic"
|
||||
end
|
||||
return nRandomCharId
|
||||
end
|
||||
if nDiscId == nil then
|
||||
for _, v in ipairs(tbMain) do
|
||||
table.insert(tbDisc, v)
|
||||
end
|
||||
for _, v in ipairs(tbSub) do
|
||||
table.insert(tbDisc, v)
|
||||
end
|
||||
else
|
||||
table.insert(tbDisc, nDiscId)
|
||||
end
|
||||
nCharId = getRandomCharId(tbDisc)
|
||||
local nIndex = 0
|
||||
while self.nLastBGMCharId == nCharId and nIndex < 10 do
|
||||
nCharId = getRandomCharId(tbDisc)
|
||||
nIndex = nIndex + 1
|
||||
end
|
||||
PlayerData.Voice:PlayCharVoice(sVoiceKey, nCharId)
|
||||
self.nLastBGMCharId = nCharId
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnBtnClick_Order(btn)
|
||||
self.tbSortCfg.bOrder = not self.tbSortCfg.bOrder
|
||||
PlayerData.Filter:CacheDiscSort(self.tbSortCfg.nSortType, self.tbSortCfg.bOrder)
|
||||
self:Refresh()
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnEvent_SortRuleChange(nValue)
|
||||
if not self.bOpen then
|
||||
return
|
||||
end
|
||||
local nV = nValue + 1
|
||||
self.tbSortCfg.nSortType = PlayerData.Disc:GetDiscSortType()[nV]
|
||||
self.tbSortCfg.bOrder = false
|
||||
PlayerData.Filter:CacheDiscSort(self.tbSortCfg.nSortType, self.tbSortCfg.bOrder)
|
||||
self:Refresh()
|
||||
end
|
||||
function FormationDisc_ListCtrl:OnEvent_ForamtionDown(mapDisc, nType)
|
||||
if nType == 1 then
|
||||
local nListIdx = table.indexof(self.tbSortedDisc, mapDisc)
|
||||
local nIdx = table.indexof(self.tbMainDisc, mapDisc.nId)
|
||||
self.tbMainDisc[nIdx] = 0
|
||||
local trGrid = self._mapNode.rtDiscContent:Find(tostring(nListIdx - 1))
|
||||
if trGrid ~= nil then
|
||||
local nInstanceId = trGrid.gameObject:GetInstanceID()
|
||||
self.tbGridCtrl[nInstanceId]:SetSelect(0, 0)
|
||||
end
|
||||
else
|
||||
local nListIdx = table.indexof(self.tbSortedDisc, mapDisc)
|
||||
local nIdx = table.indexof(self.tbSubDisc, mapDisc.nId)
|
||||
self.tbSubDisc[nIdx] = 0
|
||||
local trGrid = self._mapNode.rtDiscContent:Find(tostring(nListIdx - 1))
|
||||
if trGrid ~= nil then
|
||||
local nInstanceId = trGrid.gameObject:GetInstanceID()
|
||||
self.tbGridCtrl[nInstanceId]:SetSelect(0, 0)
|
||||
end
|
||||
end
|
||||
EventManager.Hit("DiscFormation_GridClick", self.tbMainDisc, self.tbSubDisc)
|
||||
end
|
||||
return FormationDisc_ListCtrl
|
||||
@@ -0,0 +1,52 @@
|
||||
local FormationDisc_ListGridCtrl = class("FormationDisc_ListGridCtrl", BaseCtrl)
|
||||
FormationDisc_ListGridCtrl._mapNodeConfig = {
|
||||
rtMain = {
|
||||
sCtrlName = "Game.UI.MainlineFormationDiscEx.FormationDisc_ListGridMainCtrl"
|
||||
},
|
||||
rtSub = {
|
||||
sCtrlName = "Game.UI.MainlineFormationDiscEx.FormationDisc_ListGridSubCtrl"
|
||||
},
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
nCount = 2,
|
||||
callback = "OnBtnClick_Detail"
|
||||
}
|
||||
}
|
||||
FormationDisc_ListGridCtrl._mapEventConfig = {}
|
||||
FormationDisc_ListGridCtrl._mapRedDotConfig = {}
|
||||
function FormationDisc_ListGridCtrl:Awake()
|
||||
end
|
||||
function FormationDisc_ListGridCtrl:FadeIn()
|
||||
end
|
||||
function FormationDisc_ListGridCtrl:FadeOut()
|
||||
end
|
||||
function FormationDisc_ListGridCtrl:OnEnable()
|
||||
end
|
||||
function FormationDisc_ListGridCtrl:OnDisable()
|
||||
end
|
||||
function FormationDisc_ListGridCtrl:OnDestroy()
|
||||
end
|
||||
function FormationDisc_ListGridCtrl:OnRelease()
|
||||
end
|
||||
function FormationDisc_ListGridCtrl:OnGridRefresh(mapDisc, mapNote, mapNoteCur, nType, nMainIdx, nSubIdx)
|
||||
self.mapDisc = mapDisc
|
||||
if nType == 1 then
|
||||
self._mapNode.rtMain.gameObject:SetActive(true)
|
||||
self._mapNode.rtSub.gameObject:SetActive(false)
|
||||
self._mapNode.rtMain:Refresh(mapDisc, mapNoteCur, nMainIdx, 0 < nSubIdx)
|
||||
else
|
||||
self._mapNode.rtMain.gameObject:SetActive(false)
|
||||
self._mapNode.rtSub.gameObject:SetActive(true)
|
||||
self._mapNode.rtSub:Refresh(mapDisc, mapNote, nSubIdx, 0 < nMainIdx)
|
||||
end
|
||||
end
|
||||
function FormationDisc_ListGridCtrl:SetSelect(nMainIdx, nSubIdx)
|
||||
self._mapNode.rtMain:SetSelect(nMainIdx, nSubIdx)
|
||||
self._mapNode.rtSub:SetSelect(nMainIdx, nSubIdx)
|
||||
end
|
||||
function FormationDisc_ListGridCtrl:OnBtnClick_Detail()
|
||||
if self.mapDisc ~= nil then
|
||||
EventManager.Hit("DiscFormation_Detail", self.mapDisc.nId)
|
||||
end
|
||||
end
|
||||
return FormationDisc_ListGridCtrl
|
||||
@@ -0,0 +1,100 @@
|
||||
local FormationDisc_ListGridMainCtrl = class("FormationDisc_ListGridMainCtrl", BaseCtrl)
|
||||
FormationDisc_ListGridMainCtrl._mapNodeConfig = {
|
||||
imgEdge = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgEET = {sComponentName = "Image"},
|
||||
imgEET1 = {sComponentName = "Image"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtLv = {sComponentName = "TMP_Text", sLanguageId = "Lv"},
|
||||
goNote = {nCount = 6, sComponentName = "Image"},
|
||||
imgDiscStar = {sComponentName = "Image"},
|
||||
goNoteActive = {nCount = 6, sComponentName = "Image"},
|
||||
TMPNoteCount = {nCount = 6, sComponentName = "TMP_Text"},
|
||||
TMPHintMain = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "DiscFormation_InuseSub"
|
||||
},
|
||||
TMPSelectTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_SelectedTitle"
|
||||
},
|
||||
TMPNoteTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "DiscNote_ActiveHint"
|
||||
},
|
||||
Use_Mask = {},
|
||||
Select_bg = {},
|
||||
Select_Mask = {},
|
||||
imgNumber = {nCount = 3},
|
||||
imgNoteBg = {}
|
||||
}
|
||||
FormationDisc_ListGridMainCtrl._mapEventConfig = {}
|
||||
FormationDisc_ListGridMainCtrl._mapRedDotConfig = {}
|
||||
function FormationDisc_ListGridMainCtrl:Awake()
|
||||
end
|
||||
function FormationDisc_ListGridMainCtrl:FadeIn()
|
||||
end
|
||||
function FormationDisc_ListGridMainCtrl:FadeOut()
|
||||
end
|
||||
function FormationDisc_ListGridMainCtrl:OnEnable()
|
||||
end
|
||||
function FormationDisc_ListGridMainCtrl:OnDisable()
|
||||
end
|
||||
function FormationDisc_ListGridMainCtrl:OnDestroy()
|
||||
end
|
||||
function FormationDisc_ListGridMainCtrl:OnRelease()
|
||||
end
|
||||
function FormationDisc_ListGridMainCtrl:Refresh(mapDisc, mapNote, nIdx, bSubUse)
|
||||
self.mapDisc = mapDisc
|
||||
if mapDisc == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self.gameObject:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapDisc.sIcon .. AllEnum.OutfitIconSurfix.OutInfo)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, mapDisc.nLevel)
|
||||
self._mapNode.imgNoteBg:SetActive(#mapDisc.tbSkillNeedNote > 0)
|
||||
for i = 1, 6 do
|
||||
if mapDisc.tbSkillNeedNote[i] == nil then
|
||||
self._mapNode.goNote[i].gameObject:SetActive(false)
|
||||
else
|
||||
local mapNoteCfg = ConfigTable.GetData("SubNoteSkill", mapDisc.tbSkillNeedNote[i].nId)
|
||||
if mapNoteCfg == nil then
|
||||
self._mapNode.goNote[i].gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goNote[i].gameObject:SetActive(true)
|
||||
local nNoteId = mapDisc.tbSkillNeedNote[i].nId
|
||||
local nNoteCount = mapDisc.tbSkillNeedNote[i].nCount
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPNoteCount[i], nNoteCount)
|
||||
self:SetPngSprite(self._mapNode.goNote[i], mapNoteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.goNoteActive[i], mapNoteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small .. "_Light")
|
||||
if mapNote[nNoteId] ~= nil and nNoteCount <= mapNote[nNoteId] then
|
||||
self._mapNode.goNoteActive[i].gameObject:SetActive(true)
|
||||
else
|
||||
self._mapNode.goNoteActive[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self:SetAtlasSprite(self._mapNode.imgDiscStar, "12_rare", AllEnum.FrameType_New.DiscLimitS .. AllEnum.FrameColor_New[mapDisc.nRarity] .. "_0" .. mapDisc.nStar + 1)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgDiscStar)
|
||||
self:SetAtlasSprite(self._mapNode.imgEdge, "12_rare", "rare_outfit_team_s_" .. AllEnum.FrameColor_New[mapDisc.nRarity])
|
||||
local sName = AllEnum.ElementIconType.Icon .. mapDisc.nEET
|
||||
self:SetAtlasSprite(self._mapNode.imgEET, "12_rare", sName)
|
||||
self:SetAtlasSprite(self._mapNode.imgEET1, "12_rare", sName)
|
||||
self._mapNode.Select_bg:SetActive(0 < nIdx)
|
||||
self._mapNode.Select_Mask:SetActive(0 < nIdx)
|
||||
self._mapNode.imgNumber[1]:SetActive(nIdx == 1)
|
||||
self._mapNode.imgNumber[2]:SetActive(nIdx == 2)
|
||||
self._mapNode.imgNumber[3]:SetActive(nIdx == 3)
|
||||
self._mapNode.Use_Mask:SetActive(bSubUse)
|
||||
end
|
||||
function FormationDisc_ListGridMainCtrl:SetSelect(nMainIdx, nSubIdx)
|
||||
self._mapNode.Select_bg:SetActive(0 < nMainIdx)
|
||||
self._mapNode.Select_Mask:SetActive(0 < nMainIdx)
|
||||
self._mapNode.imgNumber[1]:SetActive(nMainIdx == 1)
|
||||
self._mapNode.imgNumber[2]:SetActive(nMainIdx == 2)
|
||||
self._mapNode.imgNumber[3]:SetActive(nMainIdx == 3)
|
||||
self._mapNode.Use_Mask:SetActive(0 < nSubIdx)
|
||||
end
|
||||
return FormationDisc_ListGridMainCtrl
|
||||
@@ -0,0 +1,94 @@
|
||||
local FormationDisc_ListGridSubCtrl = class("FormationDisc_ListGridSubCtrl", BaseCtrl)
|
||||
FormationDisc_ListGridSubCtrl._mapNodeConfig = {
|
||||
imgEdge = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgEET = {sComponentName = "Image"},
|
||||
imgEET1 = {sComponentName = "Image"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtLv = {sComponentName = "TMP_Text", sLanguageId = "Lv"},
|
||||
imgDiscStar = {sComponentName = "Image"},
|
||||
imgNote = {nCount = 3, sComponentName = "Image"},
|
||||
goNoteUnuse = {nCount = 3, sComponentName = "Image"},
|
||||
TMPNoteCount = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
TMPHintMain = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "DiscFormation_InuseMain"
|
||||
},
|
||||
TMPSelectTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_SelectedTitle"
|
||||
},
|
||||
Use_Mask = {},
|
||||
Select_bg = {},
|
||||
Select_Mask = {},
|
||||
imgNumber = {nCount = 3}
|
||||
}
|
||||
FormationDisc_ListGridSubCtrl._mapEventConfig = {}
|
||||
FormationDisc_ListGridSubCtrl._mapRedDotConfig = {}
|
||||
function FormationDisc_ListGridSubCtrl:Awake()
|
||||
end
|
||||
function FormationDisc_ListGridSubCtrl:FadeIn()
|
||||
end
|
||||
function FormationDisc_ListGridSubCtrl:FadeOut()
|
||||
end
|
||||
function FormationDisc_ListGridSubCtrl:OnEnable()
|
||||
end
|
||||
function FormationDisc_ListGridSubCtrl:OnDisable()
|
||||
end
|
||||
function FormationDisc_ListGridSubCtrl:OnDestroy()
|
||||
end
|
||||
function FormationDisc_ListGridSubCtrl:OnRelease()
|
||||
end
|
||||
function FormationDisc_ListGridSubCtrl:Refresh(mapDisc, mapNote, nIdx, bMainUse)
|
||||
self.mapDisc = mapDisc
|
||||
if mapDisc == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self.gameObject:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapDisc.sIcon .. AllEnum.OutfitIconSurfix.OutInfo)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, mapDisc.nLevel)
|
||||
for i = 1, 3 do
|
||||
if mapDisc.tbSubNoteSkills[i] == nil then
|
||||
self._mapNode.imgNote[i].gameObject:SetActive(false)
|
||||
else
|
||||
local mapNoteCfg = ConfigTable.GetData("SubNoteSkill", mapDisc.tbSubNoteSkills[i].nId)
|
||||
if mapNoteCfg == nil then
|
||||
self._mapNode.imgNote[i].gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.imgNote[i].gameObject:SetActive(true)
|
||||
local nNoteId = mapDisc.tbSubNoteSkills[i].nId
|
||||
local nNoteCount = mapDisc.tbSubNoteSkills[i].nCount
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPNoteCount[i], nNoteCount)
|
||||
self:SetPngSprite(self._mapNode.imgNote[i], mapNoteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.goNoteUnuse[i], mapNoteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
if mapNote[nNoteId] == nil then
|
||||
self._mapNode.goNoteUnuse[i].gameObject:SetActive(true)
|
||||
else
|
||||
self._mapNode.goNoteUnuse[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self:SetAtlasSprite(self._mapNode.imgEdge, "12_rare", "rare_outfit_team_s_" .. AllEnum.FrameColor_New[mapDisc.nRarity])
|
||||
self:SetAtlasSprite(self._mapNode.imgDiscStar, "12_rare", AllEnum.FrameType_New.DiscLimitS .. AllEnum.FrameColor_New[mapDisc.nRarity] .. "_0" .. mapDisc.nStar + 1)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgDiscStar)
|
||||
local sName = AllEnum.ElementIconType.Icon .. mapDisc.nEET
|
||||
self:SetAtlasSprite(self._mapNode.imgEET, "12_rare", sName)
|
||||
self:SetAtlasSprite(self._mapNode.imgEET1, "12_rare", sName)
|
||||
self._mapNode.Select_bg:SetActive(0 < nIdx)
|
||||
self._mapNode.Select_Mask:SetActive(0 < nIdx)
|
||||
self._mapNode.imgNumber[1]:SetActive(nIdx == 1)
|
||||
self._mapNode.imgNumber[2]:SetActive(nIdx == 2)
|
||||
self._mapNode.imgNumber[3]:SetActive(nIdx == 3)
|
||||
self._mapNode.Use_Mask:SetActive(bMainUse)
|
||||
end
|
||||
function FormationDisc_ListGridSubCtrl:SetSelect(nMainIdx, nSubIdx)
|
||||
self._mapNode.Select_bg:SetActive(0 < nSubIdx)
|
||||
self._mapNode.Select_Mask:SetActive(0 < nSubIdx)
|
||||
self._mapNode.imgNumber[1]:SetActive(nSubIdx == 1)
|
||||
self._mapNode.imgNumber[2]:SetActive(nSubIdx == 2)
|
||||
self._mapNode.imgNumber[3]:SetActive(nSubIdx == 3)
|
||||
self._mapNode.Use_Mask:SetActive(0 < nMainIdx)
|
||||
end
|
||||
return FormationDisc_ListGridSubCtrl
|
||||
@@ -0,0 +1,129 @@
|
||||
local FormationDisc_MainDiscCtrl = class("FormationDisc_MainDiscCtrl", BaseCtrl)
|
||||
FormationDisc_MainDiscCtrl._mapNodeConfig = {
|
||||
rtDisc = {},
|
||||
imgDiscEdge = {sComponentName = "Image"},
|
||||
imgDisc = {sComponentName = "Image"},
|
||||
imgElement = {sComponentName = "Image"},
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
btnDown = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Down"
|
||||
},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtLv = {sComponentName = "TMP_Text", sLanguageId = "Lv"},
|
||||
TMPNoteTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "DiscFormation_NeedNote"
|
||||
},
|
||||
goNote = {nCount = 6, sComponentName = "Image"},
|
||||
goNoteActive = {nCount = 6, sComponentName = "Image"},
|
||||
TMPNoteCount = {nCount = 6, sComponentName = "TMP_Text"},
|
||||
TMPDiscTitle = {sComponentName = "TMP_Text"},
|
||||
TMPEmptyTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainlineFormationDisc_None"
|
||||
},
|
||||
imgNoteBg = {},
|
||||
imgDiscStar = {sComponentName = "Image"}
|
||||
}
|
||||
FormationDisc_MainDiscCtrl._mapEventConfig = {}
|
||||
FormationDisc_MainDiscCtrl._mapRedDotConfig = {}
|
||||
function FormationDisc_MainDiscCtrl:Awake()
|
||||
end
|
||||
function FormationDisc_MainDiscCtrl:FadeIn()
|
||||
end
|
||||
function FormationDisc_MainDiscCtrl:FadeOut()
|
||||
end
|
||||
function FormationDisc_MainDiscCtrl:OnEnable()
|
||||
end
|
||||
function FormationDisc_MainDiscCtrl:OnDisable()
|
||||
end
|
||||
function FormationDisc_MainDiscCtrl:OnDestroy()
|
||||
end
|
||||
function FormationDisc_MainDiscCtrl:OnRelease()
|
||||
end
|
||||
function FormationDisc_MainDiscCtrl:SetDownButton(bEnable)
|
||||
self._mapNode.btnDown.gameObject:SetActive(bEnable)
|
||||
end
|
||||
function FormationDisc_MainDiscCtrl:SetDisc(mapDisc, mapNote)
|
||||
self.mapDisc = mapDisc
|
||||
if mapDisc == nil then
|
||||
self._mapNode.rtDisc:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.rtDisc:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDiscTitle, mapDisc.sName)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, mapDisc.nLevel)
|
||||
self:SetPngSprite(self._mapNode.imgDisc, mapDisc.sIcon)
|
||||
self._mapNode.imgNoteBg:SetActive(#mapDisc.tbSkillNeedNote > 0)
|
||||
for i = 1, 6 do
|
||||
if mapDisc.tbSkillNeedNote[i] == nil then
|
||||
self._mapNode.goNote[i].gameObject:SetActive(false)
|
||||
else
|
||||
local mapNoteCfg = ConfigTable.GetData("SubNoteSkill", mapDisc.tbSkillNeedNote[i].nId)
|
||||
if mapNoteCfg == nil then
|
||||
self._mapNode.goNote[i].gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goNote[i].gameObject:SetActive(true)
|
||||
local nNoteId = mapDisc.tbSkillNeedNote[i].nId
|
||||
local nNoteCount = mapDisc.tbSkillNeedNote[i].nCount
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPNoteCount[i], nNoteCount)
|
||||
self:SetPngSprite(self._mapNode.goNote[i], mapNoteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.goNoteActive[i], mapNoteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small .. "_Light")
|
||||
if mapNote[nNoteId] ~= nil then
|
||||
self._mapNode.goNoteActive[i].gameObject:SetActive(nNoteCount <= mapNote[nNoteId])
|
||||
local _b, _c = ColorUtility.TryParseHtmlString("#8dffff")
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPNoteCount[i], _c)
|
||||
else
|
||||
self._mapNode.goNoteActive[i].gameObject:SetActive(false)
|
||||
local _b, _c = ColorUtility.TryParseHtmlString("#FAFAFA")
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPNoteCount[i], _c)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self:SetAtlasSprite(self._mapNode.imgDiscEdge, "12_rare", "rare_outfit_team_l_" .. AllEnum.FrameColor_New[mapDisc.nRarity])
|
||||
self:SetAtlasSprite(self._mapNode.imgDiscStar, "12_rare", AllEnum.FrameType_New.DiscLimitS .. AllEnum.FrameColor_New[mapDisc.nRarity] .. "_0" .. mapDisc.nStar + 1)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgDiscStar)
|
||||
local sName = AllEnum.ElementIconType.Icon .. mapDisc.nEET
|
||||
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", sName)
|
||||
end
|
||||
function FormationDisc_MainDiscCtrl:RefreshNote(mapNote)
|
||||
if self.mapDisc == nil then
|
||||
return
|
||||
end
|
||||
for i = 1, 6 do
|
||||
if self.mapDisc.tbSkillNeedNote[i] == nil then
|
||||
self._mapNode.goNote[i].gameObject:SetActive(false)
|
||||
else
|
||||
local mapNoteCfg = ConfigTable.GetData("SubNoteSkill", self.mapDisc.tbSkillNeedNote[i].nId)
|
||||
if mapNoteCfg == nil then
|
||||
self._mapNode.goNote[i].gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goNote[i].gameObject:SetActive(true)
|
||||
local nNoteId = self.mapDisc.tbSkillNeedNote[i].nId
|
||||
local nNoteCount = self.mapDisc.tbSkillNeedNote[i].nCount
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPNoteCount[i], nNoteCount)
|
||||
self:SetPngSprite(self._mapNode.goNote[i], mapNoteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.goNoteActive[i], mapNoteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small .. "_Light")
|
||||
if mapNote[nNoteId] ~= nil and nNoteCount <= mapNote[nNoteId] then
|
||||
self._mapNode.goNoteActive[i].gameObject:SetActive(true)
|
||||
else
|
||||
self._mapNode.goNoteActive[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function FormationDisc_MainDiscCtrl:OnBtnClick_Detail(btn)
|
||||
if self.mapDisc ~= nil then
|
||||
EventManager.Hit("DiscFormation_Detail", self.mapDisc.nId)
|
||||
end
|
||||
end
|
||||
function FormationDisc_MainDiscCtrl:OnBtnClick_Down(btn)
|
||||
EventManager.Hit("ForamtionDown", self.mapDisc, 1)
|
||||
end
|
||||
return FormationDisc_MainDiscCtrl
|
||||
@@ -0,0 +1,96 @@
|
||||
local FormationDisc_SubDiscCtrl = class("FormationDisc_SubDiscCtrl", BaseCtrl)
|
||||
FormationDisc_SubDiscCtrl._mapNodeConfig = {
|
||||
rtDiscRoot = {},
|
||||
imgDiscEdge = {sComponentName = "Image"},
|
||||
imgDisc = {sComponentName = "Image"},
|
||||
imgElement = {sComponentName = "Image"},
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
btnDown = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Down"
|
||||
},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtLv = {sComponentName = "TMP_Text", sLanguageId = "Lv"},
|
||||
goNote = {nCount = 3, sComponentName = "Image"},
|
||||
TMPNoteCount = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
imgLock = {},
|
||||
imgEmpty = {},
|
||||
rtNotes = {},
|
||||
imgDiscStar = {sComponentName = "Image"},
|
||||
btnLock = {
|
||||
sNodeName = "imgLock",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Lock"
|
||||
}
|
||||
}
|
||||
FormationDisc_SubDiscCtrl._mapEventConfig = {}
|
||||
FormationDisc_SubDiscCtrl._mapRedDotConfig = {}
|
||||
function FormationDisc_SubDiscCtrl:Awake()
|
||||
end
|
||||
function FormationDisc_SubDiscCtrl:FadeIn()
|
||||
end
|
||||
function FormationDisc_SubDiscCtrl:FadeOut()
|
||||
end
|
||||
function FormationDisc_SubDiscCtrl:OnEnable()
|
||||
end
|
||||
function FormationDisc_SubDiscCtrl:OnDisable()
|
||||
end
|
||||
function FormationDisc_SubDiscCtrl:OnDestroy()
|
||||
end
|
||||
function FormationDisc_SubDiscCtrl:OnRelease()
|
||||
end
|
||||
function FormationDisc_SubDiscCtrl:SetPosLock(bLock)
|
||||
self._mapNode.imgLock:SetActive(bLock)
|
||||
self._mapNode.imgEmpty:SetActive(not bLock)
|
||||
end
|
||||
function FormationDisc_SubDiscCtrl:SetDisc(mapDisc, mapNote, bLock)
|
||||
self.mapDisc = mapDisc
|
||||
self._mapNode.imgLock:SetActive(bLock)
|
||||
self._mapNode.imgEmpty:SetActive(not bLock)
|
||||
if mapDisc == nil then
|
||||
self._mapNode.rtDiscRoot:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.rtDiscRoot:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.imgDisc, mapDisc.sIcon .. AllEnum.OutfitIconSurfix.OutInfo)
|
||||
if mapDisc.tbSubNoteSkills ~= nil then
|
||||
local bHasNote = false
|
||||
for i = 1, 3 do
|
||||
if mapDisc.tbSubNoteSkills[i] ~= nil then
|
||||
local mapNoteCfg = ConfigTable.GetData("SubNoteSkill", mapDisc.tbSubNoteSkills[i].nId)
|
||||
if mapNoteCfg == nil then
|
||||
self._mapNode.goNote[i].gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goNote[i].gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPNoteCount[i], mapDisc.tbSubNoteSkills[i].nCount)
|
||||
self:SetPngSprite(self._mapNode.goNote[i], mapNoteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
end
|
||||
bHasNote = true
|
||||
else
|
||||
self._mapNode.goNote[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
self._mapNode.rtNotes:SetActive(bHasNote)
|
||||
end
|
||||
self:SetAtlasSprite(self._mapNode.imgDiscEdge, "12_rare", "rare_outfit_team_s_" .. AllEnum.FrameColor_New[mapDisc.nRarity])
|
||||
self:SetAtlasSprite(self._mapNode.imgDiscStar, "12_rare", AllEnum.FrameType_New.DiscLimitS .. AllEnum.FrameColor_New[self.mapDisc.nRarity] .. "_0" .. self.mapDisc.nStar + 1)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgDiscStar)
|
||||
local sName = AllEnum.ElementIconType.Icon .. self.mapDisc.nEET
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, self.mapDisc.nLevel)
|
||||
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", sName)
|
||||
end
|
||||
function FormationDisc_SubDiscCtrl:OnBtnClick_Detail(btn)
|
||||
if self.mapDisc ~= nil then
|
||||
EventManager.Hit("DiscFormation_Detail", self.mapDisc.nId)
|
||||
end
|
||||
end
|
||||
function FormationDisc_SubDiscCtrl:OnBtnClick_Down(btn)
|
||||
EventManager.Hit("ForamtionDown", self.mapDisc, 2)
|
||||
end
|
||||
function FormationDisc_SubDiscCtrl:OnBtnClick_Lock(btn)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("DiscFormation_UnlockDiscHint"))
|
||||
end
|
||||
return FormationDisc_SubDiscCtrl
|
||||
@@ -0,0 +1,70 @@
|
||||
local FormationMainDiscCtrl = class("FormationMainDiscCtrl", BaseCtrl)
|
||||
FormationMainDiscCtrl._mapNodeConfig = {
|
||||
rtDisc = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.MainlineFormationDiscEx.FormationDisc_MainDiscCtrl"
|
||||
},
|
||||
imgMainTitleActive = {},
|
||||
TMPMainTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "DiscFormation_MainTitle"
|
||||
},
|
||||
rtDiscBtn = {
|
||||
nCount = 3,
|
||||
sNodeName = "rtDisc",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Disc"
|
||||
},
|
||||
auDiscBtnAudio = {
|
||||
nCount = 3,
|
||||
sNodeName = "rtDisc",
|
||||
sComponentName = "AkAudioUI"
|
||||
}
|
||||
}
|
||||
FormationMainDiscCtrl._mapEventConfig = {}
|
||||
FormationMainDiscCtrl._mapRedDotConfig = {}
|
||||
function FormationMainDiscCtrl:Awake()
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function FormationMainDiscCtrl:FadeIn()
|
||||
end
|
||||
function FormationMainDiscCtrl:FadeOut()
|
||||
end
|
||||
function FormationMainDiscCtrl:OnEnable()
|
||||
end
|
||||
function FormationMainDiscCtrl:OnDisable()
|
||||
end
|
||||
function FormationMainDiscCtrl:OnDestroy()
|
||||
end
|
||||
function FormationMainDiscCtrl:OnRelease()
|
||||
end
|
||||
function FormationMainDiscCtrl:Refresh(tbMainDisc, mapNoteNeed)
|
||||
for i = 1, 3 do
|
||||
self._mapNode.rtDisc[i]:SetDisc(PlayerData.Disc:GetDiscById(tbMainDisc[i]), mapNoteNeed)
|
||||
end
|
||||
end
|
||||
function FormationMainDiscCtrl:SetCurSelect(bCur)
|
||||
self._mapNode.imgMainTitleActive:SetActive(bCur)
|
||||
end
|
||||
function FormationMainDiscCtrl:SetTitle(bEnable)
|
||||
self._mapNode.imgMainTitleActive:SetActive(bEnable)
|
||||
end
|
||||
function FormationMainDiscCtrl:OnBtnClick_Disc(btn, nIdx)
|
||||
EventManager.Hit("DiscFormation_OpenList", 1)
|
||||
end
|
||||
function FormationMainDiscCtrl:PlayAnim(bIn)
|
||||
if bIn then
|
||||
self.animator:Play("rtMainDisc_in")
|
||||
else
|
||||
self.animator:Play("rtMainDisc_out")
|
||||
end
|
||||
end
|
||||
function FormationMainDiscCtrl:SetDiscBtnEnable(bEnable)
|
||||
self._mapNode.auDiscBtnAudio[1].enabled = bEnable
|
||||
self._mapNode.auDiscBtnAudio[2].enabled = bEnable
|
||||
self._mapNode.auDiscBtnAudio[3].enabled = bEnable
|
||||
self._mapNode.rtDisc[1]:SetDownButton(not bEnable)
|
||||
self._mapNode.rtDisc[2]:SetDownButton(not bEnable)
|
||||
self._mapNode.rtDisc[3]:SetDownButton(not bEnable)
|
||||
end
|
||||
return FormationMainDiscCtrl
|
||||
@@ -0,0 +1,106 @@
|
||||
local FormationSubDiscCtrl = class("FormationSubDiscCtrl", BaseCtrl)
|
||||
FormationSubDiscCtrl._mapNodeConfig = {
|
||||
rtDisc = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.MainlineFormationDiscEx.FormationDisc_SubDiscCtrl"
|
||||
},
|
||||
TMPNoteInfoTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "DiscFormation_TotalNoteTitle"
|
||||
},
|
||||
goNote = {
|
||||
sNodeName = "goNoteInfo_",
|
||||
nCount = 8,
|
||||
sComponentName = "Image"
|
||||
},
|
||||
TMPNoteCount = {nCount = 8, sComponentName = "TMP_Text"},
|
||||
imgSubTitleActive = {},
|
||||
TMPSubTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "DiscFormation_SubTitle"
|
||||
},
|
||||
rtDiscBtn = {
|
||||
nCount = 3,
|
||||
sNodeName = "rtDisc",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Disc"
|
||||
}
|
||||
}
|
||||
FormationSubDiscCtrl._mapEventConfig = {}
|
||||
FormationSubDiscCtrl._mapRedDotConfig = {}
|
||||
function FormationSubDiscCtrl:Awake()
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function FormationSubDiscCtrl:FadeIn()
|
||||
end
|
||||
function FormationSubDiscCtrl:FadeOut()
|
||||
end
|
||||
function FormationSubDiscCtrl:OnEnable()
|
||||
end
|
||||
function FormationSubDiscCtrl:OnDisable()
|
||||
end
|
||||
function FormationSubDiscCtrl:OnDestroy()
|
||||
end
|
||||
function FormationSubDiscCtrl:OnRelease()
|
||||
end
|
||||
function FormationSubDiscCtrl:Refresh(tbSubDisc, mapNoteNeed, nSubCount)
|
||||
self.nSubCount = nSubCount
|
||||
self.mapNote = {}
|
||||
for i = 1, 3 do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(tbSubDisc[i])
|
||||
self._mapNode.rtDisc[i]:SetPosLock(nSubCount < i)
|
||||
if mapDiscData ~= nil then
|
||||
for _, mapNoteData in ipairs(mapDiscData.tbSubNoteSkills) do
|
||||
if self.mapNote[mapNoteData.nId] == nil then
|
||||
self.mapNote[mapNoteData.nId] = 0
|
||||
end
|
||||
self.mapNote[mapNoteData.nId] = self.mapNote[mapNoteData.nId] + mapNoteData.nCount
|
||||
end
|
||||
end
|
||||
self._mapNode.rtDisc[i]:SetDisc(mapDiscData, mapNoteNeed, nSubCount < i)
|
||||
end
|
||||
self:RefreshNoteList(self.mapNote)
|
||||
end
|
||||
function FormationSubDiscCtrl:RefreshNoteList(mapNote)
|
||||
local tbDisc = {}
|
||||
for nNoteId, nCount in pairs(mapNote) do
|
||||
table.insert(tbDisc, {nNoteId, nCount})
|
||||
end
|
||||
local sort = function(a, b)
|
||||
return a[1] < b[1]
|
||||
end
|
||||
table.sort(tbDisc, sort)
|
||||
for i = 1, 8 do
|
||||
if tbDisc[i] == nil then
|
||||
self._mapNode.goNote[i].gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goNote[i].gameObject:SetActive(true)
|
||||
local mapNote = ConfigTable.GetData("SubNoteSkill", tbDisc[i][1])
|
||||
if mapNote then
|
||||
self:SetPngSprite(self._mapNode.goNote[i], mapNote.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPNoteCount[i], tbDisc[i][2])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function FormationSubDiscCtrl:SetCurSelect(bCur)
|
||||
self._mapNode.imgSubTitleActive:SetActive(bCur)
|
||||
end
|
||||
function FormationSubDiscCtrl:SetTitle(bEnable)
|
||||
self._mapNode.imgSubTitleActive:SetActive(bEnable)
|
||||
end
|
||||
function FormationSubDiscCtrl:OnBtnClick_Disc(btn, nIdx)
|
||||
if nIdx > self.nSubCount then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("DiscFormation_SubUnlockHint"))
|
||||
return
|
||||
end
|
||||
EventManager.Hit("DiscFormation_OpenList", 2)
|
||||
end
|
||||
function FormationSubDiscCtrl:PlayAnim(bIn)
|
||||
if bIn then
|
||||
self.animator:Play("rtSubDiscSelect_in")
|
||||
else
|
||||
self.animator:Play("rtSubDiscSelect_out")
|
||||
end
|
||||
end
|
||||
return FormationSubDiscCtrl
|
||||
@@ -0,0 +1,521 @@
|
||||
local MainlineFormationDiscCtrl = class("MainlineFormationDiscCtrl", BaseCtrl)
|
||||
MainlineFormationDiscCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
rtMainDisc = {
|
||||
sCtrlName = "Game.UI.MainlineFormationDiscEx.FormationMainDiscCtrl"
|
||||
},
|
||||
rtSubDiscSelect = {
|
||||
sCtrlName = "Game.UI.MainlineFormationDiscEx.FormationSubDiscCtrl"
|
||||
},
|
||||
rtSubDisc = {
|
||||
sCtrlName = "Game.UI.MainlineFormationDiscEx.FormationSubDiscCtrl"
|
||||
},
|
||||
discListRoot = {
|
||||
sCtrlName = "Game.UI.MainlineFormationDiscEx.FormationDisc_ListCtrl"
|
||||
},
|
||||
btnOpenList = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_OpenList"
|
||||
},
|
||||
rtCur = {},
|
||||
rtBack = {},
|
||||
imgMaskSub = {},
|
||||
imgMaskMain = {},
|
||||
btnPreviewEffectSub = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Preview"
|
||||
},
|
||||
texPreviewEffectSub = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainlineFormationDisc_PreviewEffect"
|
||||
},
|
||||
btnFastSwitchSub = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SwitchSub"
|
||||
},
|
||||
btnFastSwitchMain = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SwitchMain"
|
||||
},
|
||||
bottomBtnList = {sComponentName = "GameObject"},
|
||||
btnFastFormation = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_FastFormation"
|
||||
},
|
||||
txtBtnFastFormation = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Auto_Formation"
|
||||
},
|
||||
btnStartBattle = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Start"
|
||||
},
|
||||
txtStartBattle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Btn_Raid"
|
||||
},
|
||||
btnPreviewEffect = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Preview"
|
||||
},
|
||||
texPreviewEffect = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainlineFormationDisc_PreviewEffect"
|
||||
},
|
||||
animator = {
|
||||
sComponentName = "Animator",
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
}
|
||||
}
|
||||
MainlineFormationDiscCtrl._mapEventConfig = {
|
||||
[EventId.UIBackConfirm] = "OnEvent_Back",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_BackHome",
|
||||
DiscFormation_GridClick = "OnEvent_DiscFormationGridClick",
|
||||
ConfirmDiscFormationChoose = "OnEvent_ConfirmDiscFormationChoose",
|
||||
DiscFormationSwitchCur = "OnEvent_DiscFormationSwitchCur",
|
||||
DiscFormation_OpenList = "OnEvent_OpenList",
|
||||
DiscFormation_Detail = "OnEvent_Detail",
|
||||
Guide_RefreshDiscFormation = "OnEvent_Guide_RefreshDiscFormation",
|
||||
UploadDiscFormation = "OnEvent_UploadFormation",
|
||||
[EventId.OpenMessageBox] = "OnEvent_OpenMessageBox"
|
||||
}
|
||||
MainlineFormationDiscCtrl._mapRedDotConfig = {}
|
||||
function MainlineFormationDiscCtrl:Awake()
|
||||
self._panel._panelType = 1
|
||||
end
|
||||
function MainlineFormationDiscCtrl:FadeIn()
|
||||
end
|
||||
function MainlineFormationDiscCtrl:FadeOut()
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnEnable()
|
||||
self.bStartClick = false
|
||||
self:Refresh()
|
||||
if self._panel._panelType == 2 then
|
||||
self:OpenList(self._panel.nListType)
|
||||
else
|
||||
self._panel.nListType = 1
|
||||
self._mapNode.rtMainDisc:SetDiscBtnEnable(true)
|
||||
end
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnDisable()
|
||||
if self._panel._panelType == 2 then
|
||||
self._mapNode.discListRoot:SyncFormation()
|
||||
end
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnDestroy()
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnRelease()
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnBtnClick_OpenList(btn, nIdx)
|
||||
if self._panel._panelType == 2 then
|
||||
return
|
||||
end
|
||||
self:OpenList(nIdx)
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnBtnClick_FastFormation()
|
||||
local isTips = false
|
||||
for i = 1, 3 do
|
||||
if self.tbMainDisc[i] ~= 0 or self.tbSubDisc[i] ~= 0 then
|
||||
isTips = true
|
||||
end
|
||||
end
|
||||
self.tbSortCfg = {
|
||||
nSortType = AllEnum.SortType.Level,
|
||||
bOrder = true
|
||||
}
|
||||
local auto = function()
|
||||
local _, tbTeamMemberId = PlayerData.Team:GetTeamData(self._panel.nTeamIndex)
|
||||
local nCharId = tbTeamMemberId[1]
|
||||
local charCfgData = DataTable.Character[nCharId]
|
||||
local eet = charCfgData.EET
|
||||
local tbSortedDisc = {}
|
||||
for _, data in pairs(self._mapNode.discListRoot.tbAllDisc) do
|
||||
local mapCfg = ConfigTable.GetData("Disc", data.nId)
|
||||
if mapCfg.Available then
|
||||
data.isEtt = mapCfg.EET == eet
|
||||
table.insert(tbSortedDisc, data)
|
||||
end
|
||||
end
|
||||
table.sort(tbSortedDisc, function(a, b)
|
||||
return a.isEtt and not b.isEtt or a.isEtt == b.isEtt and a.nRarity < b.nRarity or a.isEtt == b.isEtt and a.nRarity == b.nRarity and a.nLevel > b.nLevel or a.isEtt == b.isEtt and a.nRarity == b.nRarity and a.nLevel == b.nLevel and a.nId < b.nId
|
||||
end)
|
||||
for i = 1, 6 do
|
||||
if i < 4 then
|
||||
if tbSortedDisc[i] ~= nil then
|
||||
self.tbMainDisc[i] = tbSortedDisc[i].nId
|
||||
end
|
||||
elseif tbSortedDisc[i] ~= nil and i - 3 <= self.nSubCount then
|
||||
self.tbSubDisc[i - 3] = tbSortedDisc[i].nId
|
||||
end
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
bPositive = true,
|
||||
sContent = ConfigTable.GetUIText("Auto_FormationTips")
|
||||
})
|
||||
self.mapNoteNeed = {}
|
||||
for _, nMainDiscId in ipairs(self.tbMainDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nMainDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSkillNeedNote
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteNeed[mapNeedNote.nId] == nil then
|
||||
self.mapNoteNeed[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteNeed[mapNeedNote.nId] = self.mapNoteNeed[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
self.mapNoteSub = {}
|
||||
for _, nSubDiscId in ipairs(self.tbSubDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nSubDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSubNoteSkills
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteSub[mapNeedNote.nId] == nil then
|
||||
self.mapNoteSub[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteSub[mapNeedNote.nId] = self.mapNoteSub[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mapNode.rtMainDisc:Refresh(self.tbMainDisc, self.mapNoteSub)
|
||||
self._mapNode.rtSubDisc:Refresh(self.tbSubDisc, self.mapNoteNeed, self.nSubCount)
|
||||
end
|
||||
if PlayerData.Guide:CheckInGuideGroup(27) then
|
||||
isTips = false
|
||||
end
|
||||
if not isTips then
|
||||
auto()
|
||||
self:UploadFormation(self.tbMainDisc, self.tbSubDisc)
|
||||
else
|
||||
local confirmCallback = function()
|
||||
auto()
|
||||
self:UploadFormation(self.tbMainDisc, self.tbSubDisc)
|
||||
end
|
||||
local cancelCallback = function()
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("MainlineFormationDisc_Auto_FormationNotice"),
|
||||
callbackConfirm = confirmCallback,
|
||||
callbackCancel = cancelCallback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnBtnClick_Preview()
|
||||
local tbMain = self.tbTmpMain == nil and self.tbMainDisc or self.tbTmpMain
|
||||
local tbSub = self.tbTmpSub == nil and self.tbSubDisc or self.tbTmpSub
|
||||
local tbDisc = {}
|
||||
for _, v in ipairs(tbMain) do
|
||||
table.insert(tbDisc, v)
|
||||
end
|
||||
for _, v in ipairs(tbSub) do
|
||||
table.insert(tbDisc, v)
|
||||
end
|
||||
local mapDiscData = {}
|
||||
for _, nDiscId in pairs(tbDisc) do
|
||||
mapDiscData[nDiscId] = PlayerData.Disc:GetDiscById(nDiscId)
|
||||
end
|
||||
if nil == next(mapDiscData) then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("MainlineFormationDisc_None"))
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSkill, tbDisc, self.mapNoteNeed, mapDiscData)
|
||||
end
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnBtnClick_Start()
|
||||
if self.bStartClick == true then
|
||||
return
|
||||
end
|
||||
for i = 1, 3 do
|
||||
if self.tbMainDisc[i] and self.tbMainDisc[i] == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("MainlineFormationDisc_NotEnough"))
|
||||
return
|
||||
end
|
||||
end
|
||||
self.bStartClick = true
|
||||
if self._panel.bSweep then
|
||||
PlayerData.StarTower:EnterTowerFastBattle(self._panel.curRoguelikeId, self._panel.nTeamIndex)
|
||||
else
|
||||
PlayerData.StarTower:EnterTower(self._panel.curRoguelikeId, self._panel.nTeamIndex, self.selectDiscIdList)
|
||||
end
|
||||
end
|
||||
function MainlineFormationDiscCtrl:Refresh()
|
||||
self.nSubCount = PlayerData.StarTower:GetDiscFormationSubSlot()
|
||||
local tmpDisc = PlayerData.Team:GetTeamDiscData(self._panel.nTeamIndex)
|
||||
self.tbMainDisc = {
|
||||
tmpDisc[1] == nil and 0 or tmpDisc[1],
|
||||
tmpDisc[2] == nil and 0 or tmpDisc[2],
|
||||
tmpDisc[3] == nil and 0 or tmpDisc[3]
|
||||
}
|
||||
self.tbSubDisc = {
|
||||
tmpDisc[4] == nil and 0 or tmpDisc[4],
|
||||
tmpDisc[5] == nil and 0 or tmpDisc[5],
|
||||
tmpDisc[6] == nil and 0 or tmpDisc[6]
|
||||
}
|
||||
self.mapNoteNeed = {}
|
||||
for _, nMainDiscId in ipairs(self.tbMainDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nMainDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSkillNeedNote
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteNeed[mapNeedNote.nId] == nil then
|
||||
self.mapNoteNeed[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteNeed[mapNeedNote.nId] = self.mapNoteNeed[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
self.mapNoteSub = {}
|
||||
for _, nSubDiscId in ipairs(self.tbSubDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nSubDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSubNoteSkills
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteSub[mapNeedNote.nId] == nil then
|
||||
self.mapNoteSub[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteSub[mapNeedNote.nId] = self.mapNoteSub[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mapNode.rtMainDisc:Refresh(self.tbMainDisc, self.mapNoteSub)
|
||||
self._mapNode.rtSubDisc:Refresh(self.tbSubDisc, self.mapNoteNeed, self.nSubCount)
|
||||
self._mapNode.rtMainDisc:SetTitle(false)
|
||||
self._mapNode.rtSubDisc:SetTitle(false)
|
||||
self._mapNode.rtSubDiscSelect.gameObject:SetActive(false)
|
||||
self._mapNode.btnFastSwitchMain.gameObject:SetActive(false)
|
||||
self._mapNode.btnFastSwitchSub.gameObject:SetActive(false)
|
||||
self._mapNode.imgMaskMain:SetActive(false)
|
||||
self._mapNode.imgMaskSub:SetActive(true)
|
||||
self._mapNode.rtMainDisc.gameObject.transform:SetParent(self._mapNode.rtCur.transform)
|
||||
self._mapNode.rtSubDiscSelect.gameObject.transform:SetParent(self._mapNode.rtBack.transform)
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OpenList(nType)
|
||||
self._mapNode.rtSubDiscSelect.gameObject:SetActive(true)
|
||||
self._mapNode.discListRoot:OpenList(nType, self.tbMainDisc, self.tbSubDisc, self.nSubCount)
|
||||
self._mapNode.rtSubDiscSelect:Refresh(self.tbSubDisc, self.mapNoteNeed, self.nSubCount)
|
||||
if nType == 1 then
|
||||
self._mapNode.imgMaskMain:SetActive(false)
|
||||
self._mapNode.imgMaskSub:SetActive(true)
|
||||
self._mapNode.rtMainDisc.gameObject.transform:SetParent(self._mapNode.rtCur.transform)
|
||||
self._mapNode.rtSubDiscSelect.gameObject.transform:SetParent(self._mapNode.rtBack.transform)
|
||||
self._mapNode.rtMainDisc:SetTitle(true)
|
||||
self._mapNode.rtSubDiscSelect:SetTitle(false)
|
||||
self._mapNode.btnFastSwitchMain.gameObject:SetActive(false)
|
||||
self._mapNode.btnFastSwitchSub.gameObject:SetActive(true)
|
||||
else
|
||||
self._mapNode.imgMaskMain:SetActive(true)
|
||||
self._mapNode.imgMaskSub:SetActive(false)
|
||||
self._mapNode.rtSubDiscSelect.gameObject.transform:SetParent(self._mapNode.rtCur.transform)
|
||||
self._mapNode.rtMainDisc.gameObject.transform:SetParent(self._mapNode.rtBack.transform)
|
||||
self._mapNode.rtMainDisc:SetTitle(false)
|
||||
self._mapNode.rtSubDiscSelect:SetTitle(true)
|
||||
self._mapNode.btnFastSwitchMain.gameObject:SetActive(true)
|
||||
self._mapNode.btnFastSwitchSub.gameObject:SetActive(false)
|
||||
end
|
||||
self._panel._panelType = 2
|
||||
self._mapNode.animator:Play("distItem_in")
|
||||
self._mapNode.rtMainDisc:PlayAnim(true)
|
||||
self._mapNode.rtMainDisc:SetDiscBtnEnable(false)
|
||||
self._mapNode.rtSubDiscSelect:PlayAnim(true)
|
||||
end
|
||||
function MainlineFormationDiscCtrl:CloseList()
|
||||
self.mapNoteNeed = {}
|
||||
for _, nMainDiscId in ipairs(self.tbMainDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nMainDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSkillNeedNote
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteNeed[mapNeedNote.nId] == nil then
|
||||
self.mapNoteNeed[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteNeed[mapNeedNote.nId] = self.mapNoteNeed[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
self.mapNoteSub = {}
|
||||
for _, nSubDiscId in ipairs(self.tbSubDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nSubDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSubNoteSkills
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if self.mapNoteSub[mapNeedNote.nId] == nil then
|
||||
self.mapNoteSub[mapNeedNote.nId] = 0
|
||||
end
|
||||
self.mapNoteSub[mapNeedNote.nId] = self.mapNoteSub[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mapNode.rtMainDisc:Refresh(self.tbMainDisc, self.mapNoteSub)
|
||||
self._mapNode.rtSubDisc:Refresh(self.tbSubDisc, self.mapNoteNeed, self.nSubCount)
|
||||
self._mapNode.rtMainDisc:SetTitle(false)
|
||||
self._mapNode.rtSubDisc:SetTitle(false)
|
||||
self._mapNode.imgMaskMain:SetActive(false)
|
||||
self._mapNode.imgMaskSub:SetActive(true)
|
||||
self._mapNode.rtMainDisc.gameObject.transform:SetParent(self._mapNode.rtCur.transform)
|
||||
self._mapNode.rtSubDiscSelect.gameObject.transform:SetParent(self._mapNode.rtBack.transform)
|
||||
self._panel._panelType = 1
|
||||
self._mapNode.animator:Play("distItem_out")
|
||||
self._mapNode.rtMainDisc:PlayAnim(false)
|
||||
self._mapNode.rtSubDiscSelect:PlayAnim(false)
|
||||
self._mapNode.rtMainDisc:SetDiscBtnEnable(true)
|
||||
self._mapNode.btnFastSwitchMain.gameObject:SetActive(false)
|
||||
self._mapNode.btnFastSwitchSub.gameObject:SetActive(false)
|
||||
self.tbTmpMain = nil
|
||||
self.tbTmpSub = nil
|
||||
end
|
||||
function MainlineFormationDiscCtrl:UploadFormation(tbMainDisc, tbSubDisc, callback)
|
||||
local tbTeamMemberId = PlayerData.Team:GetTeamCharId(self._panel.nTeamIndex)
|
||||
local tbBeforeDiscId = PlayerData.Team:GetTeamDiscData(self._panel.nTeamIndex)
|
||||
local tbDisc = {}
|
||||
for i = 1, 3 do
|
||||
table.insert(tbDisc, tbMainDisc[i] == nil and 0 or tbMainDisc[i])
|
||||
end
|
||||
for i = 1, 3 do
|
||||
table.insert(tbDisc, tbSubDisc[i] == nil and 0 or tbSubDisc[i])
|
||||
end
|
||||
local bChange = false
|
||||
for i = 1, 6 do
|
||||
if tbBeforeDiscId[i] ~= tbDisc[i] then
|
||||
bChange = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not bChange then
|
||||
return
|
||||
end
|
||||
local Callback = function()
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
self.tbMainDisc = clone(tbMainDisc)
|
||||
self.tbSubDisc = clone(tbSubDisc)
|
||||
end
|
||||
PlayerData.Team:UpdateFormationInfo(self._panel.nTeamIndex, tbTeamMemberId, tbDisc, Callback)
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnBtnClick_SwitchMain()
|
||||
self._mapNode.discListRoot:OnBtnClick_Switch1()
|
||||
self._mapNode.btnFastSwitchMain.gameObject:SetActive(false)
|
||||
self._mapNode.btnFastSwitchSub.gameObject:SetActive(true)
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnBtnClick_SwitchSub()
|
||||
self._mapNode.discListRoot:OnBtnClick_Switch2()
|
||||
self._mapNode.btnFastSwitchMain.gameObject:SetActive(true)
|
||||
self._mapNode.btnFastSwitchSub.gameObject:SetActive(false)
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnEvent_Back(nPanelId)
|
||||
if self._panel._nPanelId ~= nPanelId then
|
||||
return
|
||||
end
|
||||
if self._panel._panelType == 1 then
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
elseif self._panel._panelType == 2 then
|
||||
self._mapNode.discListRoot:CloseList()
|
||||
end
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnEvent_BackHome(nPanelId)
|
||||
if self._panel._nPanelId ~= nPanelId then
|
||||
return
|
||||
end
|
||||
PanelManager.Home()
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnEvent_DiscFormationGridClick(tbMainDisc, tbSubDisc)
|
||||
local mapNoteNeed = {}
|
||||
for _, nMainDiscId in ipairs(tbMainDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nMainDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSkillNeedNote
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if mapNoteNeed[mapNeedNote.nId] == nil then
|
||||
mapNoteNeed[mapNeedNote.nId] = 0
|
||||
end
|
||||
mapNoteNeed[mapNeedNote.nId] = mapNoteNeed[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
local mapNoteSub = {}
|
||||
for _, nSubDiscId in ipairs(tbSubDisc) do
|
||||
local mapDiscData = PlayerData.Disc:GetDiscById(nSubDiscId)
|
||||
if mapDiscData ~= nil then
|
||||
local tbNeedNote = mapDiscData.tbSubNoteSkills
|
||||
for _, mapNeedNote in ipairs(tbNeedNote) do
|
||||
if mapNoteSub[mapNeedNote.nId] == nil then
|
||||
mapNoteSub[mapNeedNote.nId] = 0
|
||||
end
|
||||
mapNoteSub[mapNeedNote.nId] = mapNoteSub[mapNeedNote.nId] + mapNeedNote.nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
self.tbTmpMain = tbMainDisc
|
||||
self.tbTmpSub = tbSubDisc
|
||||
self._mapNode.rtMainDisc:Refresh(tbMainDisc, mapNoteSub)
|
||||
self._mapNode.rtSubDiscSelect:Refresh(tbSubDisc, mapNoteNeed, self.nSubCount)
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnEvent_ConfirmDiscFormationChoose(bChange, tbMainDisc, tbSubDisc)
|
||||
if bChange then
|
||||
local Callback = function()
|
||||
self.tbMainDisc = tbMainDisc
|
||||
self.tbSubDisc = tbSubDisc
|
||||
self:CloseList()
|
||||
end
|
||||
self:UploadFormation(tbMainDisc, tbSubDisc, Callback)
|
||||
else
|
||||
self:CloseList()
|
||||
end
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnEvent_DiscFormationSwitchCur(nType)
|
||||
if nType == 1 then
|
||||
self._mapNode.imgMaskMain:SetActive(false)
|
||||
self._mapNode.imgMaskSub:SetActive(true)
|
||||
self._mapNode.rtMainDisc.gameObject.transform:SetParent(self._mapNode.rtCur.transform)
|
||||
self._mapNode.rtSubDiscSelect.gameObject.transform:SetParent(self._mapNode.rtBack.transform)
|
||||
self._mapNode.rtMainDisc:SetTitle(true)
|
||||
self._mapNode.rtSubDiscSelect:SetTitle(false)
|
||||
else
|
||||
self._mapNode.imgMaskMain:SetActive(true)
|
||||
self._mapNode.imgMaskSub:SetActive(false)
|
||||
self._mapNode.rtSubDiscSelect.gameObject.transform:SetParent(self._mapNode.rtCur.transform)
|
||||
self._mapNode.rtMainDisc.gameObject.transform:SetParent(self._mapNode.rtBack.transform)
|
||||
self._mapNode.rtMainDisc:SetTitle(false)
|
||||
self._mapNode.rtSubDiscSelect:SetTitle(true)
|
||||
end
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnEvent_OpenList(nType)
|
||||
if self._panel._panelType == 2 then
|
||||
return
|
||||
end
|
||||
self:OpenList(nType)
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnEvent_Detail(nSelectId)
|
||||
local tbAllDisc = {}
|
||||
for _, nId in ipairs(self.tbMainDisc) do
|
||||
if 0 < nId then
|
||||
table.insert(tbAllDisc, nId)
|
||||
end
|
||||
end
|
||||
for _, nId in ipairs(self.tbSubDisc) do
|
||||
if 0 < nId then
|
||||
table.insert(tbAllDisc, nId)
|
||||
end
|
||||
end
|
||||
if table.indexof(tbAllDisc, nSelectId) < 1 then
|
||||
table.insert(tbAllDisc, nSelectId)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Disc, nSelectId, tbAllDisc)
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnEvent_Guide_RefreshDiscFormation()
|
||||
self:Refresh()
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnEvent_UploadFormation(tbMainDisc, tbSubDisc)
|
||||
self:UploadFormation(tbMainDisc, tbSubDisc, nil)
|
||||
end
|
||||
function MainlineFormationDiscCtrl:OnEvent_OpenMessageBox()
|
||||
self.bStartClick = false
|
||||
end
|
||||
return MainlineFormationDiscCtrl
|
||||
Reference in New Issue
Block a user