miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/RoleInfoPopup.lua

883 lines
41 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

--- 猎妖师详情弹窗(滚动条版本) ---
require("Base/BasePanel")
RoleInfoPopup = Inherit(BasePanel)
local this = RoleInfoPopup
local curHeroData
local triggerCallBack
local allSkillDatas = {}
local soulPrintPreList={}--魂印预设容器
local godPrintPreList={}--魂印预设容器
local giftList={} --礼物预设容器
local potencyList={} --潜能预设容器
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 choosedList
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/BG/BackBtn")
this.maskBtn = Util.GetGameObject(self.transform, "Mask")
this.bg = Util.GetGameObject(self.transform, "Panel/BG")
this.sc = Util.GetGameObject(self.transform, "Panel/Scroll View")
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.grid=Util.GetGameObject(this.equipInfo, "Grid")
this.selsectEquipImage = Util.GetGameObject(this.equipInfo, "SelsectEquipImage")
--装备
this.equipGrid = Util.GetGameObject(this.grid, "EquipGrid")
--宝物、 法相
this.specialEquipInfo=Util.GetGameObject(this.transform, "Panel/Scroll View/Viewport/Content/specialEquipInfo")
this.babyTitle=Util.GetGameObject(this.specialEquipInfo,"BG/BabyTitle")
--宝物
this.babyGrid=Util.GetGameObject(this.specialEquipInfo, "Grid/BabyGrid")
--法相
this.faXiangGrid=Util.GetGameObject(this.specialEquipInfo, "Grid/faXiangGrid")
--魂印
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.godPrintInfo = Util.GetGameObject(self.transform, "Panel/Scroll View/Viewport/Content/GodPrintInfo")
this.godPrintGrid = Util.GetGameObject(this.godPrintInfo, "Grid")
this.godPrintPre=Util.GetGameObject(this.godPrintGrid,"SoulPrintPre")
--礼物
this.giftInfo=Util.GetGameObject(self.transform, "Panel/Scroll View/Viewport/Content/giftInfo")
this.giftGrid = Util.GetGameObject(this.giftInfo, "Grid")
this.giftPre=Util.GetGameObject(this.giftGrid,"giftPre")
--潜能
this.potentyInfo=Util.GetGameObject(self.transform, "Panel/Scroll View/Viewport/Content/potentyInfo")
this.potentyGrid = Util.GetGameObject(this.potentyInfo, "Grid")
this.potentyPre=Util.GetGameObject(this.potentyGrid,"giftPre")
--技能
this.skillInfo = Util.GetGameObject(self.transform, "Panel/Scroll View/Viewport/Content/skillInfo")
this.trainlevel = Util.GetGameObject(this.skillInfo, "TitleBG/traininglv")
this.trainBtn = Util.GetGameObject(this.skillInfo, "TitleBG/training")
this.skillGrid = Util.GetGameObject(this.skillInfo, "Grid")
this.skillPre=Util.GetGameObject(this.godPrintGrid,"S1")
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 = 0
if this.isOther then
lv = curHeroData.godSoulLv
else
lv = GodSoulManager.GetGodSoulLv(curHeroData.dynamicId)
end
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.maskBtn, 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)
if starType~=3 then--非神魂
star=nil
end
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)
if starType~=3 then--非神魂
star=nil
end
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)
Util.AddClick(this.trainBtn,function ()
UIManager.OpenPanel(UIName.SpecailTrainingInfoPopup,curHeroData,2)
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]
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()
this.GiftInfo()
this.PotentyInfo()
this.GodPrintInfo()
this.SkillInfo()
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={}
godPrintPreList={}
giftList={}
potencyList={}
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.changeProId))
this.head_Lv.text = curHeroData.lv
local star,starType = curHeroData.GetStar(1)
SetHeroStars(this.spLoader, this.head_Star, star,starType)
SetHeroFlyEffect(this.head,this.spLoader,curHeroData.star,this.sortingOrder+1,1,2)
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=""
if curHeroData.star==HeroManager.awakeNextStarIndex then
talentBtnImage="r_hero_tianfu2_zh"
elseif curHeroData.star==12 then
talentBtnImage="r_tongyong_tianfufeisheng1"
elseif curHeroData.star==13 then
talentBtnImage="r_tongyong_tianfufeisheng2"
elseif curHeroData.star==14 then
talentBtnImage="r_tongyong_tianfufeisheng3"
else
talentBtnImage="r_hero_tianfu1_zh"
end
--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
OpenPassiveSkillRules=GetPassiveByMaxStar(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
--LogError("equip-----------------"..i)
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()
-- LogRed(tostring(curEquipData.homeEquipLv[1]).." "..tostring(curEquipData.homeEquipLv[2]))
this.treasureDatas[pos]:OnOpen(false, {curEquipData.id,0}, 0.8, false, false, false,orginLayer,nil,curEquipData)
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)
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,self, curHeroEquipDatas[i],5,false,false,curHeroData)
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(0,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)
UIManager.OpenPanel(UIName.RewardTalismanSingleShowPopup2,this,data,0,false,nil,curHeroData,5)
end
end)
end
for n = 1, #curHeroData.faxiang do
local did=curHeroData.faxiang[n]
local data = FaXiangManager.GetSingleTreasureByIdDyn(did)
if not data then
data = MonsterCampManager.GetSingleFaXiangByIdDyn(did)
end
if not data then
data = ExpeditionManager.GetSingleTreasureByIdDyn(did)
end
if not data then
data = GoodFriendManager.GetSingleFaXiangByIdDyn(did)
end
local pos = Util.GetGameObject(this.faXiangGrid,"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)
UIManager.OpenPanel(UIName.RewardTalismanSingleShowPopup2,this,data,0,false,nil,curHeroData,n+6)
end
end)
end
end
--魂印
function this.SoulPrintInfo()
local curHeroSoulPrintDatas = {}
-- 没有魂印不显示
if #curHeroData.soulPrintList==0 then
this.soulPrintInfo.gameObject:SetActive(false)
--this.backBtn.transform.localPosition = Vector2.New(432.5, 590)
this.bg.transform.sizeDelta = Vector2.New(935, 1250)
this.sc.transform.sizeDelta = Vector2.New(935, 1132)
return
end
this.soulPrintInfo.gameObject:SetActive(true)
--this.backBtn.transform.localPosition = Vector2.New(432.5, 690)
this.bg.transform.sizeDelta = Vector2.New(935, 1450)
this.sc.transform.sizeDelta = Vector2.New(935, 1332)
for key, value in pairs(soulPrintPreList) do
if value then
value:SetActive(false)
end
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.SkillInfo()
local skillList = HeroManager.GetCurHeroSidAndCurStarAllSkillDatas2(curHeroData.heroConfig.Id,curHeroData.heroConfig.MaxRank, curHeroData.star)
local skillList2
if curHeroData.heroConfig.MaxRank>9 then
skillList2 = HeroManager.GetCurHeroSidAndCurStarAllSkillDatas2(curHeroData.heroConfig.Id,10,curHeroData.star)
end
this.trainlevel:GetComponent("Text").text=Language[12326]..NumToComplexFont[curHeroData.HeroTraining.trainingLv]..Language[10065]
for i = 1, this.skillGrid.transform.childCount do
this.skillGrid.transform:GetChild(i-1).gameObject:SetActive(false)
end
for i = 1, #skillList do
if skillList[i] and skillList[i].skillConfig and GetLanguageStrById(skillList[i].skillConfig.Name) then
local go = this.skillGrid.transform:GetChild(i-1).gameObject
go:SetActive(true)
Util.GetGameObject(go.transform,"Icon"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(skillList[i].skillConfig.Icon))
local typeImg=Util.GetGameObject(go.transform,"SkillTypeImage")
typeImg:GetComponent("Image").sprite=this.spLoader:LoadSprite(GetSkillType(skillList[i]))
local sText = Util.GetGameObject(go.transform,"Text"):GetComponent("Text")
sText.text=GetLanguageStrById(skillList[i].skillConfig.Name)
sText.fontSize = GetCurLanguage() ~= 2 and 30 or 25
Util.SetGray(go,skillList[i].isOpen)
Util.AddOnceClick(go, function()
if Game.GlobalEvent:HasEvent(GameEvent.UI.OnClose, triggerCallBack) then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
end
this.selsectSkillImage:SetActive(true)
this.selsectSkillImage.transform.position=Util.GetGameObject(go.transform,"Icon").transform.position
local skillData = {}
skillData.skillConfig = skillList[i].skillConfig
skillData.isOpen=skillList[i].isOpen
skillData.needStar=skillList[i].needStar
local maxLv= HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id,skillData.skillConfig.Type)
--local panel = UIManager.OpenPanel(UIName.SkillInfoPopup,skillData,1,10,maxLv,i)
if skillList2 and skillList2[i] and i>2 then
nextData=skillList2[i]
nextData.isOpen=skillList2[i].isOpen
nextData.needStar=skillList2[i].needStar
--飞升技能
if i==6 then
panel = UIManager.OpenPanel(UIName.SkillInfoPopup,skillData,1,10,maxLv,i)
else
panel = UIManager.OpenPanel(UIName.SkillInfoPopup,nextData,1,10,maxLv,i,skillData)
end
else
panel = UIManager.OpenPanel(UIName.SkillInfoPopup,skillData,1,10,maxLv,i)
end
this.skillGrid:GetComponent("Canvas").sortingOrder = panel.sortingOrder + 1
triggerCallBack = function (panelType, p)
if panelType == UIName.SkillInfoPopup and panel == p then --监听到SkillInfoPopup关闭把层级设回去
this.skillGrid:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
this.selsectSkillImage:SetActive(false)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack)
end)
end
end
end
--神印
function this.GodPrintInfo()
local curHeroSoulPrintDatas = {}
-- 没有魂印不显示
if curHeroData.godPrintList==nil or #curHeroData.godPrintList==0 then
this.godPrintInfo.gameObject:SetActive(false)
--this.backBtn.transform.localPosition = Vector2.New(432.5, 590)
this.bg.transform.sizeDelta = Vector2.New(935, 1250)
this.sc.transform.sizeDelta = Vector2.New(935, 1132)
return
end
this.godPrintInfo.gameObject:SetActive(true)
--this.backBtn.transform.localPosition = Vector2.New(432.5, 690)
this.bg.transform.sizeDelta = Vector2.New(935, 1450)
this.sc.transform.sizeDelta = Vector2.New(935, 1332)
for key, value in pairs(godPrintPreList) do
if value then
value:SetActive(false)
end
end
for i,v in pairs(curHeroData.godPrintList) do --生成预设
if not godPrintPreList[i] then
godPrintPreList[i]=newObjToParent(this.godPrintPre,this.godPrintGrid)
end
godPrintPreList[i].name="Pre"..i
godPrintPreList[i]:SetActive(true)
--特效层级重设
for i=1,#godPrintPreList do
Util.AddParticleSortLayer(godPrintPreList[i], this.sortingOrder- orginLayer2)
end
orginLayer2 = this.sortingOrder
orginLayer=this.sortingOrder
local frame=Util.GetGameObject(godPrintPreList[i],"Frame"):GetComponent("Image")
local icon=Util.GetGameObject(godPrintPreList[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(godPrintPreList[i],"circleFrameBg"):GetComponent("Image").sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[itemConfig[v.equipId].Quantity].circleBg2)
Util.GetGameObject(godPrintPreList[i],"circleFrameBg/circleFrame"):GetComponent("Image").sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[itemConfig[v.equipId].Quantity].circle)
Util.AddOnceClick(godPrintPreList[i],function()
UIManager.OpenPanel(UIName.GodPrintPopUp,0,curHeroData.dynamicId,v.equipId)
end)
end
end
function this.GiftInfo()
local curHeroSoulPrintDatas = {}
-- 没有魂印不显示
if curHeroData.giftIds==nil or #curHeroData.giftIds==0 then
this.giftInfo.gameObject:SetActive(false)
--this.backBtn.transform.localPosition = Vector2.New(432.5, 590)
this.bg.transform.sizeDelta = Vector2.New(935, 1250)
this.sc.transform.sizeDelta = Vector2.New(935, 1132)
return
end
this.giftInfo.gameObject:SetActive(true)
--this.backBtn.transform.localPosition = Vector2.New(432.5, 690)
this.bg.transform.sizeDelta = Vector2.New(935, 1450)
this.sc.transform.sizeDelta = Vector2.New(935, 1332)
for key, value in pairs(giftList) do
if value then
value:SetActive(false)
end
end
for i=1,#curHeroData.giftIds do
LogError("curHeroData.giftIds[i]==========="..curHeroData.giftIds[i])
end
for i=1,#curHeroData.giftIds do --生成预设
if not giftList[i] then
giftList[i]=newObjToParent(this.giftPre,this.giftGrid)
end
giftList[i].name="Pre"..i
giftList[i]:SetActive(true)
--特效层级重设
for i=1,#giftList do
Util.AddParticleSortLayer(giftList[i], this.sortingOrder- orginLayer2)
end
orginLayer2 = this.sortingOrder
orginLayer=this.sortingOrder
local id=curHeroData.giftIds[i]
--LogError("v==============="..id)
local frame=Util.GetGameObject(giftList[i],"Frame"):GetComponent("Image")
local icon=Util.GetGameObject(giftList[i],"Icon"):GetComponent("Image")
Util.GetGameObject(giftList[i],"Name"):SetActive(false)
frame.sprite=this.spLoader:LoadSprite(GetQuantityImageByquality(equipConfig[id].Quality))
icon.sprite=this.spLoader:LoadSprite(GetResourcePath(itemConfig[id].ResourceID))
Util.AddOnceClick(giftList[i],function()
local data={}
data.id=id
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,this,data,0)
end)
end
end
--潜能信息
function this.PotentyInfo()
local curHeroSoulPrintDatas = {}
-- 没有潜能不显示
if curHeroData.potential==nil or #curHeroData.potential==0 then
this.potentyInfo.gameObject:SetActive(false)
--this.backBtn.transform.localPosition = Vector2.New(432.5, 590)
this.bg.transform.sizeDelta = Vector2.New(935, 1250)
this.sc.transform.sizeDelta = Vector2.New(935, 1132)
return
end
-- for i=1,#curHeroData.potential do
-- LogError("curHeroData.potential[i]===========" .. curHeroData.potential[i])
-- end
this.potentyInfo.gameObject:SetActive(true)
--this.backBtn.transform.localPosition = Vector2.New(432.5, 690)
this.bg.transform.sizeDelta = Vector2.New(935, 1450)
this.sc.transform.sizeDelta = Vector2.New(935, 1332)
for key, value in pairs(potencyList) do
if value then
value:SetActive(false)
end
end
for i=1,#curHeroData.potential do --生成预设
if not potencyList[i] then
potencyList[i]=newObjToParent(this.potentyPre,this.potentyGrid)
end
potencyList[i].name="Pre"..i
potencyList[i]:SetActive(true)
--特效层级重设
for i=1,#potencyList do
Util.AddParticleSortLayer(potencyList[i], this.sortingOrder- orginLayer2)
end
orginLayer2 = this.sortingOrder
orginLayer=this.sortingOrder
local poten=curHeroData.potential[i]
--LogError("v==============="..id)
local frame=Util.GetGameObject(potencyList[i],"Frame"):GetComponent("Image")
local icon=Util.GetGameObject(potencyList[i],"Icon"):GetComponent("Image")
Util.GetGameObject(potencyList[i],"Name"):SetActive(false)
--frame.sprite=this.spLoader:LoadSprite(GetQuantityImageByquality(equipConfig[id].Quality))
local config=ConfigManager.GetConfigData(ConfigName.PotentialNewConfig,i)
icon.sprite=this.spLoader:LoadSprite(config.Icon)
LogError("poten.type==============================="..poten.lv)
--LogError("poten.type==============================="..poten.type.." uplv=="..poten.upLv.." poten.giftLv==="..poten.giftLv)
Util.AddOnceClick(potencyList[i],function()
local data={}
data.id=id
UIManager.OpenPanel(UIName.HeroPotencyInfoPopup,i,poten.lv,poten.giftLv)
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",10)
if curTalisman ~= nil then
this.talismanBtn:SetActive(true)
local isOpen = TalismanManager.GetCurHeroIsOpenTalisman(curHeroData)
this.talismanLock:SetActive(not isOpen)
local data=FaLingManager.GetEquipDataByDid(curHeroData.baublesId)
--他人法宝数据
if data==nil then
data=curHeroData.faLingData
end
if data then
this.talismanIcon:GetComponent("Image").sprite = this.spLoader:LoadSprite(data.icon)
this.talismanlv.gameObject:SetActive(true)
this.talismanlvText.text = data.lv
else
this.talismanlv.gameObject:SetActive(false)
this.talismanIcon:GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.ItemConfig,curTalisman.TalismanaId).ResourceID))
end
Util.AddOnceClick(this.talismanBtn.gameObject, function()
-- if isOpen then
-- UIManager.OpenPanel(UIName.TalismanInfoPopup, curHeroData.heroConfig, 1, curHeroData.talismanList)
-- else
-- PopupTipPanel.ShowTip(Language[11523])
-- end
if curHeroData.baublesId then
if data then
UIManager.OpenPanel(UIName.FaLingSingleShowPopup,this,data,0,false,false,curHeroData)
end
end
end)
end
end
function this.OnSortingOrderChange()
--特效层级重设
for i=1,#soulPrintPreList do
Util.AddParticleSortLayer(soulPrintPreList[i], this.sortingOrder- orginLayer)
end
for i=1,#godPrintPreList do
Util.AddParticleSortLayer(godPrintPreList[i], this.sortingOrder- orginLayer)
end
for i=1,#giftList do
Util.AddParticleSortLayer(giftList[i], this.sortingOrder- orginLayer)
end
for i=1,#potencyList do
Util.AddParticleSortLayer(potencyList[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