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,111 @@
|
||||
local CharPotentialListCtrl = class("CharPotentialListCtrl", BaseCtrl)
|
||||
CharPotentialListCtrl._mapNodeConfig = {
|
||||
txtCharName = {sComponentName = "TMP_Text"},
|
||||
txtHas = {sComponentName = "TMP_Text"},
|
||||
txtAll = {sComponentName = "TMP_Text"},
|
||||
imgHead = {sComponentName = "Image"},
|
||||
imgHeadFrame = {sComponentName = "Image"},
|
||||
PotentialStyle = {nCount = 3},
|
||||
txtPotentialTitle = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
txtPotentialTitle3 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Potential_Build_Common"
|
||||
},
|
||||
rtPotential = {
|
||||
nCount = 3,
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
CharPotentialListCtrl._mapEventConfig = {}
|
||||
CharPotentialListCtrl._mapRedDotConfig = {}
|
||||
function CharPotentialListCtrl:RefreshPotential(nCharId, mapPotential, bShowAll, goPotentialItem, bMaster)
|
||||
self.mapPotential = mapPotential
|
||||
local charCfg = ConfigTable.GetData_Character(nCharId)
|
||||
if nil ~= charCfg then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCharName, charCfg.Name)
|
||||
local nSkinId = PlayerData.Char:GetCharUsedSkinId(nCharId)
|
||||
local skinCfg = ConfigTable.GetData_CharacterSkin(nSkinId)
|
||||
self:SetPngSprite(self._mapNode.imgHead, skinCfg.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[charCfg.Grade]
|
||||
self:SetAtlasSprite(self._mapNode.imgHeadFrame, "12_rare", sFrame)
|
||||
end
|
||||
local tbPotential = mapPotential
|
||||
local tbBuild1 = tbPotential[GameEnum.potentialBuild.PotentialBuild1] or {}
|
||||
local tbBuild2 = tbPotential[GameEnum.potentialBuild.PotentialBuild2] or {}
|
||||
local tbBuildCommon = tbPotential[GameEnum.potentialBuild.PotentialBuildCommon] or {}
|
||||
self._mapNode.PotentialStyle[1]:SetActive(0 < #tbBuild1)
|
||||
self._mapNode.PotentialStyle[2]:SetActive(0 < #tbBuild2)
|
||||
self._mapNode.PotentialStyle[3]:SetActive(0 < #tbBuildCommon)
|
||||
local nAllCount = #tbBuild1 + #tbBuild2 + #tbBuildCommon
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAll, string.format("/%s", nAllCount))
|
||||
self.nHasCount = 0
|
||||
local nPotentialCount = 1
|
||||
local createPotentialItem = function(tbPotential, rtContent)
|
||||
if 0 < #tbPotential then
|
||||
for k, v in ipairs(tbPotential) do
|
||||
if nil == self.tbPotentialItemCtrl[nPotentialCount] then
|
||||
local itemObj = instantiate(goPotentialItem, rtContent)
|
||||
itemObj.gameObject:SetActive(true)
|
||||
local itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.StarTower.Depot.DepotPotentialItemCtrl")
|
||||
itemCtrl:InitItem(v.nId, v.nLevel, v.nPotentialAdd, true)
|
||||
table.insert(self.tbPotentialItemCtrl, itemCtrl)
|
||||
else
|
||||
self.tbPotentialItemCtrl[nPotentialCount]:InitItem(v.nId, v.nLevel, v.nPotentialAdd, true)
|
||||
end
|
||||
self.nHasCount = self.nHasCount + v.nUnlock
|
||||
nPotentialCount = nPotentialCount + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
createPotentialItem(tbBuild1, self._mapNode.rtPotential[1])
|
||||
createPotentialItem(tbBuild2, self._mapNode.rtPotential[2])
|
||||
createPotentialItem(tbBuildCommon, self._mapNode.rtPotential[3])
|
||||
NovaAPI.SetTMPText(self._mapNode.txtHas, self.nHasCount)
|
||||
self:SwitchPotentialAll(bShowAll)
|
||||
self:SetPotentialBuildName(nCharId, bMaster)
|
||||
end
|
||||
function CharPotentialListCtrl:SwitchPotentialAll(bShowAll)
|
||||
local nPotentialIndex = 1
|
||||
for nStyle, tbSubMap in ipairs(self.mapPotential) do
|
||||
local bShowStyle = false
|
||||
for k, v in ipairs(tbSubMap) do
|
||||
if bShowAll then
|
||||
bShowStyle = true
|
||||
self.tbPotentialItemCtrl[nPotentialIndex].gameObject:SetActive(true)
|
||||
else
|
||||
local bShow = v.nUnlock > 0
|
||||
self.tbPotentialItemCtrl[nPotentialIndex].gameObject:SetActive(bShow)
|
||||
if bShow then
|
||||
bShowStyle = true
|
||||
end
|
||||
end
|
||||
nPotentialIndex = nPotentialIndex + 1
|
||||
end
|
||||
self._mapNode.PotentialStyle[nStyle]:SetActive(bShowStyle)
|
||||
end
|
||||
self.gameObject:SetActive(bShowAll or 0 < self.nHasCount)
|
||||
end
|
||||
function CharPotentialListCtrl:SetPotentialBuildName(nCharId, bMaster)
|
||||
local charDescCfg = ConfigTable.GetData("CharacterDes", nCharId)
|
||||
if charDescCfg ~= nil then
|
||||
for i = 1, 2 do
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPotentialTitle[i], bMaster and charDescCfg["PotentialMain" .. i] or charDescCfg["PotentialAssistant" .. i])
|
||||
end
|
||||
end
|
||||
end
|
||||
function CharPotentialListCtrl:Awake()
|
||||
self.tbPotentialItemCtrl = {}
|
||||
self.mapPotential = {}
|
||||
end
|
||||
function CharPotentialListCtrl:OnEnable()
|
||||
end
|
||||
function CharPotentialListCtrl:OnDisable()
|
||||
for nInstanceId, objCtrl in pairs(self.tbPotentialItemCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbPotentialItemCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbPotentialItemCtrl = {}
|
||||
end
|
||||
function CharPotentialListCtrl:OnDestroy()
|
||||
end
|
||||
return CharPotentialListCtrl
|
||||
@@ -0,0 +1,376 @@
|
||||
local DepotCharInfoCtrl = class("DepotCharInfoCtrl", BaseCtrl)
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
local CharacterAttrData = require("GameCore.Data.DataClass.CharacterAttrData")
|
||||
DepotCharInfoCtrl._mapNodeConfig = {
|
||||
goProperty = {
|
||||
nCount = 5,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplatePropertyCtrl"
|
||||
},
|
||||
txtTitleAttr = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Info_Property"
|
||||
},
|
||||
btnChar = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Char"
|
||||
},
|
||||
imgHead = {nCount = 3, sComponentName = "Image"},
|
||||
goSelect = {nCount = 3},
|
||||
txtLeaderCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Leader"
|
||||
},
|
||||
txtSubCn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Sub"
|
||||
},
|
||||
btnPopSkill = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Skill"
|
||||
},
|
||||
btnAttrDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
rtInfo = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateCharInfoCtrl"
|
||||
},
|
||||
txtBtnSkill = {sComponentName = "TMP_Text", sLanguageId = "SkillCn"},
|
||||
rtEquipment = {},
|
||||
txtTitleEquipment = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Info_Equipment"
|
||||
},
|
||||
btnEquipment = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Equipment"
|
||||
},
|
||||
imgEquipment = {nCount = 3, sComponentName = "Image"},
|
||||
goEquipment = {nCount = 3},
|
||||
txtEquipmentLock = {nCount = 3, sComponentName = "TMP_Text"}
|
||||
}
|
||||
DepotCharInfoCtrl._mapEventConfig = {}
|
||||
DepotCharInfoCtrl._mapRedDotConfig = {}
|
||||
function DepotCharInfoCtrl:RefreshCharInfo(tbTeam, mapCharaData)
|
||||
self.tbTeam = tbTeam
|
||||
self.mapCharData = mapCharaData
|
||||
if not self.nCharId then
|
||||
self.nCharId = self.tbTeam[1]
|
||||
self.nSelectIndex = 1
|
||||
end
|
||||
self:RefreshActorId()
|
||||
self:SwitchChar()
|
||||
self:RefreshChoose()
|
||||
end
|
||||
function DepotCharInfoCtrl:SwitchChar()
|
||||
local mapChar = {
|
||||
nLevel = self.mapCharData[self.nCharId].nLevel,
|
||||
nAdvance = self.mapCharData[self.nCharId].nAdvance
|
||||
}
|
||||
local tbEffect = {}
|
||||
for _, v in ipairs(self.mapCharData[self.nCharId].tbAffinityeffectIds) do
|
||||
table.insert(tbEffect, v)
|
||||
end
|
||||
for _, v in ipairs(self.mapCharData[self.nCharId].tbTalentEffect) do
|
||||
table.insert(tbEffect, v)
|
||||
end
|
||||
for _, v in ipairs(self.mapCharData[self.nCharId].tbEquipmentEffect) do
|
||||
table.insert(tbEffect, v)
|
||||
end
|
||||
local tbRandomAttr = self:GetCharEquipmentRandomAttr()
|
||||
if not self.attrData then
|
||||
self.attrData = CharacterAttrData.new(self.nCharId, {
|
||||
mapChar = mapChar,
|
||||
tbEffect = tbEffect,
|
||||
tbRandomAttr = tbRandomAttr
|
||||
})
|
||||
else
|
||||
self.attrData:SetCharacter(self.nCharId, {
|
||||
mapChar = mapChar,
|
||||
tbEffect = tbEffect,
|
||||
tbRandomAttr = tbRandomAttr
|
||||
})
|
||||
end
|
||||
self:RefreshActor2D()
|
||||
self:RefreshAttribute()
|
||||
self:RefreshInfo()
|
||||
end
|
||||
function DepotCharInfoCtrl:GetCharEquipmentRandomAttr()
|
||||
local tbEquipedGem = self.mapCharData[self.nCharId].tbEquipment
|
||||
if not tbEquipedGem or #tbEquipedGem == 0 then
|
||||
return {}
|
||||
end
|
||||
local tbRandomAttrList = {}
|
||||
for _, mapEquipment in pairs(tbEquipedGem) do
|
||||
local mapRandomAttr = mapEquipment:GetRandomAttr()
|
||||
for k, v in ipairs(mapRandomAttr) do
|
||||
local nAttrId = v.AttrId
|
||||
if nAttrId ~= nil then
|
||||
local nCfgValue = v.CfgValue
|
||||
local nValue = v.Value
|
||||
if nil == tbRandomAttrList[nAttrId] then
|
||||
tbRandomAttrList[nAttrId] = {CfgValue = nCfgValue, Value = nValue}
|
||||
else
|
||||
tbRandomAttrList[nAttrId].CfgValue = tbRandomAttrList[nAttrId].CfgValue + nCfgValue
|
||||
tbRandomAttrList[nAttrId].Value = tbRandomAttrList[nAttrId].Value + nValue
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, v in pairs(tbRandomAttrList) do
|
||||
v.CfgValue = clearFloat(v.CfgValue)
|
||||
end
|
||||
return tbRandomAttrList
|
||||
end
|
||||
function DepotCharInfoCtrl:RefreshChoose()
|
||||
for i = 1, 3 do
|
||||
local nCharId = self.tbTeam[i]
|
||||
local charData = self.mapCharData[nCharId]
|
||||
if charData ~= nil then
|
||||
local nCharSkinId = charData.nSkinId
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
self:SetPngSprite(self._mapNode.imgHead[i], mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.L)
|
||||
self._mapNode.goSelect[i]:SetActive(self.nSelectIndex == i)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotCharInfoCtrl:RefreshActor2D()
|
||||
EventManager.Hit("RefreshActor2D_Depot", self.nCharId)
|
||||
end
|
||||
function DepotCharInfoCtrl:RefreshAttribute()
|
||||
local HealthInfo = self.tbActorHealthInfo[self.nCharId]
|
||||
local Info = self.tbActorInfo[self.nCharId]
|
||||
local tbAttr = {}
|
||||
if self.nSelectIndex == 1 then
|
||||
local hp = HealthInfo ~= nil and HealthInfo.hp:AsInt() or 0
|
||||
local hpMax = HealthInfo ~= nil and HealthInfo.hpMax:AsInt() or 0
|
||||
tbAttr = {totalValue = hp, baseValue = hp}
|
||||
self._mapNode.goProperty[1]:SetCharProperty(AllEnum.CharAttr[1], tbAttr, true, hpMax)
|
||||
self._mapNode.goProperty[1].gameObject:SetActive(true)
|
||||
else
|
||||
local hpMax = HealthInfo ~= nil and HealthInfo.hpMax:AsInt() or 0
|
||||
tbAttr = {totalValue = hpMax, baseValue = hpMax}
|
||||
self._mapNode.goProperty[1]:SetCharProperty(AllEnum.CharAttr[1], tbAttr, true)
|
||||
self._mapNode.goProperty[1].gameObject:SetActive(true)
|
||||
end
|
||||
local atk = Info ~= nil and Info.atk:AsInt() or 0
|
||||
tbAttr = {totalValue = atk, baseValue = atk}
|
||||
self._mapNode.goProperty[2]:SetCharProperty(AllEnum.CharAttr[2], tbAttr, true)
|
||||
local def = Info ~= nil and Info.def:AsInt() or 0
|
||||
tbAttr = {totalValue = def, baseValue = def}
|
||||
self._mapNode.goProperty[3]:SetCharProperty(AllEnum.CharAttr[3], tbAttr, true)
|
||||
local critRate = Info ~= nil and Info.critRate:AsFloat() or 0
|
||||
tbAttr = {
|
||||
totalValue = critRate * 100,
|
||||
baseValue = critRate * 100
|
||||
}
|
||||
self._mapNode.goProperty[4]:SetCharProperty(AllEnum.CharAttr[4], tbAttr, false)
|
||||
local critPower = Info ~= nil and Info.critPower:AsFloat() or 0
|
||||
tbAttr = {
|
||||
totalValue = critPower * 100,
|
||||
baseValue = critPower * 100
|
||||
}
|
||||
self._mapNode.goProperty[5]:SetCharProperty(AllEnum.CharAttr[5], tbAttr, false)
|
||||
end
|
||||
function DepotCharInfoCtrl:RefreshActorId()
|
||||
local actorIdCSList = AdventureModuleHelper.GetCurrentGroupPlayers()
|
||||
self.tbActorInfo, self.tbActorHealthInfo, self.tbElementInfo, self.tbSkillCd, self.tbEnergyEfficiency, self.tbEnergyConvRatio = {}, {}, {}, {}, {}, {}
|
||||
for i = 0, actorIdCSList.Count - 1 do
|
||||
local characterId = AdventureModuleHelper.GetCharacterId(actorIdCSList[i])
|
||||
if characterId and 0 < characterId then
|
||||
self.tbActorInfo[characterId] = AdventureModuleHelper.GetEntityInfo(actorIdCSList[i])
|
||||
self.tbActorHealthInfo[characterId] = AdventureModuleHelper.GetEntityHealthInfo(actorIdCSList[i])
|
||||
self.tbElementInfo[characterId] = AdventureModuleHelper.GetEntityElementInfo(actorIdCSList[i])
|
||||
self.tbSkillCd[characterId] = AdventureModuleHelper.GetPlayerSkillCd(actorIdCSList[i])
|
||||
self.tbEnergyEfficiency[characterId] = AdventureModuleHelper.GetPlayerAttributeValue(characterId, GameEnum.playerAttributeType.FRONT_ADD_ENERGY)
|
||||
self.tbEnergyConvRatio[characterId] = AdventureModuleHelper.GetPlayerAttributeValue(characterId, GameEnum.playerAttributeType.ADD_ENERGY)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotCharInfoCtrl:RefreshInfo()
|
||||
local mapCfg = ConfigTable.GetData_Character(self.nCharId)
|
||||
local mapChar = self.mapCharData[self.nCharId]
|
||||
if mapChar ~= nil then
|
||||
self._mapNode.rtInfo:Refresh(mapChar, mapCfg)
|
||||
self:RefreshEquipment(mapChar)
|
||||
end
|
||||
end
|
||||
function DepotCharInfoCtrl:RefreshEquipment(mapChar)
|
||||
self.tbEquipment = clone(mapChar.tbEquipment)
|
||||
local tbSlot = PlayerData.Equipment:GetSlotCfgWithIndex()
|
||||
for i, v in ipairs(tbSlot) do
|
||||
local mapEquipment = mapChar.tbEquipmentSlot[v.nSlotId]
|
||||
local bEmpty = mapEquipment == nil
|
||||
self._mapNode.imgEquipment[i].gameObject:SetActive(not bEmpty)
|
||||
self._mapNode.goEquipment[i].gameObject:SetActive(bEmpty)
|
||||
if bEmpty then
|
||||
if mapChar.nLevel < v.nLevel then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEquipmentLock[i], orderedFormat(ConfigTable.GetUIText("Equipment_SlotActiveLevel"), v.nLevel))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEquipmentLock[i], ConfigTable.GetUIText("CharEquipment_UnEquip"))
|
||||
end
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgEquipment[i], mapEquipment.sIcon)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotCharInfoCtrl:Clear()
|
||||
end
|
||||
function DepotCharInfoCtrl:Awake()
|
||||
self.nCharId = nil
|
||||
self.nSelectIndex = nil
|
||||
end
|
||||
function DepotCharInfoCtrl:OnEnable()
|
||||
end
|
||||
function DepotCharInfoCtrl:OnDisable()
|
||||
end
|
||||
function DepotCharInfoCtrl:OnDestroy()
|
||||
end
|
||||
function DepotCharInfoCtrl:OnBtnClick_Char(btn, nIndex)
|
||||
if nIndex == self.nSelectIndex then
|
||||
return
|
||||
end
|
||||
self._mapNode.goSelect[self.nSelectIndex]:SetActive(false)
|
||||
self._mapNode.goSelect[nIndex]:SetActive(true)
|
||||
self.nCharId = self.tbTeam[nIndex]
|
||||
self.nSelectIndex = nIndex
|
||||
self:SwitchChar()
|
||||
end
|
||||
function DepotCharInfoCtrl:OnBtnClick_Skill(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PopupSkillPanel, self.tbTeam, false, {}, self.mapCharData, self.nCharId)
|
||||
end
|
||||
function DepotCharInfoCtrl:OnBtnClick_Detail()
|
||||
local HealthInfo = self.tbActorHealthInfo[self.nCharId]
|
||||
local Info = self.tbActorInfo[self.nCharId]
|
||||
local ElementInfo = self.tbElementInfo[self.nCharId]
|
||||
local SkillCd = self.tbSkillCd[self.nCharId]
|
||||
local EnergyEfficiency = self.tbEnergyEfficiency[self.nCharId]
|
||||
local EnergyConvRatio = self.tbEnergyConvRatio[self.nCharId]
|
||||
local attrList = self.attrData:GetAttrList()
|
||||
for k, v in pairs(AllEnum.CharAttr) do
|
||||
local total, base
|
||||
if v.sKey == "Hp" then
|
||||
total = HealthInfo ~= nil and HealthInfo.hpMax:AsInt() or 0
|
||||
elseif v.sKey == "Atk" then
|
||||
total = Info ~= nil and Info.atk:AsInt() or 0
|
||||
elseif v.sKey == "Def" then
|
||||
total = Info ~= nil and Info.def:AsInt() or 0
|
||||
elseif v.sKey == "CritRate" then
|
||||
total = Info ~= nil and Info.critRate:AsFloat() or 0
|
||||
total = total * 100
|
||||
elseif v.sKey == "CritPower" then
|
||||
total = Info ~= nil and Info.critPower:AsFloat() or 0
|
||||
total = total * 100
|
||||
elseif v.sKey == "Suppress" then
|
||||
total = Info ~= nil and Info.suppressRatio:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "UltraEnergy" then
|
||||
total = SkillCd and SkillCd:GetTotalEnergy() or 0
|
||||
base = total
|
||||
elseif v.sKey == "EnergyEfficiency" then
|
||||
total = EnergyEfficiency
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "EnergyConvRatio" then
|
||||
total = EnergyConvRatio
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "DefPierce" then
|
||||
total = Info ~= nil and Info.defPenetrate:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "DefIgnore" then
|
||||
total = Info ~= nil and Info.defIgnore:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "WEE" then
|
||||
total = ElementInfo ~= nil and ElementInfo.WEE:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "WEP" then
|
||||
total = ElementInfo ~= nil and ElementInfo.WEP:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "WEI" then
|
||||
total = ElementInfo ~= nil and ElementInfo.WEI:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "FEE" then
|
||||
total = ElementInfo ~= nil and ElementInfo.FEE:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "FEP" then
|
||||
total = ElementInfo ~= nil and ElementInfo.FEP:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "FEI" then
|
||||
total = ElementInfo ~= nil and ElementInfo.FEI:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "SEE" then
|
||||
total = ElementInfo ~= nil and ElementInfo.SEE:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "SEP" then
|
||||
total = ElementInfo ~= nil and ElementInfo.SEP:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "SEI" then
|
||||
total = ElementInfo ~= nil and ElementInfo.SEI:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "AEE" then
|
||||
total = ElementInfo ~= nil and ElementInfo.AEE:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "AEP" then
|
||||
total = ElementInfo ~= nil and ElementInfo.AEP:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "AEI" then
|
||||
total = ElementInfo ~= nil and ElementInfo.AEI:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "LEE" then
|
||||
total = ElementInfo ~= nil and ElementInfo.LEE:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "LEP" then
|
||||
total = ElementInfo ~= nil and ElementInfo.LEP:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "LEI" then
|
||||
total = ElementInfo ~= nil and ElementInfo.LEI:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "DEE" then
|
||||
total = ElementInfo ~= nil and ElementInfo.DEE:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "DEP" then
|
||||
total = ElementInfo ~= nil and ElementInfo.DEP:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "DEI" then
|
||||
total = ElementInfo ~= nil and ElementInfo.DEI:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
end
|
||||
if total then
|
||||
attrList[k].totalValue = total
|
||||
end
|
||||
if base then
|
||||
attrList[k].baseValue = base
|
||||
end
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData_Character(self.nCharId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharAttrDetail, attrList, mapCfg.EET)
|
||||
end
|
||||
function DepotCharInfoCtrl:OnBtnClick_Equipment(btn)
|
||||
if next(self.tbEquipment) == nil then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_CharEquipNone"))
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EquipmentAttrPreview, self.nCharId, self.tbEquipment)
|
||||
end
|
||||
end
|
||||
return DepotCharInfoCtrl
|
||||
@@ -0,0 +1,88 @@
|
||||
local DepotDiscCommonSkillCtrl = class("DepotDiscCommonSkillCtrl", BaseCtrl)
|
||||
DepotDiscCommonSkillCtrl._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"
|
||||
}
|
||||
}
|
||||
DepotDiscCommonSkillCtrl._mapEventConfig = {}
|
||||
function DepotDiscCommonSkillCtrl: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 DepotDiscCommonSkillCtrl: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 DepotDiscCommonSkillCtrl:OnBtnClick_Prev()
|
||||
if self.nLayer == 1 then
|
||||
return
|
||||
end
|
||||
self.nLayer = self.nLayer - 1
|
||||
self:RefreshSkill()
|
||||
end
|
||||
function DepotDiscCommonSkillCtrl:OnBtnClick_Next()
|
||||
if self.nLayer == self.nMaxLayer then
|
||||
return
|
||||
end
|
||||
self.nLayer = self.nLayer + 1
|
||||
self:RefreshSkill()
|
||||
end
|
||||
function DepotDiscCommonSkillCtrl:OnLinkClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
return DepotDiscCommonSkillCtrl
|
||||
@@ -0,0 +1,49 @@
|
||||
local DepotDiscCoreSkillCtrl = class("DepotDiscCoreSkillCtrl", BaseCtrl)
|
||||
DepotDiscCoreSkillCtrl._mapNodeConfig = {
|
||||
txtSkillName = {sComponentName = "TMP_Text"},
|
||||
imgSkillIcon = {sComponentName = "Image"},
|
||||
imgSkillIconBg = {sComponentName = "Image"},
|
||||
NoteLayer = {
|
||||
nCount = 5,
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscNoteLayerCtrl"
|
||||
},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtNoteTip = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
DepotDiscCoreSkillCtrl._mapEventConfig = {}
|
||||
function DepotDiscCoreSkillCtrl: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_LevelLong"), 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, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
return DepotDiscCoreSkillCtrl
|
||||
@@ -0,0 +1,190 @@
|
||||
local DepotDiscInfoCtrl = class("DepotDiscInfoCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
DepotDiscInfoCtrl._mapNodeConfig = {
|
||||
goBlur = {},
|
||||
btnBlur = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
goWindow = {},
|
||||
animWindow = {sNodeName = "goWindow", sComponentName = "Animator"},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Disc_Info_Title"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
goDiscItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscItemCtrl"
|
||||
},
|
||||
txtDiscName = {sComponentName = "TMP_Text"},
|
||||
txtDiscLevel = {sComponentName = "TMP_Text"},
|
||||
goDiscStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
txtPropertyTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Disc_Property_Title"
|
||||
},
|
||||
goProperty = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplatePropertyCtrl"
|
||||
},
|
||||
imgDiscEET = {sComponentName = "Image"},
|
||||
imgTag = {nCount = 3},
|
||||
txtTag = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
rtTogTab = {
|
||||
sNodeName = "goTab",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateTogTabCtrl"
|
||||
},
|
||||
btnLeft = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_left"
|
||||
},
|
||||
btnRight = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_right"
|
||||
},
|
||||
goPassiveSkill = {
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscCoreSkillCtrl"
|
||||
},
|
||||
goCommonSkill = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscCommonSkillCtrl"
|
||||
},
|
||||
goCommonNone = {nCount = 2},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
},
|
||||
btnShortcutClose = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
}
|
||||
}
|
||||
DepotDiscInfoCtrl._mapEventConfig = {}
|
||||
DepotDiscInfoCtrl._mapRedDotConfig = {}
|
||||
local skill_Tab_type = {passive = 1, common = 2}
|
||||
function DepotDiscInfoCtrl:RefreshDiscInfo(discData)
|
||||
self._mapNode.goDiscItem:Refresh(discData.nId)
|
||||
self.mapDisc = discData
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDiscName, self.mapDisc.sName)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDiscLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Disc_Info_Level"), self.mapDisc.nLevel))
|
||||
self._mapNode.goDiscStar:SetStar(self.mapDisc.nStar, self.mapDisc.nMaxStar)
|
||||
self._mapNode.goPassiveSkill:Refresh(self.mapDisc.nPassiveSkillId, false, self.tbNoteList)
|
||||
local tbCommonSkillId = self.mapDisc.tbCommonSkillId
|
||||
for i = 1, 2 do
|
||||
if tbCommonSkillId[i] then
|
||||
self._mapNode.goCommonSkill[i].gameObject:SetActive(true)
|
||||
local nCurLayer
|
||||
local mapCommonCfg = ConfigTable.GetData("DiscCommonSkill", tbCommonSkillId[i])
|
||||
if mapCommonCfg then
|
||||
nCurLayer = discData:GetCommonLayer(self.tbNoteList, mapCommonCfg)
|
||||
end
|
||||
nCurLayer = nCurLayer == 0 and 1 or nCurLayer
|
||||
self._mapNode.goCommonSkill[i]:Refresh(tbCommonSkillId[i], nCurLayer)
|
||||
self._mapNode.goCommonNone[i]:SetActive(false)
|
||||
else
|
||||
self._mapNode.goCommonSkill[i].gameObject:SetActive(false)
|
||||
self._mapNode.goCommonNone[i]:SetActive(true)
|
||||
end
|
||||
end
|
||||
local tbAttr = self.mapDisc.mapAttrBase
|
||||
local i = 1
|
||||
for _, mapAttachAttr in pairs(AllEnum.AttachAttr) do
|
||||
local mapAttr = tbAttr[mapAttachAttr.sKey]
|
||||
if 0 < mapAttr.Value then
|
||||
self._mapNode.goProperty[i]:SetItemProperty(mapAttr.Key, mapAttr.Value, nil, true)
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData("Disc", discData.nId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
local sName = AllEnum.ElementIconType.Icon .. mapCfg.EET
|
||||
self:SetAtlasSprite(self._mapNode.imgDiscEET, "12_rare", sName)
|
||||
for j = 1, 3 do
|
||||
local nTag = self.mapDisc.tbTag[j]
|
||||
if nTag then
|
||||
self._mapNode.imgTag[j]:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTag[j], ConfigTable.GetData("DiscTag", nTag).Title)
|
||||
else
|
||||
self._mapNode.imgTag[j]:SetActive(false)
|
||||
end
|
||||
end
|
||||
self:SwitchTog()
|
||||
end
|
||||
function DepotDiscInfoCtrl:SwitchTog()
|
||||
self._mapNode.rtTogTab:SetState(self.nSkillType == skill_Tab_type.common)
|
||||
if self.nSkillType == skill_Tab_type.passive then
|
||||
for i = 1, 2 do
|
||||
self._mapNode.goCommonSkill[i].gameObject:SetActive(false)
|
||||
self._mapNode.goCommonNone[i]:SetActive(false)
|
||||
end
|
||||
self._mapNode.goPassiveSkill.gameObject:SetActive(self.mapDisc.nPassiveSkillId)
|
||||
else
|
||||
self._mapNode.goPassiveSkill.gameObject:SetActive(false)
|
||||
local tbCommonSkillId = self.mapDisc.tbCommonSkillId
|
||||
for i = 1, 2 do
|
||||
self._mapNode.goCommonSkill[i].gameObject:SetActive(tbCommonSkillId[i])
|
||||
self._mapNode.goCommonNone[i]:SetActive(not tbCommonSkillId[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotDiscInfoCtrl:OpenDiscInfo(discData, tbNoteList)
|
||||
if GamepadUIManager.GetInputState() then
|
||||
GamepadUIManager.EnableGamepadUI("DepotDiscInfoCtrl", self:GetGamepadUINode(), nil, true)
|
||||
end
|
||||
self.tbNoteList = tbNoteList
|
||||
self.nSkillType = skill_Tab_type.passive
|
||||
self._mapNode.goWindow.gameObject:SetActive(false)
|
||||
self._mapNode.goBlur.gameObject:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goWindow.gameObject:SetActive(true)
|
||||
self._mapNode.animWindow:Play("t_window_04_t_in")
|
||||
self:RefreshDiscInfo(discData)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function DepotDiscInfoCtrl:Awake()
|
||||
self._mapNode.goBlur.gameObject:SetActive(false)
|
||||
self._mapNode.goWindow.gameObject:SetActive(false)
|
||||
self._mapNode.rtTogTab:SetText(ConfigTable.GetUIText("StarTower_Disc_Common_Skill"), ConfigTable.GetUIText("StarTower_Disc_Passive_Skill"))
|
||||
self._mapNode.btnShortcutClose.gameObject:SetActive(GamepadUIManager.GetInputState())
|
||||
if GamepadUIManager.GetInputState() then
|
||||
local tbConfig = {
|
||||
{
|
||||
sAction = "Back",
|
||||
sLang = "ActionBar_Back"
|
||||
}
|
||||
}
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
end
|
||||
function DepotDiscInfoCtrl:OnBtnClick_left()
|
||||
self.nSkillType = skill_Tab_type.passive
|
||||
self:SwitchTog()
|
||||
end
|
||||
function DepotDiscInfoCtrl:OnBtnClick_right()
|
||||
self.nSkillType = skill_Tab_type.common
|
||||
self:SwitchTog()
|
||||
end
|
||||
function DepotDiscInfoCtrl:OnBtnClick_Close()
|
||||
self._mapNode.goBlur.gameObject:SetActive(false)
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.animWindow, {
|
||||
"t_window_04_t_out"
|
||||
})
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
self._mapNode.animWindow:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
self._mapNode.goWindow.gameObject:SetActive(false)
|
||||
if GamepadUIManager.GetInputState() then
|
||||
GamepadUIManager.DisableGamepadUI("DepotDiscInfoCtrl")
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
return DepotDiscInfoCtrl
|
||||
@@ -0,0 +1,38 @@
|
||||
local DepotDiscMainSkillItemCtrl = class("DepotDiscMainSkillItemCtrl", BaseCtrl)
|
||||
DepotDiscMainSkillItemCtrl._mapNodeConfig = {
|
||||
btnItem = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
imgRareBg = {sComponentName = "Image"},
|
||||
imgIconBg = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
goStar = {sComponentName = "Image"},
|
||||
txtDiscSkillName = {sComponentName = "TMP_Text"},
|
||||
imgChoose = {}
|
||||
}
|
||||
DepotDiscMainSkillItemCtrl._mapEventConfig = {
|
||||
SelectDepotDiscSkill = "OnEvent_SelectDepotDiscSkill"
|
||||
}
|
||||
DepotDiscMainSkillItemCtrl._mapRedDotConfig = {}
|
||||
function DepotDiscMainSkillItemCtrl:Refresh(nSkillId, nRarity, nDiscId, nStar)
|
||||
self.nSkillId = nSkillId
|
||||
self.nDiscId = nDiscId
|
||||
local mainSkillCfg = ConfigTable.GetData("MainSkill", nSkillId)
|
||||
if mainSkillCfg == nil then
|
||||
return
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgIconBg, mainSkillCfg.IconBg)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mainSkillCfg.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDiscSkillName, mainSkillCfg.Name)
|
||||
self:SetAtlasSprite(self._mapNode.imgRareBg, "12_rare", AllEnum.FrameType_New.HarmonySkillS .. AllEnum.FrameColor_New[nRarity])
|
||||
self:SetAtlasSprite(self._mapNode.goStar, "12_rare", AllEnum.FrameType_New.DiscLimitS .. AllEnum.FrameColor_New[nRarity] .. "_0" .. nStar + 1)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.goStar)
|
||||
end
|
||||
function DepotDiscMainSkillItemCtrl:OnBtnClick_Item()
|
||||
EventManager.Hit("SelectDepotDiscSkill", self.nDiscId, self.nSkillId)
|
||||
end
|
||||
function DepotDiscMainSkillItemCtrl:OnEvent_SelectDepotDiscSkill(nDiscId, nMainSkillId, nSubSkillId, _)
|
||||
self._mapNode.imgChoose:SetActive(self.nSkillId and self.nSkillId == nMainSkillId)
|
||||
end
|
||||
return DepotDiscMainSkillItemCtrl
|
||||
@@ -0,0 +1,40 @@
|
||||
local DepotDiscNoteLayerCtrl = class("DepotDiscNoteLayerCtrl", BaseCtrl)
|
||||
DepotDiscNoteLayerCtrl._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"
|
||||
},
|
||||
canvasGroupBg = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "CanvasGroup"
|
||||
}
|
||||
}
|
||||
DepotDiscNoteLayerCtrl._mapEventConfig = {}
|
||||
function DepotDiscNoteLayerCtrl:Refresh(tbNoteId, nNoteCount, sDesc, nLayer, bLast, bUnLock)
|
||||
self._mapNode.goNote:SetNoteItem(tbNoteId, nNoteCount, not bUnLock)
|
||||
sDesc = sDesc or ""
|
||||
if bUnLock then
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroupBg, 1)
|
||||
else
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroupBg, 0.4)
|
||||
sDesc = sDesc .. ConfigTable.GetUIText("StarTower_Disc_Skill_Lock")
|
||||
end
|
||||
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 DepotDiscNoteLayerCtrl:OnLinkClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
return DepotDiscNoteLayerCtrl
|
||||
@@ -0,0 +1,153 @@
|
||||
local DepotDiscSkillCtrl = class("DepotDiscSkillCtrl", BaseCtrl)
|
||||
DepotDiscSkillCtrl._mapNodeConfig = {
|
||||
imgNote = {nCount = 9, sComponentName = "Image"},
|
||||
txtNoteCount = {nCount = 9, sComponentName = "TMP_Text"},
|
||||
btnNoteDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NoteDetail"
|
||||
},
|
||||
goNoteListBtn = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NoteDetail"
|
||||
},
|
||||
btnDiscDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DiscDetail"
|
||||
},
|
||||
txtDiscDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Depot_DiscSkillInfo"
|
||||
},
|
||||
txtMainSkillTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_MainSkill_Title"
|
||||
},
|
||||
txtMainSubSkillTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_MainSkill_TitleTip"
|
||||
},
|
||||
txtHarmonySkillTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_SubSkill_Title"
|
||||
},
|
||||
txtHarmonySkillSubTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_SubSkill_TitleTip"
|
||||
},
|
||||
DiscSkillDepotItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscMainSkillItemCtrl"
|
||||
},
|
||||
goDiscSkillItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscSkillCardCtrl"
|
||||
},
|
||||
goHarmonyGrid = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
HarmonySkillDepotItem = {},
|
||||
svDiscSkill = {sComponentName = "ScrollRect"}
|
||||
}
|
||||
DepotDiscSkillCtrl._mapEventConfig = {
|
||||
SelectDepotDiscSkill = "OnEvent_SelectDepotDiscSkill"
|
||||
}
|
||||
function DepotDiscSkillCtrl:RefreshDiscSkill(mapNote, tbActiveSecondaryIds)
|
||||
local tbDisc = {}
|
||||
local tbSkillIds = {}
|
||||
self.tbMapNote = mapNote
|
||||
if nil == self._panel.tbDisc then
|
||||
return
|
||||
end
|
||||
for i = 1, 9 do
|
||||
self._mapNode.imgNote[i].gameObject:SetActive(false)
|
||||
end
|
||||
for nIdx, nNoteId in ipairs(self._panel.tbShowNote) do
|
||||
if nIdx <= #self._mapNode.imgNote then
|
||||
self._mapNode.imgNote[nIdx].gameObject:SetActive(true)
|
||||
local nNoteId = tonumber(nNoteId)
|
||||
local nNoteCount = mapNote[nNoteId] == nil and 0 or mapNote[nNoteId]
|
||||
local noteCfg = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
self:SetPngSprite(self._mapNode.imgNote[nIdx], noteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteCount[nIdx], nNoteCount)
|
||||
end
|
||||
end
|
||||
local nSubSkillCount = 0
|
||||
local nSortingOrder = self._panel._nIndex * 100 + 99
|
||||
for j = 1, 3 do
|
||||
local nDiscId = self._panel.tbDisc[j]
|
||||
local discData = self._panel.mapDiscData[nDiscId]
|
||||
table.insert(tbDisc, nDiscId)
|
||||
if discData ~= nil then
|
||||
table.insert(tbSkillIds, discData.nMainSkillId)
|
||||
self._mapNode.DiscSkillDepotItem[j]:Refresh(discData.nMainSkillId, discData.nRarity, nDiscId, discData.nStar)
|
||||
local tbSubSkill = discData:GetAllSubSkill(mapNote)
|
||||
for i = nSubSkillCount + 1, nSubSkillCount + #tbSubSkill do
|
||||
local nSkillId = tbSubSkill[i - nSubSkillCount]
|
||||
if nil == self.tbHarmonySkillDepotItemCtrl[i] then
|
||||
local itemObj = instantiate(self._mapNode.HarmonySkillDepotItem, self._mapNode.goHarmonyGrid)
|
||||
itemObj.gameObject:SetActive(true)
|
||||
local itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.StarTower.Depot.DepotDiscSubSkillItemCtrl")
|
||||
table.insert(self.tbHarmonySkillDepotItemCtrl, itemCtrl)
|
||||
end
|
||||
if nSkillId ~= nil then
|
||||
local mapCfg = ConfigTable.GetData("SecondarySkill", nSkillId)
|
||||
if mapCfg ~= nil and nil ~= self.tbHarmonySkillDepotItemCtrl[i] then
|
||||
self.tbHarmonySkillDepotItemCtrl[i]:SetItem(nSkillId, nDiscId, mapNote, nSortingOrder)
|
||||
elseif nil ~= self.tbHarmonySkillDepotItemCtrl[i] then
|
||||
self.tbHarmonySkillDepotItemCtrl[i]:SetItem(nil)
|
||||
end
|
||||
elseif nil ~= self.tbHarmonySkillDepotItemCtrl[i] then
|
||||
self.tbHarmonySkillDepotItemCtrl[i]:SetItem(nil)
|
||||
end
|
||||
end
|
||||
nSubSkillCount = nSubSkillCount + #tbSubSkill
|
||||
end
|
||||
end
|
||||
if nSubSkillCount < 6 then
|
||||
for i = nSubSkillCount + 1, 6 do
|
||||
if nil == self.tbHarmonySkillDepotItemCtrl[i] then
|
||||
local itemObj = instantiate(self._mapNode.HarmonySkillDepotItem, self._mapNode.goHarmonyGrid)
|
||||
itemObj.gameObject:SetActive(true)
|
||||
local itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.StarTower.Depot.DepotDiscSubSkillItemCtrl")
|
||||
table.insert(self.tbHarmonySkillDepotItemCtrl, itemCtrl)
|
||||
end
|
||||
self.tbHarmonySkillDepotItemCtrl[i]:SetItem(nil)
|
||||
end
|
||||
end
|
||||
NovaAPI.SetScrollRectVertical(self._mapNode.svDiscSkill, #self.tbHarmonySkillDepotItemCtrl > 6)
|
||||
if PlayerData.Guide:GetGuideState() then
|
||||
EventManager.Hit("Guide_StarTowerDepotDisc", 0 < nSubSkillCount)
|
||||
end
|
||||
if 0 < #tbDisc and 0 < #tbSkillIds then
|
||||
EventManager.Hit("SelectDepotDiscSkill", tbDisc[1], tbSkillIds[1], nil, false)
|
||||
end
|
||||
end
|
||||
function DepotDiscSkillCtrl:Awake()
|
||||
self.tbHarmonySkillDepotItemCtrl = {}
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnEnable()
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnDisable()
|
||||
for i, v in pairs(self.tbHarmonySkillDepotItemCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
self.tbHarmonySkillDepotItemCtrl[i] = nil
|
||||
end
|
||||
self.tbHarmonySkillDepotItemCtrl = {}
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnDestroy()
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnRelease()
|
||||
end
|
||||
function DepotDiscSkillCtrl:Clear()
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnBtnClick_NoteDetail()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.NoteSkillInfo, self.tbMapNote)
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnEvent_SelectDepotDiscSkill(nDiscId, nMainSkillId, nSubSkillId)
|
||||
local discData = self._panel.mapDiscData[nDiscId]
|
||||
self._mapNode.goDiscSkillItem:Refresh(nDiscId, nMainSkillId, nSubSkillId, discData.nStar)
|
||||
self._mapNode.goDiscSkillItem:ChangeWordRaycast(true)
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnBtnClick_DiscDetail()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSkill, self._panel.tbDisc, self.tbMapNote, self._panel.mapDiscData)
|
||||
end
|
||||
return DepotDiscSkillCtrl
|
||||
@@ -0,0 +1,120 @@
|
||||
local DepotDiscSkillInfoCtrl = class("DepotDiscSkillInfoCtrl", BaseCtrl)
|
||||
DepotDiscSkillInfoCtrl._mapNodeConfig = {
|
||||
canvasGroupInfo = {
|
||||
sNodeName = "goInfo",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtLevelMax = {sComponentName = "TMP_Text"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
NoteLayer = {
|
||||
nCount = 5,
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscNoteLayerCtrl"
|
||||
},
|
||||
CommonSkill = {
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscNoteLayerCtrl"
|
||||
},
|
||||
svLevel = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
imgLock = {}
|
||||
}
|
||||
DepotDiscSkillInfoCtrl._mapEventConfig = {}
|
||||
DepotDiscSkillInfoCtrl._mapRedDotConfig = {}
|
||||
function DepotDiscSkillInfoCtrl:InitNoteSkill(tbSkill)
|
||||
if tbSkill.nType == AllEnum.DiscSkillType.Common then
|
||||
self:InitCommonSkill(tbSkill)
|
||||
else
|
||||
self:InitPassiveSkill(tbSkill)
|
||||
end
|
||||
end
|
||||
function DepotDiscSkillInfoCtrl:InitCommonSkill(mapSkill)
|
||||
self._mapNode.CommonSkill.gameObject:SetActive(true)
|
||||
self._mapNode.txtLevelMax.gameObject:SetActive(false)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(false)
|
||||
for _, v in ipairs(self._mapNode.NoteLayer) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
self.mapCommonCfg = ConfigTable.GetData("DiscCommonSkill", mapSkill.nId)
|
||||
if not self.mapCommonCfg then
|
||||
return
|
||||
end
|
||||
self.nCommonLayer = mapSkill.nLevel
|
||||
local bUnlock = self.nCommonLayer > 0
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, self.mapCommonCfg.Name)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, self.mapCommonCfg.Icon)
|
||||
local nMaxLayer = #self.mapCommonCfg.ActiveNoteNum
|
||||
if 0 < nMaxLayer then
|
||||
self._mapNode.svLevel.gameObject:SetActive(true)
|
||||
self._mapNode.svLevel:Init(nMaxLayer, self, self.OnGridRefresh, self.OnGridBtnClick)
|
||||
self:RefreshCommonSkill()
|
||||
else
|
||||
self._mapNode.svLevel.gameObject:SetActive(false)
|
||||
end
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroupInfo, bUnlock and 1 or 0.35)
|
||||
end
|
||||
function DepotDiscSkillInfoCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local txtNoteLayer = goGrid.transform:Find("btnLevel/AnimRoot/txtNoteLayer"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtNoteLayer, nIndex)
|
||||
end
|
||||
function DepotDiscSkillInfoCtrl:OnGridBtnClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
if nIndex == self.nCommonLayer then
|
||||
return
|
||||
end
|
||||
self.nCommonLayer = nIndex
|
||||
self:RefreshCommonSkill()
|
||||
end
|
||||
function DepotDiscSkillInfoCtrl:RefreshCommonSkill()
|
||||
local sDesc = UTILS.ParseDiscDesc(self.mapCommonCfg.Desc, self.mapCommonCfg, nil, self.nCommonLayer)
|
||||
local tbNote = {}
|
||||
for _, v in pairs(self.mapCommonCfg.ActiveNoteType) do
|
||||
tbNote[v] = self.mapCommonCfg.ActiveNoteNum[self.nCommonLayer]
|
||||
end
|
||||
self._mapNode.CommonSkill:Refresh(nil, tbNote, sDesc, self.nCommonLayer > 0)
|
||||
end
|
||||
function DepotDiscSkillInfoCtrl:InitPassiveSkill(mapSkill)
|
||||
self._mapNode.CommonSkill.gameObject:SetActive(false)
|
||||
local skillCfg = ConfigTable.GetData("DiscPassiveSkill", mapSkill.nId)
|
||||
if not skillCfg then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, skillCfg.Name)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, skillCfg.Icon)
|
||||
local nCurActiveLayer = mapSkill.nLevel
|
||||
local nMaxLayer = 0
|
||||
for i = 1, 5 do
|
||||
local bHasLayer = skillCfg["ActiveParam" .. i] and skillCfg["ActiveParam" .. i] ~= ""
|
||||
self._mapNode.NoteLayer[i].gameObject:SetActive(bHasLayer)
|
||||
if bHasLayer then
|
||||
if nMaxLayer == 0 then
|
||||
local bLastlayer = skillCfg["ActiveParam" .. i + 1] == nil or skillCfg["ActiveParam" .. i + 1] == ""
|
||||
if bLastlayer then
|
||||
nMaxLayer = i
|
||||
end
|
||||
end
|
||||
local sDesc = UTILS.ParseDiscDesc(skillCfg["Desc" .. i], skillCfg)
|
||||
local tbLayerNote = decodeJson(skillCfg["ActiveParam" .. i])
|
||||
local tbNote = {}
|
||||
for k, v in pairs(tbLayerNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nNoteCount = tonumber(v)
|
||||
if nNoteId then
|
||||
tbNote[nNoteId] = nNoteCount
|
||||
end
|
||||
end
|
||||
self._mapNode.NoteLayer[i]:Refresh(i, tbNote, sDesc, i <= nCurActiveLayer)
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_Lv"), nCurActiveLayer, nMaxLayer))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelMax, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_MaxLv"), nCurActiveLayer, nMaxLayer))
|
||||
local bUnlock = 0 < nCurActiveLayer
|
||||
local bMaxLv = nCurActiveLayer == nMaxLayer
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroupInfo, bUnlock and 1 or 0.4)
|
||||
self._mapNode.imgLock.gameObject:SetActive(not bUnlock)
|
||||
self._mapNode.txtLevelMax.gameObject:SetActive(bMaxLv)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(not bMaxLv)
|
||||
end
|
||||
return DepotDiscSkillInfoCtrl
|
||||
@@ -0,0 +1,137 @@
|
||||
local DepotDiscSkillItemCtrl = class("DepotDiscSkillItemCtrl", BaseCtrl)
|
||||
DepotDiscSkillItemCtrl._mapNodeConfig = {
|
||||
imgNone = {},
|
||||
goInfo = {},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgIconBg = {sComponentName = "Image"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtLevelMax = {sComponentName = "TMP_Text"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
goNote = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscMultiNoteCtrl"
|
||||
},
|
||||
imgLock = {},
|
||||
imgChoose = {}
|
||||
}
|
||||
DepotDiscSkillItemCtrl._mapEventConfig = {}
|
||||
DepotDiscSkillItemCtrl._mapRedDotConfig = {}
|
||||
function DepotDiscSkillItemCtrl:SetNone()
|
||||
self._mapNode.imgNone:SetActive(true)
|
||||
self._mapNode.goInfo:SetActive(false)
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:SetSkillInfo(skillCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, skillCfg.Name)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, skillCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.imgIconBg, skillCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:InitDiscSkill(mapSkill)
|
||||
self._mapNode.imgNone:SetActive(false)
|
||||
self._mapNode.goInfo:SetActive(true)
|
||||
if mapSkill.nType == AllEnum.DiscSkillType.Common then
|
||||
self:InitDiscCommonSkill(mapSkill)
|
||||
else
|
||||
self:InitDiscPassiveSkill(mapSkill)
|
||||
end
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:InitDiscCommonSkill(mapSkill)
|
||||
self._mapNode.imgChoose.gameObject:SetActive(false)
|
||||
local skillCfg = ConfigTable.GetData("DiscCommonSkill", mapSkill.nId)
|
||||
if skillCfg == nil then
|
||||
return
|
||||
end
|
||||
self:SetSkillInfo(skillCfg)
|
||||
local nLevel = mapSkill.nLevel
|
||||
local nMaxLevel = mapSkill.nMaxLevel
|
||||
local bMaxLv = nMaxLevel == nLevel
|
||||
self._mapNode.txtLevelMax.gameObject:SetActive(bMaxLv)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(not bMaxLv)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_Lv"), nLevel, nMaxLevel))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelMax, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_MaxLv"), nLevel, nMaxLevel))
|
||||
local bUnlock = mapSkill.nLevel > 0
|
||||
self._mapNode.imgLock.gameObject:SetActive(not bUnlock)
|
||||
local nLayer = nLevel == 0 and 1 or nLevel
|
||||
self._mapNode.goNote:SetNoteItem(skillCfg.ActiveNoteType, skillCfg.ActiveNoteNum[nLayer])
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:InitDiscPassiveSkill(mapSkill)
|
||||
self._mapNode.imgChoose.gameObject:SetActive(false)
|
||||
local skillCfg = ConfigTable.GetData("DiscPassiveSkill", mapSkill.nId)
|
||||
if skillCfg == nil then
|
||||
return
|
||||
end
|
||||
self:SetSkillInfo(skillCfg)
|
||||
local nLevel = mapSkill.nLevel
|
||||
local nMaxLevel = mapSkill.nMaxLevel
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_Lv"), nLevel, nMaxLevel))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelMax, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_MaxLv"), nLevel, nMaxLevel))
|
||||
local bUnlock = 0 < nLevel
|
||||
local bMaxLv = nLevel == nMaxLevel
|
||||
self._mapNode.imgLock.gameObject:SetActive(not bUnlock)
|
||||
self._mapNode.txtLevelMax.gameObject:SetActive(bMaxLv)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(not bMaxLv)
|
||||
local nLayer = nLevel == 0 and 1 or nLevel
|
||||
local tbLayerNote = decodeJson(skillCfg["ActiveParam" .. nLayer])
|
||||
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.goNote:SetNoteItem(tbNoteId, nNoteCount)
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:SetSelect(bSelect)
|
||||
self._mapNode.imgChoose.gameObject:SetActive(bSelect)
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:InitDiscSkillTips(tbSkill)
|
||||
if tbSkill.nType == AllEnum.DiscSkillType.Common then
|
||||
self:InitDiscCommonSkillTip(tbSkill)
|
||||
else
|
||||
self:InitDiscPassiveSkillTip(tbSkill)
|
||||
end
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:InitDiscCommonSkillTip(tbSkill)
|
||||
local skillCfg = ConfigTable.GetData("DiscCommonSkill", tbSkill.nId)
|
||||
if skillCfg == nil then
|
||||
return
|
||||
end
|
||||
self:SetSkillInfo(skillCfg)
|
||||
local nLevel = tbSkill.nLevel
|
||||
local bMaxLv = tbSkill.nMaxLevel == nLevel
|
||||
self._mapNode.txtLevelMax.gameObject:SetActive(bMaxLv)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(not bMaxLv)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_Lv"), nLevel, tbSkill.nMaxLevel))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelMax, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_MaxLv"), nLevel, tbSkill.nMaxLevel))
|
||||
local nLayer = nLevel == 0 and 1 or nLevel
|
||||
self._mapNode.goNote:SetNoteItem(skillCfg.ActiveNoteType, skillCfg.ActiveNoteNum[nLayer])
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:InitDiscPassiveSkillTip(mapSkill)
|
||||
local skillCfg = ConfigTable.GetData("DiscPassiveSkill", mapSkill.nId)
|
||||
if skillCfg == nil then
|
||||
return
|
||||
end
|
||||
self:SetSkillInfo(skillCfg)
|
||||
local nLevel = mapSkill.nLevel
|
||||
local nMaxLevel = mapSkill.nMaxLevel
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_Lv"), nLevel, nMaxLevel))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelMax, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_MaxLv"), nLevel, nMaxLevel))
|
||||
local bMaxLv = nLevel == nMaxLevel
|
||||
self._mapNode.txtLevelMax.gameObject:SetActive(bMaxLv)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(not bMaxLv)
|
||||
local nLayer = nLevel == 0 and 1 or nLevel
|
||||
local tbLayerNote = decodeJson(skillCfg["ActiveParam" .. nLayer])
|
||||
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.goNote:SetNoteItem(tbNoteId, nNoteCount)
|
||||
end
|
||||
return DepotDiscSkillItemCtrl
|
||||
@@ -0,0 +1,109 @@
|
||||
local DepotDiscSubSkillItem = class("DepotDiscSubSkillItem", BaseCtrl)
|
||||
DepotDiscSubSkillItem._mapNodeConfig = {
|
||||
btnItem = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
imgIconBg = {sComponentName = "Image"},
|
||||
imgSkillIcon = {sComponentName = "Image"},
|
||||
txtSkillName = {sComponentName = "TMP_Text"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtActivated = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_DiscSkill_MaxLevel"
|
||||
},
|
||||
imgChoose = {},
|
||||
canvasChoose = {sNodeName = "imgChoose", sComponentName = "Canvas"},
|
||||
goNoteList = {},
|
||||
goNote = {nCount = 3, sComponentName = "Image"},
|
||||
txtHas = {nCount = 3, sComponentName = "TMP_Text"}
|
||||
}
|
||||
DepotDiscSubSkillItem._mapEventConfig = {
|
||||
SelectDepotDiscSkill = "OnEvent_SelectDepotDiscSkill"
|
||||
}
|
||||
function DepotDiscSubSkillItem:SetItem(nSkillId, nDiscId, mapNote, nOrderInLayer)
|
||||
if nSkillId == nil then
|
||||
self._mapNode.btnItem.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.btnItem.gameObject:SetActive(true)
|
||||
self.nSkillId = nSkillId
|
||||
self.nDiscId = nDiscId
|
||||
local subSkillCfg = ConfigTable.GetData("SecondarySkill", nSkillId)
|
||||
if subSkillCfg == nil then
|
||||
return
|
||||
end
|
||||
local tbGroup = CacheTable.GetData("_SecondarySkill", subSkillCfg.GroupId)
|
||||
local maxLevel = #tbGroup
|
||||
self:SetPngSprite(self._mapNode.imgIconBg, subSkillCfg.IconBg)
|
||||
self:SetPngSprite(self._mapNode.imgSkillIcon, subSkillCfg.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillName, subSkillCfg.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, ConfigTable.GetUIText("Skill_Level") .. subSkillCfg.Level)
|
||||
local bAvtive = self:CheckSkillActive(subSkillCfg, mapNote)
|
||||
if not bAvtive then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, ConfigTable.GetUIText("StarTower_Depot_DiscSkill_NotActivated"))
|
||||
end
|
||||
local nNoteIndex = 1
|
||||
local bMax = maxLevel <= subSkillCfg.Level
|
||||
if not bMax then
|
||||
local nNextSkillId = bAvtive and nSkillId + 1 or nSkillId
|
||||
local nextSubSkillCfg = ConfigTable.GetData("SecondarySkill", nNextSkillId)
|
||||
if nextSubSkillCfg == nil then
|
||||
self._mapNode.goNoteList:SetActive(false)
|
||||
self._mapNode.txtActivated.gameObject:SetActive(true)
|
||||
return
|
||||
end
|
||||
local tbActiveNote = decodeJson(nextSubSkillCfg.NeedSubNoteSkills)
|
||||
for k, v in pairs(tbActiveNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nNoteMax = tonumber(v)
|
||||
local nNoteHas = mapNote[nNoteId] or 0
|
||||
local noteCfg = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
if noteCfg ~= nil then
|
||||
self._mapNode.goNote[nNoteIndex].gameObject:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.goNote[nNoteIndex], noteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
local sHasStr = ""
|
||||
if nNoteMax <= nNoteHas then
|
||||
sHasStr = "<color=#0ABEC5>" .. nNoteHas .. "</color>"
|
||||
else
|
||||
sHasStr = "<color=#5E89B4>" .. nNoteHas .. "</color>"
|
||||
bMax = false
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtHas[nNoteIndex], sHasStr .. "<color=#264278>/" .. nNoteMax .. "</color>")
|
||||
end
|
||||
nNoteIndex = nNoteIndex + 1
|
||||
end
|
||||
end
|
||||
self._mapNode.goNoteList:SetActive(not bMax)
|
||||
self._mapNode.txtActivated.gameObject:SetActive(bMax)
|
||||
if nil ~= nOrderInLayer then
|
||||
NovaAPI.SetCanvasSortingOrder(self._mapNode.canvasChoose, nOrderInLayer)
|
||||
end
|
||||
end
|
||||
function DepotDiscSubSkillItem:CheckSkillActive(subSkillCfg, mapNote)
|
||||
if subSkillCfg.Level == 1 then
|
||||
local tbActiveNote = decodeJson(subSkillCfg.NeedSubNoteSkills)
|
||||
for k, v in pairs(tbActiveNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nNoteMax = tonumber(v)
|
||||
local nNoteHas = mapNote[nNoteId] or 0
|
||||
local noteCfg = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
if noteCfg ~= nil and nNoteMax > nNoteHas then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
function DepotDiscSubSkillItem:OnBtnClick_Item()
|
||||
EventManager.Hit("SelectDepotDiscSkill", self.nDiscId, nil, self.nSkillId)
|
||||
end
|
||||
function DepotDiscSubSkillItem:OnEvent_SelectDepotDiscSkill(nDiscId, nMainSkillId, nSubSkillId, _)
|
||||
self._mapNode.imgChoose:SetActive(self.nSkillId == nSubSkillId)
|
||||
end
|
||||
function DepotDiscSubSkillItem:OnEnable()
|
||||
for i, v in ipairs(self._mapNode.goNote) do
|
||||
self._mapNode.goNote[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
return DepotDiscSubSkillItem
|
||||
@@ -0,0 +1,51 @@
|
||||
local DepotFateCardItemCtrl = class("DepotFateCardItemCtrl", BaseCtrl)
|
||||
DepotFateCardItemCtrl._mapNodeConfig = {
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtCount = {sComponentName = "TMP_Text"},
|
||||
imgChoose = {},
|
||||
imgUnable = {},
|
||||
txtUnable = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_FateCard_Unable"
|
||||
}
|
||||
}
|
||||
DepotFateCardItemCtrl._mapEventConfig = {}
|
||||
DepotFateCardItemCtrl._mapRedDotConfig = {}
|
||||
function DepotFateCardItemCtrl:InitFateCard(nId, nCount)
|
||||
self.nId = nId
|
||||
local itemCfg = ConfigTable.GetData_Item(nId)
|
||||
if nil == itemCfg then
|
||||
printError(string.format("获取Item表格配置失败!!!id = [%s]", nId))
|
||||
return
|
||||
end
|
||||
local sFrame = AllEnum.FrameType_New.FateCardS .. AllEnum.FrameColor_New[itemCfg.Rarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgRare, "12_rare", sFrame)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, itemCfg.Icon2)
|
||||
self._mapNode.imgUnable.gameObject:SetActive(nCount <= 0)
|
||||
self._mapNode.txtCount.gameObject:SetActive(0 < nCount and nCount < 999)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, "")
|
||||
self._mapNode.imgChoose.gameObject:SetActive(false)
|
||||
end
|
||||
function DepotFateCardItemCtrl:SetChoose(bChoose)
|
||||
self._mapNode.imgChoose.gameObject:SetActive(bChoose)
|
||||
end
|
||||
function DepotFateCardItemCtrl:Awake()
|
||||
end
|
||||
function DepotFateCardItemCtrl:FadeIn()
|
||||
end
|
||||
function DepotFateCardItemCtrl:FadeOut()
|
||||
end
|
||||
function DepotFateCardItemCtrl:OnEnable()
|
||||
end
|
||||
function DepotFateCardItemCtrl:OnDisable()
|
||||
end
|
||||
function DepotFateCardItemCtrl:OnDestroy()
|
||||
end
|
||||
function DepotFateCardItemCtrl:OnRelease()
|
||||
end
|
||||
function DepotFateCardItemCtrl:OnBtnClick_AAA()
|
||||
end
|
||||
function DepotFateCardItemCtrl:OnEvent_AAA()
|
||||
end
|
||||
return DepotFateCardItemCtrl
|
||||
@@ -0,0 +1,289 @@
|
||||
local DepotItemListCtrl = class("DepotItemListCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
DepotItemListCtrl._mapNodeConfig = {
|
||||
rtItemListContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goFateCardItem = {},
|
||||
goDepotItem = {},
|
||||
txtFateCard = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_FateCard_Title"
|
||||
},
|
||||
txtItem = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Item_Title"
|
||||
},
|
||||
goItemList = {},
|
||||
FateCardList = {},
|
||||
rtFateCard = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
ItemList = {},
|
||||
rtItem = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
ItemInfo = {
|
||||
sNodeName = "---ItemInfo---"
|
||||
},
|
||||
goItemL = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
txtItemName = {sComponentName = "TMP_Text"},
|
||||
txtCountCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Info_QTY"
|
||||
},
|
||||
txtItemCount = {sComponentName = "TMP_Text"},
|
||||
txtDescribeTitle1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Info_Desc"
|
||||
},
|
||||
txtItemDesc = {sComponentName = "TMP_Text"},
|
||||
Content = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
FateCardInfo = {
|
||||
sNodeName = "---FateCardInfo---"
|
||||
},
|
||||
goFateCardInfo = {
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotFateCardItemCtrl"
|
||||
},
|
||||
txtFateCardName = {sComponentName = "TMP_Text"},
|
||||
imgEffect = {nCount = 3},
|
||||
txtEffect1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_FateCard_Effect_Count"
|
||||
},
|
||||
txtEffect2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_FateCard_Effect"
|
||||
},
|
||||
txtEffect3 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_FateCard_Unable"
|
||||
},
|
||||
txtEffectCount = {sComponentName = "TMP_Text"},
|
||||
txtDescribeTitle2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Depot_Describe"
|
||||
},
|
||||
txtFateCardDesc = {sComponentName = "TMP_Text"},
|
||||
imgEmpty = {},
|
||||
txt_EmptyTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Item_List_Empty"
|
||||
}
|
||||
}
|
||||
DepotItemListCtrl._mapEventConfig = {}
|
||||
DepotItemListCtrl._mapRedDotConfig = {}
|
||||
local item_type = {FateCard = 1, Item = 2}
|
||||
function DepotItemListCtrl:RefreshItemList(mapFateCard, mapItem, nParam)
|
||||
self._mapNode.ItemInfo.gameObject:SetActive(false)
|
||||
self._mapNode.FateCardInfo.gameObject:SetActive(false)
|
||||
local bFateCard = mapFateCard ~= nil and next(mapFateCard) ~= nil
|
||||
self._mapNode.FateCardList.gameObject:SetActive(bFateCard)
|
||||
if bFateCard then
|
||||
self:RefreshFateCard(mapFateCard)
|
||||
end
|
||||
local bItem = mapItem ~= nil and next(mapItem) ~= nil
|
||||
self._mapNode.ItemList.gameObject:SetActive(bItem)
|
||||
if bItem then
|
||||
self:RefreshItem(mapItem)
|
||||
end
|
||||
self._mapNode.goItemList.gameObject:SetActive(bFateCard or bItem)
|
||||
self._mapNode.imgEmpty.gameObject:SetActive(not bFateCard and not bItem)
|
||||
local nSelectType, nSelectIndex
|
||||
if bFateCard then
|
||||
nSelectType = item_type.FateCard
|
||||
nSelectIndex = 1
|
||||
elseif bItem then
|
||||
nSelectType = item_type.Item
|
||||
nSelectIndex = 1
|
||||
end
|
||||
if nil ~= nParam then
|
||||
local mapItemCfg = ConfigTable.GetData_Item(nParam)
|
||||
if mapItemCfg ~= nil then
|
||||
if mapItemCfg.Stype == GameEnum.itemStype.FateCard then
|
||||
nSelectType = item_type.FateCard
|
||||
for k, v in ipairs(self.mapFateCard) do
|
||||
if v.nTid == nParam then
|
||||
nSelectIndex = k
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
nSelectType = item_type.Item
|
||||
for k, v in ipairs(self.mapItem) do
|
||||
if v.nTid == nParam then
|
||||
nSelectIndex = k
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if nil ~= nSelectType then
|
||||
self:SelectItem(nSelectType, nSelectIndex)
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtItemListContent)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function DepotItemListCtrl:RefreshFateCard(mapFateCard)
|
||||
self.mapFateCard = {}
|
||||
for nId, v in pairs(mapFateCard) do
|
||||
local nCount = math.max(v[1], v[2])
|
||||
nCount = nCount == -1 and 999 or nCount
|
||||
table.insert(self.mapFateCard, {
|
||||
nTid = nId,
|
||||
nCount = nCount,
|
||||
nSort = 0 < nCount and 1 or 0
|
||||
})
|
||||
end
|
||||
table.sort(self.mapFateCard, function(a, b)
|
||||
if a.nSort == b.nSort then
|
||||
if a.nCount == b.nCount then
|
||||
return a.nTid < b.nTid
|
||||
end
|
||||
return a.nCount < b.nCount
|
||||
end
|
||||
return a.nSort > b.nSort
|
||||
end)
|
||||
for _, v in ipairs(self.tbFateCardCtrl) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
for k, v in ipairs(self.mapFateCard) do
|
||||
local itemObj
|
||||
if nil == self.tbFateCardCtrl[k] then
|
||||
itemObj = instantiate(self._mapNode.goFateCardItem, self._mapNode.rtFateCard)
|
||||
itemObj.gameObject:SetActive(true)
|
||||
local itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.StarTower.Depot.DepotFateCardItemCtrl")
|
||||
itemCtrl:InitFateCard(v.nTid, v.nCount)
|
||||
table.insert(self.tbFateCardCtrl, itemCtrl)
|
||||
else
|
||||
itemObj = self.tbFateCardCtrl[k].gameObject
|
||||
itemObj:SetActive(true)
|
||||
self.tbFateCardCtrl[k]:InitFateCard(v.nTid, v.nCount)
|
||||
end
|
||||
local btnSelect = itemObj.transform:Find("btnItem"):GetComponent("UIButton")
|
||||
btnSelect.onClick:RemoveAllListeners()
|
||||
local func_select = function()
|
||||
self:SelectItem(item_type.FateCard, k)
|
||||
end
|
||||
btnSelect.onClick:AddListener(func_select)
|
||||
end
|
||||
end
|
||||
function DepotItemListCtrl:RefreshItem(mapItem)
|
||||
self.mapItem = {}
|
||||
for nId, v in pairs(mapItem) do
|
||||
local itemCfg = ConfigTable.GetData_Item(nId)
|
||||
if itemCfg ~= nil and itemCfg.Stype ~= GameEnum.itemStype.SubNoteSkill then
|
||||
table.insert(self.mapItem, {nTid = nId, nCount = v})
|
||||
end
|
||||
end
|
||||
for _, v in ipairs(self.tbItemCtrl) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
for k, v in ipairs(self.mapItem) do
|
||||
local itemObj
|
||||
if nil == self.tbItemCtrl[k] then
|
||||
itemObj = instantiate(self._mapNode.goDepotItem, self._mapNode.rtItem)
|
||||
itemObj.gameObject:SetActive(true)
|
||||
local itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
itemCtrl:SetItem(v.nTid, nil, v.nCount, nil, nil, nil, nil, true)
|
||||
table.insert(self.tbItemCtrl, itemCtrl)
|
||||
else
|
||||
itemObj = self.tbItemCtrl[k].gameObject
|
||||
itemObj:SetActive(true)
|
||||
self.tbItemCtrl[k]:SetItem(v.nTid, nil, v.nCount, nil, nil, nil, nil, true)
|
||||
end
|
||||
local btnSelect = itemObj.transform:Find("btnItem"):GetComponent("UIButton")
|
||||
btnSelect.onClick:RemoveAllListeners()
|
||||
local func_select = function()
|
||||
self:SelectItem(item_type.Item, k)
|
||||
end
|
||||
btnSelect.onClick:AddListener(func_select)
|
||||
end
|
||||
end
|
||||
function DepotItemListCtrl:SelectItem(nType, nIndex)
|
||||
self._mapNode.ItemInfo.gameObject:SetActive(false)
|
||||
self._mapNode.FateCardInfo.gameObject:SetActive(false)
|
||||
if nil ~= self.nSelectIndex then
|
||||
if self.nSelectType == item_type.FateCard then
|
||||
self.tbFateCardCtrl[self.nSelectIndex]:SetChoose(false)
|
||||
elseif self.nSelectType == item_type.Item then
|
||||
self.tbItemCtrl[self.nSelectIndex]:SetSelect(false)
|
||||
end
|
||||
end
|
||||
self.nSelectType = nType
|
||||
self.nSelectIndex = nIndex
|
||||
if self.nSelectType == item_type.FateCard then
|
||||
self._mapNode.FateCardInfo.gameObject:SetActive(true)
|
||||
self.tbFateCardCtrl[self.nSelectIndex]:SetChoose(true)
|
||||
self:SetFateCardInfo()
|
||||
elseif self.nSelectType == item_type.Item then
|
||||
self._mapNode.ItemInfo.gameObject:SetActive(true)
|
||||
self.tbItemCtrl[self.nSelectIndex]:SetSelect(true)
|
||||
self:SetItemInfo()
|
||||
end
|
||||
end
|
||||
function DepotItemListCtrl:SetItemInfo()
|
||||
local mapSelect = self.mapItem[self.nSelectIndex]
|
||||
local mapCfg = ConfigTable.GetData_Item(mapSelect.nTid)
|
||||
self._mapNode.goItemL:SetItem(mapSelect.nTid)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemCount, mapSelect.nCount)
|
||||
if mapCfg ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemName, mapCfg.Title)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemDesc, mapCfg.Desc)
|
||||
end
|
||||
end
|
||||
function DepotItemListCtrl:SetFateCardInfo()
|
||||
local mapSelect = self.mapFateCard[self.nSelectIndex]
|
||||
if nil ~= mapSelect then
|
||||
local itemCfg = ConfigTable.GetData_Item(mapSelect.nTid)
|
||||
local fateCardCfg = ConfigTable.GetData("FateCard", mapSelect.nTid)
|
||||
if nil == fateCardCfg then
|
||||
printError(string.format("获取FateCard表格配置失败!!!id = [%s]", mapSelect.nTid))
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFateCardName, fateCardCfg.Name)
|
||||
local sDesc = UTILS.ParseParamDesc(fateCardCfg.Desc, fateCardCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFateCardDesc, sDesc)
|
||||
self._mapNode.goFateCardInfo:InitFateCard(mapSelect.nTid, mapSelect.nCount)
|
||||
for _, v in ipairs(self._mapNode.imgEffect) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
if mapSelect.nCount <= 0 then
|
||||
self._mapNode.imgEffect[3].gameObject:SetActive(true)
|
||||
elseif mapSelect.nCount == 999 then
|
||||
self._mapNode.imgEffect[2].gameObject:SetActive(true)
|
||||
else
|
||||
self._mapNode.imgEffect[1].gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEffectCount, orderedFormat(ConfigTable.GetUIText("StarTower_FateCard_Effect_Count_Value"), mapSelect.nCount))
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotItemListCtrl:Clear()
|
||||
end
|
||||
function DepotItemListCtrl:Awake()
|
||||
self.tbFateCardCtrl = {}
|
||||
self.tbItemCtrl = {}
|
||||
self.nSelectIndex = nil
|
||||
self.nSelectType = 0
|
||||
self._mapNode.goFateCardItem.gameObject:SetActive(false)
|
||||
self._mapNode.goDepotItem.gameObject:SetActive(false)
|
||||
end
|
||||
function DepotItemListCtrl:OnDestroy()
|
||||
for _, v in ipairs(self.tbFateCardCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
end
|
||||
self.tbFateCardCtrl = {}
|
||||
for _, v in ipairs(self.tbItemCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
end
|
||||
self.tbItemCtrl = {}
|
||||
end
|
||||
return DepotItemListCtrl
|
||||
@@ -0,0 +1,167 @@
|
||||
local DepotNoteCtrl = class("DepotNoteCtrl", BaseCtrl)
|
||||
DepotNoteCtrl._mapNodeConfig = {
|
||||
goDiscNoteItem = {
|
||||
nCount = 5,
|
||||
sCtrlName = "Game.UI.StarTower.Note.NoteCountItemCtrl"
|
||||
},
|
||||
btnDiscItem = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DiscItem"
|
||||
},
|
||||
goDiscItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscItemCtrl"
|
||||
},
|
||||
btnPassiveSkill = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_PassiveSkill"
|
||||
},
|
||||
ctrlPassiveSkill = {
|
||||
nCount = 3,
|
||||
sNodeName = "btnPassiveSkill",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscSkillItemCtrl"
|
||||
},
|
||||
btnCommonSkill1_ = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Common1"
|
||||
},
|
||||
ctrlCommonSkill1_ = {
|
||||
nCount = 2,
|
||||
sNodeName = "btnCommonSkill1_",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscSkillItemCtrl"
|
||||
},
|
||||
btnCommonSkill2_ = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Common2"
|
||||
},
|
||||
ctrlCommonSkill2_ = {
|
||||
nCount = 2,
|
||||
sNodeName = "btnCommonSkill2_",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscSkillItemCtrl"
|
||||
},
|
||||
btnCommonSkill3_ = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Common3"
|
||||
},
|
||||
ctrlCommonSkill3_ = {
|
||||
nCount = 2,
|
||||
sNodeName = "btnCommonSkill3_",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscSkillItemCtrl"
|
||||
}
|
||||
}
|
||||
DepotNoteCtrl._mapEventConfig = {}
|
||||
DepotNoteCtrl._mapRedDotConfig = {}
|
||||
function DepotNoteCtrl:InitDisc()
|
||||
for k, nId in ipairs(self._panel.tbDisc) do
|
||||
local mapDisc = self._panel.mapDiscData[nId]
|
||||
if mapDisc ~= nil then
|
||||
self._mapNode.goDiscItem[k]:Refresh(nId, mapDisc.nStar, mapDisc.nMaxStar, mapDisc.nLevel, mapDisc.tbShowNote)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotNoteCtrl:RefreshNoteList(tbNoteList)
|
||||
if self.bInit then
|
||||
return
|
||||
end
|
||||
self.bInit = true
|
||||
self.tbPassiveSkill = {}
|
||||
self.tbCommomSkill = {}
|
||||
self.tbNoteList = tbNoteList
|
||||
for k, v in ipairs(self._mapNode.goDiscNoteItem) do
|
||||
local nNoteId = self._panel.tbShowNote[k]
|
||||
local nCount = tbNoteList[nNoteId] or 0
|
||||
v:Init(nCount)
|
||||
end
|
||||
for k, nId in ipairs(self._panel.tbDisc) do
|
||||
local discData = self._panel.mapDiscData[nId]
|
||||
self._mapNode.ctrlPassiveSkill[k]:SetNone()
|
||||
for i = 1, 2 do
|
||||
self._mapNode["ctrlCommonSkill" .. k .. "_"][i]:SetNone()
|
||||
end
|
||||
if discData then
|
||||
if discData.nPassiveSkillId then
|
||||
local mapPassiveCfg = ConfigTable.GetData("DiscPassiveSkill", discData.nPassiveSkillId)
|
||||
if mapPassiveCfg then
|
||||
local nCurLayer = discData:GetPassiveLayer(tbNoteList, mapPassiveCfg)
|
||||
local mapData = {
|
||||
nType = AllEnum.DiscSkillType.Passive,
|
||||
nId = discData.nPassiveSkillId,
|
||||
nLevel = nCurLayer,
|
||||
nMaxLevel = discData.nPassiveSkillMaxLayer
|
||||
}
|
||||
self._mapNode.ctrlPassiveSkill[k]:InitDiscSkill(mapData)
|
||||
self.tbPassiveSkill[k] = mapData
|
||||
end
|
||||
end
|
||||
for i, nCommonSkillId in ipairs(discData.tbCommonSkillId) do
|
||||
if nCommonSkillId then
|
||||
local mapCommonCfg = ConfigTable.GetData("DiscCommonSkill", nCommonSkillId)
|
||||
if mapCommonCfg then
|
||||
local nCurLayer = discData:GetCommonLayer(tbNoteList, mapCommonCfg)
|
||||
local mapData = {
|
||||
nType = AllEnum.DiscSkillType.Common,
|
||||
nId = nCommonSkillId,
|
||||
nLevel = nCurLayer,
|
||||
nMaxLevel = #mapCommonCfg.ActiveNoteNum
|
||||
}
|
||||
self._mapNode["ctrlCommonSkill" .. k .. "_"][i]:InitDiscSkill(mapData)
|
||||
if not self.tbCommomSkill[k] then
|
||||
self.tbCommomSkill[k] = {}
|
||||
end
|
||||
self.tbCommomSkill[k][i] = mapData
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotNoteCtrl:OpenTips(mapSelect, btn)
|
||||
if not mapSelect then
|
||||
return
|
||||
end
|
||||
local mapData = {
|
||||
nType = mapSelect.nType,
|
||||
nSkillId = mapSelect.nId,
|
||||
nLevel = mapSelect.nLevel,
|
||||
nMaxLevel = mapSelect.nMaxLevel
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSkillTips, btn.transform, mapData)
|
||||
end
|
||||
function DepotNoteCtrl:Clear()
|
||||
self.bInit = false
|
||||
end
|
||||
function DepotNoteCtrl:Awake()
|
||||
self.bInit = false
|
||||
end
|
||||
function DepotNoteCtrl:OnEnable()
|
||||
for k, v in ipairs(self._panel.tbShowNote) do
|
||||
if nil ~= self._mapNode.goDiscNoteItem[k] then
|
||||
self._mapNode.goDiscNoteItem[k]:InitNote(v)
|
||||
end
|
||||
end
|
||||
self:InitDisc()
|
||||
end
|
||||
function DepotNoteCtrl:OnDisable()
|
||||
end
|
||||
function DepotNoteCtrl:OnDestroy()
|
||||
end
|
||||
function DepotNoteCtrl:OnRelease()
|
||||
end
|
||||
function DepotNoteCtrl:OnBtnClick_PassiveSkill(btn, nIndex)
|
||||
self:OpenTips(self.tbPassiveSkill[nIndex], btn)
|
||||
end
|
||||
function DepotNoteCtrl:OnBtnClick_Common1(btn, nIndex)
|
||||
self:OpenTips(self.tbCommomSkill[1][nIndex], btn)
|
||||
end
|
||||
function DepotNoteCtrl:OnBtnClick_Common2(btn, nIndex)
|
||||
self:OpenTips(self.tbCommomSkill[2][nIndex], btn)
|
||||
end
|
||||
function DepotNoteCtrl:OnBtnClick_Common3(btn, nIndex)
|
||||
self:OpenTips(self.tbCommomSkill[3][nIndex], btn)
|
||||
end
|
||||
return DepotNoteCtrl
|
||||
@@ -0,0 +1,241 @@
|
||||
local DepotPotentialCtrl = class("DepotPotentialCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
DepotPotentialCtrl._mapNodeConfig = {
|
||||
goEmpty = {},
|
||||
PotentialCardRoot = {},
|
||||
PotentialCard = {
|
||||
sCtrlName = "Game.UI.StarTower.Potential.PotentialCardItemCtrl"
|
||||
},
|
||||
CharList = {},
|
||||
PotentialList = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.StarTower.Depot.CharPotentialListCtrl"
|
||||
},
|
||||
PotentialDepotItem = {},
|
||||
rtPotentialContent = {
|
||||
sNodeName = "PotentialContent",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goSwitchFull = {},
|
||||
btnSwitchFull = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SwitchFull"
|
||||
},
|
||||
SwitchFullOn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Potential_ALL"
|
||||
},
|
||||
SwitchFullOff = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Potential_Has"
|
||||
},
|
||||
txtPotentialEmpty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_PotentialEmpty"
|
||||
},
|
||||
switch_des = {},
|
||||
switch_img_bg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
switch_name = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Potential_Change_Desc"
|
||||
},
|
||||
btnSwitch_on = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SetDes"
|
||||
},
|
||||
btnSwitch_off = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SetSimpleDes"
|
||||
}
|
||||
}
|
||||
DepotPotentialCtrl._mapEventConfig = {
|
||||
SelectDepotPotential = "OnEvent_SelectDepotPotential"
|
||||
}
|
||||
DepotPotentialCtrl._mapRedDotConfig = {}
|
||||
function DepotPotentialCtrl:RefreshPotential(mapAllPotential, mapPotential)
|
||||
if self.bInit then
|
||||
return
|
||||
end
|
||||
self.bInit = true
|
||||
self.mapPotential = {}
|
||||
self.mapAllPotential = {}
|
||||
self.nSelectId = nil
|
||||
for k, v in ipairs(mapAllPotential) do
|
||||
local nCharId = v.nCharId
|
||||
local tbDepotPotential = mapPotential[nCharId]
|
||||
for nId, nLevel in pairs(tbDepotPotential) do
|
||||
self.mapPotential[nId] = {nLevel = nLevel}
|
||||
end
|
||||
local tbPotentialAdd = self._panel.mapPotentialAddLevel[nCharId]
|
||||
local tbSortList = {}
|
||||
for style, tb in ipairs(v.tbPotential) do
|
||||
tbSortList[style] = {}
|
||||
for _, v in ipairs(v.tbPotential[style]) do
|
||||
local nUnlock = tbDepotPotential[v.nId] ~= nil and 1 or 0
|
||||
local nAddCount = tbPotentialAdd[v.nId] and tbPotentialAdd[v.nId] or 0
|
||||
local nLevel = tbDepotPotential[v.nId] or 0
|
||||
if nLevel == 0 then
|
||||
nAddCount = 0
|
||||
end
|
||||
local itemCfg = ConfigTable.GetData_Item(v.nId)
|
||||
if itemCfg == nil then
|
||||
return
|
||||
end
|
||||
local nSpecial = itemCfg.Stype == GameEnum.itemStype.SpecificPotential and 1 or 0
|
||||
table.insert(tbSortList[style], {
|
||||
nId = v.nId,
|
||||
nLevel = nLevel,
|
||||
nPotentialAdd = nAddCount,
|
||||
nAllLevel = nLevel + nAddCount,
|
||||
nSpecial = nSpecial,
|
||||
nRarity = itemCfg.Rarity,
|
||||
nUnlock = nUnlock
|
||||
})
|
||||
end
|
||||
table.sort(tbSortList[style], function(a, b)
|
||||
if a.nUnlock == b.nUnlock then
|
||||
if a.nSpecial == b.nSpecial then
|
||||
if a.nRarity == b.nRarity then
|
||||
if a.nAllLevel == b.nAllLevel then
|
||||
return a.nId < b.nId
|
||||
end
|
||||
return a.nAllLevel > b.nAllLevel
|
||||
end
|
||||
return a.nRarity < b.nRarity
|
||||
end
|
||||
return a.nSpecial > b.nSpecial
|
||||
end
|
||||
return a.nUnlock > b.nUnlock
|
||||
end)
|
||||
if self.nSelectId == nil then
|
||||
self.nSelectId = tbSortList[1][1].nId
|
||||
end
|
||||
table.insert(self.mapAllPotential, {
|
||||
nCharId = nCharId,
|
||||
tbPotential = tbSortList[style]
|
||||
})
|
||||
end
|
||||
self._mapNode.PotentialList[k]:RefreshPotential(nCharId, tbSortList, self.bPotentialAll, self._mapNode.PotentialDepotItem, k == 1)
|
||||
end
|
||||
self:SwitchPotentialAll()
|
||||
EventManager.Hit("SelectDepotPotential", self.nSelectId)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtPotentialContent)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self:InitSwitch()
|
||||
end
|
||||
function DepotPotentialCtrl:SwitchPotentialAll()
|
||||
self._mapNode.btnSwitchFull[1].gameObject:SetActive(not self.bPotentialAll)
|
||||
self._mapNode.btnSwitchFull[2].gameObject:SetActive(self.bPotentialAll)
|
||||
self._mapNode.rtPotentialContent.anchoredPosition = Vector2(0, 0)
|
||||
for k, v in ipairs(self._mapNode.PotentialList) do
|
||||
v:SwitchPotentialAll(self.bPotentialAll)
|
||||
end
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtPotentialContent)
|
||||
local bEmpty = false
|
||||
if not self.bPotentialAll then
|
||||
bEmpty = true
|
||||
for _, v in pairs(self.mapPotential) do
|
||||
bEmpty = bEmpty and 0 >= v.nLevel
|
||||
end
|
||||
end
|
||||
self._mapNode.goEmpty.gameObject:SetActive(bEmpty)
|
||||
self._mapNode.CharList.gameObject:SetActive(not bEmpty)
|
||||
self._mapNode.PotentialCardRoot.gameObject:SetActive(not bEmpty)
|
||||
self._mapNode.switch_des:SetActive(not bEmpty)
|
||||
if not self.bPotentialAll then
|
||||
self._mapNode.PotentialCard.gameObject:SetActive(self.nSelectId ~= nil and self.mapPotential[self.nSelectId] ~= nil)
|
||||
if self.mapPotential[self.nSelectId] == nil then
|
||||
self.nSelectId = nil
|
||||
for _, v in ipairs(self.mapAllPotential) do
|
||||
for _, data in ipairs(v.tbPotential) do
|
||||
if 0 < data.nLevel then
|
||||
self.nSelectId = data.nId
|
||||
EventManager.Hit("SelectDepotPotential", self.nSelectId)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if nil == self.nSelectId then
|
||||
if next(self.mapAllPotential) and next(self.mapAllPotential[1].tbPotential) then
|
||||
self.nSelectId = self.mapAllPotential[1].tbPotential[1].nId
|
||||
EventManager.Hit("SelectDepotPotential", self.nSelectId)
|
||||
else
|
||||
self._mapNode.PotentialCardRoot.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotPotentialCtrl:InitSwitch()
|
||||
local bSimple = PlayerData.StarTower:GetPotentialDescSimple()
|
||||
self._mapNode.btnSwitch_on.gameObject:SetActive(bSimple)
|
||||
self._mapNode.btnSwitch_off.gameObject:SetActive(not bSimple)
|
||||
end
|
||||
function DepotPotentialCtrl:Clear()
|
||||
self.bInit = false
|
||||
self.nSelectId = nil
|
||||
self.bPotentialAll = true
|
||||
self._mapNode.PotentialDepotItem.gameObject:SetActive(false)
|
||||
self._mapNode.PotentialCard.gameObject:SetActive(false)
|
||||
end
|
||||
function DepotPotentialCtrl:Awake()
|
||||
self.bInit = false
|
||||
self.bPotentialAll = true
|
||||
local bPa = LocalData.GetPlayerLocalData("PotentialAllSwitch")
|
||||
if nil ~= bPa then
|
||||
self.bPotentialAll = bPa
|
||||
end
|
||||
self.nSelectId = nil
|
||||
self._mapNode.PotentialDepotItem.gameObject:SetActive(false)
|
||||
self._mapNode.PotentialCard.gameObject:SetActive(false)
|
||||
end
|
||||
function DepotPotentialCtrl:OnEnable()
|
||||
end
|
||||
function DepotPotentialCtrl:OnDisable()
|
||||
end
|
||||
function DepotPotentialCtrl:OnDestroy()
|
||||
end
|
||||
function DepotPotentialCtrl:OnRelease()
|
||||
end
|
||||
function DepotPotentialCtrl:OnBtnClick_SetSimpleDes(...)
|
||||
PlayerData.StarTower:SetPotentialDescSimple(true)
|
||||
EventManager.Hit("SelectDepotPotential", self.nSelectId)
|
||||
self._mapNode.btnSwitch_on.gameObject:SetActive(true)
|
||||
self._mapNode.btnSwitch_off.gameObject:SetActive(false)
|
||||
end
|
||||
function DepotPotentialCtrl:OnBtnClick_SetDes(...)
|
||||
PlayerData.StarTower:SetPotentialDescSimple(false)
|
||||
EventManager.Hit("SelectDepotPotential", self.nSelectId)
|
||||
self._mapNode.btnSwitch_on.gameObject:SetActive(false)
|
||||
self._mapNode.btnSwitch_off.gameObject:SetActive(true)
|
||||
end
|
||||
function DepotPotentialCtrl:OnBtnClick_SwitchFull()
|
||||
self.bPotentialAll = not self.bPotentialAll
|
||||
LocalData.SetPlayerLocalData("PotentialAllSwitch", self.bPotentialAll)
|
||||
self:SwitchPotentialAll()
|
||||
end
|
||||
function DepotPotentialCtrl:OnEvent_SelectDepotPotential(nPotentialId)
|
||||
self._mapNode.PotentialCard.gameObject:SetActive(true)
|
||||
local nLevel = 0
|
||||
if nil ~= self.mapPotential[nPotentialId] then
|
||||
nLevel = self.mapPotential[nPotentialId].nLevel or 0
|
||||
end
|
||||
nLevel = nLevel == 0 and 1 or nLevel
|
||||
self.nSelectId = nPotentialId
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nPotentialId)
|
||||
if nil ~= potentialCfg then
|
||||
local nCharId = potentialCfg.CharId
|
||||
local nPotentialAddLv = self._panel.mapPotentialAddLevel[nCharId][nPotentialId] or 0
|
||||
local bSimple = PlayerData.StarTower:GetPotentialDescSimple()
|
||||
self._mapNode.PotentialCard:SetPotentialItem(nPotentialId, nLevel, nil, bSimple, nil, nPotentialAddLv, AllEnum.PotentialCardType.StarTower)
|
||||
self._mapNode.PotentialCard:ChangeWordRaycast(true)
|
||||
end
|
||||
end
|
||||
return DepotPotentialCtrl
|
||||
@@ -0,0 +1,87 @@
|
||||
local DepotPotentialItemCtrl = class("DepotPotentialItemCtrl", BaseCtrl)
|
||||
DepotPotentialItemCtrl._mapNodeConfig = {
|
||||
btnItem = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
canvasGroup = {
|
||||
sNodeName = "goNormal",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
goNormal = {},
|
||||
imgRare = {sComponentName = "Image"},
|
||||
goIcon = {
|
||||
sCtrlName = "Game.UI.StarTower.Potential.PotentialIconCtrl"
|
||||
},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtLevelValue = {sComponentName = "TMP_Text"},
|
||||
goSpecial = {},
|
||||
imgSpIcon = {sComponentName = "Image"},
|
||||
txtSpName = {sComponentName = "TMP_Text"},
|
||||
imgChoose = {},
|
||||
imgLock = {},
|
||||
txtLock = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Potential_Lock"
|
||||
},
|
||||
imgMask = {}
|
||||
}
|
||||
DepotPotentialItemCtrl._mapEventConfig = {
|
||||
SelectDepotPotential = "OnEvent_SelectDepotPotential"
|
||||
}
|
||||
DepotPotentialItemCtrl._mapRedDotConfig = {}
|
||||
local level_txt_color = {
|
||||
[1] = "#264278",
|
||||
[2] = "#2c5fd5"
|
||||
}
|
||||
function DepotPotentialItemCtrl:InitItem(nPotentialId, nLevel, nPotentialAdd, bShowAdd, bHideChoose)
|
||||
self.nPotentialId = nPotentialId
|
||||
self.nLevel = nLevel
|
||||
self.nPotentialAdd = nPotentialAdd
|
||||
self.bHideChoose = bHideChoose
|
||||
local itemCfg = ConfigTable.GetData_Item(nPotentialId)
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nPotentialId)
|
||||
if nil == potentialCfg or nil == itemCfg then
|
||||
return
|
||||
end
|
||||
self._mapNode.imgLock.gameObject:SetActive(nLevel <= 0)
|
||||
self._mapNode.imgMask.gameObject:SetActive(nLevel <= 0)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 1)
|
||||
local bSpecial = itemCfg.Stype == GameEnum.itemStype.SpecificPotential
|
||||
self._mapNode.goNormal.gameObject:SetActive(not bSpecial)
|
||||
self._mapNode.goSpecial.gameObject:SetActive(bSpecial)
|
||||
if not bSpecial then
|
||||
self:SetNormalPotential(itemCfg, potentialCfg, bShowAdd)
|
||||
else
|
||||
self:SetSpecialPotential(itemCfg, potentialCfg)
|
||||
end
|
||||
self._mapNode.imgChoose.gameObject:SetActive(false)
|
||||
end
|
||||
function DepotPotentialItemCtrl:SetNormalPotential(itemCfg, potentialCfg, bShowAdd)
|
||||
local sFrame = AllEnum.FrameType_New.PotentialS .. AllEnum.FrameColor_New[itemCfg.Rarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgRare, "12_rare", sFrame)
|
||||
self._mapNode.goIcon:SetIcon(potentialCfg.Id)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, itemCfg.Title)
|
||||
local nPotentialAdd = self.nPotentialAdd
|
||||
if not bShowAdd then
|
||||
nPotentialAdd = 0
|
||||
end
|
||||
local sColor = nPotentialAdd == 0 and level_txt_color[1] or level_txt_color[2]
|
||||
local _, color = ColorUtility.TryParseHtmlString(sColor)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelValue, self.nLevel + nPotentialAdd)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtLevelValue, color)
|
||||
end
|
||||
function DepotPotentialItemCtrl:SetSpecialPotential(itemCfg, potentialCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSpName, itemCfg.Title)
|
||||
self:SetPngSprite(self._mapNode.imgSpIcon, itemCfg.Icon .. AllEnum.PotentialIconSurfix.A)
|
||||
end
|
||||
function DepotPotentialItemCtrl:OnBtnClick_Item()
|
||||
EventManager.Hit("SelectDepotPotential", self.nPotentialId, self.nLevel, self.nPotentialAdd, self._mapNode.btnItem)
|
||||
end
|
||||
function DepotPotentialItemCtrl:OnEvent_SelectDepotPotential(nId)
|
||||
if self.bHideChoose then
|
||||
return
|
||||
end
|
||||
self._mapNode.imgChoose:SetActive(self.nPotentialId == nId)
|
||||
end
|
||||
return DepotPotentialItemCtrl
|
||||
@@ -0,0 +1,237 @@
|
||||
local StarTowerDepotCtrl = class("StarTowerDepotCtrl", BaseCtrl)
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
StarTowerDepotCtrl._mapNodeConfig = {
|
||||
trActor2D_PNG = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
animActor2D = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgActorBg = {},
|
||||
animActorBg = {sNodeName = "imgActorBg", sComponentName = "Animator"},
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
goRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
aniRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgNoteTogBg = {},
|
||||
imgEmpty = {},
|
||||
ItemList = {
|
||||
sNodeName = "---ItemList---",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotItemListCtrl"
|
||||
},
|
||||
CharInfo = {
|
||||
sNodeName = "---CharInfo---",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotCharInfoCtrl"
|
||||
},
|
||||
Potential = {
|
||||
sNodeName = "---Potential---",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotPotentialCtrl"
|
||||
},
|
||||
DiscSkill = {
|
||||
sNodeName = "---DiscSkill---",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscSkillCtrl"
|
||||
},
|
||||
tog = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ChangeTab"
|
||||
},
|
||||
ctrlTog = {
|
||||
nCount = 4,
|
||||
sNodeName = "tog",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
btnBack = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_CloseStarTowerDepot"
|
||||
},
|
||||
btnHelp = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Dictionary"
|
||||
},
|
||||
txtTitle = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot"
|
||||
},
|
||||
txt_EmptyTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "FRDepot_EmptyItem"
|
||||
}
|
||||
}
|
||||
StarTowerDepotCtrl._mapEventConfig = {
|
||||
OpenStarTowerDepot = "OnEvent_OpenStarTowerDepot",
|
||||
RefreshActor2D_Depot = "OnEvent_RefreshActor2D",
|
||||
Guide_SelectDepotTog = "OnEvent_SelectDepotTog"
|
||||
}
|
||||
StarTowerDepotCtrl._mapRedDotConfig = {}
|
||||
function StarTowerDepotCtrl:InitAllPotential()
|
||||
self.mapAllPotential = {}
|
||||
for k, nCharId in ipairs(self._panel.tbTeam) do
|
||||
local tbData = {
|
||||
nCharId = nCharId,
|
||||
tbPotential = {}
|
||||
}
|
||||
local charPotentialCfg = PlayerData.Char:GetCharPotentialList(nCharId)
|
||||
if charPotentialCfg ~= nil then
|
||||
if k == 1 then
|
||||
tbData.tbPotential = charPotentialCfg.master
|
||||
else
|
||||
tbData.tbPotential = charPotentialCfg.assist
|
||||
end
|
||||
end
|
||||
table.insert(self.mapAllPotential, tbData)
|
||||
end
|
||||
end
|
||||
function StarTowerDepotCtrl:RefreshTogText()
|
||||
self._mapNode.ctrlTog[1]:SetText(ConfigTable.GetUIText("StarTower_Depot_Potential"))
|
||||
self._mapNode.ctrlTog[2]:SetText(ConfigTable.GetUIText("StarTower_Depot_Note"))
|
||||
self._mapNode.ctrlTog[3]:SetText(ConfigTable.GetUIText("StarTower_Depot_Char"))
|
||||
self._mapNode.ctrlTog[4]:SetText(ConfigTable.GetUIText("StarTower_Depot_Bag"))
|
||||
end
|
||||
function StarTowerDepotCtrl:SetDefaultTog()
|
||||
if nil == self.nCurTog then
|
||||
self.nCurTog = AllEnum.StarTowerDepotTog.CharInfo
|
||||
end
|
||||
for i = 1, 4 do
|
||||
self._mapNode.ctrlTog[i]:SetDefault(i == self.nCurTog)
|
||||
end
|
||||
self:SwitchTog()
|
||||
end
|
||||
function StarTowerDepotCtrl:SwitchTog()
|
||||
self:RefreshList()
|
||||
end
|
||||
function StarTowerDepotCtrl:RefreshList()
|
||||
self._mapNode.CharInfo.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.CharInfo)
|
||||
self._mapNode.Potential.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.Potential)
|
||||
self._mapNode.DiscSkill.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.DiscSkill)
|
||||
self._mapNode.ItemList.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.ItemList)
|
||||
self._mapNode.trActor2D_PNG.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.CharInfo)
|
||||
self._mapNode.imgActorBg.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.CharInfo)
|
||||
self._mapNode.imgNoteTogBg.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.DiscSkill)
|
||||
if self.nCurTog == AllEnum.StarTowerDepotTog.CharInfo then
|
||||
self._mapNode.CharInfo:RefreshCharInfo(self._panel.tbTeam, self._panel.mapCharData)
|
||||
elseif self.nCurTog == AllEnum.StarTowerDepotTog.Potential then
|
||||
self._mapNode.Potential:RefreshPotential(self.mapAllPotential, self.mapPotential)
|
||||
elseif self.nCurTog == AllEnum.StarTowerDepotTog.DiscSkill then
|
||||
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_OpenStarTowerDepot")
|
||||
self._mapNode.DiscSkill:RefreshDiscSkill(self.mapNote, self.tbActiveSecondaryIds)
|
||||
elseif self.nCurTog == AllEnum.StarTowerDepotTog.ItemList then
|
||||
self._mapNode.ItemList:RefreshItemList(self.mapFateCard, self.mapItem, self.nParam)
|
||||
self.nParam = nil
|
||||
end
|
||||
end
|
||||
function StarTowerDepotCtrl:Awake()
|
||||
if self:GetPanelId() == PanelId.StarTowerFastBattle then
|
||||
self._mapNode.tog[3].gameObject:SetActive(false)
|
||||
self._mapNode.CharInfo.gameObject:SetActive(false)
|
||||
end
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
self.nInitSortingOrder = NovaAPI.GetCanvasSortingOrder(self.canvas)
|
||||
self:RefreshTogText()
|
||||
self:InitAllPotential()
|
||||
self.nCurTog = nil
|
||||
self.tbCharPotential = {}
|
||||
self._mapNode.goRoot:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
end
|
||||
function StarTowerDepotCtrl:FadeOut()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnEnable()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnDisable()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnDestroy()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnRelease()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnBtnClick_ChangeTab(btn, nIndex)
|
||||
if nIndex == self.nCurTog then
|
||||
return
|
||||
end
|
||||
self._mapNode.ctrlTog[nIndex]:SetTrigger(true)
|
||||
self._mapNode.ctrlTog[self.nCurTog]:SetTrigger(false)
|
||||
self.nCurTog = nIndex
|
||||
self:SwitchTog()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnBtnClick_CloseStarTowerDepot()
|
||||
PanelManager.InputEnable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, true)
|
||||
NovaAPI.SetCanvasSortingOrder(self.canvas, self.nInitSortingOrder)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, true)
|
||||
self.nCurTog = nil
|
||||
if self.callbackClose then
|
||||
self.callbackClose()
|
||||
end
|
||||
self._mapNode.goRoot:SetActive(false)
|
||||
self._mapNode.goBlur:SetActive(false)
|
||||
self._mapNode.trActor2D_PNG.gameObject:SetActive(false)
|
||||
self._mapNode.imgActorBg.gameObject:SetActive(false)
|
||||
self._mapNode.imgNoteTogBg.gameObject:SetActive(false)
|
||||
self._mapNode.Potential:Clear()
|
||||
self._mapNode.DiscSkill:Clear()
|
||||
self._mapNode.CharInfo:Clear()
|
||||
self._mapNode.ItemList:Clear()
|
||||
EventManager.Hit("CloseStarTowerDepot")
|
||||
GamepadUIManager.DisableGamepadUI("StarTowerDepotCtrl")
|
||||
end
|
||||
function StarTowerDepotCtrl:OnEvent_OpenStarTowerDepot(mapPotential, mapNote, mapFateCard, mapItem, tbActiveSecondaryIds, nTog, nParam, callback)
|
||||
self._panel:SetTop(self.canvas)
|
||||
PanelManager.InputDisable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
self.callbackClose = callback
|
||||
self.mapPotential = mapPotential
|
||||
self.mapNote = mapNote
|
||||
self.mapFateCard = mapFateCard
|
||||
self.mapItem = mapItem
|
||||
self.tbActiveSecondaryIds = tbActiveSecondaryIds
|
||||
self.nParam = nParam
|
||||
if nil ~= nTog then
|
||||
self.nCurTog = nTog
|
||||
end
|
||||
self._mapNode.goBlur:SetActive(true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.33)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
|
||||
self:SetDefaultTog()
|
||||
self._mapNode.goRoot:SetActive(true)
|
||||
self._mapNode.aniRoot:Play("depot_t_in")
|
||||
if self.nCurTog == AllEnum.StarTowerDepotTog.CharInfo then
|
||||
self._mapNode.animActor2D:Play("Actor2D_PNG_down_in", 0, 0)
|
||||
self._mapNode.animActorBg:Play("imgActorBg_in", 0, 0)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
GamepadUIManager.EnableGamepadUI("StarTowerDepotCtrl", self.tbGamepadUINode, nil, true)
|
||||
end
|
||||
function StarTowerDepotCtrl:OnEvent_RefreshActor2D(nCharId)
|
||||
Actor2DManager.SetActor2D_PNG(self._mapNode.trActor2D_PNG, PanelId.MainView, nCharId)
|
||||
end
|
||||
function StarTowerDepotCtrl:OnEvent_SelectDepotTog(nTog)
|
||||
if nTog == self.nCurTog then
|
||||
return
|
||||
end
|
||||
self._mapNode.ctrlTog[nTog]:SetTrigger(true)
|
||||
self._mapNode.ctrlTog[self.nCurTog]:SetTrigger(false)
|
||||
self.nCurTog = nTog
|
||||
self:SwitchTog()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnBtnClick_Dictionary()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DictionaryFR, self:GetPanelId() == PanelId.StarTowerFastBattle)
|
||||
end
|
||||
return StarTowerDepotCtrl
|
||||
Reference in New Issue
Block a user