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,261 @@
|
||||
local DiscAdvanceCtrl = class("DiscAdvanceCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
DiscAdvanceCtrl._mapNodeConfig = {
|
||||
txtTitleRank = {sComponentName = "TMP_Text", sLanguageId = "Disc_Level"},
|
||||
txtLv = {sComponentName = "TMP_Text"},
|
||||
txtLvMax = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
goAdvanceStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarAdvanceCtrl"
|
||||
},
|
||||
goPropertyLong = {},
|
||||
goPropertyLongNote = {},
|
||||
goBuff = {},
|
||||
trProperty = {sComponentName = "Transform"},
|
||||
txtUnlockDesc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_UnlockLVDesc"
|
||||
},
|
||||
AdvanceBuffList = {
|
||||
sNodeName = "AdvanceBuffList",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
goMat = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateMatCtrl"
|
||||
},
|
||||
btnAdd = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Tips"
|
||||
},
|
||||
btnAdvance = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Advance"
|
||||
},
|
||||
txtBtnAdvance = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Outfit_Btn_Promote"
|
||||
},
|
||||
btnAutoFill = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_AutoFill"
|
||||
},
|
||||
txtBtnAutoFill = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "AutoDevelopment_Btn_Fill"
|
||||
},
|
||||
imgCostIcon = {sComponentName = "Image"},
|
||||
txtCostCount = {sComponentName = "TMP_Text"},
|
||||
txtAdvanceTips = {sComponentName = "TMP_Text"},
|
||||
txtBuffHeight = {sComponentName = "TMP_Text"},
|
||||
rtTxtBuffHeight = {
|
||||
sNodeName = "txtBuffHeight",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtBuffHeightAfter = {sComponentName = "TMP_Text"},
|
||||
rtTxtBuffHeightAfter = {
|
||||
sNodeName = "txtBuffHeightAfter",
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
DiscAdvanceCtrl._mapEventConfig = {
|
||||
CraftingSuccess = "OnEvent_ItemChanged",
|
||||
ConsumableUsed = "OnEvent_ItemChanged",
|
||||
AutoFillSuccess = "OnEvent_ItemChanged"
|
||||
}
|
||||
function DiscAdvanceCtrl:_CalcGridHeight(sContent)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuffHeight, sContent)
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtTxtBuffHeight)
|
||||
local nH = self._mapNode.rtTxtBuffHeight.rect.height
|
||||
return nH
|
||||
end
|
||||
function DiscAdvanceCtrl:_CalcGridHeightAfter(sContent)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuffHeightAfter, sContent)
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtTxtBuffHeightAfter)
|
||||
local nH = self._mapNode.rtTxtBuffHeightAfter.rect.height + 14
|
||||
return nH
|
||||
end
|
||||
function DiscAdvanceCtrl:InitData()
|
||||
self.mapAttrBefore = nil
|
||||
self.mapAttrAfter = nil
|
||||
self.tbUpgradeNote = nil
|
||||
self.tbMat = {}
|
||||
end
|
||||
function DiscAdvanceCtrl:Refresh()
|
||||
self:InitData()
|
||||
local mapDisc = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
self:RefreshLv(mapDisc)
|
||||
self:RefreshAttr(mapDisc)
|
||||
self:RefreshCoin(mapDisc)
|
||||
self:RefreshMat(mapDisc)
|
||||
self:RefreshBuffInfo(mapDisc)
|
||||
end
|
||||
function DiscAdvanceCtrl:RefreshLv(mapDisc)
|
||||
self.nNextMaxLv = PlayerData.Disc:GetMaxLv(mapDisc.nRarity, mapDisc.nPhase + 1)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLv, mapDisc.nLevel)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLvMax[1], "/" .. mapDisc.nMaxLv)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLvMax[2], self.nNextMaxLv)
|
||||
self._mapNode.goAdvanceStar:SetStar(mapDisc.nPhase, mapDisc.nMaxPhase, mapDisc.nPhase + 1)
|
||||
end
|
||||
function DiscAdvanceCtrl:RefreshAttr(mapDisc)
|
||||
self.mapAttrBefore = mapDisc.mapAttrBase
|
||||
self.mapAttrAfter = PlayerData.Disc:GetAttrBase(mapDisc.nAttrBaseGroupId, mapDisc.nPhase + 1, mapDisc.nLevel, mapDisc.nAttrExtraGroupId, mapDisc.nStar)
|
||||
delChildren(self._mapNode.trProperty)
|
||||
for _, mapAttachAttr in pairs(AllEnum.AttachAttr) do
|
||||
local mapAttr = self.mapAttrBefore[mapAttachAttr.sKey]
|
||||
if mapAttr.Value > 0 then
|
||||
local goItemObj = instantiate(self._mapNode.goPropertyLong, self._mapNode.trProperty)
|
||||
goItemObj:SetActive(true)
|
||||
local ctrlItem = self:BindCtrlByNode(goItemObj, "Game.UI.TemplateEx.TemplatePropertyCtrl")
|
||||
local bValueChanged = self.mapAttrAfter[mapAttachAttr.sKey].Value ~= mapAttr.Value
|
||||
if bValueChanged then
|
||||
ctrlItem:SetItemProperty(mapAttr.Key, mapAttr.Value, self.mapAttrAfter[mapAttachAttr.sKey].Value, true)
|
||||
else
|
||||
ctrlItem:SetItemProperty(mapAttr.Key, mapAttr.Value, nil, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
self.tbUpgradeNote = PlayerData.Disc:GetUpgradeNote(self._panel.nId)
|
||||
for _, v in pairs(self.tbUpgradeNote) do
|
||||
local goItemObj = instantiate(self._mapNode.goPropertyLongNote, self._mapNode.trProperty)
|
||||
goItemObj:SetActive(true)
|
||||
local ctrlItem = self:BindCtrlByNode(goItemObj, "Game.UI.TemplateEx.TemplatePropertyCtrl")
|
||||
ctrlItem:SetNote(v[1], v[2], v[3])
|
||||
end
|
||||
end
|
||||
function DiscAdvanceCtrl:RefreshCoin(mapDisc)
|
||||
local nGoldCost = mapDisc.nPromoteGoldReq
|
||||
self:SetSprite_Coin(self._mapNode.imgCostIcon, AllEnum.CoinItemId.Gold)
|
||||
local nHasCoin = PlayerData.Coin:GetCoinCount(AllEnum.CoinItemId.Gold)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCostCount, math.ceil(nGoldCost))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtCostCount, nGoldCost <= nHasCoin and Blue_Normal or Red_Unable)
|
||||
end
|
||||
function DiscAdvanceCtrl:RefreshMat(mapDisc)
|
||||
self.tbMat = mapDisc.tbPromoteItemInfoReq
|
||||
local nMatCount = #self.tbMat
|
||||
for i = 1, 4 do
|
||||
self._mapNode.btnAdd[i].interactable = i <= nMatCount
|
||||
if i <= nMatCount then
|
||||
self._mapNode.goMat[i]:SetMat(self.tbMat[i].nItemId, self.tbMat[i].nItemNum)
|
||||
else
|
||||
self._mapNode.goMat[i]:SetMat(0)
|
||||
end
|
||||
end
|
||||
local nWorldClassLimit = 0
|
||||
local foreachPromoteLimit = function(mapData)
|
||||
if mapData.Rarity == mapDisc.nRarity and tonumber(mapData.Phase) == mapDisc.nPhase + 1 then
|
||||
nWorldClassLimit = mapData.WorldClassLimit
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.DiscPromoteLimit, foreachPromoteLimit)
|
||||
local nCurWorldClass = PlayerData.Base:GetWorldClass()
|
||||
if nWorldClassLimit > nCurWorldClass then
|
||||
self._mapNode.btnAdvance.gameObject:SetActive(false)
|
||||
self._mapNode.btnAutoFill.gameObject:SetActive(false)
|
||||
self._mapNode.txtAdvanceTips.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAdvanceTips, orderedFormat(ConfigTable.GetUIText("Disc_Advance_WorldClass_Limit"), nWorldClassLimit))
|
||||
return
|
||||
end
|
||||
local tbNeedMat = {}
|
||||
for _, v in ipairs(self.tbMat) do
|
||||
table.insert(tbNeedMat, {
|
||||
nId = v.nItemId,
|
||||
nCount = v.nItemNum
|
||||
})
|
||||
end
|
||||
self.tbFillStep, self.tbUseItem, self.tbShowNeedItem = PlayerData.Item:AutoFillMat(tbNeedMat)
|
||||
local nHasCoin = PlayerData.Coin:GetCoinCount(AllEnum.CoinItemId.Gold)
|
||||
local bAbleAutoFill = next(self.tbUseItem) ~= nil and nHasCoin >= mapDisc.nPromoteGoldReq
|
||||
self._mapNode.btnAdvance.gameObject:SetActive(not bAbleAutoFill)
|
||||
self._mapNode.btnAutoFill.gameObject:SetActive(bAbleAutoFill)
|
||||
self._mapNode.txtAdvanceTips.gameObject:SetActive(false)
|
||||
end
|
||||
function DiscAdvanceCtrl:RefreshBuffInfo(mapDisc)
|
||||
local buffCount = 0
|
||||
self.tbGridHeight = {}
|
||||
self.mapPreviewDesc = {}
|
||||
self.tbDesc = {}
|
||||
local AdvanceDescFront, AdvanceDescAfter = "", ""
|
||||
if mapDisc.nRarity == GameEnum.itemRarity.SSR then
|
||||
local nLimit = ConfigTable.GetConfigNumber("DiscL2dUnlock")
|
||||
if nLimit == mapDisc.nPhase + 1 then
|
||||
AdvanceDescFront = ConfigTable.GetUIText("Disc_Advance_L2dUnlock1")
|
||||
AdvanceDescAfter = ConfigTable.GetUIText("Disc_Advance_L2dUnlock2")
|
||||
table.insert(self.tbDesc, {sFront = AdvanceDescFront, sAfter = AdvanceDescAfter})
|
||||
end
|
||||
end
|
||||
if AdvanceDescFront ~= "" or AdvanceDescAfter ~= "" then
|
||||
buffCount = buffCount + 1
|
||||
local nMaxHeight = math.max(self:_CalcGridHeight(AdvanceDescFront), self:_CalcGridHeightAfter(AdvanceDescAfter))
|
||||
table.insert(self.tbGridHeight, nMaxHeight)
|
||||
table.insert(self.mapPreviewDesc, {sFront = AdvanceDescFront, sAfter = AdvanceDescAfter})
|
||||
end
|
||||
if 0 < buffCount then
|
||||
local goGrid = instantiate(self._mapNode.goBuff, self._mapNode.trProperty)
|
||||
goGrid:SetActive(true)
|
||||
local txtBuff = goGrid.transform:Find("txtBuff")
|
||||
if txtBuff ~= nil then
|
||||
NovaAPI.SetTMPText(txtBuff:GetComponent("TMP_Text"), self.mapPreviewDesc[1].sFront)
|
||||
end
|
||||
local txtBuffContent = goGrid.transform:Find("txtBuffContent")
|
||||
if txtBuffContent ~= nil then
|
||||
NovaAPI.SetTMPText(txtBuffContent:GetComponent("TMP_Text"), self.mapPreviewDesc[1].sAfter)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscAdvanceCtrl:Awake()
|
||||
end
|
||||
function DiscAdvanceCtrl:OnEnable()
|
||||
end
|
||||
function DiscAdvanceCtrl:OnDisable()
|
||||
end
|
||||
function DiscAdvanceCtrl:OnDestroy()
|
||||
end
|
||||
function DiscAdvanceCtrl:OnBtnClick_Advance(btn)
|
||||
local mapDisc = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
for _, mapMat in pairs(self.tbMat) do
|
||||
local nHas = PlayerData.Item:GetItemCountByID(mapMat.nItemId)
|
||||
if nHas < mapMat.nItemNum then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("OUTFIT_04"))
|
||||
return
|
||||
end
|
||||
end
|
||||
if mapDisc.nPromoteGoldReq > PlayerData.Coin:GetCoinCount(AllEnum.CoinItemId.Gold) then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("OUTFIT_06"))
|
||||
return
|
||||
end
|
||||
local callback = function()
|
||||
local mapData = {
|
||||
nLevel = mapDisc.nLevel,
|
||||
nLevelMax = self.nNextMaxLv,
|
||||
mapAttrBefore = self.mapAttrBefore,
|
||||
mapAttrAfter = self.mapAttrAfter,
|
||||
tbDesc = self.tbDesc,
|
||||
nPhase = mapDisc.nPhase,
|
||||
nMaxPhase = mapDisc.nMaxPhase,
|
||||
tbUpgradeNote = self.tbUpgradeNote
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSucBar, mapData, AllEnum.DiscSucBar.Advance)
|
||||
EventManager.Hit("DiscRefresh")
|
||||
end
|
||||
PlayerData.Disc:SendDiscPromoteReq(self._panel.nId, callback)
|
||||
end
|
||||
function DiscAdvanceCtrl:OnBtnClick_AutoFill()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.FillMaterial, self.tbFillStep, self.tbUseItem, self.tbShowNeedItem)
|
||||
end
|
||||
function DiscAdvanceCtrl:OnBtnClick_Tips(btn, nIndex)
|
||||
if self.tbMat[nIndex] and self.tbMat[nIndex].nItemId > 0 then
|
||||
local mapData = {
|
||||
nTid = self.tbMat[nIndex].nItemId,
|
||||
nNeedCount = self.tbMat[nIndex].nItemNum,
|
||||
bShowDepot = true,
|
||||
bShowJumpto = true
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ItemTips, btn.transform, mapData)
|
||||
end
|
||||
end
|
||||
function DiscAdvanceCtrl:OnEvent_ItemChanged()
|
||||
local mapDisc = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
self:RefreshMat(mapDisc)
|
||||
end
|
||||
return DiscAdvanceCtrl
|
||||
@@ -0,0 +1,237 @@
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local DiscBreakLimitCtrl = class("DiscBreakLimitCtrl", BaseCtrl)
|
||||
DiscBreakLimitCtrl._mapNodeConfig = {
|
||||
NoMax = {},
|
||||
goStar = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
txtStarMax = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_MaxStar"
|
||||
},
|
||||
goPropertyLong = {},
|
||||
goPropertyLong_Atk = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplatePropertyCtrl"
|
||||
},
|
||||
trProperty = {sComponentName = "Transform"},
|
||||
rtMat = {},
|
||||
goMat = {
|
||||
nCount = 5,
|
||||
sCtrlName = "Game.UI.Disc.DiscSelectedMatCtrl"
|
||||
},
|
||||
btnBreakLimit = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_BreakLimit"
|
||||
},
|
||||
txtBtnBreakLimit = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Outfit_Btn_LimitBreak"
|
||||
},
|
||||
DiscSkill = {},
|
||||
txtSkillName = {sComponentName = "TMP_Text"},
|
||||
imgSkillIcon = {sComponentName = "Image"},
|
||||
imgSkillIconBg = {sComponentName = "Image"},
|
||||
txtLayerDesc = {sComponentName = "TMP_Text"},
|
||||
TMP_Link = {
|
||||
sNodeName = "txtLayerDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
},
|
||||
cgSkillBg = {
|
||||
sNodeName = "DiscSkill",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
goDiscLimit = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscLimitCtrl"
|
||||
},
|
||||
goSkillInfoMask = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goDiscSkillUpgrade = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
DiscBreakLimitCtrl._mapEventConfig = {
|
||||
DiscChangeSelectedMat = "OnEvent_ChangeMat",
|
||||
DiscOpenMatList = "OnEvent_OpenMatList",
|
||||
DiscCloseMatList = "OnEvent_CloseMatList"
|
||||
}
|
||||
function DiscBreakLimitCtrl:InitData(mapDisc)
|
||||
self._panel:ClearMatList()
|
||||
local nMatId, nMatCount = PlayerData.Disc:GetBreakLimitMat(self._panel.nId)
|
||||
if nMatCount > mapDisc.nMaxStar - mapDisc.nStar then
|
||||
nMatCount = mapDisc.nMaxStar - mapDisc.nStar
|
||||
end
|
||||
nMatCount = nMatCount > mapDisc.nMaxStar and mapDisc.nMaxStar or nMatCount
|
||||
for i = 1, nMatCount do
|
||||
local mapData = {
|
||||
nId = nMatId,
|
||||
nIndex = i,
|
||||
nCost = 1,
|
||||
nType = GameEnum.itemStype.DiscLimitBreak,
|
||||
nAddIndex = i
|
||||
}
|
||||
self._panel:ChangeMatList(mapData)
|
||||
end
|
||||
self.nAfterStar = nMatCount + mapDisc.nStar
|
||||
end
|
||||
function DiscBreakLimitCtrl:Refresh()
|
||||
local mapDisc = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
self:InitData(mapDisc)
|
||||
local bMax = mapDisc.nStar == mapDisc.nMaxStar
|
||||
self._mapNode.rtMat:SetActive(not bMax)
|
||||
self._mapNode.txtStarMax.gameObject:SetActive(bMax)
|
||||
self:RefreshSkill(mapDisc)
|
||||
self:RefreshStar(mapDisc, self.nAfterStar)
|
||||
self:RefreshAttr(mapDisc, self.nAfterStar)
|
||||
if not bMax then
|
||||
self:RefreshMat()
|
||||
end
|
||||
end
|
||||
function DiscBreakLimitCtrl:RefreshStar(mapDisc, nAfterStar)
|
||||
self._mapNode.goDiscLimit:SetLimit(mapDisc.nStar + 1, nAfterStar + 1, mapDisc.nRarity)
|
||||
end
|
||||
local nMaskHeightWithOneAttr = 269
|
||||
function DiscBreakLimitCtrl:RefreshAttr(mapDisc, nAfterStar)
|
||||
local bStarChanged = false
|
||||
if nAfterStar > mapDisc.nStar then
|
||||
bStarChanged = true
|
||||
end
|
||||
self.mapAttrBefore = mapDisc.mapAttrBase
|
||||
self.mapAttrAfter = PlayerData.Disc:GetAttrBase(mapDisc.nAttrBaseGroupId, mapDisc.nPhase, mapDisc.nLevel, mapDisc.nAttrExtraGroupId, nAfterStar)
|
||||
local nAttrCount = -1
|
||||
local sKey = "Atk"
|
||||
local mapAttr = self.mapAttrBefore[sKey]
|
||||
if mapAttr.Value > 0 then
|
||||
self._mapNode.goPropertyLong_Atk.gameObject:SetActive(true)
|
||||
local bValueChanged = self.mapAttrAfter[sKey].Value ~= mapAttr.Value
|
||||
if bStarChanged and bValueChanged then
|
||||
self._mapNode.goPropertyLong_Atk:SetItemProperty(mapAttr.Key, mapAttr.Value, self.mapAttrAfter[sKey].Value, true)
|
||||
else
|
||||
self._mapNode.goPropertyLong_Atk:SetItemProperty(mapAttr.Key, mapAttr.Value, nil, true)
|
||||
end
|
||||
nAttrCount = nAttrCount + 1
|
||||
else
|
||||
self._mapNode.goPropertyLong_Atk.gameObject:SetActive(false)
|
||||
end
|
||||
local nHeightToReduce = nAttrCount * 51
|
||||
local v2SizeDelta = self._mapNode.goSkillInfoMask.sizeDelta
|
||||
v2SizeDelta.y = nMaskHeightWithOneAttr - nHeightToReduce
|
||||
self._mapNode.goSkillInfoMask.sizeDelta = v2SizeDelta
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.goDiscSkillUpgrade)
|
||||
end
|
||||
function DiscBreakLimitCtrl:RefreshSkill(mapDisc)
|
||||
local nMainSkillId = mapDisc.nMainSkillId
|
||||
if nMainSkillId then
|
||||
self._mapNode.DiscSkill:SetActive(true)
|
||||
else
|
||||
self._mapNode.DiscSkill:SetActive(false)
|
||||
return
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData("MainSkill", nMainSkillId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgSkillIcon, mapCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.imgSkillIconBg, mapCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillName, mapCfg.Name)
|
||||
if self.nAfterStar == nil or self.nAfterStar <= mapDisc.nStar then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLayerDesc, UTILS.ParseParamDesc(mapCfg.Desc, mapCfg))
|
||||
else
|
||||
local mapGroup = CacheTable.GetData("_MainSkill", mapDisc.nMainSkillGroupId)
|
||||
if not mapGroup then
|
||||
return
|
||||
end
|
||||
local nAfter = self.nAfterStar
|
||||
while nAfter > mapDisc.nStar do
|
||||
local mapNextCfg = mapGroup[nAfter + 1]
|
||||
if mapNextCfg then
|
||||
local sNext = UTILS.ParseParamDesc(mapCfg.Desc, mapCfg, mapNextCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLayerDesc, sNext)
|
||||
self.sSucDesc = UTILS.ParseParamDesc(mapCfg.Desc, mapNextCfg)
|
||||
return
|
||||
else
|
||||
nAfter = nAfter - 1
|
||||
end
|
||||
end
|
||||
self.sSucDesc = UTILS.ParseParamDesc(mapCfg.Desc, mapCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLayerDesc, self.sSucDesc)
|
||||
end
|
||||
end
|
||||
function DiscBreakLimitCtrl:RefreshMat()
|
||||
local tbMat = {}
|
||||
if next(self._panel.tbMat) ~= nil then
|
||||
for _, v in pairs(self._panel.tbMat) do
|
||||
table.insert(tbMat, v)
|
||||
end
|
||||
table.sort(tbMat, function(a, b)
|
||||
return a.nAddIndex < b.nAddIndex
|
||||
end)
|
||||
end
|
||||
for i = 1, 5 do
|
||||
if i <= #tbMat then
|
||||
self._mapNode.goMat[i]:Refresh(tbMat[i])
|
||||
self._mapNode.goMat[i]:SetCount(tbMat[i].nCost)
|
||||
else
|
||||
self._mapNode.goMat[i]:Refresh()
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscBreakLimitCtrl:Awake()
|
||||
end
|
||||
function DiscBreakLimitCtrl:OnEnable()
|
||||
end
|
||||
function DiscBreakLimitCtrl:OnDisable()
|
||||
end
|
||||
function DiscBreakLimitCtrl:OnDestroy()
|
||||
end
|
||||
function DiscBreakLimitCtrl:OnBtnClick_BreakLimit(btn)
|
||||
if next(self._panel.tbMat) == nil then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("OUTFIT_09"))
|
||||
return
|
||||
end
|
||||
local nMatCount = 0
|
||||
for _, _ in pairs(self._panel.tbMat) do
|
||||
nMatCount = nMatCount + 1
|
||||
end
|
||||
local mapDisc = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
local mapSucData = {
|
||||
nId = self._panel.nId,
|
||||
nBeforeStar = mapDisc.nStar,
|
||||
nAfterStar = self.nAfterStar,
|
||||
sDesc = self.sSucDesc,
|
||||
sName = ConfigTable.GetData("MainSkill", mapDisc.nMainSkillId).Name,
|
||||
mapAttrBefore = self.mapAttrBefore,
|
||||
mapAttrAfter = self.mapAttrAfter
|
||||
}
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSucBar, mapSucData, AllEnum.DiscSucBar.BreakLimit)
|
||||
EventManager.Hit("DiscRefresh")
|
||||
end
|
||||
PlayerData.Disc:SendDiscLimitBreakReq(self._panel.nId, nMatCount, callback)
|
||||
end
|
||||
function DiscBreakLimitCtrl:OnEvent_ChangeMat(bRefreshMat)
|
||||
local mapDisc = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
local nStarCount = mapDisc.nStar
|
||||
for _, _ in pairs(self._panel.tbMat) do
|
||||
nStarCount = nStarCount + 1
|
||||
end
|
||||
self.nAfterStar = nStarCount > mapDisc.nMaxStar and mapDisc.nMaxStar or nStarCount
|
||||
self:RefreshStar(mapDisc, self.nAfterStar)
|
||||
self:RefreshSkill(mapDisc)
|
||||
self:RefreshAttr(mapDisc, self.nAfterStar)
|
||||
if bRefreshMat then
|
||||
self:RefreshMat()
|
||||
end
|
||||
end
|
||||
function DiscBreakLimitCtrl:OnEvent_CloseMatList()
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.cgSkillBg, true)
|
||||
end
|
||||
function DiscBreakLimitCtrl:OnEvent_OpenMatList()
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.cgSkillBg, false)
|
||||
end
|
||||
function DiscBreakLimitCtrl:OnLinkClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
return DiscBreakLimitCtrl
|
||||
@@ -0,0 +1,88 @@
|
||||
local DiscCommonSkillCtrl = class("DiscCommonSkillCtrl", BaseCtrl)
|
||||
DiscCommonSkillCtrl._mapNodeConfig = {
|
||||
txtSkillName = {sComponentName = "TMP_Text"},
|
||||
imgSkillIcon = {sComponentName = "Image"},
|
||||
imgSkillIconBg = {sComponentName = "Image"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
btnPrevLevel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Prev"
|
||||
},
|
||||
btnNextLevel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Next"
|
||||
},
|
||||
imgPrevOn = {},
|
||||
imgPrevOff = {},
|
||||
imgNextOn = {},
|
||||
imgNextOff = {},
|
||||
goNote = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscMultiNoteCtrl"
|
||||
},
|
||||
txtSkillDesc = {sComponentName = "TMP_Text"},
|
||||
txtNoteTip = {sComponentName = "TMP_Text"},
|
||||
TMP_Link = {
|
||||
sNodeName = "txtSkillDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
}
|
||||
}
|
||||
DiscCommonSkillCtrl._mapEventConfig = {}
|
||||
function DiscCommonSkillCtrl:Refresh(nId, nLayer)
|
||||
self.mapCfg = ConfigTable.GetData("DiscCommonSkill", nId)
|
||||
if not self.mapCfg then
|
||||
return
|
||||
end
|
||||
self.nLayer = 1
|
||||
if nLayer then
|
||||
self.nLayer = nLayer
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgSkillIcon, self.mapCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.imgSkillIconBg, self.mapCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillName, self.mapCfg.Name)
|
||||
self.nMaxLayer = #self.mapCfg.ActiveNoteNum
|
||||
self:RefreshSkill()
|
||||
end
|
||||
function DiscCommonSkillCtrl:RefreshSkill()
|
||||
local sDesc = UTILS.ParseDiscDesc(self.mapCfg.Desc, self.mapCfg, nil, self.nLayer)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillDesc, sDesc)
|
||||
self._mapNode.goNote:SetNoteItem(self.mapCfg.ActiveNoteType, self.mapCfg.ActiveNoteNum[self.nLayer])
|
||||
local bMulti = #self.mapCfg.ActiveNoteType > 1
|
||||
if bMulti then
|
||||
local mapNote1 = ConfigTable.GetData("Note", self.mapCfg.ActiveNoteType[1])
|
||||
local mapNote2 = ConfigTable.GetData("Note", self.mapCfg.ActiveNoteType[2])
|
||||
if not mapNote1 or not mapNote2 then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteTip, orderedFormat(ConfigTable.GetUIText("Disc_CommonSkill_MultiNoteTip"), mapNote1.Name1, mapNote2.Name1))
|
||||
else
|
||||
local mapNote1 = ConfigTable.GetData("Note", self.mapCfg.ActiveNoteType[1])
|
||||
if not mapNote1 then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteTip, orderedFormat(ConfigTable.GetUIText("Disc_CommonSkill_NoteTip"), mapNote1.Name1))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("Disc_CommonSkill_Level"), self.nLayer))
|
||||
self._mapNode.imgPrevOn:SetActive(self.nLayer > 1)
|
||||
self._mapNode.imgPrevOff:SetActive(self.nLayer == 1)
|
||||
self._mapNode.imgNextOn:SetActive(self.nLayer < self.nMaxLayer)
|
||||
self._mapNode.imgNextOff:SetActive(self.nLayer == self.nMaxLayer)
|
||||
end
|
||||
function DiscCommonSkillCtrl:OnBtnClick_Prev()
|
||||
if self.nLayer == 1 then
|
||||
return
|
||||
end
|
||||
self.nLayer = self.nLayer - 1
|
||||
self:RefreshSkill()
|
||||
end
|
||||
function DiscCommonSkillCtrl:OnBtnClick_Next()
|
||||
if self.nLayer == self.nMaxLayer then
|
||||
return
|
||||
end
|
||||
self.nLayer = self.nLayer + 1
|
||||
self:RefreshSkill()
|
||||
end
|
||||
function DiscCommonSkillCtrl:OnLinkClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
return DiscCommonSkillCtrl
|
||||
@@ -0,0 +1,49 @@
|
||||
local DiscCoreSkillCtrl = class("DiscCoreSkillCtrl", BaseCtrl)
|
||||
DiscCoreSkillCtrl._mapNodeConfig = {
|
||||
txtSkillName = {sComponentName = "TMP_Text"},
|
||||
imgSkillIcon = {sComponentName = "Image"},
|
||||
imgSkillIconBg = {sComponentName = "Image"},
|
||||
NoteLayer = {
|
||||
nCount = 5,
|
||||
sCtrlName = "Game.UI.Disc.DiscNoteLayerCtrl"
|
||||
},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtNoteTip = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
DiscCoreSkillCtrl._mapEventConfig = {}
|
||||
function DiscCoreSkillCtrl:Refresh(nId)
|
||||
local mapCfg = ConfigTable.GetData("DiscPassiveSkill", nId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgSkillIcon, mapCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.imgSkillIconBg, mapCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillName, mapCfg.Name)
|
||||
local mapNote = ConfigTable.GetData("Note", mapCfg.MainNote)
|
||||
if not mapNote then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteTip, orderedFormat(ConfigTable.GetUIText("Disc_CoreSkill_NoteTip"), mapNote.Name2))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("Disc_Skill_Level"), mapCfg.Level))
|
||||
for i = 1, 5 do
|
||||
local bHasLayer = mapCfg["ActiveParam" .. i] and mapCfg["ActiveParam" .. i] ~= ""
|
||||
self._mapNode.NoteLayer[i].gameObject:SetActive(bHasLayer)
|
||||
if bHasLayer then
|
||||
local bLastlayer = mapCfg["ActiveParam" .. i + 1] == nil or mapCfg["ActiveParam" .. i + 1] == ""
|
||||
local sDesc = UTILS.ParseDiscDesc(mapCfg["Desc" .. i], mapCfg)
|
||||
local tbLayerNote = decodeJson(mapCfg["ActiveParam" .. i])
|
||||
local tbNoteId = {}
|
||||
local nNoteCount = 0
|
||||
for k, v in pairs(tbLayerNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nCount = tonumber(v)
|
||||
if nNoteId then
|
||||
nNoteCount = nNoteCount + nCount
|
||||
table.insert(tbNoteId, nNoteId)
|
||||
end
|
||||
end
|
||||
self._mapNode.NoteLayer[i]:Refresh(tbNoteId, nNoteCount, sDesc, i, bLastlayer)
|
||||
end
|
||||
end
|
||||
end
|
||||
return DiscCoreSkillCtrl
|
||||
@@ -0,0 +1,410 @@
|
||||
local DiscCtrl = class("DiscCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local MoveBarPos = {
|
||||
-484.2,
|
||||
-159.5,
|
||||
161.6,
|
||||
484.2
|
||||
}
|
||||
local TogAni = {
|
||||
[AllEnum.DiscTab.Info] = {
|
||||
[AllEnum.DiscTab.Development] = "DiscPanel_Development",
|
||||
[AllEnum.DiscTab.BreakLimit] = "DiscPanel_Development",
|
||||
[AllEnum.DiscTab.Music] = "DiscPanel_Music"
|
||||
},
|
||||
[AllEnum.DiscTab.Development] = {
|
||||
[AllEnum.DiscTab.Info] = "DiscPanel_in3",
|
||||
[AllEnum.DiscTab.BreakLimit] = "DiscPanel_Development1",
|
||||
[AllEnum.DiscTab.Music] = "DiscPanel_Music1"
|
||||
},
|
||||
[AllEnum.DiscTab.BreakLimit] = {
|
||||
[AllEnum.DiscTab.Info] = "DiscPanel_in3",
|
||||
[AllEnum.DiscTab.Development] = "DiscPanel_Development1",
|
||||
[AllEnum.DiscTab.Music] = "DiscPanel_Music1"
|
||||
},
|
||||
[AllEnum.DiscTab.Music] = {
|
||||
[AllEnum.DiscTab.Info] = "DiscPanel_in1",
|
||||
[AllEnum.DiscTab.Development] = "DiscPanel_in2",
|
||||
[AllEnum.DiscTab.BreakLimit] = "DiscPanel_in2"
|
||||
}
|
||||
}
|
||||
DiscCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
UIDrag = {
|
||||
sComponentName = "UIDrag",
|
||||
callback = "OnDrag_Disc"
|
||||
},
|
||||
imgDiscFrame = {sComponentName = "Image"},
|
||||
imgDiscIcon = {sComponentName = "Image"},
|
||||
Middle = {
|
||||
sNodeName = "---Middle---"
|
||||
},
|
||||
liveDiscCtrl = {
|
||||
sNodeName = "goLiveDisc",
|
||||
sCtrlName = "Game.UI.Disc.LiveDiscCtrl"
|
||||
},
|
||||
FullImage = {
|
||||
sNodeName = "----Full----"
|
||||
},
|
||||
imgFull = {nCount = 2, sComponentName = "Image"},
|
||||
rtImgFull2 = {
|
||||
sNodeName = "imgFull2",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgFullBg = {},
|
||||
btnCloseFull = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CloseFull"
|
||||
},
|
||||
btnOpenFull2 = {
|
||||
sNodeName = "imgDiscFrame",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_OpenFull"
|
||||
},
|
||||
Development = {
|
||||
sNodeName = "---Development---"
|
||||
},
|
||||
Info = {
|
||||
sNodeName = "---Info---",
|
||||
sCtrlName = "Game.UI.Disc.DiscInfoCtrl"
|
||||
},
|
||||
Upgrade = {
|
||||
sCtrlName = "Game.UI.Disc.DiscUpgradeCtrl"
|
||||
},
|
||||
Advance = {
|
||||
sCtrlName = "Game.UI.Disc.DiscAdvanceCtrl"
|
||||
},
|
||||
BreakLimit = {
|
||||
sNodeName = "---BreakLimit---",
|
||||
sCtrlName = "Game.UI.Disc.DiscBreakLimitCtrl"
|
||||
},
|
||||
Music = {
|
||||
sNodeName = "---Music---",
|
||||
sCtrlName = "Game.UI.Disc.DiscMusicCtrl"
|
||||
},
|
||||
MusicRight = {
|
||||
sNodeName = "--MusicRight--"
|
||||
},
|
||||
cgMiddle = {
|
||||
sNodeName = "---Middle---",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
cgMusic = {
|
||||
sNodeName = "---Music---",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
Story = {
|
||||
sNodeName = "----Story----",
|
||||
sCtrlName = "Game.UI.Disc.DiscStoryCtrl"
|
||||
},
|
||||
btnTab = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Tab"
|
||||
},
|
||||
imgTabOn = {nCount = 4},
|
||||
txtTabOn = {nCount = 4, sComponentName = "TMP_Text"},
|
||||
txtTabOff = {nCount = 4, sComponentName = "TMP_Text"},
|
||||
layoutOff = {nCount = 4},
|
||||
reddot = {nCount = 4},
|
||||
imgMoveBar = {sComponentName = "Transform"},
|
||||
MatList = {
|
||||
sCtrlName = "Game.UI.Disc.DiscMatListCtrl"
|
||||
},
|
||||
btnMask = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Mask"
|
||||
},
|
||||
aniMatList = {sNodeName = "MatList", sComponentName = "Animator"},
|
||||
anibtnMask = {sNodeName = "btnMask", sComponentName = "Animator"},
|
||||
aniRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
reddotB = {},
|
||||
reddotBreak = {},
|
||||
reddotBRead = {},
|
||||
reddotBAvg = {},
|
||||
btnTabSwitchLeft = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_TabSwitchLeft"
|
||||
},
|
||||
btnTabSwitchRight = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_TabSwitchRight"
|
||||
}
|
||||
}
|
||||
DiscCtrl._mapEventConfig = {
|
||||
DiscRefresh = "OnEvent_GrowthRefresh",
|
||||
DiscOpenMatList = "OnEvent_OpenMatList",
|
||||
ClickLiveDisc = "OnEvent_OpenFull",
|
||||
Guide_DiscSkill = "OnEvent_Guide_DiscSkill"
|
||||
}
|
||||
function DiscCtrl:Refresh()
|
||||
self:ClosePopup()
|
||||
self:RefreshMiddle()
|
||||
self:SwitchTog()
|
||||
self:RefreshIndex()
|
||||
end
|
||||
function DiscCtrl:ClosePopup()
|
||||
self._mapNode.MatList:Open(false)
|
||||
self._mapNode.btnMask.gameObject:SetActive(false)
|
||||
end
|
||||
function DiscCtrl:RefreshMiddle()
|
||||
local mapCfg = ConfigTable.GetData("Disc", self._panel.nId)
|
||||
local mapData = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
self._mapNode.imgDiscIcon.gameObject:SetActive(false)
|
||||
self._mapNode.liveDiscCtrl:SetDiscActive(true, mapCfg.DiscBg ~= "")
|
||||
self._mapNode.liveDiscCtrl:SetRawImage(mapCfg.DiscBg, mapData.nRarity)
|
||||
if mapCfg.DiscBg ~= "" then
|
||||
local bSSR = mapData.nRarity == GameEnum.itemRarity.SSR
|
||||
self._mapNode.imgFull[1].gameObject:SetActive(bSSR)
|
||||
self._mapNode.imgFull[2].gameObject:SetActive(not bSSR)
|
||||
if bSSR then
|
||||
self:SetPngSprite(self._mapNode.imgFull[1], mapCfg.DiscBg .. AllEnum.DiscBgSurfix.Image)
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgFull[2], mapCfg.DiscBg .. AllEnum.DiscBgSurfix.Image)
|
||||
local nH = Settings.CURRENT_CANVAS_FULL_RECT_HEIGHT
|
||||
self._mapNode.rtImgFull2.sizeDelta = Vector2(nH, nH)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscCtrl:SwitchTog()
|
||||
self._mapNode.TopBar:SetCoinVisible(self._panel.nCurTog == AllEnum.DiscTab.Development)
|
||||
local mapData = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
local bMaxLv = mapData.nLevel == mapData.nMaxLv
|
||||
local bAdvance = mapData.nPhase < mapData.nMaxPhase and bMaxLv
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.cgMusic, self._panel.nCurTog == AllEnum.DiscTab.Music)
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.cgMiddle, self._panel.nCurTog ~= AllEnum.DiscTab.Music)
|
||||
self._mapNode.Info.gameObject:SetActive(self._panel.nCurTog == AllEnum.DiscTab.Info)
|
||||
self._mapNode.Development:SetActive(self._panel.nCurTog == AllEnum.DiscTab.Development)
|
||||
self._mapNode.BreakLimit.gameObject:SetActive(self._panel.nCurTog == AllEnum.DiscTab.BreakLimit)
|
||||
self._mapNode.MusicRight:SetActive(self._panel.nCurTog == AllEnum.DiscTab.Music)
|
||||
if self._panel.nCurTog == AllEnum.DiscTab.Info then
|
||||
self._mapNode.Info:RefreshContent()
|
||||
elseif self._panel.nCurTog == AllEnum.DiscTab.Development then
|
||||
self._mapNode.Upgrade.gameObject:SetActive(not bAdvance)
|
||||
self._mapNode.Advance.gameObject:SetActive(bAdvance)
|
||||
if bAdvance then
|
||||
self._mapNode.Advance:Refresh()
|
||||
else
|
||||
self._mapNode.Upgrade:Refresh()
|
||||
end
|
||||
elseif self._panel.nCurTog == AllEnum.DiscTab.BreakLimit then
|
||||
self._mapNode.BreakLimit:Refresh()
|
||||
elseif self._panel.nCurTog == AllEnum.DiscTab.Music then
|
||||
self._mapNode.Music:Refresh()
|
||||
end
|
||||
end
|
||||
function DiscCtrl:PlayBGM()
|
||||
local mapCfg = ConfigTable.GetData("DiscIP", self._panel.nId)
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
local sState = mapCfg.VoFile
|
||||
WwiseAudioMgr:SetState_Custom("outfit", sState)
|
||||
self._mapNode.Music:InitMusic()
|
||||
end
|
||||
function DiscCtrl:QuitBGM()
|
||||
if self._panel.bPause and not self._panel.bAvg then
|
||||
WwiseAudioMgr:PostEvent("music_outfit_resume")
|
||||
end
|
||||
end
|
||||
function DiscCtrl:ClosePanel()
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
end
|
||||
function DiscCtrl:InitTab()
|
||||
if self._panel.nCurTog == nil then
|
||||
self._panel.nCurTog = AllEnum.DiscTab.Info
|
||||
end
|
||||
self._mapNode.imgMoveBar.localPosition = Vector3(MoveBarPos[self._panel.nCurTog], 4.5, 0)
|
||||
for i = 1, 4 do
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTabOn[i], ConfigTable.GetUIText("Disc_Tab" .. i))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTabOff[i], ConfigTable.GetUIText("Disc_Tab" .. i))
|
||||
self._mapNode.imgTabOn[i]:SetActive(self._panel.nCurTog == i)
|
||||
self._mapNode.txtTabOn[i].gameObject:SetActive(self._panel.nCurTog == i)
|
||||
self._mapNode.layoutOff[i].gameObject:SetActive(self._panel.nCurTog ~= i)
|
||||
end
|
||||
end
|
||||
function DiscCtrl:RefreshIndex()
|
||||
for index, discId in ipairs(self._panel.tbId) do
|
||||
if self._panel.nId == discId then
|
||||
self.curDiscIndex = index
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscCtrl:RegisterRedDot()
|
||||
RedDotManager.RegisterNode(RedDotDefine.Disc_BreakLimit, self._panel.nId, self._mapNode.reddot[3])
|
||||
RedDotManager.RegisterNode(RedDotDefine.Disc_Music, self._panel.nId, self._mapNode.reddot[4])
|
||||
RedDotManager.RegisterNode(RedDotDefine.Disc_SideB, self._panel.nId, self._mapNode.reddotB)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Disc_BreakBtn, self._panel.nId, self._mapNode.reddotBreak)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Disc_SideB_Read, self._panel.nId, self._mapNode.reddotBRead)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Disc_SideB_Avg, self._panel.nId, self._mapNode.reddotBAvg)
|
||||
end
|
||||
function DiscCtrl:FadeIn()
|
||||
if self._panel._nFadeInType == 1 then
|
||||
self._mapNode.aniRoot:Play("DiscPanel_in")
|
||||
elseif self._panel.nCurTog == AllEnum.DiscTab.Development or self._panel.nCurTog == AllEnum.DiscTab.BreakLimit then
|
||||
self._mapNode.aniRoot:Play("DiscPanel_Development", 0, 1)
|
||||
elseif self._panel.nCurTog == AllEnum.DiscTab.Music then
|
||||
self._mapNode.aniRoot:Play("DiscPanel_Music", 0, 1)
|
||||
else
|
||||
self._mapNode.aniRoot:Play("DiscPanel_in")
|
||||
end
|
||||
end
|
||||
function DiscCtrl:Awake()
|
||||
self.aniFull = self.gameObject.transform:GetComponent("Animator")
|
||||
self.aniFull.enabled = false
|
||||
self.nDragStartPosX = nil
|
||||
self.nDragThreshold = ConfigTable.GetConfigNumber("DiscDragThreshold")
|
||||
self.curDiscIndex = nil
|
||||
self:InitTab()
|
||||
end
|
||||
function DiscCtrl:OnEnable()
|
||||
self:RegisterRedDot()
|
||||
self:PlayBGM()
|
||||
self:Refresh()
|
||||
self.nTabCount = 0
|
||||
for k, v in pairs(AllEnum.DiscTab) do
|
||||
self.nTabCount = self.nTabCount + 1
|
||||
end
|
||||
end
|
||||
function DiscCtrl:OnDisable()
|
||||
self:QuitBGM()
|
||||
end
|
||||
function DiscCtrl:OnDestroy()
|
||||
end
|
||||
function DiscCtrl:OnBtnClick_Tab(btn, nIndex)
|
||||
if nIndex == self._panel.nCurTog then
|
||||
return
|
||||
end
|
||||
if self._panel.nCurTog == AllEnum.DiscTab.Music then
|
||||
self._mapNode.Music:PlayOutMusic()
|
||||
end
|
||||
local sAni = TogAni[self._panel.nCurTog][nIndex]
|
||||
self._mapNode.aniRoot:Play(sAni, 0, 0)
|
||||
self._mapNode.imgMoveBar:DOLocalMoveX(MoveBarPos[nIndex], 0.1):SetUpdate(true)
|
||||
self._mapNode.imgTabOn[self._panel.nCurTog]:SetActive(false)
|
||||
self._mapNode.txtTabOn[self._panel.nCurTog].gameObject:SetActive(false)
|
||||
self._mapNode.layoutOff[self._panel.nCurTog].gameObject:SetActive(true)
|
||||
self._mapNode.imgTabOn[nIndex]:SetActive(true)
|
||||
self._mapNode.txtTabOn[nIndex].gameObject:SetActive(true)
|
||||
self._mapNode.layoutOff[nIndex].gameObject:SetActive(false)
|
||||
self._panel.nCurTog = nIndex
|
||||
self:SwitchTog()
|
||||
end
|
||||
function DiscCtrl:OnBtnClick_TabSwitchLeft()
|
||||
if #self._panel.tbId <= 1 then
|
||||
return
|
||||
end
|
||||
self.curDiscIndex = self.curDiscIndex - 1
|
||||
if 1 > self.curDiscIndex then
|
||||
self.curDiscIndex = #self._panel.tbId
|
||||
end
|
||||
self._panel.nId = self._panel.tbId[self.curDiscIndex]
|
||||
self:OnEvent_Drag()
|
||||
self._mapNode.Info:RefreshShow()
|
||||
end
|
||||
function DiscCtrl:OnBtnClick_TabSwitchRight()
|
||||
if #self._panel.tbId <= 1 then
|
||||
return
|
||||
end
|
||||
self.curDiscIndex = self.curDiscIndex + 1
|
||||
if self.curDiscIndex > #self._panel.tbId then
|
||||
self.curDiscIndex = 1
|
||||
end
|
||||
self._panel.nId = self._panel.tbId[self.curDiscIndex]
|
||||
self:OnEvent_Drag()
|
||||
self._mapNode.Info:RefreshShow()
|
||||
end
|
||||
function DiscCtrl:OnBtnClick_Mask(btn)
|
||||
self._mapNode.anibtnMask:SetTrigger("tOut")
|
||||
self._mapNode.aniMatList:Play("MatList_out")
|
||||
local ani_end = function()
|
||||
self._mapNode.MatList:Open(false)
|
||||
self._mapNode.btnMask.gameObject:SetActive(false)
|
||||
end
|
||||
self:AddTimer(1, 0.2, ani_end, true, true, true)
|
||||
end
|
||||
function DiscCtrl:OnBtnClick_OpenFull()
|
||||
if self._mapNode.liveDiscCtrl:GetCanOpenFullState() then
|
||||
self.aniFull.enabled = true
|
||||
self._mapNode.FullImage.gameObject:SetActive(true)
|
||||
if self._mapNode.imgFull[2].gameObject.activeSelf then
|
||||
self._mapNode.imgFullBg.gameObject:SetActive(true)
|
||||
end
|
||||
if self._panel.nCurTog == AllEnum.DiscTab.Info then
|
||||
self.aniFull:Play("DiscPanel_Full_in", 0, 0)
|
||||
elseif self._panel.nCurTog == AllEnum.DiscTab.Development or self._panel.nCurTog == AllEnum.DiscTab.BreakLimit then
|
||||
self.aniFull:Play("DiscPanel_Full_in1", 0, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscCtrl:OnBtnClick_CloseFull()
|
||||
if self._panel.nCurTog == AllEnum.DiscTab.Info then
|
||||
self.aniFull:Play("DiscPanel_Full_out")
|
||||
elseif self._panel.nCurTog == AllEnum.DiscTab.Development or self._panel.nCurTog == AllEnum.DiscTab.BreakLimit then
|
||||
self.aniFull:Play("DiscPanel_Full_out1")
|
||||
end
|
||||
local ani_end = function()
|
||||
self.aniFull.enabled = false
|
||||
self._mapNode.FullImage.gameObject:SetActive(false)
|
||||
self._mapNode.imgFullBg.gameObject:SetActive(false)
|
||||
end
|
||||
self:AddTimer(1, 0.4, ani_end, true, true, true)
|
||||
end
|
||||
function DiscCtrl:OnDrag_Disc(mDrag)
|
||||
if mDrag.DragEventType == AllEnum.UIDragType.DragStart then
|
||||
self.nDragStartPosX = mDrag.EventData.position.x
|
||||
elseif mDrag.DragEventType == AllEnum.UIDragType.DragEnd then
|
||||
local dragEndPosX = mDrag.EventData.position.x
|
||||
if dragEndPosX - self.nDragStartPosX > self.nDragThreshold then
|
||||
self:OnBtnClick_TabSwitchLeft()
|
||||
elseif dragEndPosX - self.nDragStartPosX < -self.nDragThreshold then
|
||||
self:OnBtnClick_TabSwitchRight()
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscCtrl:OnEvent_OpenMatList()
|
||||
self._mapNode.btnMask.gameObject:SetActive(true)
|
||||
self._mapNode.MatList:Open(true)
|
||||
end
|
||||
function DiscCtrl:OnEvent_Drag()
|
||||
self:RefreshMiddle()
|
||||
self:RegisterRedDot()
|
||||
self:PlayBGM()
|
||||
local mapData = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
local bMaxLv = mapData.nLevel == mapData.nMaxLv
|
||||
local bAdvance = mapData.nPhase < mapData.nMaxPhase and bMaxLv
|
||||
if self._panel.nCurTog == AllEnum.DiscTab.Development then
|
||||
self._mapNode.Upgrade.gameObject:SetActive(not bAdvance)
|
||||
self._mapNode.Advance.gameObject:SetActive(bAdvance)
|
||||
if bAdvance then
|
||||
self._mapNode.Advance:Refresh()
|
||||
else
|
||||
self._mapNode.Upgrade:Refresh()
|
||||
end
|
||||
elseif self._panel.nCurTog == AllEnum.DiscTab.BreakLimit then
|
||||
self._mapNode.BreakLimit:Refresh()
|
||||
elseif self._panel.nCurTog == AllEnum.DiscTab.Music then
|
||||
self._mapNode.Music:Refresh()
|
||||
end
|
||||
end
|
||||
function DiscCtrl:OnEvent_OpenFull()
|
||||
self:OnBtnClick_OpenFull()
|
||||
end
|
||||
function DiscCtrl:OnEvent_Guide_DiscSkill()
|
||||
EventManager.Hit("Guide_SelectDisc", self._panel.nId)
|
||||
end
|
||||
function DiscCtrl:OnEvent_GrowthRefresh()
|
||||
self:ClosePopup()
|
||||
self:SwitchTog()
|
||||
end
|
||||
return DiscCtrl
|
||||
@@ -0,0 +1,88 @@
|
||||
local DiscGridMatCtrl = class("DiscGridMatCtrl", BaseCtrl)
|
||||
DiscGridMatCtrl._mapNodeConfig = {
|
||||
btnAdd = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Add"
|
||||
},
|
||||
btnReduce = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reduce"
|
||||
},
|
||||
ctrlMat = {
|
||||
sNodeName = "tc_mat_grid_01",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateMatGridCtrl"
|
||||
}
|
||||
}
|
||||
DiscGridMatCtrl._mapEventConfig = {}
|
||||
function DiscGridMatCtrl:Refresh(mapData)
|
||||
self.mapData = mapData
|
||||
self._mapNode.ctrlMat:RerfeshGrid(mapData)
|
||||
end
|
||||
function DiscGridMatCtrl:SetCount(nCount)
|
||||
self._mapNode.ctrlMat:SetGridCount(nCount)
|
||||
end
|
||||
function DiscGridMatCtrl:SetSelect(bSelect)
|
||||
self._mapNode.ctrlMat:SetSelect(bSelect)
|
||||
end
|
||||
function DiscGridMatCtrl:SetLock(bLock)
|
||||
self._mapNode.ctrlMat:SetLock(bLock)
|
||||
end
|
||||
function DiscGridMatCtrl:AddMat(btn)
|
||||
if btn.Operate_Type == 0 then
|
||||
local mapDisc = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
local nMaxStar = mapDisc.nMaxStar - mapDisc.nStar
|
||||
local nHasStar = 0
|
||||
for _, _ in pairs(self._panel.tbMat) do
|
||||
nHasStar = nHasStar + 1
|
||||
end
|
||||
if nMaxStar <= nHasStar then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("OUTFIT_15"))
|
||||
return
|
||||
end
|
||||
local nAddIndex = PlayerData.Disc:GetIndexOfNewBreakLimitMat(self._panel.tbMat)
|
||||
if nAddIndex == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("OUTFIT_16"))
|
||||
return
|
||||
end
|
||||
self.mapData.nAddIndex = nAddIndex
|
||||
self.mapData.nCost = 1
|
||||
self._panel:ChangeMatList(self.mapData)
|
||||
EventManager.Hit("DiscChangeSelectedMat", true)
|
||||
self:SetCount(self.mapData.nCost)
|
||||
elseif btn.Operate_Type == 3 then
|
||||
return
|
||||
end
|
||||
end
|
||||
function DiscGridMatCtrl:ReduceMat(btn)
|
||||
if btn.Operate_Type == 0 then
|
||||
self.mapData.nCost = 0
|
||||
self._panel:ChangeMatList(self.mapData, true)
|
||||
EventManager.Hit("DiscChangeSelectedMat", true)
|
||||
self:SetCount(self.mapData.nCost)
|
||||
elseif btn.Operate_Type == 3 then
|
||||
return
|
||||
end
|
||||
end
|
||||
function DiscGridMatCtrl:Awake()
|
||||
end
|
||||
function DiscGridMatCtrl:OnEnable()
|
||||
end
|
||||
function DiscGridMatCtrl:OnDisable()
|
||||
end
|
||||
function DiscGridMatCtrl:OnDestroy()
|
||||
end
|
||||
function DiscGridMatCtrl:OnBtnClick_Add(btn)
|
||||
if not self._panel.tbMat[self.mapData.nIndex] then
|
||||
self:AddMat(btn)
|
||||
else
|
||||
self:ReduceMat(btn)
|
||||
end
|
||||
EventManager.Hit("DiscGridClick", tonumber(self.gameObject.name) + 1)
|
||||
self:SetSelect(true)
|
||||
end
|
||||
function DiscGridMatCtrl:OnBtnClick_Reduce(btn)
|
||||
self:ReduceMat(btn)
|
||||
EventManager.Hit("DiscGridClick", tonumber(self.gameObject.name) + 1)
|
||||
self:SetSelect(true)
|
||||
end
|
||||
return DiscGridMatCtrl
|
||||
@@ -0,0 +1,337 @@
|
||||
local DiscInfoCtrl = class("DiscInfoCtrl", BaseCtrl)
|
||||
DiscInfoCtrl._mapNodeConfig = {
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtDiscLevel = {sComponentName = "TMP_Text"},
|
||||
txtTitleRank = {sComponentName = "TMP_Text", sLanguageId = "Disc_Level"},
|
||||
txtLevelMax = {sComponentName = "TMP_Text"},
|
||||
goStarAdvance = {
|
||||
sNodeName = "tc_star_advance",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarAdvanceCtrl"
|
||||
},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
txtTitleProperty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "CharacterInfo_Property"
|
||||
},
|
||||
goProperty = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplatePropertyCtrl"
|
||||
},
|
||||
txtElement = {sComponentName = "TMP_Text"},
|
||||
imgElementIcon = {sComponentName = "Image"},
|
||||
imgTag = {nCount = 3},
|
||||
txtTag = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
DiscNote = {},
|
||||
DiscSkill = {},
|
||||
imgOn = {nCount = 2},
|
||||
imgOff = {nCount = 2},
|
||||
txtMainSkill = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_Btn_MainSkill"
|
||||
},
|
||||
txtSubSkill = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_Btn_SubSkill"
|
||||
},
|
||||
btnSkill = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Tab"
|
||||
},
|
||||
ScrollView = {sComponentName = "ScrollRect"},
|
||||
goMainSkill = {},
|
||||
txtMainSkillTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_MainSkill_Title"
|
||||
},
|
||||
txtMainSkillName = {sComponentName = "TMP_Text"},
|
||||
imgMainSkillIcon = {sComponentName = "Image"},
|
||||
imgMainSkillIconBg = {sComponentName = "Image"},
|
||||
goMainLevel = {sComponentName = "Image"},
|
||||
txtMainSkillDesc = {sComponentName = "TMP_Text"},
|
||||
TMP_Link1 = {
|
||||
sNodeName = "txtMainSkillDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
},
|
||||
goSubSkill = {},
|
||||
txtSubSkillTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_SubSkill_Title"
|
||||
},
|
||||
rtSubBg = {nCount = 2},
|
||||
txtSubSkillName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
imgSubSkillIcon = {nCount = 2, sComponentName = "Image"},
|
||||
imgSubSkillIconBg = {nCount = 2, sComponentName = "Image"},
|
||||
txtSubSkillDesc = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
TMP_Link2 = {
|
||||
sNodeName = "txtSubSkillDesc1",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
},
|
||||
TMP_Link3 = {
|
||||
sNodeName = "txtSubSkillDesc2",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
},
|
||||
txtActiveNeed = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_SubSkill_ActiveConditions"
|
||||
},
|
||||
txtSubSkillLevel = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
btnPrevLevel = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Prev"
|
||||
},
|
||||
btnNextLevel = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Next"
|
||||
},
|
||||
imgPrevOn = {nCount = 2},
|
||||
imgPrevOff = {nCount = 2},
|
||||
imgNextOn = {nCount = 2},
|
||||
imgNextOff = {nCount = 2},
|
||||
imgNeedNoteBg1_ = {nCount = 3},
|
||||
imgNeedNoteIcon1_ = {nCount = 3, sComponentName = "Image"},
|
||||
txtNeedNoteName1_ = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtNoteActiveLv1_ = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
imgNeedNoteBg2_ = {nCount = 3},
|
||||
imgNeedNoteIcon2_ = {nCount = 3, sComponentName = "Image"},
|
||||
txtNeedNoteName2_ = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtNoteActiveLv2_ = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtNoteTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_SubSkill_Tip"
|
||||
},
|
||||
btnNote = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Note"
|
||||
},
|
||||
imgNoteCount = {nCount = 3, sComponentName = "Image"},
|
||||
imgNoteIcon = {nCount = 3, sComponentName = "Image"},
|
||||
txtNoteName = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtNoteLv = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtNoteDesc = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
btnNotePreview = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NotePreview"
|
||||
}
|
||||
}
|
||||
DiscInfoCtrl._mapEventConfig = {
|
||||
Guide_ShowAllSubSkill = "OnEvent_Guide_ShowAllSubSkill"
|
||||
}
|
||||
function DiscInfoCtrl:RefreshContent()
|
||||
if self._panel.nCurTog ~= AllEnum.DiscTab.Info then
|
||||
return
|
||||
end
|
||||
self.nCurTab = 1
|
||||
for i = 1, 2 do
|
||||
self._mapNode.imgOn[i]:SetActive(i == self.nCurTab)
|
||||
self._mapNode.imgOff[i]:SetActive(i ~= self.nCurTab)
|
||||
end
|
||||
if type(self._panel.nId) ~= "number" then
|
||||
return
|
||||
end
|
||||
self:RefreshShow()
|
||||
end
|
||||
function DiscInfoCtrl:RefreshShow()
|
||||
self.mapDisc = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
self:RefreshInfo()
|
||||
self:RefreshProperty()
|
||||
self:RefreshSkill()
|
||||
self:SwitchSkill()
|
||||
end
|
||||
function DiscInfoCtrl:RefreshSkill()
|
||||
local nMainSkillId = self.mapDisc.nMainSkillId
|
||||
if nMainSkillId then
|
||||
self._mapNode.goMainSkill:SetActive(true)
|
||||
local mapCfg = ConfigTable.GetData("MainSkill", nMainSkillId)
|
||||
if mapCfg then
|
||||
self:SetPngSprite(self._mapNode.imgMainSkillIcon, mapCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.imgMainSkillIconBg, mapCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMainSkillName, mapCfg.Name)
|
||||
self:SetAtlasSprite(self._mapNode.goMainLevel, "12_rare", AllEnum.FrameType_New.DiscLimitS .. AllEnum.FrameColor_New[self.mapDisc.nRarity] .. "_0" .. self.mapDisc.nStar + 1)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.goMainLevel)
|
||||
local sDesc = UTILS.ParseParamDesc(mapCfg.Desc, mapCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMainSkillDesc, sDesc)
|
||||
end
|
||||
else
|
||||
self._mapNode.goMainSkill:SetActive(false)
|
||||
end
|
||||
self.tbSubLayer = nil
|
||||
self.tbSubMaxLayer = nil
|
||||
self:RefreshSubSkill()
|
||||
for i = 1, 3 do
|
||||
self._mapNode.btnNote[i].gameObject:SetActive(self.mapDisc.tbSubNoteSkills[i])
|
||||
if self.mapDisc.tbSubNoteSkills[i] then
|
||||
local nImgCount = 2
|
||||
self:SetPngSprite(self._mapNode.imgNoteCount[i], "UI/big_sprites/zs_outfit_lv_" .. nImgCount)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgNoteCount[i])
|
||||
local mapNote = ConfigTable.GetData("SubNoteSkill", self.mapDisc.tbSubNoteSkills[i].nId)
|
||||
if mapNote then
|
||||
self:SetPngSprite(self._mapNode.imgNoteIcon[i], mapNote.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteName[i], mapNote.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteDesc[i], mapNote.BriefDesc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteLv[i], orderedFormat(ConfigTable.GetUIText("StarTower_Disc_Info_Level"), self.mapDisc.tbSubNoteSkills[i].nCount))
|
||||
end
|
||||
end
|
||||
end
|
||||
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.ScrollView, 1)
|
||||
end
|
||||
function DiscInfoCtrl:RefreshSubSkill()
|
||||
if not self.tbSubLayer then
|
||||
self.tbSubLayer = {}
|
||||
end
|
||||
if not self.tbSubMaxLayer then
|
||||
self.tbSubMaxLayer = {}
|
||||
end
|
||||
local tbSubSkillGroupId = self.mapDisc.tbSubSkillGroupId
|
||||
self._mapNode.goSubSkill:SetActive(next(tbSubSkillGroupId))
|
||||
for i = 1, 2 do
|
||||
if tbSubSkillGroupId[i] then
|
||||
self._mapNode.rtSubBg[i]:SetActive(true)
|
||||
local tbGroup = CacheTable.GetData("_SecondarySkill", tbSubSkillGroupId[i])
|
||||
if tbGroup then
|
||||
if not self.tbSubLayer[i] then
|
||||
self.tbSubLayer[i] = 1
|
||||
end
|
||||
if not self.tbSubMaxLayer[i] then
|
||||
self.tbSubMaxLayer[i] = #tbGroup
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSubSkillLevel[i], orderedFormat(ConfigTable.GetUIText("Disc_SubSkill_Level"), self.tbSubLayer[i]))
|
||||
self._mapNode.imgPrevOn[i]:SetActive(self.tbSubLayer[i] > 1)
|
||||
self._mapNode.imgPrevOff[i]:SetActive(self.tbSubLayer[i] == 1)
|
||||
self._mapNode.imgNextOn[i]:SetActive(self.tbSubLayer[i] < self.tbSubMaxLayer[i])
|
||||
self._mapNode.imgNextOff[i]:SetActive(self.tbSubLayer[i] == self.tbSubMaxLayer[i])
|
||||
local mapCfg = tbGroup[self.tbSubLayer[i]]
|
||||
if mapCfg then
|
||||
self:SetPngSprite(self._mapNode.imgSubSkillIcon[i], mapCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.imgSubSkillIconBg[i], mapCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSubSkillName[i], mapCfg.Name)
|
||||
local sDesc = UTILS.ParseParamDesc(mapCfg.Desc, mapCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSubSkillDesc[i], sDesc)
|
||||
local tbActiveNote = decodeJson(mapCfg.NeedSubNoteSkills)
|
||||
local j = 1
|
||||
for nNeed = 1, 3 do
|
||||
self._mapNode["imgNeedNoteBg" .. i .. "_"][nNeed]:SetActive(false)
|
||||
end
|
||||
for k, v in pairs(tbActiveNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nNoteCount = tonumber(v)
|
||||
if nNoteId then
|
||||
local mapNote = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
if mapNote then
|
||||
self._mapNode["imgNeedNoteBg" .. i .. "_"][j]:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode["imgNeedNoteIcon" .. i .. "_"][j], mapNote.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode["txtNeedNoteName" .. i .. "_"][j], mapNote.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode["txtNoteActiveLv" .. i .. "_"][j], orderedFormat(ConfigTable.GetUIText("Disc_SubSkill_ActiveLevel"), nNoteCount))
|
||||
j = j + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
self._mapNode.rtSubBg[i]:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscInfoCtrl:RefreshInfo()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, self.mapDisc.sName)
|
||||
self._mapNode.goStar:SetStar(0, 6 - self.mapDisc.nRarity)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDiscLevel, self.mapDisc.nLevel)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelMax, "/" .. self.mapDisc.nMaxLv)
|
||||
self._mapNode.goStarAdvance:SetStar(self.mapDisc.nPhase, self.mapDisc.nMaxPhase)
|
||||
local sName = AllEnum.ElementIconType.Icon .. self.mapDisc.nEET
|
||||
self:SetAtlasSprite(self._mapNode.imgElementIcon, "12_rare", sName)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtElement, AllEnum.ElementColor[self.mapDisc.nEET])
|
||||
NovaAPI.SetTMPText(self._mapNode.txtElement, ConfigTable.GetUIText("T_Element_Attr_" .. self.mapDisc.nEET))
|
||||
for i = 1, 3 do
|
||||
local nTag = self.mapDisc.tbTag[i]
|
||||
if nTag then
|
||||
self._mapNode.imgTag[i]:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTag[i], ConfigTable.GetData("DiscTag", nTag).Title)
|
||||
else
|
||||
self._mapNode.imgTag[i]:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscInfoCtrl:RefreshProperty()
|
||||
local tbAttr = self.mapDisc.mapAttrBase
|
||||
local i = 1
|
||||
for _, mapAttachAttr in pairs(AllEnum.AttachAttr) do
|
||||
local mapAttr = tbAttr[mapAttachAttr.sKey]
|
||||
if mapAttr.Value > 0 then
|
||||
self._mapNode.goProperty[i]:SetItemProperty(mapAttr.Key, mapAttr.Value, nil, true)
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscInfoCtrl:SwitchSkill()
|
||||
self._mapNode.DiscSkill:SetActive(self.nCurTab == 1)
|
||||
self._mapNode.DiscNote:SetActive(self.nCurTab == 2)
|
||||
end
|
||||
function DiscInfoCtrl:FadeIn()
|
||||
end
|
||||
function DiscInfoCtrl:Awake()
|
||||
end
|
||||
function DiscInfoCtrl:OnEnable()
|
||||
end
|
||||
function DiscInfoCtrl:OnDisable()
|
||||
end
|
||||
function DiscInfoCtrl:OnDestroy()
|
||||
end
|
||||
function DiscInfoCtrl:OnBtnClick_Tab(btn, nIndex)
|
||||
if nIndex == self.nCurTab then
|
||||
return
|
||||
end
|
||||
for i = 1, 2 do
|
||||
self._mapNode.imgOn[i]:SetActive(i == nIndex)
|
||||
self._mapNode.imgOff[i]:SetActive(i ~= nIndex)
|
||||
end
|
||||
self.nCurTab = nIndex
|
||||
self:SwitchSkill()
|
||||
end
|
||||
function DiscInfoCtrl:OnBtnClick_Prev(btn, nIndex)
|
||||
if self.tbSubLayer and self.tbSubLayer[nIndex] == 1 then
|
||||
return
|
||||
end
|
||||
self.tbSubLayer[nIndex] = self.tbSubLayer[nIndex] - 1
|
||||
self:RefreshSubSkill()
|
||||
end
|
||||
function DiscInfoCtrl:OnBtnClick_Next(btn, nIndex)
|
||||
if self.tbSubMaxLayer and self.tbSubLayer and self.tbSubLayer[nIndex] == self.tbSubMaxLayer[nIndex] then
|
||||
return
|
||||
end
|
||||
self.tbSubLayer[nIndex] = self.tbSubLayer[nIndex] + 1
|
||||
self:RefreshSubSkill()
|
||||
end
|
||||
function DiscInfoCtrl:OnLinkClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
function DiscInfoCtrl:OnBtnClick_Note(btn, nIndex)
|
||||
local mapNote = self.mapDisc.tbSubNoteSkills[nIndex]
|
||||
if not mapNote then
|
||||
return
|
||||
end
|
||||
local tbNote = {}
|
||||
for _, v in ipairs(self.mapDisc.tbSubNoteSkills) do
|
||||
tbNote[v.nId] = v.nCount
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.NoteSkill, tbNote, mapNote.nId)
|
||||
end
|
||||
function DiscInfoCtrl:OnBtnClick_NotePreview(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.NoteSkillPreview, self.mapDisc.nSubNoteSkillId, self.mapDisc.nPhase, self.mapDisc.nRarity)
|
||||
end
|
||||
function DiscInfoCtrl:OnEvent_Guide_ShowAllSubSkill()
|
||||
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.ScrollView, 0)
|
||||
end
|
||||
return DiscInfoCtrl
|
||||
@@ -0,0 +1,213 @@
|
||||
local DiscListCtrl = class("DiscListCtrl", BaseCtrl)
|
||||
DiscListCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
imgEmpty = {},
|
||||
labEmpty = {
|
||||
sNodeName = "txt_EmptyTitle",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Filter_NoAim"
|
||||
},
|
||||
sv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
btnFilter = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Filter"
|
||||
},
|
||||
imgFilterChoose = {},
|
||||
aniPanel = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
goSortDropdown = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDropdownCtrl"
|
||||
},
|
||||
btnOrder = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Order"
|
||||
},
|
||||
imgArrowUpEnable = {},
|
||||
imgArrowUpDisable = {},
|
||||
imgArrowDownEnable = {},
|
||||
imgArrowDownDisable = {},
|
||||
btnBreakLimitAll = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_BreakLimitAll"
|
||||
},
|
||||
txtBtnBreakLimitAll = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_Btn_BreakLimitAll"
|
||||
}
|
||||
}
|
||||
DiscListCtrl._mapEventConfig = {
|
||||
[EventId.FilterConfirm] = "RefreshByFilter",
|
||||
SelectTemplateDD = "OnEvent_SortRuleChange"
|
||||
}
|
||||
function DiscListCtrl:Refresh()
|
||||
local isDirty = PlayerData.Filter:IsDirty(AllEnum.OptionType.Disc)
|
||||
self._mapNode.imgFilterChoose:SetActive(isDirty)
|
||||
self:FilterDisc()
|
||||
self:SortDisc()
|
||||
self:RefreshOrderState()
|
||||
self:RefreshAllBreakLimit()
|
||||
local nCurCount = #self.tbSortedDisc
|
||||
if 0 < nCurCount then
|
||||
self._mapNode.imgEmpty:SetActive(false)
|
||||
self._mapNode.sv.gameObject:SetActive(true)
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self._mapNode.sv:Init(nCurCount, self, self.OnGridRefresh, self.OnGridBtnClick, self.bFirstIn == false)
|
||||
else
|
||||
self._mapNode.imgEmpty:SetActive(true)
|
||||
self._mapNode.sv.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function DiscListCtrl:FilterDisc()
|
||||
self.tbSortedDisc = {}
|
||||
for _, data in pairs(self.tbAllDisc) do
|
||||
local mapCfg = ConfigTable.GetData("Disc", data.nId)
|
||||
if mapCfg.Visible then
|
||||
local isFilter = PlayerData.Filter:CheckFilterByDisc(data.nId)
|
||||
if isFilter then
|
||||
table.insert(self.tbSortedDisc, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscListCtrl:SortDisc()
|
||||
self.tbDiscId = {}
|
||||
UTILS.SortByPriority(self.tbSortedDisc, {
|
||||
AllEnum.DiscSortField[self.tbSortCfg.nSortType]
|
||||
}, PlayerData.Disc:GetDiscSortField(), self.tbSortCfg.bOrder)
|
||||
for i = 1, #self.tbSortedDisc do
|
||||
table.insert(self.tbDiscId, self.tbSortedDisc[i].nId)
|
||||
end
|
||||
end
|
||||
function DiscListCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceId] then
|
||||
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.TemplateEx.TemplateDiscCtrl")
|
||||
end
|
||||
self.tbGridCtrl[nInstanceId]:Refresh(self.tbSortedDisc[nIndex].nId)
|
||||
end
|
||||
function DiscListCtrl:OnGridBtnClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Disc, self.tbSortedDisc[nIndex].nId, self.tbDiscId)
|
||||
self._panel._nFadeInType = 2
|
||||
end
|
||||
function DiscListCtrl: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 DiscListCtrl:RefreshAllBreakLimit()
|
||||
self.tbMat = PlayerData.Disc:GetAllBreakLimitMat()
|
||||
self._mapNode.btnBreakLimitAll.gameObject:SetActive(next(self.tbMat) ~= nil)
|
||||
end
|
||||
function DiscListCtrl:FadeIn(bPlayFadeIn)
|
||||
if self._panel._nFadeInType == 1 then
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
self._mapNode.aniPanel:SetTrigger("tIn")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.4)
|
||||
end
|
||||
end
|
||||
function DiscListCtrl:Awake()
|
||||
self.tbFilterCfg = {}
|
||||
self.bFirstIn = true
|
||||
self.bOpen = false
|
||||
end
|
||||
function DiscListCtrl: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.tbSortedDisc = {}
|
||||
self.tbDiscId = {}
|
||||
self.tbGridCtrl = {}
|
||||
self:Refresh()
|
||||
self.bOpen = true
|
||||
end
|
||||
function DiscListCtrl:OnDisable()
|
||||
self.bOpen = false
|
||||
self.tbSortedDisc = nil
|
||||
self.tbDiscId = nil
|
||||
self.tbAllDisc = nil
|
||||
self.bFirstIn = false
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function DiscListCtrl:OnDestroy()
|
||||
self.tbFilterCfg = nil
|
||||
self.tbSortCfg = nil
|
||||
end
|
||||
function DiscListCtrl:RefreshByFilter()
|
||||
self:Refresh()
|
||||
end
|
||||
function DiscListCtrl: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 DiscListCtrl:OnBtnClick_Order(btn)
|
||||
self.tbSortCfg.bOrder = not self.tbSortCfg.bOrder
|
||||
PlayerData.Filter:CacheDiscSort(self.tbSortCfg.nSortType, self.tbSortCfg.bOrder)
|
||||
self:Refresh()
|
||||
end
|
||||
function DiscListCtrl:OnBtnClick_Filter()
|
||||
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 DiscListCtrl:OnCharacterScreenConfirm(tbFilterCfg)
|
||||
end
|
||||
function DiscListCtrl:OnBtnClick_BreakLimitAll()
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSucBar, {
|
||||
tbMat = self.tbMat
|
||||
}, AllEnum.DiscSucBar.BreakLimitAll)
|
||||
self.tbAllDisc = PlayerData.Disc:GetAllDisc()
|
||||
self:Refresh()
|
||||
end
|
||||
local allBreak = function()
|
||||
PlayerData.Disc:SendAllDiscLimitBreakReq(callback)
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Item,
|
||||
sTitle = ConfigTable.GetUIText("Disc_BreakLimitAll_Title"),
|
||||
sContent = ConfigTable.GetUIText("Disc_BreakLimitAll_Tip"),
|
||||
tbItem = self.tbMat,
|
||||
callbackConfirm = function()
|
||||
allBreak()
|
||||
end
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
return DiscListCtrl
|
||||
@@ -0,0 +1,8 @@
|
||||
local DiscListPanel = class("DiscListPanel", BasePanel)
|
||||
DiscListPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Disc/DiscListPanel.prefab",
|
||||
sCtrlName = "Game.UI.Disc.DiscListCtrl"
|
||||
}
|
||||
}
|
||||
return DiscListPanel
|
||||
@@ -0,0 +1,144 @@
|
||||
local DiscMatListCtrl = class("DiscMatListCtrl", BaseCtrl)
|
||||
DiscMatListCtrl._mapNodeConfig = {
|
||||
sv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
trSv = {sNodeName = "sv", sComponentName = "Transform"},
|
||||
Empty = {},
|
||||
txtEmptyTitle = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
DiscMatListCtrl._mapEventConfig = {
|
||||
DiscChangeGridMat = "OnEvent_ChangeMat",
|
||||
DiscGridClick = "OnEvent_GridClick"
|
||||
}
|
||||
function DiscMatListCtrl:InitData()
|
||||
if self.tbGridCtrl and next(self.tbGridCtrl) ~= nil then
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
self.mapSelect = nil
|
||||
self.nSelectIndex = nil
|
||||
self.nPos = nil
|
||||
end
|
||||
function DiscMatListCtrl:Open(bOpen)
|
||||
if self.gameObject.activeSelf and bOpen or not self.gameObject.activeSelf and not bOpen then
|
||||
return
|
||||
end
|
||||
self.gameObject:SetActive(bOpen)
|
||||
self:InitData()
|
||||
if not bOpen then
|
||||
EventManager.Hit("DiscCloseMatList")
|
||||
return
|
||||
end
|
||||
self:RefreshAllData_BreakLimit()
|
||||
self:RefreshListData_BreakLimit()
|
||||
self:Refresh()
|
||||
end
|
||||
function DiscMatListCtrl:Refresh()
|
||||
self._mapNode.Empty:SetActive(self.bEmpty)
|
||||
self._mapNode.sv.gameObject:SetActive(not self.bEmpty)
|
||||
if self.bEmpty then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEmptyTitle, ConfigTable.GetUIText("Outfit_BreakLimit_NoneMat"))
|
||||
return
|
||||
end
|
||||
self:RefreshList()
|
||||
end
|
||||
function DiscMatListCtrl:RefreshList()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self._mapNode.sv.gameObject:SetActive(self.nMatCount > 0)
|
||||
if self.nMatCount > 0 then
|
||||
self._mapNode.sv:Init(self.nMatCount, self, self.OnGridRefresh, nil, self.nPos ~= nil)
|
||||
end
|
||||
end
|
||||
function DiscMatListCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local mapData = self.tbMatList[nIndex]
|
||||
local nInstanceID = goGrid:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceID] then
|
||||
self.tbGridCtrl[nInstanceID] = self:BindCtrlByNode(goGrid, "Game.UI.Disc.DiscGridMatCtrl")
|
||||
end
|
||||
if self._panel.tbMat[nIndex] then
|
||||
self.tbMatList[nIndex].nCost = self._panel.tbMat[nIndex].nCost
|
||||
self.tbMatList[nIndex].nAddIndex = self._panel.tbMat[nIndex].nAddIndex
|
||||
else
|
||||
self.tbMatList[nIndex].nCost = 0
|
||||
self.tbMatList[nIndex].nAddIndex = 0
|
||||
end
|
||||
self.tbGridCtrl[nInstanceID]:Refresh(mapData)
|
||||
self.tbGridCtrl[nInstanceID]:SetCount(mapData.nCost)
|
||||
self.tbGridCtrl[nInstanceID]:SetSelect(self.nSelectIndex == nIndex)
|
||||
end
|
||||
function DiscMatListCtrl:RefreshListWithPos()
|
||||
self.nPos = self._mapNode.sv:GetScrollPos()
|
||||
self:RefreshList()
|
||||
end
|
||||
function DiscMatListCtrl:SetSelectData()
|
||||
if self.mapSelect then
|
||||
for i, mapData in pairs(self.tbMatList) do
|
||||
if mapData.nIndex == self.mapSelect.nIndex then
|
||||
self.mapSelect = mapData
|
||||
self.nSelectIndex = i
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscMatListCtrl:RefreshAllData_BreakLimit()
|
||||
local nMatId, nMatCount = PlayerData.Disc:GetBreakLimitMat(self._panel.nId)
|
||||
self.nMatCount = nMatCount
|
||||
self.mapDiscMat = {nId = nMatId, nCount = nMatCount}
|
||||
self.bEmpty = self.nMatCount == 0
|
||||
end
|
||||
function DiscMatListCtrl:RefreshListData_BreakLimit()
|
||||
if self.nMatCount > 0 then
|
||||
self.tbMatList = {}
|
||||
for i = 1, self.mapDiscMat.nCount do
|
||||
local mapData = {
|
||||
nId = self.mapDiscMat.nId,
|
||||
nIndex = i,
|
||||
nType = GameEnum.itemStype.DiscLimitBreak,
|
||||
nCost = 0,
|
||||
nAddIndex = 0
|
||||
}
|
||||
table.insert(self.tbMatList, mapData)
|
||||
end
|
||||
self:SetSelectData()
|
||||
end
|
||||
end
|
||||
function DiscMatListCtrl:Awake()
|
||||
end
|
||||
function DiscMatListCtrl:OnEnable()
|
||||
end
|
||||
function DiscMatListCtrl:OnDisable()
|
||||
if self.tbGridCtrl then
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
end
|
||||
function DiscMatListCtrl:OnDestroy()
|
||||
end
|
||||
function DiscMatListCtrl:OnEvent_ChangeMat()
|
||||
if self.gameObject.activeSelf then
|
||||
self:RefreshListWithPos()
|
||||
end
|
||||
end
|
||||
function DiscMatListCtrl:OnEvent_GridClick(nIndex)
|
||||
if self.nSelectIndex then
|
||||
local goSelect = self._mapNode.trSv:Find("Viewport/Content/" .. self.nSelectIndex - 1)
|
||||
if goSelect then
|
||||
self.tbGridCtrl[goSelect.gameObject:GetInstanceID()]:SetSelect(false)
|
||||
end
|
||||
end
|
||||
self.nSelectIndex = nIndex
|
||||
self.mapSelect = self.tbMatList[nIndex]
|
||||
end
|
||||
return DiscMatListCtrl
|
||||
@@ -0,0 +1,445 @@
|
||||
local DiscMusicCtrl = class("DiscMusicCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local LoopType = CS.DG.Tweening.LoopType
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
DiscMusicCtrl._mapNodeConfig = {
|
||||
imgMusicIcon = {sComponentName = "Image"},
|
||||
trIcon = {
|
||||
sNodeName = "imgMusicIcon",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
btnResetMusic = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ResetMusic"
|
||||
},
|
||||
btnSetMusic = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SetMusic"
|
||||
},
|
||||
goSetMusic = {},
|
||||
txtAlreadySetMusic = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_AlreadyMainMusic"
|
||||
},
|
||||
txtSetMusic = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_SetMainMusic"
|
||||
},
|
||||
goSideA = {},
|
||||
ScrollViewA = {sComponentName = "ScrollRect"},
|
||||
rtDiscDescBg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
ContentDiscDesc = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtDiscDesc = {sComponentName = "TMP_Text"},
|
||||
rtSideABg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnMusic = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Music"
|
||||
},
|
||||
goMusicOff = {nCount = 2},
|
||||
goMusicOn = {nCount = 2},
|
||||
txtMusicOffTitle = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
txtMusicOnTitle = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
txtMusicTime = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
MusicProgessA = {},
|
||||
sliderA = {
|
||||
sComponentName = "Slider",
|
||||
callback = "OnValueChanged_SliderA"
|
||||
},
|
||||
sliderDragA = {sNodeName = "sliderA", sComponentName = "SliderDrag"},
|
||||
txtMusicValue = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
btnSideAPause = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SideAPause"
|
||||
},
|
||||
btnSideAPlay = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SideAPlay"
|
||||
},
|
||||
goSideB = {},
|
||||
txtSideBTitle = {sComponentName = "TMP_Text"},
|
||||
txtLiteraryTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_Appendix_RecordTitle"
|
||||
},
|
||||
txtSideBDesc = {
|
||||
sComponentName = "RubyTextMeshProUGUI"
|
||||
},
|
||||
ScrollViewSideB = {sComponentName = "ScrollRect"},
|
||||
btnRead = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Read"
|
||||
},
|
||||
txtBtnRead = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_Appendix_Stroy"
|
||||
},
|
||||
goReadOff = {},
|
||||
goReadOn = {},
|
||||
txtReadLock = {sComponentName = "TMP_Text"},
|
||||
btnAvg = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Avg"
|
||||
},
|
||||
txtBtnAvg = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_Appendix_AvgEntrance"
|
||||
},
|
||||
goAvgOff = {},
|
||||
goAvgOn = {},
|
||||
txtAvgLock = {sComponentName = "TMP_Text"},
|
||||
imgOn = {nCount = 2},
|
||||
imgOff = {nCount = 2},
|
||||
txtSideA = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_Btn_SideAppendix"
|
||||
},
|
||||
txtSideB = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_Btn_SideMusic"
|
||||
},
|
||||
btnSide = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Tab"
|
||||
},
|
||||
aniB = {sNodeName = "goSideB", sComponentName = "Animator"},
|
||||
aniLeft = {sNodeName = "--Left--", sComponentName = "Animator"},
|
||||
UIParticleNote = {},
|
||||
goMusicMask = {}
|
||||
}
|
||||
DiscMusicCtrl._mapEventConfig = {
|
||||
[EventId.TransAnimOutClear] = "OnEvent_TransAnimOutClear"
|
||||
}
|
||||
function DiscMusicCtrl:InitMusic()
|
||||
self.mapDisc = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
self.mapCfg = ConfigTable.GetData("DiscIP", self._panel.nId)
|
||||
self.nMusicAIndex = 1
|
||||
self:ClearTimer()
|
||||
self:PlayMusicA(false)
|
||||
end
|
||||
function DiscMusicCtrl:Refresh()
|
||||
self.nCurTab = 1
|
||||
for i = 1, 2 do
|
||||
self._mapNode.imgOn[i]:SetActive(i == self.nCurTab)
|
||||
self._mapNode.imgOff[i]:SetActive(i ~= self.nCurTab)
|
||||
end
|
||||
self._mapNode.goSideA:SetActive(2 == self.nCurTab)
|
||||
self._mapNode.goSideB:SetActive(1 == self.nCurTab)
|
||||
local mapItem = ConfigTable.GetData_Item(self._panel.nId)
|
||||
if mapItem then
|
||||
self:SetPngSprite(self._mapNode.imgMusicIcon, mapItem.Icon)
|
||||
end
|
||||
local nBGMDisc = PlayerData.Disc:GetBGMDisc()
|
||||
self._mapNode.btnSetMusic.gameObject:SetActive(nBGMDisc ~= self._panel.nId)
|
||||
self._mapNode.goSetMusic.gameObject:SetActive(nBGMDisc == self._panel.nId)
|
||||
self:RefreshSideA()
|
||||
self:RefreshSideB()
|
||||
self:PlayInMusic()
|
||||
end
|
||||
function DiscMusicCtrl:SwitchSide()
|
||||
self._mapNode.goSideA:SetActive(2 == self.nCurTab)
|
||||
self._mapNode.goSideB:SetActive(1 == self.nCurTab)
|
||||
end
|
||||
function DiscMusicCtrl:RefreshSideA()
|
||||
for i = 1, 2 do
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMusicOnTitle[i], self.mapCfg["VoName" .. i])
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMusicOffTitle[i], self.mapCfg["VoName" .. i])
|
||||
local sec = self.mapCfg["VoBegin" .. i] + self.mapCfg["VoLoop" .. i]
|
||||
local min = math.floor(sec / 60)
|
||||
local secSub = math.floor(sec - min * 60)
|
||||
local sTime = 0 < min and orderedFormat(ConfigTable.GetUIText("Disc_MusicTimeMin"), min) or ""
|
||||
if 0 < secSub then
|
||||
sTime = sTime .. orderedFormat(ConfigTable.GetUIText("Disc_MusicTimeSec"), secSub)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMusicTime[i], sTime)
|
||||
end
|
||||
for i = 1, 2 do
|
||||
self._mapNode.goMusicOn[i]:SetActive(self.nMusicAIndex == i)
|
||||
self._mapNode.goMusicOff[i]:SetActive(self.nMusicAIndex ~= i)
|
||||
end
|
||||
end
|
||||
function DiscMusicCtrl:RefreshSideB()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSideBTitle, self.mapCfg.StoryName)
|
||||
local mapItem = ConfigTable.GetData_Item(self._panel.nId)
|
||||
if mapItem then
|
||||
NovaAPI.SetText_RubyTMP(self._mapNode.txtSideBDesc, mapItem.Literary)
|
||||
end
|
||||
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.ScrollViewSideB, 1)
|
||||
self:RefreshStory()
|
||||
self:RefreshAvg()
|
||||
end
|
||||
function DiscMusicCtrl:RefreshStory()
|
||||
local nLimit = ConfigTable.GetConfigNumber("DiscStoryReadLimit")
|
||||
local bLimit = nLimit > self.mapDisc.nPhase
|
||||
self._mapNode.goReadOn:SetActive(not bLimit)
|
||||
self._mapNode.goReadOff:SetActive(bLimit)
|
||||
if bLimit then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtReadLock, orderedFormat(ConfigTable.GetUIText("Disc_Btn_LockAppendix"), nLimit))
|
||||
end
|
||||
end
|
||||
function DiscMusicCtrl:RefreshAvg()
|
||||
local bHas = self.mapCfg.AvgId ~= "" and self.mapDisc.mapAvgReward.nId ~= nil
|
||||
self._mapNode.btnAvg.gameObject:SetActive(bHas)
|
||||
if not bHas then
|
||||
return
|
||||
end
|
||||
local nLimit = ConfigTable.GetConfigNumber("DiscAVGStoryReadLimit")
|
||||
local bLimit = nLimit > self.mapDisc.nPhase
|
||||
self._mapNode.goAvgOn:SetActive(not bLimit)
|
||||
self._mapNode.goAvgOff:SetActive(bLimit)
|
||||
if bLimit then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAvgLock, orderedFormat(ConfigTable.GetUIText("Disc_Btn_LockAppendix"), nLimit))
|
||||
end
|
||||
end
|
||||
function DiscMusicCtrl:ShowReward()
|
||||
local mapMsgData = self._panel.mapAvgRewardData
|
||||
local bHasReward = mapMsgData and mapMsgData.Props and #mapMsgData.Props > 0
|
||||
if bHasReward then
|
||||
UTILS.OpenReceiveByChangeInfo(mapMsgData)
|
||||
end
|
||||
self._panel.mapAvgRewardData = nil
|
||||
end
|
||||
function DiscMusicCtrl:PlayMusicAni()
|
||||
self._mapNode.aniLeft:Play("Music_in", 0, 0)
|
||||
if self.tweener == nil then
|
||||
self.tweener = self._mapNode.trIcon:DORotate(Vector3(0, 0, -360), 25, RotateMode.FastBeyond360)
|
||||
self.tweener:SetEase(Ease.Linear):SetLoops(-1, LoopType.Incremental):SetUpdate(true)
|
||||
else
|
||||
self.tweener:Play()
|
||||
end
|
||||
end
|
||||
function DiscMusicCtrl:StopMusicAni()
|
||||
self._mapNode.aniLeft:Play("Music_out", 0, 0)
|
||||
if self.tweener then
|
||||
self.tweener:Pause()
|
||||
end
|
||||
end
|
||||
function DiscMusicCtrl:PlayInMusic()
|
||||
WwiseAudioMgr:PostEvent("ui_outfit_audio_start")
|
||||
if not self._panel.bPause then
|
||||
self:PlayMusicAni()
|
||||
end
|
||||
self._mapNode.UIParticleNote:SetActive(true)
|
||||
end
|
||||
function DiscMusicCtrl:PlayOutMusic()
|
||||
self:StopMusicAni()
|
||||
self._mapNode.UIParticleNote:SetActive(false)
|
||||
end
|
||||
function DiscMusicCtrl:PlayMusicA(bShow)
|
||||
self.nLoopTime = self.mapCfg["VoLoop" .. self.nMusicAIndex]
|
||||
self.nBeginTime = self.mapCfg["VoBegin" .. self.nMusicAIndex]
|
||||
self.nFullTimeA = self.nBeginTime + self.nLoopTime
|
||||
self.nRemainTimeA = self.nFullTimeA
|
||||
for i = 1, 2 do
|
||||
self._mapNode.goMusicOn[i]:SetActive(self.nMusicAIndex == i)
|
||||
self._mapNode.goMusicOff[i]:SetActive(self.nMusicAIndex ~= i)
|
||||
end
|
||||
NovaAPI.SetSliderMaxValue(self._mapNode.sliderA, self.nFullTimeA * 10)
|
||||
NovaAPI.SetSliderValue(self._mapNode.sliderA, 0)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMusicValue[1], self:SecondsToClock(0))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMusicValue[2], self:SecondsToClock(self.nFullTimeA))
|
||||
self._mapNode.btnSideAPause.gameObject:SetActive(true)
|
||||
self._mapNode.btnSideAPlay.gameObject:SetActive(false)
|
||||
if self._panel.bPause then
|
||||
self._panel.bPause = false
|
||||
WwiseAudioMgr:PostEvent("music_outfit_resume")
|
||||
end
|
||||
if bShow then
|
||||
self:PlayMusicAni()
|
||||
end
|
||||
if self.nMusicAIndex == 1 then
|
||||
WwiseAudioMgr:SetState("outfit", self.mapCfg.VoFile)
|
||||
WwiseAudioMgr:SetState("Disc", "discMain")
|
||||
WwiseAudioMgr:SeekOnEvent("music_outfit", 0)
|
||||
else
|
||||
WwiseAudioMgr:SetState("outfit", self.mapCfg.VoFile)
|
||||
WwiseAudioMgr:SetState("Disc", "discVictory")
|
||||
WwiseAudioMgr:SeekOnEvent("music_outfit", 0)
|
||||
end
|
||||
self:SetTimerA()
|
||||
end
|
||||
function DiscMusicCtrl:SetTimerA()
|
||||
if self.timerCountDownA then
|
||||
self.timerCountDownA:Reset()
|
||||
return
|
||||
end
|
||||
local countdown = function()
|
||||
self.nRemainTimeA = self.nRemainTimeA - 0.034
|
||||
if self.nRemainTimeA >= 0 then
|
||||
NovaAPI.SetSliderValue(self._mapNode.sliderA, (self.nFullTimeA - self.nRemainTimeA) * 10)
|
||||
else
|
||||
self.nRemainTimeA = self.nLoopTime
|
||||
end
|
||||
end
|
||||
self.timerCountDownA = self:AddTimer(0, 0.034, countdown, true, true, false)
|
||||
end
|
||||
function DiscMusicCtrl:SecondsToClock(seconds)
|
||||
seconds = math.floor(seconds)
|
||||
local minutes = math.floor(seconds / 60)
|
||||
local remainingSeconds = seconds % 60
|
||||
return string.format("%d:%02d", minutes, remainingSeconds)
|
||||
end
|
||||
function DiscMusicCtrl:BindSlider()
|
||||
self.handler = ui_handler(self, self.OnEndDrag_SliderA, self._mapNode.sliderDragA)
|
||||
self._mapNode.sliderDragA.onEndDrag:AddListener(self.handler)
|
||||
self.handler2 = ui_handler(self, self.OnStartDrag_SliderA, self._mapNode.sliderDragA)
|
||||
self._mapNode.sliderDragA.onStartDrag:AddListener(self.handler2)
|
||||
end
|
||||
function DiscMusicCtrl:UnbindSlider()
|
||||
self._mapNode.sliderDragA.onEndDrag:RemoveListener(self.handler)
|
||||
self._mapNode.sliderDragA.onStartDrag:RemoveListener(self.handler2)
|
||||
end
|
||||
function DiscMusicCtrl:ClearTimer()
|
||||
if self.timerCountDownA ~= nil then
|
||||
self.timerCountDownA:Cancel()
|
||||
end
|
||||
self.timerCountDownA = nil
|
||||
end
|
||||
function DiscMusicCtrl:Awake()
|
||||
end
|
||||
function DiscMusicCtrl:OnEnable()
|
||||
self:BindSlider()
|
||||
end
|
||||
function DiscMusicCtrl:OnDisable()
|
||||
self:UnbindSlider()
|
||||
if self.tweener then
|
||||
self.tweener:Kill()
|
||||
self.tweener = nil
|
||||
end
|
||||
self:ClearTimer()
|
||||
end
|
||||
function DiscMusicCtrl:OnDestroy()
|
||||
end
|
||||
function DiscMusicCtrl:OnBtnClick_Read()
|
||||
local nLimit = ConfigTable.GetConfigNumber("DiscStoryReadLimit")
|
||||
local bLimit = nLimit > self.mapDisc.nPhase
|
||||
if bLimit then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Disc_StoryLimitTip"))
|
||||
else
|
||||
EventManager.Hit("OpenDiscStory", self.mapDisc, self.mapCfg)
|
||||
end
|
||||
end
|
||||
function DiscMusicCtrl:OnBtnClick_Avg()
|
||||
local nLimit = ConfigTable.GetConfigNumber("DiscAVGStoryReadLimit")
|
||||
local bLimit = nLimit > self.mapDisc.nPhase
|
||||
if bLimit then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Disc_AvgLimitTip"))
|
||||
else
|
||||
local callback = function()
|
||||
if not self.mapDisc.bAvgRead then
|
||||
local cbSuc = function(mapMsgData)
|
||||
self._panel.bGetAvgReward = true
|
||||
self._panel.mapAvgRewardData = mapMsgData
|
||||
self._panel.bAvg = false
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.PureAvgStory)
|
||||
end
|
||||
PlayerData.Disc:SendDiscReadRewardReceiveReq(self._panel.nId, AllEnum.DiscReadType.DiscAvg, cbSuc)
|
||||
else
|
||||
self._panel.bAvg = false
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.PureAvgStory)
|
||||
end
|
||||
end
|
||||
self._panel.bAvg = true
|
||||
local mapData = {
|
||||
nType = AllEnum.StoryAvgType.Plot,
|
||||
sAvgId = self.mapCfg.AvgId,
|
||||
nNodeId = nil,
|
||||
callback = callback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PureAvgStory, mapData)
|
||||
end
|
||||
end
|
||||
function DiscMusicCtrl:OnBtnClick_ResetMusic()
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
bPositive = true,
|
||||
sContent = EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Disc_ResetMusicSuc"))
|
||||
})
|
||||
self._mapNode.btnSetMusic.gameObject:SetActive(true)
|
||||
self._mapNode.goSetMusic.gameObject:SetActive(false)
|
||||
end
|
||||
PlayerData.Disc:SendPlayerMusicSetReq(0, callback)
|
||||
end
|
||||
function DiscMusicCtrl:OnBtnClick_SetMusic()
|
||||
local callback = function()
|
||||
self._mapNode.btnSetMusic.gameObject:SetActive(false)
|
||||
self._mapNode.goSetMusic.gameObject:SetActive(true)
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
bPositive = true,
|
||||
sContent = EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Disc_SetMusicSuc"))
|
||||
})
|
||||
end
|
||||
PlayerData.Disc:SendPlayerMusicSetReq(self._panel.nId, callback)
|
||||
end
|
||||
function DiscMusicCtrl:OnBtnClick_Tab(btn, nIndex)
|
||||
if nIndex == self.nCurTab then
|
||||
return
|
||||
end
|
||||
for i = 1, 2 do
|
||||
self._mapNode.imgOn[i]:SetActive(i == nIndex)
|
||||
self._mapNode.imgOff[i]:SetActive(i ~= nIndex)
|
||||
end
|
||||
self.nCurTab = nIndex
|
||||
self:SwitchSide()
|
||||
end
|
||||
function DiscMusicCtrl:OnBtnClick_Music(btn, nIndex)
|
||||
if self.nMusicAIndex == nIndex then
|
||||
return
|
||||
end
|
||||
self.nMusicAIndex = nIndex
|
||||
self:PlayMusicA(true)
|
||||
end
|
||||
function DiscMusicCtrl:OnValueChanged_SliderA(_, value)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMusicValue[1], self:SecondsToClock(math.floor(value / 10)))
|
||||
end
|
||||
function DiscMusicCtrl:OnStartDrag_SliderA()
|
||||
self.timerCountDownA:Pause(true)
|
||||
end
|
||||
function DiscMusicCtrl:OnEndDrag_SliderA(_, value)
|
||||
WwiseAudioMgr:SeekOnEvent_Position("music_outfit", value * 100)
|
||||
self.nRemainTimeA = self.nFullTimeA - value / 10
|
||||
self.timerCountDownA:Pause(false)
|
||||
self._mapNode.btnSideAPause.gameObject:SetActive(true)
|
||||
self._mapNode.btnSideAPlay.gameObject:SetActive(false)
|
||||
if self._panel.bPause then
|
||||
self._panel.bPause = false
|
||||
WwiseAudioMgr:PostEvent("music_outfit_resume")
|
||||
self:PlayMusicAni()
|
||||
end
|
||||
end
|
||||
function DiscMusicCtrl:OnBtnClick_SideAPause()
|
||||
self._mapNode.btnSideAPause.gameObject:SetActive(false)
|
||||
self._mapNode.btnSideAPlay.gameObject:SetActive(true)
|
||||
WwiseAudioMgr:PostEvent("music_outfit_pause")
|
||||
self.timerCountDownA:Pause(true)
|
||||
self:StopMusicAni()
|
||||
self._panel.bPause = true
|
||||
end
|
||||
function DiscMusicCtrl:OnBtnClick_SideAPlay()
|
||||
self._mapNode.btnSideAPause.gameObject:SetActive(true)
|
||||
self._mapNode.btnSideAPlay.gameObject:SetActive(false)
|
||||
WwiseAudioMgr:PostEvent("music_outfit_resume")
|
||||
self.timerCountDownA:Pause(false)
|
||||
self:PlayMusicAni()
|
||||
self._panel.bPause = false
|
||||
end
|
||||
function DiscMusicCtrl:OnEvent_TransAnimOutClear(...)
|
||||
if self._panel.bGetAvgReward then
|
||||
self:ShowReward()
|
||||
self._panel.bGetAvgReward = false
|
||||
end
|
||||
end
|
||||
return DiscMusicCtrl
|
||||
@@ -0,0 +1,29 @@
|
||||
local DiscNoteLayerCtrl = class("DiscNoteLayerCtrl", BaseCtrl)
|
||||
DiscNoteLayerCtrl._mapNodeConfig = {
|
||||
imgLine = {},
|
||||
goNote = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscMultiNoteCtrl"
|
||||
},
|
||||
txtLayerDesc = {sComponentName = "TMP_Text"},
|
||||
txtLayerName = {sComponentName = "TMP_Text"},
|
||||
TMP_Link = {
|
||||
sNodeName = "txtLayerDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
}
|
||||
}
|
||||
DiscNoteLayerCtrl._mapEventConfig = {}
|
||||
function DiscNoteLayerCtrl:Refresh(tbNoteId, nNoteCount, sDesc, nLayer, bLast)
|
||||
self._mapNode.goNote:SetNoteItem(tbNoteId, nNoteCount)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLayerDesc, sDesc)
|
||||
local sLayer = ConfigTable.GetUIText("Disc_CoreSkill_Base")
|
||||
if 1 < nLayer then
|
||||
sLayer = orderedFormat(ConfigTable.GetUIText("Disc_CoreSkill_Expand"), nLayer - 1)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLayerName, sLayer)
|
||||
self._mapNode.imgLine:SetActive(not bLast)
|
||||
end
|
||||
function DiscNoteLayerCtrl:OnLinkClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
return DiscNoteLayerCtrl
|
||||
@@ -0,0 +1,40 @@
|
||||
local DiscPanel = class("DiscPanel", BasePanel)
|
||||
DiscPanel._nFADEINTYPE = 2
|
||||
DiscPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Disc/DiscPanel.prefab",
|
||||
sCtrlName = "Game.UI.Disc.DiscCtrl"
|
||||
}
|
||||
}
|
||||
function DiscPanel:ChangeMatList(mapMat, bRemove)
|
||||
if not bRemove then
|
||||
self.tbMat[mapMat.nIndex] = mapMat
|
||||
else
|
||||
self.tbMat[mapMat.nIndex] = nil
|
||||
end
|
||||
end
|
||||
function DiscPanel:ClearMatList()
|
||||
self.tbMat = {}
|
||||
end
|
||||
function DiscPanel:Awake()
|
||||
self.tbMat = {}
|
||||
self.nId = nil
|
||||
self.nCurTog = nil
|
||||
self.bPause = false
|
||||
self.bAvg = false
|
||||
self.bGetAvgReward = false
|
||||
self.mapAvgRewardData = {}
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.nId = tbParam[1]
|
||||
self.tbId = tbParam[2]
|
||||
self.nCurTog = tbParam[3]
|
||||
end
|
||||
end
|
||||
function DiscPanel:OnEnable()
|
||||
end
|
||||
function DiscPanel:OnDisable()
|
||||
end
|
||||
function DiscPanel:OnDestroy()
|
||||
end
|
||||
return DiscPanel
|
||||
@@ -0,0 +1,559 @@
|
||||
local DiscSampleCtrl = class("DiscSampleCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
DiscSampleCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
UIDrag = {
|
||||
sComponentName = "UIDrag",
|
||||
callback = "OnDrag_Disc"
|
||||
},
|
||||
imgDiscFrame = {sComponentName = "Image"},
|
||||
imgDiscIcon = {sComponentName = "Image"},
|
||||
Middle = {
|
||||
sNodeName = "---Middle---"
|
||||
},
|
||||
liveDiscCtrl = {
|
||||
sNodeName = "goLiveDisc",
|
||||
sCtrlName = "Game.UI.Disc.LiveDiscCtrl"
|
||||
},
|
||||
FullImage = {
|
||||
sNodeName = "----Full----"
|
||||
},
|
||||
imgFull = {nCount = 2, sComponentName = "Image"},
|
||||
rtImgFull2 = {
|
||||
sNodeName = "imgFull2",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgFullBg = {},
|
||||
btnCloseFull = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CloseFull"
|
||||
},
|
||||
btnOpenFull2 = {
|
||||
sNodeName = "imgDiscFrame",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_OpenFull"
|
||||
},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtDiscLevel = {sComponentName = "TMP_Text"},
|
||||
txtTitleRank = {sComponentName = "TMP_Text", sLanguageId = "Disc_Level"},
|
||||
txtLevelMax = {sComponentName = "TMP_Text"},
|
||||
goStarAdvance = {
|
||||
sNodeName = "tc_star_advance",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarAdvanceCtrl"
|
||||
},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
txtTitleProperty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "CharacterInfo_Property"
|
||||
},
|
||||
goProperty = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplatePropertyCtrl"
|
||||
},
|
||||
txtElement = {sComponentName = "TMP_Text"},
|
||||
imgElementIcon = {sComponentName = "Image"},
|
||||
imgTag = {nCount = 3},
|
||||
txtTag = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
DiscNote = {},
|
||||
DiscSkill = {},
|
||||
imgOn = {nCount = 2},
|
||||
imgOff = {nCount = 2},
|
||||
txtMainSkill = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_Btn_MainSkill"
|
||||
},
|
||||
txtSubSkill = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_Btn_SubSkill"
|
||||
},
|
||||
btnSkill = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Tab"
|
||||
},
|
||||
ScrollView = {sComponentName = "ScrollRect"},
|
||||
goMainSkill = {},
|
||||
txtMainSkillTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_MainSkill_Title"
|
||||
},
|
||||
txtMainSkillName = {sComponentName = "TMP_Text"},
|
||||
imgMainSkillIcon = {sComponentName = "Image"},
|
||||
imgMainSkillIconBg = {sComponentName = "Image"},
|
||||
goMainLevel = {sComponentName = "Image"},
|
||||
txtMainSkillDesc = {sComponentName = "TMP_Text"},
|
||||
TMP_Link1 = {
|
||||
sNodeName = "txtMainSkillDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
},
|
||||
goSubSkill = {},
|
||||
txtSubSkillTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_SubSkill_Title"
|
||||
},
|
||||
rtSubBg = {nCount = 2},
|
||||
txtSubSkillName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
imgSubSkillIcon = {nCount = 2, sComponentName = "Image"},
|
||||
imgSubSkillIconBg = {nCount = 2, sComponentName = "Image"},
|
||||
txtSubSkillDesc = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
TMP_Link2 = {
|
||||
sNodeName = "txtSubSkillDesc1",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
},
|
||||
TMP_Link3 = {
|
||||
sNodeName = "txtSubSkillDesc2",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
},
|
||||
txtActiveNeed = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_SubSkill_ActiveConditions"
|
||||
},
|
||||
txtSubSkillLevel = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
btnPrevLevel = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Prev"
|
||||
},
|
||||
btnNextLevel = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Next"
|
||||
},
|
||||
imgPrevOn = {nCount = 2},
|
||||
imgPrevOff = {nCount = 2},
|
||||
imgNextOn = {nCount = 2},
|
||||
imgNextOff = {nCount = 2},
|
||||
imgNeedNoteBg1_ = {nCount = 3},
|
||||
imgNeedNoteIcon1_ = {nCount = 3, sComponentName = "Image"},
|
||||
txtNeedNoteName1_ = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtNoteActiveLv1_ = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
imgNeedNoteBg2_ = {nCount = 3},
|
||||
imgNeedNoteIcon2_ = {nCount = 3, sComponentName = "Image"},
|
||||
txtNeedNoteName2_ = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtNoteActiveLv2_ = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtNoteTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_SubSkill_Tip"
|
||||
},
|
||||
btnNote = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Note"
|
||||
},
|
||||
imgNoteCount = {nCount = 3, sComponentName = "Image"},
|
||||
imgNoteIcon = {nCount = 3, sComponentName = "Image"},
|
||||
txtNoteName = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtNoteLv = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtNoteDesc = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
btnNotePreview = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NotePreview"
|
||||
},
|
||||
btnSwitch = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Switch"
|
||||
},
|
||||
goSwitch = {},
|
||||
SwitchOn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Shop_Sample_SwithOn"
|
||||
},
|
||||
SwitchOff = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Shop_Sample_SwithOff"
|
||||
},
|
||||
aniRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
}
|
||||
}
|
||||
DiscSampleCtrl._mapEventConfig = {
|
||||
[EventId.UIBackConfirm] = "OnEvent_UIBack",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_Home",
|
||||
ClickLiveDisc = "OnBtnClick_OpenFull"
|
||||
}
|
||||
function DiscSampleCtrl:InitData()
|
||||
if self.tbId then
|
||||
for index, discId in ipairs(self.tbId) do
|
||||
if self.nId == discId then
|
||||
self.curDiscIndex = index
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
self.nCurTab = 1
|
||||
for i = 1, 2 do
|
||||
self._mapNode.imgOn[i]:SetActive(i == self.nCurTab)
|
||||
self._mapNode.imgOff[i]:SetActive(i ~= self.nCurTab)
|
||||
end
|
||||
self._mapNode.goSwitch:SetActive(not self.bPlayerHad)
|
||||
self.bMax = false
|
||||
self._mapNode.btnSwitch[1].gameObject:SetActive(true)
|
||||
self._mapNode.btnSwitch[2].gameObject:SetActive(false)
|
||||
end
|
||||
function DiscSampleCtrl:RefreshData()
|
||||
if self.bPlayerHad then
|
||||
return
|
||||
end
|
||||
self.mapMin = PlayerData.Disc:GenerateLocalDiscData(self.nId)
|
||||
local nMaxLv = 1
|
||||
local foreachPromoteLimit = function(mapData)
|
||||
if mapData.Rarity == self.mapMin.nRarity and tonumber(mapData.Phase) == self.mapMin.nMaxPhase and tonumber(mapData.Phase) == self.mapMin.nMaxPhase then
|
||||
nMaxLv = tonumber(mapData.MaxLevel)
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.DiscPromoteLimit, foreachPromoteLimit)
|
||||
self.mapMax = PlayerData.Disc:GenerateLocalDiscData(self.nId, 0, nMaxLv, self.mapMin.nMaxPhase, self.mapMin.nMaxStar)
|
||||
end
|
||||
function DiscSampleCtrl:GetDiscData()
|
||||
if self.bPlayerHad then
|
||||
return PlayerData.Disc:GetDiscById(self.nId)
|
||||
else
|
||||
return self.bMax and self.mapMax or self.mapMin
|
||||
end
|
||||
end
|
||||
function DiscSampleCtrl:Refresh()
|
||||
local mapDisc = self:GetDiscData()
|
||||
self:RefreshInfo(mapDisc)
|
||||
self:RefreshProperty(mapDisc)
|
||||
self:RefreshSkill(mapDisc)
|
||||
self:SwitchSkill()
|
||||
end
|
||||
function DiscSampleCtrl:RefreshMiddle()
|
||||
local mapDisc = self:GetDiscData()
|
||||
local mapCfg = ConfigTable.GetData("Disc", self.nId)
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
self._mapNode.imgDiscIcon.gameObject:SetActive(false)
|
||||
self._mapNode.liveDiscCtrl:SetDiscActive(true, mapCfg.DiscBg ~= "")
|
||||
self._mapNode.liveDiscCtrl:SetRawImage(mapCfg.DiscBg, mapDisc.nRarity)
|
||||
if mapCfg.DiscBg ~= "" then
|
||||
local bSSR = mapDisc.nRarity == GameEnum.itemRarity.SSR
|
||||
self._mapNode.imgFull[1].gameObject:SetActive(bSSR)
|
||||
self._mapNode.imgFull[2].gameObject:SetActive(not bSSR)
|
||||
if bSSR then
|
||||
self:SetPngSprite(self._mapNode.imgFull[1], mapCfg.DiscBg .. AllEnum.DiscBgSurfix.Image)
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgFull[2], mapCfg.DiscBg .. AllEnum.DiscBgSurfix.Image)
|
||||
local nH = Settings.CURRENT_CANVAS_FULL_RECT_HEIGHT
|
||||
self._mapNode.rtImgFull2.sizeDelta = Vector2(nH, nH)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscSampleCtrl:RefreshInfo(mapDisc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapDisc.sName)
|
||||
self._mapNode.goStar:SetStar(0, 6 - mapDisc.nRarity)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDiscLevel, mapDisc.nLevel)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelMax, "/" .. mapDisc.nMaxLv)
|
||||
self._mapNode.goStarAdvance:SetStar(mapDisc.nPhase, mapDisc.nMaxPhase)
|
||||
local sName = AllEnum.ElementIconType.Icon .. mapDisc.nEET
|
||||
self:SetAtlasSprite(self._mapNode.imgElementIcon, "12_rare", sName)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtElement, AllEnum.ElementColor[mapDisc.nEET])
|
||||
NovaAPI.SetTMPText(self._mapNode.txtElement, ConfigTable.GetUIText("T_Element_Attr_" .. mapDisc.nEET))
|
||||
for i = 1, 3 do
|
||||
local nTag = mapDisc.tbTag[i]
|
||||
if nTag then
|
||||
self._mapNode.imgTag[i]:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTag[i], ConfigTable.GetData("DiscTag", nTag).Title)
|
||||
else
|
||||
self._mapNode.imgTag[i]:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscSampleCtrl:RefreshProperty(mapDisc)
|
||||
local tbAttr = mapDisc.mapAttrBase
|
||||
local i = 1
|
||||
for _, mapAttachAttr in pairs(AllEnum.AttachAttr) do
|
||||
local mapAttr = tbAttr[mapAttachAttr.sKey]
|
||||
if mapAttr.Value > 0 then
|
||||
self._mapNode.goProperty[i]:SetItemProperty(mapAttr.Key, mapAttr.Value, nil, true)
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscSampleCtrl:RefreshSkill(mapDisc)
|
||||
local nMainSkillId = mapDisc.nMainSkillId
|
||||
if nMainSkillId then
|
||||
self._mapNode.goMainSkill:SetActive(true)
|
||||
local mapCfg = ConfigTable.GetData("MainSkill", nMainSkillId)
|
||||
if mapCfg then
|
||||
self:SetPngSprite(self._mapNode.imgMainSkillIcon, mapCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.imgMainSkillIconBg, mapCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMainSkillName, mapCfg.Name)
|
||||
self:SetAtlasSprite(self._mapNode.goMainLevel, "12_rare", AllEnum.FrameType_New.DiscLimitS .. AllEnum.FrameColor_New[mapDisc.nRarity] .. "_0" .. mapDisc.nStar + 1)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.goMainLevel)
|
||||
local sDesc = UTILS.ParseParamDesc(mapCfg.Desc, mapCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMainSkillDesc, sDesc)
|
||||
end
|
||||
else
|
||||
self._mapNode.goMainSkill:SetActive(false)
|
||||
end
|
||||
self.tbSubLayer = nil
|
||||
self.tbSubMaxLayer = nil
|
||||
self:RefreshSubSkill()
|
||||
for i = 1, 3 do
|
||||
self._mapNode.btnNote[i].gameObject:SetActive(mapDisc.tbSubNoteSkills[i])
|
||||
if mapDisc.tbSubNoteSkills[i] then
|
||||
local nImgCount = 2
|
||||
self:SetPngSprite(self._mapNode.imgNoteCount[i], "UI/big_sprites/zs_outfit_lv_" .. nImgCount)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgNoteCount[i])
|
||||
local mapNote = ConfigTable.GetData("SubNoteSkill", mapDisc.tbSubNoteSkills[i].nId)
|
||||
if mapNote then
|
||||
self:SetPngSprite(self._mapNode.imgNoteIcon[i], mapNote.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteName[i], mapNote.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteDesc[i], mapNote.BriefDesc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteLv[i], orderedFormat(ConfigTable.GetUIText("StarTower_Disc_Info_Level"), mapDisc.tbSubNoteSkills[i].nCount))
|
||||
end
|
||||
end
|
||||
end
|
||||
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.ScrollView, 1)
|
||||
end
|
||||
function DiscSampleCtrl:RefreshSubSkill()
|
||||
if not self.tbSubLayer then
|
||||
self.tbSubLayer = {}
|
||||
end
|
||||
if not self.tbSubMaxLayer then
|
||||
self.tbSubMaxLayer = {}
|
||||
end
|
||||
local mapDisc = self:GetDiscData()
|
||||
local tbSubSkillGroupId = mapDisc.tbSubSkillGroupId
|
||||
self._mapNode.goSubSkill:SetActive(next(tbSubSkillGroupId))
|
||||
for i = 1, 2 do
|
||||
if tbSubSkillGroupId[i] then
|
||||
self._mapNode.rtSubBg[i]:SetActive(true)
|
||||
local tbGroup = CacheTable.GetData("_SecondarySkill", tbSubSkillGroupId[i])
|
||||
if tbGroup then
|
||||
if not self.tbSubLayer[i] then
|
||||
self.tbSubLayer[i] = 1
|
||||
end
|
||||
if not self.tbSubMaxLayer[i] then
|
||||
self.tbSubMaxLayer[i] = #tbGroup
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSubSkillLevel[i], orderedFormat(ConfigTable.GetUIText("Disc_SubSkill_Level"), self.tbSubLayer[i]))
|
||||
self._mapNode.imgPrevOn[i]:SetActive(self.tbSubLayer[i] > 1)
|
||||
self._mapNode.imgPrevOff[i]:SetActive(self.tbSubLayer[i] == 1)
|
||||
self._mapNode.imgNextOn[i]:SetActive(self.tbSubLayer[i] < self.tbSubMaxLayer[i])
|
||||
self._mapNode.imgNextOff[i]:SetActive(self.tbSubLayer[i] == self.tbSubMaxLayer[i])
|
||||
local mapCfg = tbGroup[self.tbSubLayer[i]]
|
||||
if mapCfg then
|
||||
self:SetPngSprite(self._mapNode.imgSubSkillIcon[i], mapCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.imgSubSkillIconBg[i], mapCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSubSkillName[i], mapCfg.Name)
|
||||
local sDesc = UTILS.ParseParamDesc(mapCfg.Desc, mapCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSubSkillDesc[i], sDesc)
|
||||
local tbActiveNote = decodeJson(mapCfg.NeedSubNoteSkills)
|
||||
local j = 1
|
||||
for nNeed = 1, 3 do
|
||||
self._mapNode["imgNeedNoteBg" .. i .. "_"][nNeed]:SetActive(false)
|
||||
end
|
||||
for k, v in pairs(tbActiveNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nNoteCount = tonumber(v)
|
||||
if nNoteId then
|
||||
local mapNote = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
if mapNote then
|
||||
self._mapNode["imgNeedNoteBg" .. i .. "_"][j]:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode["imgNeedNoteIcon" .. i .. "_"][j], mapNote.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode["txtNeedNoteName" .. i .. "_"][j], mapNote.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode["txtNoteActiveLv" .. i .. "_"][j], orderedFormat(ConfigTable.GetUIText("Disc_SubSkill_ActiveLevel"), nNoteCount))
|
||||
j = j + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
self._mapNode.rtSubBg[i]:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscSampleCtrl:SwitchSkill()
|
||||
self._mapNode.DiscSkill:SetActive(self.nCurTab == 1)
|
||||
self._mapNode.DiscNote:SetActive(self.nCurTab == 2)
|
||||
end
|
||||
function DiscSampleCtrl:PlayBGM()
|
||||
self.bPrevDisc = WwiseAudioMgr.IsPrevDiscBgm
|
||||
local mapCfg = ConfigTable.GetData("DiscIP", self.nId)
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
local sState = mapCfg.VoFile
|
||||
if not self.bPrevDisc then
|
||||
WwiseAudioMgr:PostEvent("music_outfit_enter")
|
||||
end
|
||||
WwiseAudioMgr:SetState("outfit", sState)
|
||||
WwiseAudioMgr:SetState("Disc", "discMain")
|
||||
end
|
||||
function DiscSampleCtrl:QuitBGM()
|
||||
if self.bPrevDisc then
|
||||
WwiseAudioMgr:SetState("outfit", WwiseAudioMgr.DiscUIBgm)
|
||||
WwiseAudioMgr:SetState("Disc", "discMain")
|
||||
WwiseAudioMgr:SeekOnEvent("music_outfit", 0)
|
||||
else
|
||||
WwiseAudioMgr:StopDiscMusic()
|
||||
end
|
||||
end
|
||||
function DiscSampleCtrl:FadeIn()
|
||||
self._mapNode.aniRoot:Play("DiscPanel_in")
|
||||
end
|
||||
function DiscSampleCtrl:Awake()
|
||||
self.aniFull = self.gameObject.transform:GetComponent("Animator")
|
||||
self.aniFull.enabled = false
|
||||
self.nDragStartPosX = nil
|
||||
self.nDragThreshold = ConfigTable.GetConfigNumber("DiscDragThreshold")
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.nId = tbParam[1]
|
||||
self.bPlayerHad = tbParam[2]
|
||||
self.tbId = tbParam[3]
|
||||
end
|
||||
self:InitData()
|
||||
end
|
||||
function DiscSampleCtrl:OnEnable()
|
||||
PlayerData.Voice:ClearTimer()
|
||||
PlayerData.Voice:StopCharVoice()
|
||||
self:RefreshData()
|
||||
self:Refresh()
|
||||
self:RefreshMiddle()
|
||||
self:PlayBGM()
|
||||
end
|
||||
function DiscSampleCtrl:OnDisable()
|
||||
self:QuitBGM()
|
||||
end
|
||||
function DiscSampleCtrl:OnDestroy()
|
||||
end
|
||||
function DiscSampleCtrl:OnBtnClick_Tab(btn, nIndex)
|
||||
if nIndex == self.nCurTab then
|
||||
return
|
||||
end
|
||||
for i = 1, 2 do
|
||||
self._mapNode.imgOn[i]:SetActive(i == nIndex)
|
||||
self._mapNode.imgOff[i]:SetActive(i ~= nIndex)
|
||||
end
|
||||
self.nCurTab = nIndex
|
||||
self:SwitchSkill()
|
||||
end
|
||||
function DiscSampleCtrl:OnBtnClick_Switch(btn, nIndex)
|
||||
self.bMax = not self.bMax
|
||||
self:Refresh()
|
||||
self._mapNode.btnSwitch[1].gameObject:SetActive(nIndex == 2)
|
||||
self._mapNode.btnSwitch[2].gameObject:SetActive(nIndex == 1)
|
||||
end
|
||||
function DiscSampleCtrl:OnBtnClick_OpenFull()
|
||||
if self._mapNode.liveDiscCtrl:GetCanOpenFullState() then
|
||||
self.aniFull.enabled = true
|
||||
self._mapNode.FullImage.gameObject:SetActive(true)
|
||||
if self._mapNode.imgFull[2].gameObject.activeSelf then
|
||||
self._mapNode.imgFullBg.gameObject:SetActive(true)
|
||||
end
|
||||
self.aniFull:Play("DiscPanel_Full_in", 0, 0)
|
||||
end
|
||||
end
|
||||
function DiscSampleCtrl:OnBtnClick_CloseFull()
|
||||
self.aniFull:Play("DiscPanel_Full_out")
|
||||
local ani_end = function()
|
||||
self.aniFull.enabled = false
|
||||
self._mapNode.FullImage.gameObject:SetActive(false)
|
||||
self._mapNode.imgFullBg.gameObject:SetActive(false)
|
||||
end
|
||||
self:AddTimer(1, 0.4, ani_end, true, true, true)
|
||||
end
|
||||
function DiscSampleCtrl:OnEvent_UIBack(nPanelId)
|
||||
if self._panel._nPanelId ~= nPanelId then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.DiscSample)
|
||||
end
|
||||
function DiscSampleCtrl:OnEvent_Home(nPanelId)
|
||||
if self._panel._nPanelId ~= nPanelId then
|
||||
return
|
||||
end
|
||||
PanelManager.Home()
|
||||
end
|
||||
function DiscSampleCtrl:OnBtnClick_Prev(btn, nIndex)
|
||||
if self.tbSubLayer and self.tbSubLayer[nIndex] == 1 then
|
||||
return
|
||||
end
|
||||
self.tbSubLayer[nIndex] = self.tbSubLayer[nIndex] - 1
|
||||
self:RefreshSubSkill()
|
||||
end
|
||||
function DiscSampleCtrl:OnBtnClick_Next(btn, nIndex)
|
||||
if self.tbSubMaxLayer and self.tbSubLayer and self.tbSubLayer[nIndex] == self.tbSubMaxLayer[nIndex] then
|
||||
return
|
||||
end
|
||||
self.tbSubLayer[nIndex] = self.tbSubLayer[nIndex] + 1
|
||||
self:RefreshSubSkill()
|
||||
end
|
||||
function DiscSampleCtrl:OnLinkClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
function DiscSampleCtrl:OnBtnClick_Note(btn, nIndex)
|
||||
local mapDisc = self:GetDiscData()
|
||||
local mapNote = mapDisc.tbSubNoteSkills[nIndex]
|
||||
if not mapNote then
|
||||
return
|
||||
end
|
||||
local tbNote = {}
|
||||
for _, v in ipairs(mapDisc.tbSubNoteSkills) do
|
||||
tbNote[v.nId] = v.nCount
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.NoteSkill, tbNote, mapNote.nId)
|
||||
end
|
||||
function DiscSampleCtrl:OnBtnClick_NotePreview(btn)
|
||||
local mapDisc = self:GetDiscData()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.NoteSkillPreview, mapDisc.nSubNoteSkillId, mapDisc.nPhase, mapDisc.nRarity)
|
||||
end
|
||||
function DiscSampleCtrl:OnDrag_Disc(mDrag)
|
||||
if mDrag.DragEventType == AllEnum.UIDragType.DragStart then
|
||||
self.nDragStartPosX = mDrag.EventData.position.x
|
||||
elseif mDrag.DragEventType == AllEnum.UIDragType.DragEnd then
|
||||
local dragEndPosX = mDrag.EventData.position.x
|
||||
if dragEndPosX - self.nDragStartPosX > self.nDragThreshold then
|
||||
self:OnBtnClick_Left()
|
||||
elseif dragEndPosX - self.nDragStartPosX < -self.nDragThreshold then
|
||||
self:OnBtnClick_Right()
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscSampleCtrl:OnBtnClick_Left()
|
||||
if not self.tbId or #self.tbId <= 1 then
|
||||
return
|
||||
end
|
||||
self.curDiscIndex = self.curDiscIndex - 1
|
||||
if 1 > self.curDiscIndex then
|
||||
self.curDiscIndex = #self.tbId
|
||||
end
|
||||
self.nId = self.tbId[self.curDiscIndex]
|
||||
self:RefreshData()
|
||||
self:Refresh()
|
||||
self:RefreshMiddle()
|
||||
self:PlayBGM()
|
||||
end
|
||||
function DiscSampleCtrl:OnBtnClick_Right()
|
||||
if not self.tbId or #self.tbId <= 1 then
|
||||
return
|
||||
end
|
||||
self.curDiscIndex = self.curDiscIndex + 1
|
||||
if self.curDiscIndex > #self.tbId then
|
||||
self.curDiscIndex = 1
|
||||
end
|
||||
self.nId = self.tbId[self.curDiscIndex]
|
||||
self:RefreshData()
|
||||
self:Refresh()
|
||||
self:RefreshMiddle()
|
||||
self:PlayBGM()
|
||||
end
|
||||
return DiscSampleCtrl
|
||||
@@ -0,0 +1,18 @@
|
||||
local DiscSamplePanel = class("DiscSamplePanel", BasePanel)
|
||||
DiscSamplePanel._bIsMainPanel = false
|
||||
DiscSamplePanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
|
||||
DiscSamplePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Disc/DiscSamplePanel.prefab",
|
||||
sCtrlName = "Game.UI.Disc.DiscSampleCtrl"
|
||||
}
|
||||
}
|
||||
function DiscSamplePanel:Awake()
|
||||
end
|
||||
function DiscSamplePanel:OnEnable()
|
||||
end
|
||||
function DiscSamplePanel:OnDisable()
|
||||
end
|
||||
function DiscSamplePanel:OnDestroy()
|
||||
end
|
||||
return DiscSamplePanel
|
||||
@@ -0,0 +1,49 @@
|
||||
local DiscSelectedMatCtrl = class("DiscSelectedMatCtrl", BaseCtrl)
|
||||
DiscSelectedMatCtrl._mapNodeConfig = {
|
||||
btnAdd = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Add"
|
||||
},
|
||||
btnReduce = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reduce"
|
||||
},
|
||||
ctrlMat = {
|
||||
sNodeName = "tc_mat_grid_01",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateMatGridCtrl"
|
||||
}
|
||||
}
|
||||
DiscSelectedMatCtrl._mapEventConfig = {}
|
||||
function DiscSelectedMatCtrl:Refresh(mapData)
|
||||
self.mapData = mapData
|
||||
self._mapNode.ctrlMat:RerfeshSelected(mapData)
|
||||
end
|
||||
function DiscSelectedMatCtrl:SetCount(nCount)
|
||||
self._mapNode.ctrlMat:SetSelectedCount(nCount)
|
||||
end
|
||||
function DiscSelectedMatCtrl:ReduceMat(btn)
|
||||
if btn.Operate_Type == 0 then
|
||||
self.mapData.nCost = 0
|
||||
elseif btn.Operate_Type == 3 then
|
||||
return
|
||||
end
|
||||
self.mapData.nCost = 0
|
||||
self._panel:ChangeMatList(self.mapData, true)
|
||||
EventManager.Hit("DiscChangeSelectedMat", true)
|
||||
EventManager.Hit("DiscChangeGridMat")
|
||||
end
|
||||
function DiscSelectedMatCtrl:Awake()
|
||||
end
|
||||
function DiscSelectedMatCtrl:OnEnable()
|
||||
end
|
||||
function DiscSelectedMatCtrl:OnDisable()
|
||||
end
|
||||
function DiscSelectedMatCtrl:OnDestroy()
|
||||
end
|
||||
function DiscSelectedMatCtrl:OnBtnClick_Add(btn)
|
||||
EventManager.Hit("DiscOpenMatList")
|
||||
end
|
||||
function DiscSelectedMatCtrl:OnBtnClick_Reduce(btn)
|
||||
self:ReduceMat(btn)
|
||||
end
|
||||
return DiscSelectedMatCtrl
|
||||
@@ -0,0 +1,74 @@
|
||||
local DiscStoryCtrl = class("DiscStoryCtrl", BaseCtrl)
|
||||
DiscStoryCtrl._mapNodeConfig = {
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_story"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_story",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnClose = {
|
||||
sNodeName = "snapshot_story",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
aniRoot = {sNodeName = "StoryRoot", sComponentName = "Animator"},
|
||||
btnRead = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Read"
|
||||
},
|
||||
txtStory = {
|
||||
sComponentName = "RubyTextMeshProUGUI"
|
||||
},
|
||||
txtStoryName = {sComponentName = "TMP_Text"},
|
||||
btn_CloseStory = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtBtnCloseStory = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Confirm"
|
||||
},
|
||||
sv = {sComponentName = "ScrollRect"}
|
||||
}
|
||||
DiscStoryCtrl._mapEventConfig = {OpenDiscStory = "Open"}
|
||||
function DiscStoryCtrl:Open(mapDisc, mapCfg)
|
||||
self._mapNode.blur:SetActive(true)
|
||||
self._mapNode.btnRead.gameObject:SetActive(mapDisc.bRead == false)
|
||||
NovaAPI.SetText_RubyTMP(self._mapNode.txtStory, mapCfg.StoryDesc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtStoryName, mapCfg.StoryName)
|
||||
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.sv, 1)
|
||||
self:PlayInAni()
|
||||
end
|
||||
function DiscStoryCtrl:PlayInAni()
|
||||
self.gameObject:SetActive(true)
|
||||
self._mapNode.aniRoot:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function DiscStoryCtrl:PlayOutAni()
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
self._mapNode.aniRoot:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, 0.2, "Close", true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
function DiscStoryCtrl:Close()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
function DiscStoryCtrl:Awake()
|
||||
end
|
||||
function DiscStoryCtrl:OnEnable()
|
||||
end
|
||||
function DiscStoryCtrl:OnDisable()
|
||||
end
|
||||
function DiscStoryCtrl:OnDestroy()
|
||||
end
|
||||
function DiscStoryCtrl:OnBtnClick_Read()
|
||||
local callback = function()
|
||||
self._mapNode.btnRead.gameObject:SetActive(false)
|
||||
end
|
||||
PlayerData.Disc:SendDiscReadRewardReceiveReq(self._panel.nId, AllEnum.DiscReadType.DiscStory, callback)
|
||||
end
|
||||
function DiscStoryCtrl:OnBtnClick_Close(btn)
|
||||
self:PlayOutAni()
|
||||
end
|
||||
return DiscStoryCtrl
|
||||
@@ -0,0 +1,316 @@
|
||||
local DiscUpgradeCtrl = class("DiscUpgradeCtrl", BaseCtrl)
|
||||
DiscUpgradeCtrl._mapNodeConfig = {
|
||||
NotMax = {},
|
||||
txtTitleRank = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_Level"
|
||||
},
|
||||
txtCurLv = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
goAdvanceStar = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarAdvanceCtrl"
|
||||
},
|
||||
txtMaxLevel = {sComponentName = "TMP_Text"},
|
||||
goExpbar = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateExpBarCtrl"
|
||||
},
|
||||
goProperty = {},
|
||||
goPropertyLong = {},
|
||||
trProperty = {sComponentName = "Transform"},
|
||||
goMat = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateMatGridCtrl"
|
||||
},
|
||||
btnMaxLv = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_MaxLv"
|
||||
},
|
||||
btnNextLv = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NextLv"
|
||||
},
|
||||
txtBtnNextLv = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Btn_UpOneLevel"
|
||||
},
|
||||
txtBtnMaxLv = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Btn_UpMaxLevel"
|
||||
},
|
||||
btnAdd = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Add"
|
||||
},
|
||||
btnReduce = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reduce"
|
||||
},
|
||||
btnUpgrade = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Upgrade"
|
||||
},
|
||||
txtBtnUpgrade = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Btn_LevelUp"
|
||||
},
|
||||
imgCostIcon = {sComponentName = "Image"},
|
||||
txtCostCount = {sComponentName = "TMP_Text"},
|
||||
Max = {},
|
||||
txtMaxLv = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
trMaxProperty = {sComponentName = "Transform"},
|
||||
txtLvMax = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Tip_MaxLevel"
|
||||
}
|
||||
}
|
||||
DiscUpgradeCtrl._mapEventConfig = {}
|
||||
function DiscUpgradeCtrl:InitData()
|
||||
self.mapBeforeLevel = nil
|
||||
self.mapAfterLevel = nil
|
||||
self.tbMat = nil
|
||||
self.nGoldCost = 0
|
||||
self.mapAttrBefore = nil
|
||||
self.mapAttrAfter = nil
|
||||
end
|
||||
function DiscUpgradeCtrl:Refresh()
|
||||
self:InitData()
|
||||
local mapDisc = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
local bMax = mapDisc.nLevel == mapDisc.nMaxLv
|
||||
self._mapNode.NotMax:SetActive(not bMax)
|
||||
self._mapNode.Max:SetActive(bMax)
|
||||
if bMax then
|
||||
self:RefreshMax(mapDisc)
|
||||
else
|
||||
self:RefreshNotMax(mapDisc)
|
||||
end
|
||||
self:RefreshStar(mapDisc)
|
||||
end
|
||||
function DiscUpgradeCtrl:RefreshMax(mapDisc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMaxLv[1], mapDisc.nLevel)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMaxLv[2], "/" .. mapDisc.nLevel)
|
||||
local mapLevelData = self:BuildLevelData(mapDisc, true)
|
||||
self._mapNode.goExpbar[2]:Refresh(mapLevelData)
|
||||
delChildren(self._mapNode.trMaxProperty)
|
||||
for _, mapAttachAttr in pairs(AllEnum.AttachAttr) do
|
||||
local mapAttr = mapDisc.mapAttrBase[mapAttachAttr.sKey]
|
||||
if mapAttr.Value > 0 then
|
||||
local goItemObj = instantiate(self._mapNode.goProperty, self._mapNode.trMaxProperty)
|
||||
goItemObj:SetActive(true)
|
||||
local ctrlItem = self:BindCtrlByNode(goItemObj, "Game.UI.TemplateEx.TemplatePropertyCtrl")
|
||||
ctrlItem:SetItemProperty(mapAttr.Key, mapAttr.Value, nil, true)
|
||||
end
|
||||
end
|
||||
for _, v in pairs(mapDisc.tbSubNoteSkills) do
|
||||
local goItemObj = instantiate(self._mapNode.goProperty, self._mapNode.trMaxProperty)
|
||||
goItemObj:SetActive(true)
|
||||
local ctrlItem = self:BindCtrlByNode(goItemObj, "Game.UI.TemplateEx.TemplatePropertyCtrl")
|
||||
ctrlItem:SetNote(v.nId, v.nCount)
|
||||
end
|
||||
end
|
||||
function DiscUpgradeCtrl:RefreshNotMax(mapDisc)
|
||||
self.mapBeforeLevel = self:BuildLevelData(mapDisc)
|
||||
self.mapAfterLevel = self:BuildLevelData(mapDisc)
|
||||
self:RefreshInfo(mapDisc)
|
||||
end
|
||||
function DiscUpgradeCtrl:RefreshInfo(mapDisc)
|
||||
self:RefreshLvAndExp(self.mapBeforeLevel, self.mapAfterLevel)
|
||||
self:RefreshAttr(mapDisc)
|
||||
self:RefreshCoin()
|
||||
self:RefreshMat(true)
|
||||
end
|
||||
function DiscUpgradeCtrl:RefreshLvAndExp(mapBeforeLevel, mapAfterLevel)
|
||||
self._mapNode.txtCurLv[1].gameObject:SetActive(mapAfterLevel.nLevel <= mapBeforeLevel.nLevel)
|
||||
self._mapNode.txtCurLv[2].gameObject:SetActive(mapAfterLevel.nLevel > mapBeforeLevel.nLevel)
|
||||
for i = 1, 2 do
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCurLv[i], mapAfterLevel.nLevel)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMaxLevel, "/" .. mapAfterLevel.nMaxLevel)
|
||||
self._mapNode.goExpbar[1]:Refresh(mapBeforeLevel, mapAfterLevel)
|
||||
end
|
||||
function DiscUpgradeCtrl:RefreshAttr(mapDisc)
|
||||
local bExpChanged = true
|
||||
if self.mapAfterLevel.nLevel == self.mapBeforeLevel.nLevel and self.mapAfterLevel.nExp == self.mapBeforeLevel.nExp then
|
||||
bExpChanged = false
|
||||
end
|
||||
self.mapAttrBefore = mapDisc.mapAttrBase
|
||||
self.mapAttrAfter = PlayerData.Disc:GetAttrBase(mapDisc.nAttrBaseGroupId, mapDisc.nPhase, self.mapAfterLevel.nLevel, mapDisc.nAttrExtraGroupId, mapDisc.nStar)
|
||||
delChildren(self._mapNode.trProperty)
|
||||
for _, mapAttachAttr in pairs(AllEnum.AttachAttr) do
|
||||
local mapAttr = self.mapAttrBefore[mapAttachAttr.sKey]
|
||||
if mapAttr.Value > 0 then
|
||||
local goItemObj = instantiate(self._mapNode.goPropertyLong, self._mapNode.trProperty)
|
||||
goItemObj:SetActive(true)
|
||||
local ctrlItem = self:BindCtrlByNode(goItemObj, "Game.UI.TemplateEx.TemplatePropertyCtrl")
|
||||
local bValueChanged = self.mapAttrAfter[mapAttachAttr.sKey].Value ~= mapAttr.Value
|
||||
if bExpChanged and bValueChanged then
|
||||
ctrlItem:SetItemProperty(mapAttr.Key, mapAttr.Value, self.mapAttrAfter[mapAttachAttr.sKey].Value, true)
|
||||
else
|
||||
ctrlItem:SetItemProperty(mapAttr.Key, mapAttr.Value, nil, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscUpgradeCtrl:RefreshStar(mapDisc)
|
||||
self._mapNode.goAdvanceStar[1]:SetStar(mapDisc.nPhase, mapDisc.nMaxPhase)
|
||||
self._mapNode.goAdvanceStar[2]:SetStar(mapDisc.nPhase, mapDisc.nMaxPhase)
|
||||
end
|
||||
function DiscUpgradeCtrl:RefreshCoin()
|
||||
self:SetSprite_Coin(self._mapNode.imgCostIcon, AllEnum.CoinItemId.Gold)
|
||||
local nHasCoin = PlayerData.Coin:GetCoinCount(AllEnum.CoinItemId.Gold)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCostCount, math.ceil(self.nGoldCost))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtCostCount, nHasCoin < self.nGoldCost and Red_Unable or Blue_Normal)
|
||||
end
|
||||
function DiscUpgradeCtrl:RefreshMat(bInit)
|
||||
if bInit then
|
||||
self.tbMat = PlayerData.Disc:GetUpgradeMatList()
|
||||
for i = 1, 4 do
|
||||
self._mapNode.goMat[i]:RerfeshGrid({
|
||||
nId = self.tbMat[i].nItemId
|
||||
})
|
||||
end
|
||||
else
|
||||
for i = 1, 4 do
|
||||
self._mapNode.goMat[i]:SetGridCount(self.tbMat[i].nCost)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscUpgradeCtrl:BuildLevelData(mapDisc, bMax)
|
||||
local mapLevelData = {
|
||||
nLevel = mapDisc.nLevel,
|
||||
nExp = mapDisc.nExp,
|
||||
nMaxLevel = mapDisc.nMaxLv,
|
||||
nMaxExp = bMax and 0 or PlayerData.Disc:GetMaxExp(mapDisc.nStrengthenGroupId, mapDisc.nLevel),
|
||||
nMatExp = 0
|
||||
}
|
||||
return mapLevelData
|
||||
end
|
||||
function DiscUpgradeCtrl:ChangeMat()
|
||||
self.mapAfterLevel, self.nGoldCost = PlayerData.Disc:GetLevelDataAndCostByMat(self._panel.nId, self.tbMat)
|
||||
local mapDisc = PlayerData.Disc:GetDiscById(self._panel.nId)
|
||||
self:RefreshLvAndExp(self.mapBeforeLevel, self.mapAfterLevel)
|
||||
self:RefreshAttr(mapDisc)
|
||||
self:RefreshCoin()
|
||||
self:RefreshMat()
|
||||
end
|
||||
function DiscUpgradeCtrl:Awake()
|
||||
end
|
||||
function DiscUpgradeCtrl:OnEnable()
|
||||
end
|
||||
function DiscUpgradeCtrl:OnDisable()
|
||||
end
|
||||
function DiscUpgradeCtrl:OnDestroy()
|
||||
end
|
||||
function DiscUpgradeCtrl:OnBtnClick_MaxLv(btn)
|
||||
if self.mapAfterLevel.nLevel == self.mapAfterLevel.nMaxLevel then
|
||||
return
|
||||
end
|
||||
self.mapAfterLevel, self.tbMat, self.nGoldCost = PlayerData.Disc:GetMaxLevelDataAndCost(self._panel.nId)
|
||||
if self.nGoldCost == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Upgrade_NoneMat"))
|
||||
return
|
||||
end
|
||||
self:ChangeMat()
|
||||
end
|
||||
function DiscUpgradeCtrl:OnBtnClick_NextLv(btn)
|
||||
if self.mapAfterLevel.nLevel == self.mapAfterLevel.nMaxLevel then
|
||||
return
|
||||
end
|
||||
self.mapAfterLevel, self.tbMat, self.nGoldCost = PlayerData.Disc:GetCustomizeLevelDataAndCost(self._panel.nId, self.mapAfterLevel.nLevel + 1)
|
||||
if self.nGoldCost == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Upgrade_NoneMat"))
|
||||
return
|
||||
end
|
||||
self:ChangeMat()
|
||||
end
|
||||
function DiscUpgradeCtrl:OnBtnClick_Upgrade()
|
||||
if self.nGoldCost == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Upgrade_NoneMat"))
|
||||
return
|
||||
end
|
||||
if self.nGoldCost > PlayerData.Coin:GetCoinCount(AllEnum.CoinItemId.Gold) then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Upgrade_GoinNotEnough"))
|
||||
return
|
||||
end
|
||||
local callback = function()
|
||||
local ani_end = function()
|
||||
self.nGoldCost = 0
|
||||
local mapData = {
|
||||
nLevel = self.mapAfterLevel.nLevel,
|
||||
mapAttrBefore = self.mapAttrBefore,
|
||||
mapAttrAfter = self.mapAttrAfter
|
||||
}
|
||||
if self.mapAfterLevel.nLevel > self.mapBeforeLevel.nLevel then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSucBar, mapData, AllEnum.DiscSucBar.Upgrade)
|
||||
end
|
||||
EventManager.Hit("DiscRefresh")
|
||||
end
|
||||
self:RefreshLvAndExp(self.mapBeforeLevel, self.mapBeforeLevel)
|
||||
self._mapNode.goExpbar[1]:PlayAni(self.mapBeforeLevel, self.mapAfterLevel, ani_end, self._mapNode.txtCurLv[1])
|
||||
end
|
||||
PlayerData.Disc:SendDiscStrengthenReq(self._panel.nId, self.tbMat, callback)
|
||||
end
|
||||
function DiscUpgradeCtrl:OnBtnClick_Add(btn, nIndex)
|
||||
local func_tips = function()
|
||||
local mapData = {
|
||||
nTid = self.tbMat[nIndex].nItemId,
|
||||
bShowDepot = true,
|
||||
bShowJumpto = true
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ItemTips, btn.transform, mapData)
|
||||
end
|
||||
if self.mapAfterLevel.nLevel == self.mapAfterLevel.nMaxLevel then
|
||||
if btn.Operate_Type == 0 then
|
||||
func_tips()
|
||||
end
|
||||
return
|
||||
end
|
||||
local nHas = PlayerData.Item:GetItemCountByID(self.tbMat[nIndex].nItemId)
|
||||
if nHas <= 0 then
|
||||
func_tips()
|
||||
return
|
||||
end
|
||||
local nHasRemain = nHas - self.tbMat[nIndex].nCost
|
||||
if nHasRemain <= 0 then
|
||||
func_tips()
|
||||
return
|
||||
end
|
||||
if btn.Operate_Type == 0 then
|
||||
self.tbMat[nIndex].nCost = self.tbMat[nIndex].nCost + 1
|
||||
elseif btn.Operate_Type == 3 then
|
||||
if btn.CurrentGear == 0 then
|
||||
self.nRemain = PlayerData.Disc:GetMaxMatCost(self._panel.nId, self.tbMat, self.tbMat[nIndex])
|
||||
if nHasRemain < self.nRemain then
|
||||
self.nRemain = nHasRemain
|
||||
end
|
||||
end
|
||||
local nGear, _ = math.modf(btn.CurrentGear / 3)
|
||||
local nAdd = 2 ^ nGear
|
||||
local nRemain = self.nRemain - nAdd
|
||||
if nRemain < 0 then
|
||||
nAdd = self.nRemain
|
||||
self.nRemain = 0
|
||||
else
|
||||
self.nRemain = nRemain
|
||||
end
|
||||
self.tbMat[nIndex].nCost = math.floor(self.tbMat[nIndex].nCost + nAdd)
|
||||
end
|
||||
self.mapAfterLevel, self.nGoldCost = PlayerData.Disc:GetLevelDataAndCostByMat(self._panel.nId, self.tbMat)
|
||||
self:ChangeMat()
|
||||
end
|
||||
function DiscUpgradeCtrl:OnBtnClick_Reduce(btn, nIndex)
|
||||
if btn.Operate_Type == 0 then
|
||||
self.tbMat[nIndex].nCost = self.tbMat[nIndex].nCost - 1
|
||||
elseif btn.Operate_Type == 3 then
|
||||
self.tbMat[nIndex].nCost = math.floor(self.tbMat[nIndex].nCost - 2 ^ btn.CurrentGear)
|
||||
end
|
||||
if 0 > self.tbMat[nIndex].nCost then
|
||||
self.tbMat[nIndex].nCost = 0
|
||||
end
|
||||
self.mapAfterLevel, self.nGoldCost = PlayerData.Disc:GetLevelDataAndCostByMat(self._panel.nId, self.tbMat)
|
||||
self:ChangeMat()
|
||||
end
|
||||
return DiscUpgradeCtrl
|
||||
@@ -0,0 +1,172 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local LiveDiscCtrl = class("LiveDiscCtrl", BaseCtrl)
|
||||
local PathType = CS.DG.Tweening.PathType
|
||||
local LoopType = CS.DG.Tweening.LoopType
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
LiveDiscCtrl._mapNodeConfig = {
|
||||
CardDrag = {
|
||||
sComponentName = "UIDrag",
|
||||
callback = "OnUIDrag_Drag"
|
||||
},
|
||||
rImgDisc = {sComponentName = "RawImage"},
|
||||
btnOpenFull = {
|
||||
sNodeName = "CardDrag",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_OpenFull"
|
||||
},
|
||||
btnFull = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_OpenFull"
|
||||
}
|
||||
}
|
||||
LiveDiscCtrl._mapEventConfig = {}
|
||||
function LiveDiscCtrl:Awake()
|
||||
self.bMobile = NovaAPI.IsMobilePlatform()
|
||||
end
|
||||
function LiveDiscCtrl:OnEnable()
|
||||
self.callback = nil
|
||||
end
|
||||
function LiveDiscCtrl:OnDisable()
|
||||
self:ClearClickCallback()
|
||||
self:ReleaseRawImage()
|
||||
end
|
||||
function LiveDiscCtrl:SetDiscActive(bGoActice, bBtnAcitve)
|
||||
self._mapNode.rImgDisc.gameObject:SetActive(bGoActice)
|
||||
self._mapNode.CardDrag.gameObject:SetActive(not self.bMobile)
|
||||
self._mapNode.btnFull.gameObject:SetActive(self.bMobile)
|
||||
self._mapNode.btnOpenFull.interactable = bBtnAcitve
|
||||
self._mapNode.btnFull.interactable = bBtnAcitve
|
||||
end
|
||||
function LiveDiscCtrl:SetClickCallback(callback)
|
||||
self.callback = callback
|
||||
end
|
||||
function LiveDiscCtrl:ClearClickCallback()
|
||||
self.callback = nil
|
||||
end
|
||||
function LiveDiscCtrl:SetRawImage(sDiscBg, nRarity)
|
||||
local bSSR = nRarity == GameEnum.itemRarity.SSR
|
||||
if self.uiRoot == nil then
|
||||
self.uiRoot = PanelManager.GetUIRoot()
|
||||
end
|
||||
if self.goRender == nil then
|
||||
local renderPrefab = self:LoadAsset("UI/Disc/Disc_OffScreen_Renderer.prefab")
|
||||
self.goRender = instantiate(renderPrefab, self.uiRoot)
|
||||
self.camera = self.goRender.transform:Find("----Renderer----/OffScreen2DCamera"):GetComponent("Camera")
|
||||
local nScale = self.bMobile and math.floor(Settings.CURRENT_CANVAS_FULL_RECT_HEIGHT * Settings.RENDERTEXTURE_SIZE_FACTOR) or math.floor(2048 * Settings.RENDERTEXTURE_SIZE_FACTOR)
|
||||
self.rt2d = GameUIUtils.GenerateRenderTextureFor2D(nScale, nScale)
|
||||
self.rt2d.name = "LiveDisc"
|
||||
self.camera.targetTexture = self.rt2d
|
||||
NovaAPI.SetTexture(self._mapNode.rImgDisc, self.rt2d)
|
||||
end
|
||||
local discRoot = self.goRender.transform:Find("----Renderer----/Canvas")
|
||||
if discRoot.transform.childCount > 0 then
|
||||
for i = discRoot.transform.childCount, 1, -1 do
|
||||
local obj = discRoot.transform:GetChild(i - 1).gameObject
|
||||
destroyImmediate(obj)
|
||||
end
|
||||
end
|
||||
local discPrefab
|
||||
local sRootPath = Settings.AB_ROOT_PATH
|
||||
if type(sDiscBg) == "string" and sDiscBg ~= "" then
|
||||
local sPrefab = sDiscBg .. AllEnum.DiscBgSurfix.Card .. ".prefab"
|
||||
if GameResourceLoader.ExistsAsset(sRootPath .. sPrefab) == true then
|
||||
discPrefab = self:LoadAsset(sPrefab)
|
||||
end
|
||||
end
|
||||
local bNoneAsset = false
|
||||
if discPrefab == nil then
|
||||
discPrefab = self:LoadAsset("Disc/Common/Common.prefab")
|
||||
bNoneAsset = true
|
||||
end
|
||||
if discPrefab then
|
||||
local goDisc = instantiate(discPrefab, discRoot)
|
||||
if not bSSR or bNoneAsset then
|
||||
goDisc.transform.localPosition = Vector3(0, -11, 0)
|
||||
local imgIcon = goDisc.transform:Find("layer_-1/icon"):GetComponent("Image")
|
||||
local imgFrame = goDisc.transform:Find("layer_-1/frame"):GetComponent("Image")
|
||||
self:SetPngSprite(imgIcon, sDiscBg .. AllEnum.DiscBgSurfix.Image)
|
||||
self:SetSprite_FrameColor(imgFrame, nRarity, AllEnum.FrameType_New.SuperscriptDB, true)
|
||||
end
|
||||
self.trTarget = goDisc.transform:Find("Gyroscope/Target").transform
|
||||
NovaAPI.SetComponentEnable(self.trTarget:GetComponent("Image"), false)
|
||||
NovaAPI.SetComponentEnable(goDisc.transform:Find("Gyroscope/Axis"):GetComponent("Image"), false)
|
||||
if not self.bMobile then
|
||||
self.trTarget.localPosition = Vector3(-8, 0, 0)
|
||||
local tbPath = {
|
||||
[1] = Vector3(-8, 0, 0),
|
||||
[2] = Vector3(8, 0, 0)
|
||||
}
|
||||
local nTime = 8
|
||||
if self.tweener then
|
||||
self.tweener:Kill()
|
||||
self.tweener = nil
|
||||
end
|
||||
self.tweener = self.trTarget:DOLocalPath(tbPath, nTime, PathType.Linear):SetLoops(-1, LoopType.Yoyo):SetEase(Ease.InOutSine):SetUpdate(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function LiveDiscCtrl:ReleaseRawImage()
|
||||
if self.camera and self.camera:IsNull() == false then
|
||||
self.camera.targetTexture = nil
|
||||
self.camera = nil
|
||||
end
|
||||
NovaAPI.SetTexture(self._mapNode.rImgDisc, nil)
|
||||
if self.rt2d then
|
||||
GameUIUtils.ReleaseRenderTexture(self.rt2d)
|
||||
self.rt2d = nil
|
||||
end
|
||||
if self.goRender then
|
||||
destroy(self.goRender)
|
||||
self.goRender = nil
|
||||
end
|
||||
if self.tweener then
|
||||
self.tweener:Kill()
|
||||
self.tweener = nil
|
||||
end
|
||||
end
|
||||
function LiveDiscCtrl:OnUIDrag_Drag(mDrag)
|
||||
if self.bMobile then
|
||||
return
|
||||
end
|
||||
local clamp = function(value, min, max)
|
||||
if value < min then
|
||||
value = min
|
||||
elseif max < value then
|
||||
value = max
|
||||
end
|
||||
return value
|
||||
end
|
||||
if mDrag.DragEventType == AllEnum.UIDragType.DragStart then
|
||||
self.bStartDrag = true
|
||||
if self.tweener then
|
||||
self.tweener:Pause()
|
||||
end
|
||||
elseif mDrag.DragEventType == AllEnum.UIDragType.Drag then
|
||||
if true == self.bStartDrag then
|
||||
local nX = self.trTarget.localPosition.x + (mDrag.EventData.delta.x or 0)
|
||||
local nY = self.trTarget.localPosition.y + (mDrag.EventData.delta.y or 0)
|
||||
nX = clamp(nX, -100, 100)
|
||||
nY = clamp(nY, -100, 100)
|
||||
self.trTarget.localPosition = Vector3(nX, nY, 0)
|
||||
end
|
||||
elseif mDrag.DragEventType == AllEnum.UIDragType.DragEnd then
|
||||
self.bStartDrag = false
|
||||
self.trTarget.localPosition = Vector3(0, 0, 0)
|
||||
if self.tweener then
|
||||
self.tweener:Play()
|
||||
end
|
||||
end
|
||||
end
|
||||
function LiveDiscCtrl:GetCanOpenFullState()
|
||||
return not self.bStartDrag
|
||||
end
|
||||
function LiveDiscCtrl:OnBtnClick_OpenFull()
|
||||
if self.bStartDrag then
|
||||
return
|
||||
end
|
||||
EventManager.Hit("ClickLiveDisc")
|
||||
if self.callback then
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
return LiveDiscCtrl
|
||||
Reference in New Issue
Block a user