2020-05-09 13:31:21 +08:00
|
|
|
|
--- 猎妖师详情弹窗(滚动条版本) ---
|
|
|
|
|
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 pinjieImage={"r_hero_pinjiebiao_01","r_hero_pinjiebiao_02"} --该死的品阶图片 1是未激活 2是激活
|
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function RoleInfoPopup:InitComponent()
|
|
|
|
|
|
|
|
|
|
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")
|
2020-06-08 20:18:49 +08:00
|
|
|
|
--品阶
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.pinjieList={}
|
2020-06-08 20:18:49 +08:00
|
|
|
|
this.pinjieRoot=Util.GetGameObject(this.roleInfo1,"Pinjie")
|
|
|
|
|
this.pinjiePre=Util.GetGameObject(this.roleInfo1,"Pre")
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function RoleInfoPopup:BindEvent()
|
|
|
|
|
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 maxLv = HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id, allSkillDatas[1].skillConfig.Type)
|
|
|
|
|
local panel = UIManager.OpenPanel(UIName.SkillInfoPopup, allSkillDatas[1], 4, 10, maxLv, 1)
|
|
|
|
|
--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 maxLv = HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id, allSkillDatas[2].skillConfig.Type)
|
|
|
|
|
local panel = UIManager.OpenPanel(UIName.SkillInfoPopup, allSkillDatas[2], 4, 10, maxLv, 2)
|
|
|
|
|
--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]
|
|
|
|
|
this.isOther = arg[2]
|
|
|
|
|
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()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
soulPrintPreList={}
|
2020-06-08 20:18:49 +08:00
|
|
|
|
this.pinjieList={}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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)
|
|
|
|
|
this.head_Frame.sprite = Util.LoadSprite(GetHeroQuantityImageByquality(curHeroData.heroConfig.Quality))
|
|
|
|
|
this.head_Icon.sprite = Util.LoadSprite(curHeroData.icon)
|
|
|
|
|
this.head_Pro.sprite = Util.LoadSprite(GetProStrImageByProNum(curHeroData.heroConfig.PropertyName))
|
|
|
|
|
this.head_Lv.text = curHeroData.lv
|
|
|
|
|
SetHeroStars(this.head_Star, curHeroData.star)
|
|
|
|
|
this.roleName.text = curHeroData.name
|
|
|
|
|
|
|
|
|
|
local allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData, false)
|
|
|
|
|
if this.isOther then
|
|
|
|
|
this.power.text = curHeroData.actionPower
|
|
|
|
|
else
|
|
|
|
|
this.power.text = allAddProVal[HeroProType.WarPower]
|
|
|
|
|
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)
|
|
|
|
|
if curHeroData.heroConfig.OpenPassiveSkillRules then
|
|
|
|
|
local openlists,compoundOpenNum,compoundNum = HeroManager.GetAllPassiveSkillIds(curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId)
|
|
|
|
|
this.talentProgress.text = #openlists - compoundOpenNum .."/"..#curHeroData.heroConfig.OpenPassiveSkillRules - compoundNum
|
|
|
|
|
end
|
|
|
|
|
--法宝
|
|
|
|
|
this.TalismanInfo()
|
|
|
|
|
end
|
|
|
|
|
--RoleInfo1
|
|
|
|
|
function this.RoleInfo1()
|
|
|
|
|
--定位描述相关
|
|
|
|
|
this.posBgImage.sprite=Util.LoadSprite(GetHeroPosBgStr(curHeroData.heroConfig.Profession))
|
|
|
|
|
this.posImage.sprite=Util.LoadSprite(GetHeroPosStr(curHeroData.heroConfig.Profession))
|
|
|
|
|
this.posText.text=curHeroData.heroConfig.HeroLocation
|
|
|
|
|
|
|
|
|
|
--品阶
|
|
|
|
|
local pId=0
|
|
|
|
|
if curHeroData.breakId~=0 then
|
|
|
|
|
pId= heroRankupConfig[curHeroData.breakId].Phase[2]
|
|
|
|
|
end
|
2020-06-08 20:18:49 +08:00
|
|
|
|
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
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.pinjieList[i]:GetComponent("Image").sprite=Util.LoadSprite(i<=pId and pinjieImage[2] or pinjieImage[1])
|
|
|
|
|
end
|
2020-06-08 20:18:49 +08:00
|
|
|
|
for n = 0, this.pinjieRoot.transform.childCount-1 do --超过品阶关闭显示
|
|
|
|
|
this.pinjieRoot.transform:GetChild(n).gameObject:SetActive(n+1<=#hruConfig)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
--基础属性
|
|
|
|
|
local allAddProVal = {}
|
|
|
|
|
if (this.isOther) then
|
2020-06-18 20:39:29 +08:00
|
|
|
|
--this.atk.text = curHeroData.attack
|
|
|
|
|
--this.hp.text = curHeroData.hp
|
|
|
|
|
--this.phyDef.text = curHeroData.pDef
|
|
|
|
|
--this.magDef.text = curHeroData.mDef
|
2020-05-09 13:31:21 +08:00
|
|
|
|
allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData, false)
|
|
|
|
|
else
|
|
|
|
|
allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false)
|
|
|
|
|
end
|
2020-06-18 20:39:29 +08:00
|
|
|
|
this.atk.text = allAddProVal[HeroProType.Attack]
|
|
|
|
|
this.hp.text = allAddProVal[HeroProType.Hp]
|
|
|
|
|
this.phyDef.text = allAddProVal[HeroProType.PhysicalDefence]
|
|
|
|
|
this.magDef.text = allAddProVal[HeroProType.MagicDefence]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Util.AddOnceClick(this.proBtn,function()
|
2020-06-18 20:39:29 +08:00
|
|
|
|
local guildSkill = nil
|
|
|
|
|
if this.isOther then guildSkill = curHeroData.guildSkill end
|
|
|
|
|
LogGreen("guildSkill "..guildSkill)
|
|
|
|
|
UIManager.OpenPanel(UIName.RoleProInfoPopup,allAddProVal,curHeroData.heroConfig,true,guildSkill)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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 = Util.LoadSprite(GetResourcePath(allSkillDatas[1].skillConfig.Icon))
|
|
|
|
|
Util.GetGameObject(this.skill1.transform, "Text"):GetComponent("Text").text = allSkillDatas[1].skillConfig.Name--"lv." .. (allSkillDatas[1].skillId % 10)
|
|
|
|
|
Util.GetGameObject(this.skill1.transform,"SkillTypeImage"):GetComponent("Image").sprite=Util.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 = Util.LoadSprite(GetResourcePath(allSkillDatas[2].skillConfig.Icon))
|
|
|
|
|
Util.GetGameObject(this.skill2.transform, "Text"):GetComponent("Text").text = allSkillDatas[2].skillConfig.Name--"lv." .. (allSkillDatas[2].skillId % 10)
|
|
|
|
|
Util.GetGameObject(this.skill2.transform,"SkillTypeImage"):GetComponent("Image").sprite= Util.LoadSprite(GetSkillType(allSkillDatas[2]))
|
|
|
|
|
else
|
|
|
|
|
this.skill2:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--装备
|
|
|
|
|
function this.EquipInfo()
|
|
|
|
|
local curHeroEquipDatas = {}
|
|
|
|
|
for i = 1, #curHeroData.equipIdList do
|
|
|
|
|
local equipData = {}
|
|
|
|
|
if (this.isOther) then
|
|
|
|
|
equipData = GoodFriendManager.GetSingleEquipData(curHeroData.equipIdList[i])
|
|
|
|
|
else
|
|
|
|
|
equipData = EquipManager.GetSingleEquipData(curHeroData.equipIdList[i])
|
|
|
|
|
end
|
|
|
|
|
if equipData ~= nil then
|
|
|
|
|
curHeroEquipDatas[equipData.equipConfig.Position] = equipData
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--this.equipGrid:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1
|
|
|
|
|
for i = 1, this.equipGrid.transform.childCount do
|
|
|
|
|
local go = this.equipGrid.transform:GetChild(i - 1).gameObject
|
|
|
|
|
local curEquipData
|
|
|
|
|
--Util.GetGameObject(go.transform,"Frame"):GetComponent("Image").sprite=Util.LoadSprite(GetQuantityImageByquality(2))
|
|
|
|
|
if curHeroEquipDatas[i] then
|
|
|
|
|
Util.GetGameObject(go.transform, "Frame"):SetActive(true)
|
|
|
|
|
Util.GetGameObject(go.transform, "Frame"):GetComponent("Image").sprite = Util.LoadSprite(curHeroEquipDatas[i].frame)
|
|
|
|
|
Util.GetGameObject(go.transform, "Frame/Icon"):GetComponent("Image").sprite = Util.LoadSprite(curHeroEquipDatas[i].icon)
|
|
|
|
|
curEquipData = curHeroEquipDatas[i]
|
|
|
|
|
else
|
|
|
|
|
Util.GetGameObject(go.transform, "Frame"):SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
local frameBtn = Util.GetGameObject(go.transform, "Frame")
|
|
|
|
|
Util.AddOnceClick(frameBtn, function()
|
|
|
|
|
if curEquipData then
|
|
|
|
|
if Game.GlobalEvent:HasEvent(GameEvent.UI.OnClose, triggerCallBack) then
|
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
|
|
|
|
|
end
|
|
|
|
|
this:SetEquipSelectImage(frameBtn.transform, true)--设置选中图片
|
|
|
|
|
--打开装备信息弹窗,传递生成位置,设置层级
|
|
|
|
|
--local panel = UIManager.OpenPanel(UIName.EquipInfoPopup,curEquipData,this.content.anchoredPosition.y)
|
|
|
|
|
local panel = UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup, curEquipData.backData)
|
|
|
|
|
triggerCallBack = function(panelType, p)
|
|
|
|
|
if panelType == UIName.RewardEquipSingleShowPopup and panel == p then
|
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
|
|
|
|
|
this:SetEquipSelectImage(frameBtn.transform, false)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--宝器
|
|
|
|
|
for m = 1, 2 do
|
|
|
|
|
Util.GetGameObject(this.babyGrid,"Pre"..m.."/Frame").gameObject:SetActive(false)
|
|
|
|
|
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)
|
|
|
|
|
--是魂宝1 还是灵宝2
|
|
|
|
|
local pos= jewelConfig[data.id].Location
|
|
|
|
|
|
|
|
|
|
local o=Util.GetGameObject(this.babyGrid,"Pre"..pos)
|
|
|
|
|
local btn=Util.GetGameObject(o,"Frame")
|
|
|
|
|
btn.gameObject:SetActive(true)
|
|
|
|
|
local frame=Util.GetGameObject(o,"Frame"):GetComponent("Image")
|
|
|
|
|
local icon=Util.GetGameObject(o,"Frame/Icon"):GetComponent("Image")
|
|
|
|
|
|
|
|
|
|
frame.sprite=Util.LoadSprite(data.frame)
|
|
|
|
|
icon.sprite=Util.LoadSprite(data.icon)
|
|
|
|
|
Util.AddOnceClick(btn,function()
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardTalismanSingleShowPopup,0, data.idDyn,data.id, 0, 0)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--魂印
|
|
|
|
|
function this.SoulPrintInfo()
|
|
|
|
|
local curHeroSoulPrintDatas = {}
|
|
|
|
|
this.soulPrintInfo.gameObject:SetActive(#curHeroData.soulPrintList~=0)
|
|
|
|
|
if #curHeroData.soulPrintList==0 then return end
|
|
|
|
|
|
2020-05-25 19:16:23 +08:00
|
|
|
|
for i,v in pairs(curHeroData.soulPrintList) do --生成预设
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if not soulPrintPreList[i] then
|
|
|
|
|
soulPrintPreList[i]=newObjToParent(this.soulPrintPre,this.soulPrintGrid)
|
|
|
|
|
end
|
|
|
|
|
soulPrintPreList[i].name="Pre"..i
|
|
|
|
|
|
|
|
|
|
local frame=Util.GetGameObject(soulPrintPreList[i],"Frame"):GetComponent("Image")
|
|
|
|
|
local icon=Util.GetGameObject(soulPrintPreList[i],"Icon"):GetComponent("Image")
|
2020-05-25 19:16:23 +08:00
|
|
|
|
frame.sprite=Util.LoadSprite(GetQuantityImageByquality(equipConfig[v.equipId].Quality))
|
|
|
|
|
icon.sprite=Util.LoadSprite(GetResourcePath(itemConfig[v.equipId].ResourceID))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Util.AddOnceClick(soulPrintPreList[i],function()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.SoulPrintPopUp,3,curHeroData.dynamicId,v.equipId)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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 = Util.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
|
2020-06-08 20:18:49 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.TalismanInfoPopup, curHeroData.heroConfig, 1, curHeroData.talismanList)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
PopupTipPanel.ShowTip("此猎妖师尚未获得专属法宝!")
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return RoleInfoPopup
|