622 lines
30 KiB
Lua
622 lines
30 KiB
Lua
require("Base/BasePanel")
|
|
SpecailTrainingInfoPopup = Inherit(BasePanel)
|
|
----- 修行境界预览弹窗 -----
|
|
-- SpecailTrainingInfoPopup = {}
|
|
--传入父脚本模块
|
|
local parent
|
|
local _HeroTraining
|
|
local Training = ConfigManager.GetConfig(ConfigName.Train)
|
|
local TrainingSetting = ConfigManager.GetConfig(ConfigName.TrainSetting)
|
|
local SkillConfig = ConfigManager.GetConfig(ConfigName.SkillConfig)
|
|
local selectSkillUnlockItems1 = {}
|
|
local selectSkillUnlockItems2 = {}
|
|
function SpecailTrainingInfoPopup:InitComponent()
|
|
self.spLoader = SpriteLoader.New()
|
|
self.titleText = Util.GetGameObject(self.gameObject, "Panel/Title"):GetComponent("Text")
|
|
self.btn_help = Util.GetGameObject(self.gameObject, "Panel/btn_help")
|
|
self.itemPre = Util.GetGameObject(self.gameObject, "Panel/Pre")
|
|
self.GameObject = Util.GetGameObject(self.gameObject, "Panel/Scroll")
|
|
self.BackBtn = Util.GetGameObject(self.gameObject, "BackBtn")
|
|
local rootHight = self.GameObject.transform.rect.height
|
|
local width = self.GameObject.transform.rect.width
|
|
self.ScrollView = SubUIManager.Open(SubUIConfig.ScrollFitterView, self.GameObject.transform,
|
|
self.itemPre, Vector2.New(width, rootHight), 1, 0)
|
|
self.ScrollView.moveTween.MomentumAmount = 1
|
|
self.ScrollView.moveTween.Strength = 2
|
|
|
|
self.preList = {}
|
|
self.textList = {}
|
|
self.attList = {}
|
|
self.attSkill = {}
|
|
self.OpenType = 1
|
|
end
|
|
|
|
function SpecailTrainingInfoPopup:BindEvent()
|
|
Util.AddClick(self.BackBtn, function()
|
|
self:ClosePanel()
|
|
end)
|
|
|
|
Util.AddClick(self.btn_help, function()
|
|
UIManager.OpenPanel(UIName.HelpPopup, 145, 0, 0)
|
|
end)
|
|
end
|
|
|
|
function SpecailTrainingInfoPopup:AddListener()
|
|
end
|
|
|
|
function SpecailTrainingInfoPopup:RemoveListener()
|
|
end
|
|
|
|
--type 1 是自己的英雄打开 --type 2 是别人的英雄打开
|
|
function SpecailTrainingInfoPopup:OnOpen(curHeroData, OpenType)
|
|
self._curHerodata = curHeroData
|
|
self._HeroTraining = curHeroData.HeroTraining
|
|
self.showList = {}
|
|
self.OpenType = OpenType
|
|
self.curLevelData = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.Train, "HeroID", self._curHerodata.id,
|
|
"Level", self._HeroTraining.trainingLv)
|
|
end
|
|
|
|
function SpecailTrainingInfoPopup:OnShow()
|
|
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
|
|
self.titleText.text = Language[12242]
|
|
--self.previewData = PracticeManager.GetPreViewData()
|
|
|
|
local tData = ConfigManager.TryGetAllConfigsDataByKey(ConfigName.Train, "HeroID", self._curHerodata.id)
|
|
if tData then
|
|
for k, v in ipairs(tData) do
|
|
if not self.showList[k] then
|
|
self.showList[k] = { data = v, curTrainingLevel = self._curHerodata.HeroTraining.trainingLv }
|
|
end
|
|
end
|
|
end
|
|
HeroManager.GetHeroTrainingAddPro(self._curHerodata.dynamicId)
|
|
self.ScrollView:SetData(self.showList, function(index, go)
|
|
self:SetSingleData(index, go, self.showList[index])
|
|
UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(go.transform)
|
|
end)
|
|
--ForceRebuildLayout(self.GameObject.transform)
|
|
|
|
UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self.GameObject.transform)
|
|
self.ScrollView:SetIndex(1)
|
|
end
|
|
|
|
--
|
|
--_data=TrainingConfig
|
|
--
|
|
function SpecailTrainingInfoPopup:SetSingleData(index, _go, _data)
|
|
local tData = _data.data
|
|
local curLevel = _data.curTrainingLevel
|
|
local title = Util.GetGameObject(_go, "HeroInfo/title/Text"):GetComponent("Text")
|
|
title.text = Language[12242] .. index .. Language[10065]
|
|
local heroContion = Util.GetGameObject(_go, "HeroInfo/heroContion")
|
|
local condition = Util.GetGameObject(heroContion, "condition"):GetComponent("Text")
|
|
local Content = Util.GetGameObject(_go, "Content")
|
|
local SkillContent = Util.GetGameObject(_go, "SkillContent")
|
|
local attPre = Util.GetGameObject(_go, "Content/attPre")
|
|
local numPre = Util.GetGameObject(_go, "Content/attPre/numPre")
|
|
local mySelfCondition = Util.GetGameObject(_go, "HeroInfo/title/TrainingStatus/mySelfCondition"):GetComponent("Text")
|
|
local trainingIcon = Util.GetGameObject(_go, "HeroInfo/title/TrainingStatus/trainingIcon")
|
|
trainingIcon:GetComponent("Image").sprite = self.spLoader:LoadSprite("r_map_time")
|
|
local DesTip = Util.GetGameObject(_go, "DesTip")
|
|
--DesTip.gameObject:SetActive(tData.Level == #self.showList)
|
|
DesTip.gameObject:SetActive(false)
|
|
-- local isOpen=self._curHerodata.star>=tData.MyselfCondition and curLevel>=tData.Level
|
|
local lastLevelData = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.Train, "HeroID", self._curHerodata.id,
|
|
"Level", tData.Level - 1 == 0 and 1 or tData.Level - 1)
|
|
local isOpen = self._curHerodata.star >= lastLevelData.MyselfCondition and curLevel >= tData.Level
|
|
if curLevel == 1 and tData.Level == 1 then
|
|
isOpen = true
|
|
end
|
|
if tData.Level > 1 then
|
|
mySelfCondition.gameObject:SetActive(lastLevelData.MyselfCondition ~= 0)
|
|
mySelfCondition.text = NumToChinese[lastLevelData.MyselfCondition == 0 and 1 or lastLevelData.MyselfCondition] ..
|
|
Language[12783]
|
|
condition.gameObject:SetActive(tData.Desc ~= "")
|
|
condition.text = GetLanguageStrById(tData.Desc)
|
|
if lastLevelData.OtherCondition then
|
|
if type(lastLevelData.OtherCondition[1][1]) == "userdata" then
|
|
heroContion:SetActive(false)
|
|
else
|
|
heroContion:SetActive(true)
|
|
for i = 1, #lastLevelData.OtherCondition do
|
|
local t = Util.GetGameObject(heroContion.transform, "HeroList/hero" .. tostring(i) .. "/hero/icon")
|
|
:GetComponent("Image")
|
|
t.sprite = self.spLoader:LoadSprite(GetResourcePath(ConfigManager.GetConfigDataByKey(
|
|
ConfigName.HeroConfig, "Id", lastLevelData.OtherCondition[i][1]).Icon))
|
|
end
|
|
end
|
|
else
|
|
heroContion:SetActive(false)
|
|
end
|
|
else
|
|
heroContion:SetActive(false)
|
|
mySelfCondition.gameObject:SetActive(false)
|
|
condition.gameObject:SetActive(false)
|
|
end
|
|
trainingIcon:SetActive(tData.Level == curLevel and self._curHerodata.HeroTraining.isTraining == 1)
|
|
|
|
--最外层Pre
|
|
if not self.attList[_go] then
|
|
self.attList[_go] = {}
|
|
end
|
|
if not self.attSkill[_go] then
|
|
self.attSkill[_go] = {}
|
|
end
|
|
local singleAttList = self.attList[_go]
|
|
for k, v in ipairs(singleAttList) do
|
|
if v[1] then
|
|
v[1].gameObject:SetActive(false)
|
|
end
|
|
end
|
|
local ActiveButton = Util.GetGameObject(_go, "HeroInfo/title/TrainingStatus/ActiveBtn")
|
|
ActiveButton:GetComponent("Image").sprite = self.spLoader:LoadSprite("r_guanka_zouguodian_02")
|
|
|
|
local TrainingSetting = ConfigManager.GetConfigDataByDoubleKey(ConfigName.TrainSetting, "PoolID",
|
|
tData.TrainSettingID, "Level", tData.Level)
|
|
local lastLevelTrainingSetting = ConfigManager.GetConfigDataByDoubleKey(ConfigName.TrainSetting, "PoolID",
|
|
tData.TrainSettingID, "Level", (tData.Level - 1) == 0 and 1 or tData.Level - 1)
|
|
|
|
for i = 1, 3 do
|
|
if not singleAttList[i] then
|
|
local t = {}
|
|
local prefab = newObject(attPre)
|
|
prefab.transform:SetParent(Content.transform)
|
|
prefab.transform.localScale = Vector3.one
|
|
prefab.transform.localPosition = Vector3.zero
|
|
t[1] = prefab
|
|
singleAttList[i] = t
|
|
end
|
|
local Text = Util.GetGameObject(singleAttList[i][1], "Text"):GetComponent("Text")
|
|
local NoOpen = Util.GetGameObject(singleAttList[i][1], "NoOpen")
|
|
local Finishi = Util.GetGameObject(singleAttList[i][1], "Finishi")
|
|
local Button = Util.GetGameObject(singleAttList[i][1], "Button")
|
|
Util.AddOnceClick(Button, function()
|
|
if not CheckFunctionOpen(FUNCTION_OPEN_TYPE.TrainBuild) then
|
|
PopupTipPanel.ShowTip(Language[12784])
|
|
return
|
|
end
|
|
if (ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.TrainBuild)) then
|
|
NetManager.TrainingArchitectureInfoRequest(function()
|
|
UIManager.OpenPanel(UIName.TrainBuildPanel)
|
|
end)
|
|
else
|
|
local tip = ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.TrainBuild)
|
|
PopupTipPanel.ShowTip(tip)
|
|
end
|
|
end)
|
|
NoOpen:SetActive(not isOpen);
|
|
Finishi:SetActive(false);
|
|
|
|
|
|
|
|
-- local string,string2 = PracticeManager.GetPreviewSingleText(templist[i].id,templist[i].value)
|
|
|
|
local tAtt = {}
|
|
local trainExp = 100000
|
|
local curExp = 0
|
|
if not singleAttList[i][2] then
|
|
singleAttList[i][2] = {}
|
|
end
|
|
local singleTextList = singleAttList[i][2]
|
|
if i == 1 then
|
|
tAtt = TrainingSetting.AttackProperty
|
|
trainExp = TrainingSetting.TrainExp1
|
|
curExp = self._curHerodata.HeroTraining.attackExp
|
|
Text.text = Language[12785]
|
|
elseif i == 2 then
|
|
tAtt = TrainingSetting.HpProperty
|
|
trainExp = TrainingSetting.TrainExp2
|
|
curExp = self._curHerodata.HeroTraining.hpExp
|
|
Text.text = Language[12786]
|
|
elseif i == 3 then
|
|
tAtt = TrainingSetting.PhProperty
|
|
trainExp = TrainingSetting.TrainExp3
|
|
curExp = self._curHerodata.HeroTraining.defenseExp
|
|
Text.text = Language[12787]
|
|
end
|
|
for j = 1, #tAtt do
|
|
local str1, str2 = HeroManager.GetAttSingleText(tAtt[j][1], tAtt[j][2]);
|
|
if not singleTextList[j] then
|
|
singleTextList[j] = newObject(numPre)
|
|
singleTextList[j].transform:SetParent(singleAttList[i][1].transform)
|
|
singleTextList[j].transform.localScale = Vector3.one
|
|
singleTextList[j].transform.localPosition = Vector3.zero
|
|
end
|
|
singleTextList[j]:GetComponent("Text").text = GetLanguageStrById(str1) .. str2
|
|
singleTextList[j]:SetActive(true)
|
|
end
|
|
if tData.Level > curLevel then
|
|
curExp = 0
|
|
end
|
|
|
|
Button.gameObject:SetActive(isOpen and self.OpenType == 1);
|
|
local size = curExp / trainExp
|
|
if curExp >= trainExp then
|
|
curExp = trainExp
|
|
Button.gameObject:SetActive(false);
|
|
Finishi:SetActive(true);
|
|
end
|
|
if curLevel > tData.Level then
|
|
size = 1
|
|
curExp = trainExp
|
|
Finishi:SetActive(true)
|
|
NoOpen:SetActive(false)
|
|
Button.gameObject:SetActive(false);
|
|
end
|
|
size = size > 1 and 1 or size
|
|
Util.GetGameObject(singleAttList[i][1], "Progress/Image"):GetComponent("RectTransform").sizeDelta = Vector3.New(
|
|
360 * size, 25, 0)
|
|
Util.GetGameObject(singleAttList[i][1], "Progress/Text"):GetComponent("Text").text = string.format("%s/%s",
|
|
curExp, trainExp)
|
|
-- ForceRebuildLayout( singleAttList[i][1].transform)
|
|
|
|
singleAttList[i][1]:SetActive(true)
|
|
end
|
|
local activeIsOpen = false
|
|
|
|
if (tData.Level - curLevel == 1) and (self._curHerodata.HeroTraining.attackExp >= lastLevelTrainingSetting.TrainExp1 and self._curHerodata.HeroTraining.defenseExp >= lastLevelTrainingSetting.TrainExp2 and self._curHerodata.HeroTraining.hpExp >= lastLevelTrainingSetting.TrainExp3) and self._curHerodata.star >= lastLevelData.MyselfCondition and HeroManager.CheckTrainingCanLevelUp(self._curHerodata, self.curLevelData) then
|
|
activeIsOpen = true
|
|
else
|
|
activeIsOpen = false
|
|
end
|
|
ActiveButton:SetActive(activeIsOpen and self.OpenType == 1)
|
|
Util.AddOnceClick(ActiveButton, function()
|
|
NetManager.TrainingUpLvRequest(tostring(self._curHerodata.dynamicId), function()
|
|
self.curLevelData = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.Train, "HeroID",
|
|
self._curHerodata.id, "Level", self._curHerodata.HeroTraining.trainingLv)
|
|
local t = ConfigManager.TryGetAllConfigsDataByKey(ConfigName.Train, "HeroID", self._curHerodata.id)
|
|
if t then
|
|
for k, v in ipairs(t) do
|
|
if not self.showList[k] then
|
|
self.showList[k] = { data = v, curTrainingLevel = self._curHerodata.HeroTraining.trainingLv }
|
|
else
|
|
self.showList[k].curTrainingLevel = self._curHerodata.HeroTraining.trainingLv
|
|
end
|
|
end
|
|
end
|
|
self.ScrollView:SetData(self.showList, function(index, go)
|
|
self:SetSingleData(index, go, self.showList[index])
|
|
end)
|
|
end)
|
|
end)
|
|
local singleSkillList = self.attSkill[_go]
|
|
for k, v in ipairs(singleSkillList) do
|
|
if v then
|
|
v.gameObject:SetActive(false)
|
|
end
|
|
end
|
|
if tData.PassiveSkill and type(tData.PassiveSkill[1]) ~= "userdata" then
|
|
SkillContent:SetActive(true)
|
|
local skill = ConfigManager.GetConfigData(ConfigName.PassiveSkillConfig, tData.PassiveSkill[1])
|
|
local icon = Util.GetGameObject(SkillContent, "IconBG/Icon"):GetComponent("Image")
|
|
local Name = Util.GetGameObject(SkillContent, "IconBG/Text"):GetComponent("Text")
|
|
local Desc = Util.GetGameObject(SkillContent, "IconBG/des1/Text"):GetComponent("Text")
|
|
local itemPre = Util.GetGameObject(SkillContent, "Chose/Content/itemPre")
|
|
local localContent = Util.GetGameObject(SkillContent, "Chose/Content")
|
|
local Chose = Util.GetGameObject(SkillContent, "Chose")
|
|
local skillBtn = Util.GetGameObject(SkillContent, "Chose/Button")
|
|
local tip = Util.GetGameObject(SkillContent, "Chose/Tip")
|
|
local tip2 = Util.GetGameObject(SkillContent, "IconBG/Tip2")
|
|
tip:GetComponent("Text").text = Language[12242] .. NumToChinese[tData.Level] .. Language[11333]
|
|
Util.AddOnceClick(skillBtn, function()
|
|
if curLevel <= tData.Level and (TrainingSetting.TrainExp1 > self._curHerodata.HeroTraining.attackExp or TrainingSetting.TrainExp2 > self._curHerodata.HeroTraining.defenseExp or TrainingSetting.TrainExp3 > self._curHerodata.HeroTraining.hpExp) then
|
|
PopupTipPanel.ShowTip(Language[12788])
|
|
return
|
|
end
|
|
if tData.Level <= curLevel then
|
|
if #selectSkillUnlockItems1 == 0 or #selectSkillUnlockItems2 == 0 then
|
|
PopupTipPanel.ShowTip(Language[10054])
|
|
|
|
return
|
|
end
|
|
local item = {}
|
|
local pokemenons = {}
|
|
local godWeapon = {}
|
|
--local noHeroList={}
|
|
if selectSkillUnlockItems1[1].type == 3 then
|
|
for i = 1, #selectSkillUnlockItems1 do
|
|
local t = selectSkillUnlockItems1[i]
|
|
local pockemen = {}
|
|
pokemenons[i] = selectSkillUnlockItems1[i].dynamicId
|
|
end
|
|
--noHeroList=pokemenons
|
|
elseif selectSkillUnlockItems1[1].type == 4 then
|
|
for i = 1, #selectSkillUnlockItems1 do
|
|
local t = selectSkillUnlockItems1[i]
|
|
local pockemen = {}
|
|
godWeapon[i] = selectSkillUnlockItems1[i].dynamicId
|
|
end
|
|
--noHeroList=godWeapon
|
|
else
|
|
item.id = selectSkillUnlockItems1[1].itemData.id
|
|
item.itemNum = 1
|
|
item.itemtype = selectSkillUnlockItems1[1].itemData.itemType
|
|
end
|
|
local TrainingUnlockSkillHeroItem = {}
|
|
for i = 1, #selectSkillUnlockItems2 do
|
|
local t = selectSkillUnlockItems2[i]
|
|
local Heroitem = {}
|
|
Heroitem.type = t.type
|
|
if t.type == 1 then
|
|
Heroitem.id = t.dynamicId
|
|
else
|
|
Heroitem.id = t.id
|
|
end
|
|
Heroitem.num = 1
|
|
TrainingUnlockSkillHeroItem[i] = Heroitem
|
|
end
|
|
|
|
local magicSoldierIds = {}
|
|
magicSoldierIds[1] = ""
|
|
--LogError("111111111111111111111111111111111111111111111111111111111111111111111111111 noHeroList=="..#noHeroList.." TrainingUnlockSkillHeroItem=="..#TrainingUnlockSkillHeroItem)
|
|
NetManager.TrainingUnlockSkillRequest(self._curHerodata.dynamicId, tData.Id, pokemenons, godWeapon,
|
|
TrainingUnlockSkillHeroItem, item, function(msg)
|
|
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1)
|
|
if #TrainingUnlockSkillHeroItem > 0 then
|
|
local t = {}
|
|
for i = 1, #TrainingUnlockSkillHeroItem do
|
|
t[i] = TrainingUnlockSkillHeroItem[i].id
|
|
end
|
|
HeroManager.DeleteHeroDatas(t)
|
|
end
|
|
selectSkillUnlockItems1 = {}
|
|
selectSkillUnlockItems2 = {}
|
|
if pokemenons and #pokemenons > 0 then
|
|
PokemonManager.RemovePokemonData(pokemenons)
|
|
end
|
|
if godWeapon and #godWeapon > 0 then
|
|
--PokemonManager.RemovePokemonData(pokemenons)
|
|
GodWeaponManager.RemoveWeaponData(godWeapon)
|
|
end
|
|
if self.OpenType == 1 then
|
|
if CheckListIsContainValue1(self._curHerodata.HeroTraining.unlockIds, tData.Id) then
|
|
Chose:SetActive(false)
|
|
tip2:SetActive(true)
|
|
else
|
|
Chose:SetActive(true)
|
|
tip2:SetActive(false)
|
|
end
|
|
else
|
|
if CheckListIsContainValue1(self._curHerodata.HeroTraining.unlockIds, tData.Id) then
|
|
Chose:SetActive(false)
|
|
tip2:SetActive(true)
|
|
localContent:SetActive(true)
|
|
skillBtn:SetActive(true)
|
|
else
|
|
Chose:SetActive(true)
|
|
tip2:SetActive(false)
|
|
localContent:SetActive(false)
|
|
skillBtn:SetActive(false)
|
|
end
|
|
end
|
|
self.ScrollView:SetData(self.showList, function(index, go)
|
|
self:SetSingleData(index, go, self.showList[index])
|
|
UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(go.transform)
|
|
end)
|
|
--ForceRebuildLayout(_go.transform)
|
|
|
|
UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(_go.transform)
|
|
--ForceRebuildLayout(self.GameObject.transform)
|
|
--UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self.GameObject.transform)
|
|
UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self.GameObject.transform)
|
|
end)
|
|
end
|
|
end
|
|
)
|
|
icon.sprite = self.spLoader:LoadSprite(GetResourcePath(skill.Icon))
|
|
Name.text = GetLanguageStrById(skill.Name)
|
|
Desc.text = GetLanguageStrById(skill.Desc)
|
|
if self.OpenType == 1 then
|
|
if CheckListIsContainValue1(self._curHerodata.HeroTraining.unlockIds, tData.Id) then
|
|
Chose:SetActive(false)
|
|
tip2:SetActive(true)
|
|
else
|
|
Chose:SetActive(true)
|
|
tip2:SetActive(false)
|
|
end
|
|
else
|
|
if CheckListIsContainValue1(self._curHerodata.HeroTraining.unlockIds, tData.Id) then
|
|
Chose:SetActive(false)
|
|
tip2:SetActive(true)
|
|
localContent:SetActive(true)
|
|
skillBtn:SetActive(true)
|
|
else
|
|
Chose:SetActive(true)
|
|
tip2:SetActive(false)
|
|
localContent:SetActive(false)
|
|
skillBtn:SetActive(false)
|
|
end
|
|
end
|
|
local tmpData = {}
|
|
for i = 1, #tData.NeedItem1 do
|
|
tmpData[i] = {}
|
|
tmpData[i].data = tData.NeedItem1[i]
|
|
tmpData[i].type = 1 ---Item 栏位
|
|
if tData.NeedItem1[i][1] == 21 then
|
|
tmpData[i].type = 3
|
|
elseif tData.NeedItem1[i][1] == 53 then
|
|
tmpData[i].type = 4
|
|
end
|
|
if tData.NeedItem1[i][1] == 56 then
|
|
tmpData[i].Name = ItemBaseTypeName[tData.NeedItem1[i][2]]
|
|
else
|
|
tmpData[i].Name = ItemTypeName[tData.NeedItem1[i][1]]
|
|
end
|
|
tmpData[i].qua = tData.NeedItem1[i][3]
|
|
end
|
|
local index = #tmpData
|
|
for i = index + 1, index + #tData.NeedHero do
|
|
-- local HeroGroup=ConfigManager.GetConfigData(ConfigName.HeroRankupGroup,tData.NeedHero[i-index][1])
|
|
tmpData[i] = {}
|
|
-- if HeroGroup then
|
|
tmpData[i].heroGroupData = tData.NeedHero[i - index]
|
|
tmpData[i].type = 2 --hero烂尾
|
|
tmpData[i].Name = ItemTypeName[1]
|
|
-- end
|
|
tmpData[i].NeedHeroOther = tData.NeedHeroOther
|
|
end
|
|
for i = 1, #tmpData do
|
|
if not singleSkillList[i] then
|
|
singleSkillList[i] = newObject(itemPre)
|
|
singleSkillList[i].transform:SetParent(Util.GetGameObject(SkillContent, "Chose/Content").transform)
|
|
singleSkillList[i].transform.localScale = Vector3.one
|
|
singleSkillList[i].transform.localPosition = Vector3.zero
|
|
end
|
|
local curData = tmpData[i]
|
|
local itemIcon = Util.GetGameObject(singleSkillList[i], "hero/icon"):GetComponent("Image")
|
|
if curData.type == 1 then
|
|
Util.GetGameObject(singleSkillList[i], "Name"):GetComponent("Text").text = GetQuantityStrByquality(
|
|
curData.data[3]) .. curData.Name
|
|
itemIcon.sprite = self.spLoader:LoadSprite("r_characterbg_blue")
|
|
elseif curData.type == 2 then
|
|
Util.GetGameObject(singleSkillList[i], "Name"):GetComponent("Text").text = NumToChinese
|
|
[curData.heroGroupData[1]] .. Language[10473] .. curData.Name
|
|
itemIcon.sprite = self.spLoader:LoadSprite("r_hero_jinjie-touxiang2")
|
|
else
|
|
Util.GetGameObject(singleSkillList[i], "Name"):GetComponent("Text").text = GetQuantityStrByquality(
|
|
curData.data[3]) .. curData.Name
|
|
itemIcon.sprite = self.spLoader:LoadSprite("r_characterbg_blue")
|
|
end
|
|
local needNum = Util.GetGameObject(singleSkillList[i], "hero/lvbg/CountText"):GetComponent("Text")
|
|
local neednum = 1
|
|
if curData.type == 1 then
|
|
needNum.text = "0" .. "/" .. curData.data[4]
|
|
neednum = curData.data[4]
|
|
elseif curData.type == 2 then
|
|
needNum.text = "0" .. "/" .. curData.heroGroupData[2]
|
|
neednum = curData.heroGroupData[2]
|
|
else
|
|
needNum.text = "0" .. "/" .. curData.data[4]
|
|
neednum = curData.data[4]
|
|
end
|
|
|
|
local add = Util.GetGameObject(singleSkillList[i], "hero/icon/add")
|
|
local Btn = Util.GetGameObject(singleSkillList[i], "frame")
|
|
|
|
Util.AddOnceClick(Btn, function()
|
|
if curLevel <= tData.Level and (TrainingSetting.TrainExp1 > self._curHerodata.HeroTraining.attackExp or TrainingSetting.TrainExp2 > self._curHerodata.HeroTraining.defenseExp or TrainingSetting.TrainExp3 > self._curHerodata.HeroTraining.hpExp) then
|
|
PopupTipPanel.ShowTip(Language[12788])
|
|
return
|
|
end
|
|
UIManager.OpenPanel(UIName.TrainingItemListPanel, curData,
|
|
function(selectItems, selectHeroOrItems)
|
|
LogError("curData.type======================" .. curData.type)
|
|
itemIcon.gameObject:SetActive(true)
|
|
if curData.type == 1 then
|
|
selectSkillUnlockItems1 = {}
|
|
if #selectItems > 0 then
|
|
selectSkillUnlockItems1 = {}
|
|
itemIcon.sprite = self.spLoader:LoadSprite(selectItems[1].itemData.icon)
|
|
add:SetActive(false)
|
|
needNum.text = #selectItems .. "/" .. neednum
|
|
for i = 1, #selectItems do
|
|
selectSkillUnlockItems1[i] = selectItems[i]
|
|
end
|
|
else
|
|
itemIcon.sprite = self.spLoader:LoadSprite("r_characterbg_blue")
|
|
add:SetActive(true)
|
|
needNum.text = "0" .. "/" .. neednum
|
|
end
|
|
elseif curData.type == 2 then
|
|
selectSkillUnlockItems2 = {}
|
|
if #selectHeroOrItems > 0 then
|
|
if selectHeroOrItems[1].type == 1 then
|
|
itemIcon.sprite = self.spLoader:LoadSprite(selectHeroOrItems[1].icon)
|
|
needNum.text = #selectHeroOrItems .. "/" .. neednum
|
|
else
|
|
local itemConfig = ConfigManager.TryGetConfigData(ConfigName.ItemConfig,
|
|
selectHeroOrItems[1].id)
|
|
if not itemConfig then return end
|
|
|
|
-- icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig.ResourceID))
|
|
itemIcon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig.ResourceID))
|
|
needNum.text = #selectHeroOrItems .. "/" .. neednum
|
|
end
|
|
for i = 1, #selectHeroOrItems do
|
|
selectSkillUnlockItems2[i] = selectHeroOrItems[i]
|
|
end
|
|
add:SetActive(false)
|
|
else
|
|
itemIcon.sprite = self.spLoader:LoadSprite("r_hero_jinjie-touxiang2")
|
|
add:SetActive(true)
|
|
needNum.text = "0" .. "/" .. neednum
|
|
end
|
|
elseif curData.type == 3 then
|
|
selectSkillUnlockItems1 = {}
|
|
if #selectItems > 0 then
|
|
--LogError("selectItems======================"..#selectItems.." selectItems[1].type==="..selectItems[1].type)
|
|
if selectItems[1].type == 1 or selectItems[1].type == 3 then
|
|
itemIcon.sprite = self.spLoader:LoadSprite(selectItems[1].icon)
|
|
else
|
|
local itemConfig = ConfigManager.TryGetConfigData(ConfigName.ItemConfig,
|
|
selectItems[1].id)
|
|
if not itemConfig then return end
|
|
-- icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig.ResourceID))
|
|
itemIcon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig.ResourceID))
|
|
needNum.text = #selectItems .. "/" .. neednum
|
|
end
|
|
for i = 1, #selectItems do
|
|
selectSkillUnlockItems1[i] = selectItems[i]
|
|
end
|
|
add:SetActive(false)
|
|
else
|
|
itemIcon.sprite = self.spLoader:LoadSprite("UI_hz_zhonghe05_70")
|
|
add:SetActive(true)
|
|
needNum.text = "0" .. "/" .. neednum
|
|
end
|
|
elseif curData.type == 4 then
|
|
selectSkillUnlockItems1 = {}
|
|
if #selectItems > 0 then
|
|
LogError("selectItems======================" ..
|
|
#selectItems ..
|
|
" selectItems[1].type===" ..
|
|
selectItems[1].type .. "selectItems[1].id==" .. selectItems[1].id)
|
|
local itemConfig = ConfigManager.TryGetConfigData(ConfigName.ItemConfig,
|
|
selectItems[1].id)
|
|
if not itemConfig then return end
|
|
itemIcon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig.ResourceID))
|
|
needNum.text = #selectItems .. "/" .. neednum
|
|
for i = 1, #selectItems do
|
|
selectSkillUnlockItems1[i] = selectItems[i]
|
|
end
|
|
add:SetActive(false)
|
|
else
|
|
itemIcon.sprite = self.spLoader:LoadSprite("UI_hz_zhonghe05_70")
|
|
add:SetActive(true)
|
|
needNum.text = "0" .. "/" .. neednum
|
|
end
|
|
end
|
|
end
|
|
, neednum, selectSkillUnlockItems1, selectSkillUnlockItems2, self)
|
|
end)
|
|
|
|
singleSkillList[i]:SetActive(true)
|
|
end
|
|
else
|
|
SkillContent:SetActive(false)
|
|
end
|
|
UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(_go.transform)
|
|
_go:SetActive(true)
|
|
end
|
|
|
|
function SpecailTrainingInfoPopup:SetSingleData2(index, _go, _data)
|
|
|
|
end
|
|
|
|
function SpecailTrainingInfoPopup:CheckCanLvUp(curLevel, tdLevel)
|
|
|
|
end
|
|
|
|
function SpecailTrainingInfoPopup:OnClose()
|
|
selectSkillUnlockItems1 = {}
|
|
selectSkillUnlockItems2 = {}
|
|
self.OpenType = 1
|
|
end
|
|
|
|
function SpecailTrainingInfoPopup:OnDestroy()
|
|
|
|
end
|
|
|
|
return SpecailTrainingInfoPopup
|