527 lines
25 KiB
Lua
527 lines
25 KiB
Lua
--- 猎妖师详情弹窗(滚动条版本) ---
|
||
require("Base/BasePanel")
|
||
RoleInfoPopup = Inherit(BasePanel)
|
||
local this = RoleInfoPopup
|
||
local curHeroData
|
||
local triggerCallBack
|
||
local allSkillDatas = {}
|
||
local soulPrintPreList={}--魂印预设容器
|
||
local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig)
|
||
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||
local heroRankupConfig=ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
|
||
local jewelConfig=ConfigManager.GetConfig(ConfigName.JewelConfig)
|
||
local formationId
|
||
local pinjieImage={"r_hero_pinjiebiao_01","r_hero_pinjiebiao_02"} --该死的品阶图片 1是未激活 2是激活
|
||
|
||
local orginLayer2 = 0
|
||
local orginLayer = 0
|
||
local formationHeroNum = nil
|
||
--初始化组件(用于子类重写)
|
||
function RoleInfoPopup:InitComponent()
|
||
this.spLoader = SpriteLoader.New()
|
||
|
||
this.content = Util.GetGameObject(self.transform, "Panel/Scroll View/Viewport/Content"):GetComponent("RectTransform")
|
||
this.backBtn = Util.GetGameObject(self.transform, "Panel/BackBtn")
|
||
|
||
this.roleInfo0 = Util.GetGameObject(self.transform, "Panel/Scroll View/Viewport/Content/RoleInfo0")
|
||
this.head = Util.GetGameObject(this.roleInfo0, "Head")
|
||
this.head_Frame = Util.GetGameObject(this.roleInfo0, "Frame"):GetComponent("Image")
|
||
this.head_Icon = Util.GetGameObject(this.head, "Icon"):GetComponent("Image")
|
||
this.head_Pro=Util.GetGameObject(this.head,"Pro"):GetComponent("Image")
|
||
this.head_Lv = Util.GetGameObject(this.head, "Lv/Text"):GetComponent("Text")
|
||
this.head_Star = Util.GetGameObject(this.head, "Star")
|
||
this.roleName = Util.GetGameObject(this.roleInfo0, "RoleName"):GetComponent("Text")
|
||
this.power = Util.GetGameObject(this.roleInfo0, "Power/PowerValue"):GetComponent("Text")
|
||
this.radar = Util.GetGameObject(this.roleInfo0, "ProRadarImage/Radar"):GetComponent("RadarChart")
|
||
this.talentBtn=Util.GetGameObject(this.roleInfo0,"Other/TalentBtn")
|
||
this.talentProgress=Util.GetGameObject(this.roleInfo0,"Other/TalentBtn/Progress"):GetComponent("Text")
|
||
this.talismanBtn=Util.GetGameObject(this.roleInfo0,"Other/TalismanBtn")
|
||
this.talismanIcon = Util.GetGameObject(this.roleInfo0, "Other/TalismanBtn/Icon")
|
||
this.talismanLock = Util.GetGameObject(this.roleInfo0, "Other/TalismanBtn/lockImage")
|
||
this.talismanlv=Util.GetGameObject(this.roleInfo0,"Other/TalismanBtn/LvText")
|
||
this.talismanlvText = Util.GetGameObject(this.roleInfo0, "Other/TalismanBtn/LvText/Text"):GetComponent("Text")
|
||
|
||
this.roleInfo1 = Util.GetGameObject(self.transform, "Panel/Scroll View/Viewport/Content/RoleInfo1")
|
||
this.atk = Util.GetGameObject(this.roleInfo1, "Pro/Atk/ProValue"):GetComponent("Text")
|
||
this.hp = Util.GetGameObject(this.roleInfo1, "Pro/Hp/ProValue"):GetComponent("Text")
|
||
this.phyDef = Util.GetGameObject(this.roleInfo1, "Pro/PhyDef/ProValue"):GetComponent("Text")
|
||
this.magDef = Util.GetGameObject(this.roleInfo1, "Pro/MagDef/ProValue"):GetComponent("Text")
|
||
this.skillGrid = Util.GetGameObject(this.roleInfo1, "Skill")
|
||
this.skill1 = Util.GetGameObject(this.skillGrid, "S1")
|
||
this.skill2 = Util.GetGameObject(this.skillGrid, "S2")
|
||
this.selsectSkillImage = Util.GetGameObject(this.skillGrid, "SelsectSkillImage")
|
||
this.posBgImage=Util.GetGameObject(this.roleInfo1,"Pos"):GetComponent("Image")
|
||
this.posImage=Util.GetGameObject(this.roleInfo1,"Pos/PosImage"):GetComponent("Image")
|
||
this.posText=Util.GetGameObject(this.roleInfo1,"Pos/PosText"):GetComponent("Text")
|
||
--品阶
|
||
this.pinjieList={}
|
||
this.pinjieRoot=Util.GetGameObject(this.roleInfo1,"Pinjie")
|
||
this.pinjiePre=Util.GetGameObject(this.roleInfo1,"Pre")
|
||
|
||
this.proBtn=Util.GetGameObject(this.roleInfo1,"ProTitle/Btn")--基础属性
|
||
|
||
this.equipInfo = Util.GetGameObject(self.transform, "Panel/Scroll View/Viewport/Content/EquipInfo")
|
||
this.equipTitle=Util.GetGameObject(this.equipInfo,"BG/EquipTitle")
|
||
this.babyTitle=Util.GetGameObject(this.equipInfo,"BG/BabyTitle")
|
||
this.grid=Util.GetGameObject(this.equipInfo, "Grid")
|
||
this.selsectEquipImage = Util.GetGameObject(this.equipInfo, "SelsectEquipImage")
|
||
--装备
|
||
this.equipGrid = Util.GetGameObject(this.grid, "EquipGrid")
|
||
--宝物
|
||
this.babyGrid=Util.GetGameObject(this.grid, "BabyGrid")
|
||
|
||
--魂印
|
||
this.soulPrintInfo = Util.GetGameObject(self.transform, "Panel/Scroll View/Viewport/Content/SoulPrintInfo")
|
||
this.soulPrintGrid = Util.GetGameObject(this.soulPrintInfo, "Grid")
|
||
this.soulPrintPre=Util.GetGameObject(this.soulPrintGrid,"SoulPrintPre")
|
||
|
||
this.shenhunList = {}
|
||
this.shenhunRoot = Util.GetGameObject(this.roleInfo1,"shenhun")
|
||
for i = 1,5 do
|
||
if not this.shenhunList[i] then
|
||
this.shenhunList[i] = {}
|
||
end
|
||
this.shenhunList[i].go = Util.GetGameObject(this.shenhunRoot, "shenhunPre"..i)
|
||
this.shenhunList[i].goItem = Util.GetGameObject(this.shenhunList[i].go, "godItem")
|
||
this.shenhunList[i].fx_shenhun = Util.GetGameObject(this.shenhunList[i].go, "fx_shenhun")
|
||
end
|
||
this.ShenhunBtn = Util.GetGameObject(this.shenhunRoot,"ShenhunBtn")
|
||
end
|
||
|
||
--绑定事件(用于子类重写)
|
||
function RoleInfoPopup:BindEvent()
|
||
Util.AddClick(this.ShenhunBtn,function()
|
||
local s = function()
|
||
local pro = {}
|
||
local lv = curHeroData.godSoulLv
|
||
local skillList = GodSoulManager.GetGodSoulDataByLv(curHeroData.heroConfig.Id,0)
|
||
|
||
for i = 1,LengthOfTable(skillList) do
|
||
local color = "B9AC97"
|
||
if lv >= i then
|
||
color = "00FF00"
|
||
end
|
||
table.insert(pro,string.format("<color=#%s>神魂%s:%s</color>",color,i,skillList[i].skill))
|
||
end
|
||
return pro
|
||
end
|
||
local data = {}
|
||
local singData = {}
|
||
singData.title = "神魂效果"
|
||
singData.pro = s()
|
||
table.insert(data,singData)
|
||
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.ShenHunShuXing,data)
|
||
end)
|
||
Util.AddClick(this.talentBtn,function()
|
||
UIManager.OpenPanel(UIName.RoleTalentPopup,curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId)
|
||
end)
|
||
Util.AddClick(this.backBtn, function()
|
||
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
||
self:ClosePanel()
|
||
end)
|
||
Util.AddClick(this.skill1, function()
|
||
if Game.GlobalEvent:HasEvent(GameEvent.UI.OnClose, triggerCallBack) then
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
|
||
end
|
||
this:SetSkillSelectImage(this.skill1.transform, true)
|
||
|
||
local star,starType = curHeroData.GetStar(1)
|
||
local maxLv = HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id, allSkillDatas[1].skillConfig.Type)
|
||
local panel = UIManager.OpenPanel(UIName.SkillInfoPopup, allSkillDatas[1], 4, 10, maxLv, 1,nil,star)
|
||
--this.skillGrid:GetComponent("Canvas").overrideSorting=true
|
||
--this.skillGrid:GetComponent("Canvas").sortingOrder = panel.sortingOrder + 1
|
||
triggerCallBack = function(panelType, p)
|
||
if panelType == UIName.SkillInfoPopup and p == panel then
|
||
--监听到SkillInfoPopup关闭,把层级设回去
|
||
--this.skillGrid:GetComponent("Canvas").overrideSorting=false
|
||
--this.skillGrid:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
|
||
this:SetSkillSelectImage(self.transform, false)
|
||
end
|
||
end
|
||
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack)
|
||
end)
|
||
Util.AddClick(this.skill2, function()
|
||
if Game.GlobalEvent:HasEvent(GameEvent.UI.OnClose, triggerCallBack) then
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
|
||
end
|
||
this:SetSkillSelectImage(this.skill2.transform, true)
|
||
|
||
|
||
Log("===============22222 "..allSkillDatas[2].skillConfig.Type)
|
||
|
||
local star,starType = curHeroData.GetStar(1)
|
||
local maxLv = HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id, allSkillDatas[2].skillConfig.Type)
|
||
local panel = UIManager.OpenPanel(UIName.SkillInfoPopup, allSkillDatas[2], 4, 10, maxLv, 2,nil,star)
|
||
--this.skillGrid:GetComponent("Canvas").overrideSorting=true
|
||
--this.skillGrid:GetComponent("Canvas").sortingOrder = panel.sortingOrder + 1
|
||
triggerCallBack = function(panelType, p)
|
||
if panelType == UIName.SkillInfoPopup and p == panel then
|
||
--监听到SkillInfoPopup关闭,把层级设回去
|
||
-- this.skillGrid:GetComponent("Canvas").overrideSorting=false
|
||
--this.skillGrid:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
|
||
this:SetSkillSelectImage(self.transform, false)
|
||
end
|
||
end
|
||
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack)
|
||
end)
|
||
end
|
||
|
||
--添加事件监听(用于子类重写)
|
||
function RoleInfoPopup:AddListener()
|
||
|
||
end
|
||
|
||
--移除事件监听(用于子类重写)
|
||
function RoleInfoPopup:RemoveListener()
|
||
|
||
end
|
||
|
||
--界面打开时调用(用于子类重写)
|
||
function RoleInfoPopup:OnOpen(...)
|
||
|
||
this.selsectEquipImage:SetActive(false)
|
||
this.selsectSkillImage:SetActive(false)
|
||
local arg = { ... }
|
||
curHeroData = arg[1]
|
||
LogGreen("curHeroData:"..curHeroData.dynamicId)
|
||
this.isOther = arg[2]
|
||
choosedList = arg[3] or nil
|
||
formationHeroNum = arg[4] or nil
|
||
end
|
||
|
||
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||
function RoleInfoPopup:OnShow()
|
||
this.content:DOAnchorPosY(566, 0)
|
||
this.RoleInfo0()
|
||
this.RoleInfo1()
|
||
this.EquipInfo()
|
||
this.SoulPrintInfo()
|
||
end
|
||
|
||
--界面关闭时调用(用于子类重写)
|
||
function RoleInfoPopup:OnClose()
|
||
|
||
end
|
||
|
||
--界面销毁时调用(用于子类重写)
|
||
function RoleInfoPopup:OnDestroy()
|
||
for k,v in pairs(this.treasureDatas) do
|
||
SubUIManager.Close(v)
|
||
end
|
||
this.treasureDatas = {}
|
||
this.spLoader:Destroy()
|
||
soulPrintPreList={}
|
||
this.pinjieList={}
|
||
soulPrintPreList={}
|
||
orginLayer2=0
|
||
this.shenhunList = {}
|
||
orginLayer=0
|
||
end
|
||
|
||
--设置技能选中外框
|
||
function this:SetSkillSelectImage(_goTran, _type)
|
||
--_goTran父级 _type==true 显示 =false 隐藏
|
||
this.selsectSkillImage:SetActive(_type)
|
||
--this.selsectSkillImage.transform:SetParent(_goTran)
|
||
--this.selsectSkillImage.transform.localScale = Vector3.one
|
||
--this.selsectSkillImage.transform.localPosition=Vector3.zero
|
||
this.selsectSkillImage.transform.position = _goTran.position
|
||
end
|
||
--设置装备选中外框
|
||
function this:SetEquipSelectImage(_goTran, _type)
|
||
--_goTran父级 _type==true 显示 =false 隐藏
|
||
this.selsectEquipImage:SetActive(_type)
|
||
this.selsectEquipImage.transform:SetParent(_goTran)
|
||
this.selsectEquipImage.transform.localScale = Vector3.one
|
||
this.selsectEquipImage.transform.localPosition = Vector3.zero
|
||
end
|
||
|
||
--RoleInfo0
|
||
function this.RoleInfo0()
|
||
LogBlue(curHeroData.id.." "..curHeroData.dynamicId)
|
||
this.head_Frame.sprite = this.spLoader:LoadSprite(GetHeroQuantityImageByquality(curHeroData.heroConfig.Quality, curHeroData.star))
|
||
this.head_Icon.sprite = this.spLoader:LoadSprite(curHeroData.icon)
|
||
this.head_Pro.sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(curHeroData.heroConfig.PropertyName))
|
||
this.head_Lv.text = curHeroData.lv
|
||
local star,starType = curHeroData.GetStar(1)
|
||
SetHeroStars(this.spLoader, this.head_Star, star,starType)
|
||
Util.SetParticleSortLayer(this.head_Star,this.sortingOrder + 1)
|
||
this.roleName.text = curHeroData.name
|
||
|
||
local allAddProVal = {}
|
||
if this.isOther then
|
||
this.power.text = curHeroData.actionPower
|
||
else
|
||
this.power.text = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, formationId)
|
||
end
|
||
|
||
this.radar:SetEdges({ curHeroData.heroConfig.AttackScale / 100, curHeroData.heroConfig.DefenseScale / 100, curHeroData.heroConfig.AssistScale / 100 })
|
||
this.radar.color = Color.New(238 / 255, 211 / 255, 156 / 255, 102 / 255)
|
||
--天赋
|
||
this.talentBtn:SetActive(curHeroData.heroConfig.OpenPassiveSkillRules ~= nil)
|
||
local talentBtnImage = curHeroData.star == HeroManager.awakeNextStarIndex and "r_hero_tianfu2_zh" or "r_hero_tianfu1_zh"
|
||
this.talentBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite(talentBtnImage)
|
||
local OpenPassiveSkillRules = curHeroData.star == HeroManager.awakeNextStarIndex and curHeroData.heroConfig.Awaken or curHeroData.heroConfig.OpenPassiveSkillRules
|
||
if OpenPassiveSkillRules then
|
||
local openlists,compoundOpenNum,compoundNum = HeroManager.GetAllPassiveSkillIds(curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId)
|
||
this.talentProgress.text = #openlists - compoundOpenNum .."/"..#OpenPassiveSkillRules - compoundNum
|
||
end
|
||
--法宝
|
||
this.TalismanInfo()
|
||
end
|
||
--RoleInfo1
|
||
function this.RoleInfo1()
|
||
--定位描述相关
|
||
this.posBgImage.sprite=this.spLoader:LoadSprite(GetHeroPosBgStr(curHeroData.heroConfig.Profession))
|
||
this.posImage.sprite=this.spLoader:LoadSprite(GetHeroPosStr(curHeroData.heroConfig.Profession))
|
||
this.posText.text=GetLanguageStrById(curHeroData.heroConfig.HeroLocation)
|
||
SetTextVerTial(this.posText.gameObject,Vector3.New(64,0,0),"MiddleLeft")
|
||
|
||
local star,starType = curHeroData.GetStar(1)
|
||
if starType == 3 then
|
||
this.pinjieRoot.gameObject:SetActive(false)
|
||
this.shenhunRoot.gameObject:SetActive(true)
|
||
for i = 1,#this.shenhunList do
|
||
if i > star then
|
||
this.shenhunList[i].fx_shenhun.gameObject:SetActive(false)
|
||
this.shenhunList[i].goItem.gameObject:SetActive(true)
|
||
else
|
||
this.shenhunList[i].goItem.gameObject:SetActive(false)
|
||
this.shenhunList[i].fx_shenhun.gameObject:SetActive(true)
|
||
Util.SetParticleScale(this.shenhunList[i].fx_shenhun,1/this.shenhunList[i].fx_shenhun.transform.localScale.x)
|
||
Util.SetParticleScale(this.shenhunList[i].fx_shenhun,1.2)
|
||
end
|
||
end
|
||
else
|
||
this.shenhunRoot.gameObject:SetActive(false)
|
||
this.pinjieRoot.gameObject:SetActive(true)
|
||
--品阶
|
||
local pId=0
|
||
if curHeroData.breakId~=0 then
|
||
pId= heroRankupConfig[curHeroData.breakId].Phase[2]
|
||
end
|
||
local hruConfig= ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.HeroRankupConfig,"Star",curHeroData.heroConfig.Star,"Show",1) --动态获取不同英雄最大突破等阶
|
||
for i = 1, #hruConfig do --动态生成
|
||
local item=this.pinjieList[i]
|
||
if not item then
|
||
item= newObjToParent(this.pinjiePre,this.pinjieRoot)
|
||
item.name="Pre"..i
|
||
this.pinjieList[i]=item
|
||
end
|
||
this.pinjieList[i]:GetComponent("Image").sprite=this.spLoader:LoadSprite(i<=pId and pinjieImage[2] or pinjieImage[1])
|
||
end
|
||
for n = 1, this.pinjieRoot.transform.childCount - 1 do --超过品阶关闭显示
|
||
this.pinjieRoot.transform:GetChild(n).gameObject:SetActive(n<=#hruConfig)
|
||
end
|
||
end
|
||
|
||
--基础属性
|
||
local allAddProVal = {}
|
||
if (this.isOther) then
|
||
--this.atk.text = curHeroData.attack
|
||
--this.hp.text = curHeroData.hp
|
||
--this.phyDef.text = curHeroData.pDef
|
||
--this.magDef.text = curHeroData.mDef
|
||
allAddProVal = curHeroData.allAddProVal
|
||
else
|
||
-- allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId, formationId)
|
||
if choosedList then
|
||
-- local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal(choosedList,curHeroData.dynamicId)
|
||
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal,formationHeroNum)
|
||
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId,FormationTypeDef.FORMATION_NORMAL)
|
||
else
|
||
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,false,{},formationHeroNum)
|
||
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId)
|
||
end
|
||
end
|
||
this.atk.text = allAddProVal[HeroProType.Attack]
|
||
this.hp.text = allAddProVal[HeroProType.Hp]
|
||
this.phyDef.text = allAddProVal[HeroProType.PhysicalDefence]
|
||
this.magDef.text = allAddProVal[HeroProType.MagicDefence]
|
||
Util.AddOnceClick(this.proBtn,function()
|
||
local guildSkill = nil
|
||
if this.isOther then guildSkill = curHeroData.guildSkill end
|
||
UIManager.OpenPanel(UIName.RoleProInfoPopup,allAddProVal,curHeroData.heroConfig,true,guildSkill)
|
||
end)
|
||
|
||
|
||
--this.skillGrid:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1
|
||
allSkillDatas = HeroManager.GetCurHeroSidAndCurStarAllSkillDatas(curHeroData.id,curHeroData.star)
|
||
if allSkillDatas[1] and allSkillDatas[1].skillConfig and allSkillDatas[1].skillConfig.Name then
|
||
this.skill1:SetActive(true)
|
||
Util.GetGameObject(this.skill1.transform,"Icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(allSkillDatas[1].skillConfig.Icon))
|
||
Util.GetGameObject(this.skill1.transform, "Text"):GetComponent("Text").text = GetLanguageStrById(allSkillDatas[1].skillConfig.Name)--"lv." .. (allSkillDatas[1].skillId % 10)
|
||
Util.GetGameObject(this.skill1.transform,"SkillTypeImage"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetSkillType(allSkillDatas[1]))
|
||
else
|
||
this.skill1:SetActive(false)
|
||
end
|
||
if allSkillDatas[2] and allSkillDatas[2].skillConfig and allSkillDatas[2].skillConfig.Name then
|
||
this.skill2:SetActive(true)
|
||
Util.GetGameObject(this.skill2.transform,"Icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(allSkillDatas[2].skillConfig.Icon))
|
||
Util.GetGameObject(this.skill2.transform, "Text"):GetComponent("Text").text = GetLanguageStrById(allSkillDatas[2].skillConfig.Name)--"lv." .. (allSkillDatas[2].skillId % 10)
|
||
Util.GetGameObject(this.skill2.transform,"SkillTypeImage"):GetComponent("Image").sprite= this.spLoader:LoadSprite(GetSkillType(allSkillDatas[2]))
|
||
else
|
||
this.skill2:SetActive(false)
|
||
end
|
||
|
||
for i = 1,#this.shenhunList do
|
||
Util.SetParticleSortLayer(this.shenhunList[i].fx_shenhun,this.sortingOrder + 1)
|
||
end
|
||
end
|
||
--装备
|
||
function this.EquipInfo()
|
||
if not this.treasureDatas then
|
||
this.treasureDatas = {}
|
||
end
|
||
for k,v in pairs(this.treasureDatas) do
|
||
v.gameObject:SetActive(false)
|
||
end
|
||
|
||
local curHeroEquipDatas = {}
|
||
for i = 1, #curHeroData.equipIdList do
|
||
local equipData = GoodFriendManager.GetSingleEquipData(curHeroData.equipIdList[i]) or EquipManager.GetSingleEquipData(curHeroData.equipIdList[i])
|
||
if equipData ~= nil then
|
||
curHeroEquipDatas[equipData.equipConfig.Position] = equipData
|
||
end
|
||
end
|
||
for i = 1, this.equipGrid.transform.childCount do
|
||
local go = this.equipGrid.transform:GetChild(i - 1).gameObject
|
||
local pos = Util.GetGameObject(go.transform, "pos")
|
||
local curEquipData
|
||
if curHeroEquipDatas[i] then
|
||
curEquipData = curHeroEquipDatas[i]
|
||
if not this.treasureDatas[pos] then
|
||
this.treasureDatas[pos] = SubUIManager.Open(SubUIConfig.ItemView,pos.transform)
|
||
end
|
||
this.treasureDatas[pos].gameObject:SetActive(true)
|
||
this.treasureDatas[pos].transform:SetAsFirstSibling()
|
||
this.treasureDatas[pos]:OnOpen(false, {curEquipData.id,0}, 0.8, false, false, false, 0)
|
||
end
|
||
|
||
local frameBtn = Util.GetGameObject(pos, "mask")
|
||
Util.AddOnceClick(frameBtn, function()
|
||
if curEquipData then
|
||
UIManager.OpenPanel(UIName.RoleEquipChangePopup, this, 2, curHeroData, curHeroEquipDatas[i],0,nil,0)
|
||
end
|
||
end)
|
||
end
|
||
|
||
|
||
--宝器
|
||
for m = 1, 2 do
|
||
Util.GetGameObject(this.babyGrid,"Pre"..m.."/Text"):GetComponent("RectTransform").sizeDelta = GetCurLanguage() == 0 and Vector2.New(48, 95) or Vector2.New(95, 95)
|
||
end
|
||
local b = #curHeroData.jewels>0
|
||
this.babyTitle.gameObject:SetActive(b)
|
||
this.babyGrid.gameObject:SetActive(b)
|
||
local v3 = b and Vector2.New(-145,75) or Vector2.New(0,75)
|
||
this.equipTitle.transform:DOAnchorPos(v3,0)
|
||
|
||
|
||
for n = 1, #curHeroData.jewels do
|
||
local did=curHeroData.jewels[n]
|
||
local data = EquipTreasureManager.GetSingleTreasureByIdDyn(did)
|
||
if not data then
|
||
data = MonsterCampManager.GetSingleTreasureByIdDyn(did)
|
||
end
|
||
if not data then
|
||
data = ExpeditionManager.GetSingleTreasureByIdDyn(did)
|
||
end
|
||
if not data then
|
||
data = GoodFriendManager.GetSingleTreasureByIdDyn(did)
|
||
end
|
||
local pos = Util.GetGameObject(this.babyGrid,"Pre"..n.."/pos")
|
||
local btn = Util.GetGameObject(pos,"mask")
|
||
if not this.treasureDatas[pos] then
|
||
this.treasureDatas[pos] = SubUIManager.Open(SubUIConfig.ItemView,pos.transform)
|
||
end
|
||
this.treasureDatas[pos].gameObject:SetActive(true)
|
||
this.treasureDatas[pos].transform:SetAsFirstSibling()
|
||
this.treasureDatas[pos]:OnOpen(false, {data.id,0}, 0.8, false, false, false, 0,did)
|
||
Util.AddOnceClick(btn,function()
|
||
if did and data then
|
||
UIManager.OpenPanel(UIName.RoleEquipTreasureChangePopup,this,2,curHeroData,data,nil,pos,0)
|
||
end
|
||
end)
|
||
end
|
||
end
|
||
--魂印
|
||
|
||
function this.SoulPrintInfo()
|
||
local curHeroSoulPrintDatas = {}
|
||
this.soulPrintInfo.gameObject:SetActive(#curHeroData.soulPrintList~=0)
|
||
for key, value in pairs(soulPrintPreList) do
|
||
if value then
|
||
value:SetActive(false)
|
||
end
|
||
end
|
||
if #curHeroData.soulPrintList==0 then return end
|
||
|
||
for i,v in pairs(curHeroData.soulPrintList) do --生成预设
|
||
if not soulPrintPreList[i] then
|
||
soulPrintPreList[i]=newObjToParent(this.soulPrintPre,this.soulPrintGrid)
|
||
end
|
||
soulPrintPreList[i].name="Pre"..i
|
||
soulPrintPreList[i]:SetActive(true)
|
||
--特效层级重设
|
||
for i=1,#soulPrintPreList do
|
||
Util.AddParticleSortLayer(soulPrintPreList[i], this.sortingOrder- orginLayer2)
|
||
end
|
||
orginLayer2 = this.sortingOrder
|
||
orginLayer=this.sortingOrder
|
||
|
||
local frame=Util.GetGameObject(soulPrintPreList[i],"Frame"):GetComponent("Image")
|
||
local icon=Util.GetGameObject(soulPrintPreList[i],"circleFrameBg/Icon"):GetComponent("Image")
|
||
frame.sprite=this.spLoader:LoadSprite(GetQuantityImageByquality(equipConfig[v.equipId].Quality))
|
||
icon.sprite=this.spLoader:LoadSprite(GetResourcePath(itemConfig[v.equipId].ResourceID))
|
||
Util.GetGameObject(soulPrintPreList[i],"circleFrameBg"):GetComponent("Image").sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[itemConfig[v.equipId].Quantity].circleBg2)
|
||
Util.GetGameObject(soulPrintPreList[i],"circleFrameBg/circleFrame"):GetComponent("Image").sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[itemConfig[v.equipId].Quantity].circle)
|
||
Util.AddOnceClick(soulPrintPreList[i],function()
|
||
UIManager.OpenPanel(UIName.SoulPrintPopUp,3,curHeroData.dynamicId,v.equipId)
|
||
end)
|
||
end
|
||
end
|
||
--法宝
|
||
function this.TalismanInfo()
|
||
--法宝表数据
|
||
if not curHeroData.heroConfig.EquipTalismana or curHeroData.talismanList == 0 then
|
||
this.talismanBtn:SetActive(false)
|
||
this.talismanLock:SetActive(true)
|
||
this.talismanlvText.text = ""
|
||
return
|
||
end
|
||
local curTalisman = ConfigManager.GetConfigDataByDoubleKey(ConfigName.EquipTalismana,"TalismanaId",curHeroData.heroConfig.EquipTalismana[2],"Level",curHeroData.talismanList)
|
||
if curTalisman ~= nil then
|
||
this.talismanBtn:SetActive(true)
|
||
this.talismanIcon:GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.ItemConfig,curTalisman.TalismanaId).ResourceID))
|
||
local isOpen = TalismanManager.GetCurHeroIsOpenTalisman(curHeroData)
|
||
this.talismanLock:SetActive(not isOpen)
|
||
this.talismanlv.gameObject:SetActive(isOpen)
|
||
this.talismanlvText.text = curHeroData.talismanList
|
||
Util.AddOnceClick(this.talismanBtn.gameObject, function()
|
||
if isOpen then
|
||
UIManager.OpenPanel(UIName.TalismanInfoPopup, curHeroData.heroConfig, 1, curHeroData.talismanList)
|
||
else
|
||
PopupTipPanel.ShowTip(Language[11523])
|
||
end
|
||
end)
|
||
end
|
||
end
|
||
|
||
function this.OnSortingOrderChange()
|
||
--特效层级重设
|
||
for i=1,#soulPrintPreList do
|
||
Util.AddParticleSortLayer(soulPrintPreList[i], this.sortingOrder- orginLayer)
|
||
end
|
||
for i = 1,#this.shenhunList do
|
||
Util.SetParticleSortLayer(this.shenhunList[i].fx_shenhun,this.sortingOrder + 1)
|
||
end
|
||
Util.SetParticleSortLayer(this.head_Star,this.sortingOrder + 1)
|
||
orginLayer = this.sortingOrder
|
||
end
|
||
|
||
return RoleInfoPopup
|
||
|