455 lines
25 KiB
Lua
455 lines
25 KiB
Lua
require("Base/BasePanel")
|
||
RoleGetInfoPopup = Inherit(BasePanel)
|
||
local this=RoleGetInfoPopup
|
||
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
||
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||
local heroBackData
|
||
local isGet
|
||
local heroSId
|
||
local heroStar
|
||
local allSkillDatas = {}
|
||
local breakId,upStarId
|
||
--初始化组件(用于子类重写)
|
||
function RoleGetInfoPopup:InitComponent()
|
||
this.spLoader = SpriteLoader.New()
|
||
|
||
this.mask=Util.GetGameObject(self.transform, "BackMask")
|
||
this.BtnBack=Util.GetGameObject(self.transform, "bg/btnBack")
|
||
this.liveRoot=Util.GetGameObject(self.transform, "bg/liveRoot")
|
||
this.heroName = Util.GetGameObject(self.transform, "RoleInfo/nameAndPossLayout/heroName"):GetComponent("Text")
|
||
this.starGrid = Util.GetGameObject(self.transform, "bg/NameButtom/star")
|
||
this.starPre = Util.GetGameObject(self.transform, "bg/NameButtom/starPre")
|
||
|
||
this.starGrid = Util.GetGameObject(self.transform, "RoleInfo/sartAndLvLayout")
|
||
--定位描述
|
||
this.posBgImage=Util.GetGameObject(self.transform,"pos"):GetComponent("Image")
|
||
this.posImage=Util.GetGameObject(self.transform,"pos/posImage"):GetComponent("Image")
|
||
this.posText=Util.GetGameObject(self.transform,"pos/posText"):GetComponent("Text")
|
||
-- this.posImage = Util.GetGameObject(self.transform, "RoleInfo/nameAndPossLayout/posImage/posImage/posImage"):GetComponent("Image")
|
||
-- this.posText = Util.GetGameObject(self.transform, "RoleInfo/nameAndPossLayout/posText/posText"):GetComponent("Text")
|
||
this.profession = Util.GetGameObject(self.transform, "RoleInfo/nameAndPossLayout/proImage/proImage"):GetComponent("Image")
|
||
-- this.qualityImage=Util.GetGameObject(self.transform,"quality"):GetComponent("Image")
|
||
-- this.quality=Util.GetGameObject(self.transform,"quality/qualityText")
|
||
-- this.doubleQuality=Util.GetGameObject(self.transform,"quality/qualityDoubleText")
|
||
-- this.heroTypeText=Util.GetGameObject(self.transform,"RoleInfo/heroTypeText"):GetComponent("Text")
|
||
|
||
Util.GetGameObject(self.transform,"bg/RoleInfo/pro/atk/proName"):GetComponent("Text").text = GetLanguageStrById(propertyConfig[2].Info)
|
||
Util.GetGameObject(self.transform,"bg/RoleInfo/pro/hp/proName"):GetComponent("Text").text = GetLanguageStrById(propertyConfig[1].Info)
|
||
Util.GetGameObject(self.transform,"bg/RoleInfo/pro/phyDef/proName"):GetComponent("Text").text = GetLanguageStrById(propertyConfig[3].Info)
|
||
Util.GetGameObject(self.transform,"bg/RoleInfo/pro/magDef/proName"):GetComponent("Text").text = GetLanguageStrById(propertyConfig[4].Info)
|
||
local atk_Image = Util.GetGameObject(self.transform,"bg/RoleInfo/pro/atk/Image"):GetComponent("Image")
|
||
local hp_Image = Util.GetGameObject(self.transform,"bg/RoleInfo/pro/hp/Image"):GetComponent("Image")
|
||
local phyDef_Image = Util.GetGameObject(self.transform,"bg/RoleInfo/pro/phyDef/Image"):GetComponent("Image")
|
||
local magDef_Image = Util.GetGameObject(self.transform,"bg/RoleInfo/pro/magDef/Image"):GetComponent("Image")
|
||
|
||
atk_Image.sprite = this.spLoader:LoadSprite(GetResourcePath(propertyConfig[2].PropertyIcon) )
|
||
hp_Image.sprite = this.spLoader:LoadSprite(GetResourcePath(propertyConfig[1].PropertyIcon) )
|
||
phyDef_Image.sprite = this.spLoader:LoadSprite(GetResourcePath(propertyConfig[3].PropertyIcon) )
|
||
magDef_Image.sprite = this.spLoader:LoadSprite(GetResourcePath(propertyConfig[4].PropertyIcon) )
|
||
atk_Image:SetNativeSize()
|
||
hp_Image:SetNativeSize()
|
||
phyDef_Image:SetNativeSize()
|
||
magDef_Image:SetNativeSize()
|
||
-- Util.GetGameObject(self.transform,"bg/RoleInfo/pro/speed/proName"):GetComponent("Text").text = propertyConfig[5].Info
|
||
this.atk = Util.GetGameObject(self.transform, "bg/RoleInfo/pro/atk/proValue"):GetComponent("Text")
|
||
this.hp = Util.GetGameObject(self.transform, "bg/RoleInfo/pro/hp/proValue"):GetComponent("Text")
|
||
this.phyDef = Util.GetGameObject(self.transform, "bg/RoleInfo/pro/phyDef/proValue"):GetComponent("Text")
|
||
this.magDef = Util.GetGameObject(self.transform, "bg/RoleInfo/pro/magDef/proValue"):GetComponent("Text")
|
||
-- this.speed = Util.GetGameObject(self.transform, "bg/RoleInfo/pro/speed/proValue"):GetComponent("Text")
|
||
|
||
-- this.skillGrid=Util.GetGameObject(self.transform, "bg/RoleInfo/skill")
|
||
-- this.skill1=Util.GetGameObject(self.transform, "bg/RoleInfo/skill/s1")
|
||
-- this.skill2=Util.GetGameObject(self.transform, "bg/RoleInfo/skill/s2")
|
||
-- this.selsectSkillImage=Util.GetGameObject(self.transform, "selsectSkillImage")
|
||
|
||
-- this.radar = Util.GetGameObject(self.transform, "bg/RoleInfo/proRadarImage/radar"):GetComponent("RadarChart")
|
||
self.skillName=Util.GetGameObject(self.transform,"RoleInfo/skillName")
|
||
self.skillLine=Util.GetGameObject(self.transform,"RoleInfo/skillLine")
|
||
|
||
this.skillGrid=Util.GetGameObject(self.transform,"RoleInfo/Panel/Skill/skill")
|
||
-- this.skill1 = Util.GetGameObject(this.skillGrid, "sBg1/SkillTypeImage")
|
||
-- this.skill2 = Util.GetGameObject(this.skillGrid, "sBg2/SkillTypeImage")
|
||
this.selsectSkillImage=Util.GetGameObject(self.transform,"RoleInfo/selsectSkillImage")
|
||
this.talismanBtn=Util.GetGameObject(self.transform,"RoleInfo/Panel/Other/TalismanBtn")
|
||
-- this.talismanFrame=Util.GetGameObject(self.transform,"RoleInfo/Panel/Other/TalismanBtn"):GetComponent("Image")
|
||
this.talismanIcon=Util.GetGameObject(self.transform,"RoleInfo/Panel/Other/TalismanBtn/Icon"):GetComponent("Image")
|
||
this.talentBtn=Util.GetGameObject(self.transform,"RoleInfo/Panel/Other/talentBtn")
|
||
this.talentProgress=Util.GetGameObject(self.transform,"RoleInfo/Panel/Other/talentBtn/progress"):GetComponent("Text")
|
||
|
||
end
|
||
local triggerCallBack
|
||
--绑定事件(用于子类重写)
|
||
function RoleGetInfoPopup:BindEvent()
|
||
|
||
Util.AddClick(this.BtnBack, function()
|
||
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
||
self:ClosePanel()
|
||
end)
|
||
Util.AddClick(this.mask, 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 skillData=allSkillDatas[1]
|
||
-- local maxLv= HeroManager.GetHeroSkillMaxLevel(heroSId, skillData.skillConfig.Type)
|
||
-- local panel = UIManager.OpenPanel(UIName.SkillInfoPopup,skillData,3,10,maxLv,1)
|
||
-- 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").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)
|
||
-- local skillData=allSkillDatas[2]
|
||
-- local maxLv= HeroManager.GetHeroSkillMaxLevel(heroSId, skillData.skillConfig.Type)
|
||
-- local panel = UIManager.OpenPanel(UIName.SkillInfoPopup,skillData,3,10,maxLv,2)
|
||
-- 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").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 RoleGetInfoPopup:AddListener()
|
||
|
||
end
|
||
|
||
--移除事件监听(用于子类重写)
|
||
function RoleGetInfoPopup:RemoveListener()
|
||
|
||
end
|
||
|
||
--界面打开时调用(用于子类重写)
|
||
function RoleGetInfoPopup:OnOpen(...)
|
||
|
||
local data={...}
|
||
isGet=data[1]
|
||
if isGet then
|
||
heroBackData=data[2]
|
||
heroSId= heroBackData.heroId
|
||
heroStar= heroBackData.star
|
||
else
|
||
heroSId=data[2]
|
||
heroStar=data[3]
|
||
end
|
||
|
||
end
|
||
function RoleGetInfoPopup:OnShow()
|
||
allSkillDatas = HeroManager.GetCurHeroSidAndCurStarAllSkillDatas2(heroSId,heroStar)
|
||
local heroSData=ConfigManager.GetConfigData(ConfigName.HeroConfig, heroSId)
|
||
--heroStar=heroSData.MaxRank
|
||
|
||
if isGet then
|
||
this.GetShowPanelData()
|
||
--天赋
|
||
this.talentBtn:SetActive(heroSData.OpenPassiveSkillRules ~= nil)
|
||
Util.AddOnceClick(this.talentBtn,function()
|
||
UIManager.OpenPanel(UIName.RoleTalentPopup,heroSData,0,0)
|
||
end)
|
||
else
|
||
this.NoGetShowPanelData()
|
||
end
|
||
LogError("breakid=="..breakId.." upstarid=="..upStarId)
|
||
local talentBtnImage = heroStar == HeroManager.awakeNextStarIndex and "r_hero_tianfu2_zh" or "r_hero_tianfu1_zh"
|
||
this.talentBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite(talentBtnImage)
|
||
local OpenPassiveSkillRules = heroStar >= HeroManager.awakeNextStarIndex and heroSData.Awaken or heroSData.OpenPassiveSkillRules
|
||
if OpenPassiveSkillRules then
|
||
local openlists,compoundOpenNum,compoundNum = HeroManager.GetAllPassiveSkillIds(heroSData,breakId,upStarId)
|
||
this.talentProgress.text = #openlists - compoundOpenNum .."/"..#OpenPassiveSkillRules - compoundNum
|
||
end
|
||
|
||
--技能 布局变动
|
||
self.skillLine.gameObject:SetActive(not (heroSData.OpenPassiveSkillRules == nil and heroSData.EquipTalismana==nil))
|
||
if heroSData.OpenPassiveSkillRules == nil and heroSData.EquipTalismana==nil then
|
||
Util.GetGameObject(self.transform,"RoleInfo/Panel/Skill"):GetComponent("LayoutElement").minWidth=500
|
||
Util.GetGameObject(self.transform,"RoleInfo/Panel/Skill/skill"):GetComponent("GridLayoutGroup").startAxis=0
|
||
--self.skillName.transform:DOAnchorPos(Vector3.New(230,158,0),0)
|
||
else
|
||
Util.GetGameObject(self.transform,"RoleInfo/Panel/Skill"):GetComponent("LayoutElement").minWidth=150
|
||
Util.GetGameObject(self.transform,"RoleInfo/Panel/Skill/skill"):GetComponent("GridLayoutGroup").startAxis=1
|
||
-- self.skillName.transform:DOAnchorPos(Vector3.New(90,158,0),0)
|
||
end
|
||
|
||
--技能点击特殊处理
|
||
this.selsectSkillImage:SetActive(false)
|
||
this.skillGrid:GetComponent("Canvas").sortingOrder = self.sortingOrder + 1
|
||
local triggerCallBack
|
||
local skillList = HeroManager.GetCurHeroSidAndCurStarAllSkillDatas2(heroSData.Id,heroStar)
|
||
local skillList2=nil
|
||
local isAwake=false
|
||
if heroStar>11 then
|
||
isAwake=true
|
||
skillList2 = HeroManager.GetCurHeroSidAndCurStarAllSkillDatas2(heroSData.Id,10)
|
||
else
|
||
|
||
end
|
||
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,"s"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(skillList[i].skillConfig.Icon))
|
||
local sText = Util.GetGameObject(go.transform,"s/Text"):GetComponent("Text")
|
||
sText.text=GetLanguageStrById(skillList[i].skillConfig.Name)
|
||
sText.fontSize = GetCurLanguage() ~= 2 and 30 or 25
|
||
Util.GetGameObject(go.transform,"SkillTypeImage"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetSkillType(allSkillDatas[i]))
|
||
Util.AddOnceClick(Util.GetGameObject(go.transform,"s"), 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,"s").transform.position
|
||
local skillData = {}
|
||
skillData.skillConfig = skillList[i].skillConfig
|
||
skillData.isOpen=skillList[i].isOpen
|
||
skillData.needStar=skillList[i].needStar
|
||
local maxLv= HeroManager.GetHeroSkillMaxLevel(heroSData.Id,skillData.skillConfig.Type)
|
||
local nextData
|
||
local panel
|
||
if skillList2 and skillList2[i] and i>2 then
|
||
nextData=skillList2[i]
|
||
--飞升技能
|
||
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 = self.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
|
||
--法宝
|
||
self.talismanBtn.gameObject:SetActive(heroSData.EquipTalismana~=nil)
|
||
if heroSData.EquipTalismana~=nil then
|
||
-- self.talismanFrame.sprite=this.spLoader:LoadSprite(TalismanBubble[itemConfig[heroSData.EquipTalismana[2]].Quantity])
|
||
this.talismanIcon.sprite = this.spLoader:LoadSprite(GetResourcePath(itemConfig[heroSData.EquipTalismana[2]].ResourceID))
|
||
end
|
||
Util.AddOnceClick(this.talismanBtn.gameObject,function()
|
||
--UIManager.OpenPanel(UIName.TalismanInfoPopup,heroSData,1,1)
|
||
local aaa={
|
||
id="",
|
||
equipId=heroSData.EquipTalismana[2],
|
||
exp=0,
|
||
|
||
}
|
||
local data=FaLingManager.initSingleData(aaa)
|
||
UIManager.OpenPanel(UIName.FaLingSingleShowPopup,this,data,0,false,false,nil)
|
||
end)
|
||
end
|
||
function this.ShowHeroLive(_heroSConfigData)
|
||
this.testLiveGO = poolManager:LoadLive(GetResourcePath(_heroSConfigData.Painting), this.liveRoot.transform,
|
||
Vector3.one * _heroSConfigData.Scale*0.7, Vector3.New(_heroSConfigData.Position[1], _heroSConfigData.Position[2], 0))
|
||
local SkeletonGraphic = this.testLiveGO:GetComponent("SkeletonGraphic")
|
||
local position=_heroSConfigData.Position
|
||
position[2]=position[2]-250
|
||
SetHEeroLiveToward(this.testLiveGO,_heroSConfigData.Toward,position)
|
||
local idle = function() SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true) end
|
||
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idle
|
||
poolManager:SetLiveClearCall(GetResourcePath(_heroSConfigData.Live), this.testLiveGO, function ()
|
||
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idle
|
||
end)
|
||
--资质相关
|
||
-- this.qualityImage.sprite=GetQuantityImage(this.spLoader, _heroSConfigData.Natural)
|
||
-- this.quality:SetActive(_heroSConfigData.Natural < 10)
|
||
-- this.doubleQuality:SetActive(_heroSConfigData.Natural >= 10)
|
||
-- this.quality:GetComponent("Text").text = _heroSConfigData.Natural
|
||
-- this.doubleQuality:GetComponent("Text").text = _heroSConfigData.Natural
|
||
--定位描述相关
|
||
--this.posBgImage.sprite=this.spLoader:LoadSprite(GetHeroPosBgStr(_heroSConfigData.Profession))
|
||
this.posImage.sprite=this.spLoader:LoadSprite(GetHeroPosStr(_heroSConfigData.Profession))
|
||
this.posText.text=GetLanguageStrById(_heroSConfigData.HeroLocation)
|
||
SetTextVerTial(this.posText.gameObject,Vector3.New(67.5,0,0),"MiddleLeft")
|
||
this.heroName.text = GetLanguageStrById(_heroSConfigData.ReadingName)
|
||
-- this.posText.text = HeroOccupationDef[_heroSConfigData.Profession]
|
||
-- this.posImage.sprite = this.spLoader:LoadSprite(GetJobSpriteStrByJobNum(_heroSConfigData.Profession))
|
||
this.profession.sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(_heroSConfigData.PropertyName))
|
||
-- this.heroTypeText.text = "定位:".."<size=35>".._heroSConfigData.HeroLocation.."</size>"
|
||
-- this.radar:SetEdges({_heroSConfigData.AttackScale/100,_heroSConfigData.DefenseScale/100,_heroSConfigData.AssistScale/100})
|
||
-- this.radar.color = Color.New(238/255,211/255,156/255,102/255)
|
||
end
|
||
function this.GetShowPanelData()
|
||
local heroSData=ConfigManager.GetConfigData(ConfigName.HeroConfig, heroBackData.heroId)
|
||
this.ShowHeroLive(heroSData)
|
||
--星级
|
||
SetHeroStars(this.spLoader, this.starGrid, heroBackData.star,2,Vector2.New(60,60),-11.92,Vector2.New(0.5,0.5))
|
||
--属性
|
||
local allAddProVal=HeroPropManager.GetHeroProp(heroBackData.id)
|
||
this.atk.text=allAddProVal[HeroProType.Attack]
|
||
this.hp.text=allAddProVal[HeroProType.Hp]
|
||
this.phyDef.text=allAddProVal[HeroProType.PhysicalDefence]
|
||
this.magDef.text=allAddProVal[HeroProType.MagicDefence]
|
||
breakId = heroBackData.breakId
|
||
upStarId = heroBackData.starBreakId
|
||
-- this.speed.text= allAddProVal[HeroProType.Speed]
|
||
--技能
|
||
-- this.selsectSkillImage:SetActive(false)
|
||
-- this.skillGrid:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1
|
||
-- if allSkillDatas[1] and allSkillDatas[1].skillConfig and allSkillDatas[1].skillConfig.Name then
|
||
-- this.skill1:SetActive(true)
|
||
-- this.skill1.transform:GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(allSkillDatas[1].skillConfig.Icon))
|
||
-- Util.GetGameObject(this.skill1.transform,"Text"):GetComponent("Text").text="等级"..(allSkillDatas[1].skillId % 10)
|
||
-- else
|
||
-- this.skill1:SetActive(false)
|
||
-- end
|
||
-- if allSkillDatas[2] and allSkillDatas[2].skillConfig and allSkillDatas[2].skillConfig.Name then
|
||
-- this.skill2:SetActive(true)
|
||
-- this.skill2.transform:GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(allSkillDatas[2].skillConfig.Icon))
|
||
-- Util.GetGameObject(this.skill2.transform,"Text"):GetComponent("Text").text="等级"..(allSkillDatas[2].skillId % 10)
|
||
-- else
|
||
-- this.skill2:SetActive(false)
|
||
-- end
|
||
|
||
end
|
||
function this.NoGetShowPanelData()
|
||
local heroSData=ConfigManager.GetConfigData(ConfigName.HeroConfig, heroSId)
|
||
this.ShowHeroLive(heroSData)
|
||
--星级
|
||
--Util.ClearChild(this.starGrid.transform)
|
||
SetHeroStars(this.spLoader, this.starGrid, heroStar,2,Vector2.New(60,60),-11.92)
|
||
--属性
|
||
local allAddProVal = this.CalculateHeroAllProValList(heroSData,heroStar,heroStar ~= heroSData.Star)
|
||
this.atk.text=allAddProVal[HeroProType.Attack]
|
||
this.hp.text=allAddProVal[HeroProType.Hp]
|
||
this.phyDef.text=allAddProVal[HeroProType.PhysicalDefence]
|
||
this.magDef.text=allAddProVal[HeroProType.MagicDefence]
|
||
-- this.speed.text= heroSData.Speed
|
||
--技能
|
||
-- Log("#allSkillDatas "..#allSkillDatas)
|
||
-- this.selsectSkillImage:SetActive(false)
|
||
-- this.skillGrid:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1
|
||
-- if allSkillDatas[1] and allSkillDatas[1].skillConfig and allSkillDatas[1].skillConfig.Name then
|
||
-- this.skill1:SetActive(true)
|
||
-- this.skill1.transform:GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(allSkillDatas[1].skillConfig.Icon))
|
||
-- Util.GetGameObject(this.skill1.transform,"Text"):GetComponent("Text").text="等级"..(allSkillDatas[1].skillId % 10)
|
||
-- else
|
||
-- this.skill1:SetActive(false)
|
||
-- end
|
||
-- if allSkillDatas[2] and allSkillDatas[2].skillConfig and allSkillDatas[2].skillConfig.Name then
|
||
-- this.skill2:SetActive(true)
|
||
-- this.skill2.transform:GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(allSkillDatas[2].skillConfig.Icon))
|
||
-- Util.GetGameObject(this.skill2.transform,"Text"):GetComponent("Text").text="等级"..(allSkillDatas[2].skillId % 10)
|
||
-- else
|
||
-- this.skill2:SetActive(false)
|
||
-- end
|
||
|
||
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
|
||
local heroLevelConfig = ConfigManager.GetConfig(ConfigName.HeroLevelConfig)
|
||
--计算英雄属性 1 初始 2 满星
|
||
function this.CalculateHeroAllProValList(heroConFigData,_starNum,isCalculateStarVal)
|
||
local allAddProVal = {}
|
||
for i, v in ConfigPairs(propertyConfig) do
|
||
allAddProVal[i] = 0
|
||
end
|
||
-- local heroRankupConfig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.HeroRankupConfig, "Star", heroConFigData.Star, "OpenStar", _starNum)
|
||
-- local curLvNum = 1
|
||
-- local breakId = 0
|
||
-- local upStarId = 0
|
||
-- if isCalculateStarVal then
|
||
-- curLvNum = heroLevelConfig[heroRankupConfig.OpenLevel].CharacterLevelPara
|
||
-- for i, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.HeroRankupConfig)) do
|
||
-- if v.Star == heroConFigData.Star then
|
||
-- if v.Type == 1 then
|
||
-- breakId = v.Id
|
||
-- end
|
||
-- if v.Type == 2 then
|
||
-- upStarId = v.Id
|
||
-- end
|
||
-- end
|
||
-- end
|
||
-- end
|
||
local heroRankupConfig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.HeroRankupConfig, "Star", heroConFigData.Star, "OpenStar", _starNum)
|
||
local curLvNum=1
|
||
breakId = 0
|
||
upStarId = 0
|
||
if isCalculateStarVal then
|
||
--等级
|
||
curLvNum = heroRankupConfig.OpenLevel
|
||
--解锁天赋
|
||
for i, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.HeroRankupConfig)) do
|
||
if v.OpenStar == _starNum and v.Star==heroConFigData.Star then
|
||
if v.Type == 1 then
|
||
breakId = v.Id
|
||
end
|
||
if v.Type == 2 then
|
||
upStarId = v.Id
|
||
end
|
||
end
|
||
end
|
||
if breakId==0 then
|
||
breakId=6
|
||
end
|
||
end
|
||
allAddProVal[HeroProType.Attack]=HeroManager.CalculateProVal(heroConFigData.Attack, curLvNum, breakId,upStarId,HeroProType.Attack)
|
||
allAddProVal[HeroProType.Hp]=HeroManager.CalculateProVal(heroConFigData.Hp, curLvNum, breakId,upStarId,HeroProType.Hp)
|
||
allAddProVal[HeroProType.PhysicalDefence]=HeroManager.CalculateProVal(heroConFigData.PhysicalDefence, curLvNum, breakId,upStarId,HeroProType.PhysicalDefence)
|
||
allAddProVal[HeroProType.MagicDefence]=HeroManager.CalculateProVal(heroConFigData.MagicDefence, curLvNum, breakId,upStarId,HeroProType.MagicDefence)
|
||
--allAddProVal[HeroProType.Speed]= math.floor(((curSpeedFormulaData[1] * math.pow(breakId, 3) + curSpeedFormulaData[2] * math.pow(breakId, 2) + curSpeedFormulaData[3] * breakId + curSpeedFormulaData[4]) + heroConFigData.Speed * speedNum))
|
||
-- for i = 1, #heroConFigData.SecondaryFactor do
|
||
-- local proId = heroConFigData.SecondaryFactor[i][1]
|
||
-- if propertyConfig[proId].Style ==2 then
|
||
-- allAddProVal[heroConFigData.SecondaryFactor[i][1]] = heroConFigData.SecondaryFactor[i][2]/10000
|
||
-- else
|
||
-- allAddProVal[heroConFigData.SecondaryFactor[i][1]] = heroConFigData.SecondaryFactor[i][2]
|
||
-- end
|
||
-- end
|
||
Util.AddOnceClick(this.talentBtn,function()
|
||
UIManager.OpenPanel(UIName.RoleTalentPopup,heroConFigData,breakId,upStarId)
|
||
end)
|
||
return allAddProVal
|
||
end
|
||
--界面关闭时调用(用于子类重写)
|
||
function RoleGetInfoPopup:OnClose()
|
||
|
||
poolManager:UnLoadLive(this.testLiveGO.name, this.testLiveGO)
|
||
this.testLiveGO = nil
|
||
end
|
||
|
||
--界面销毁时调用(用于子类重写)
|
||
function RoleGetInfoPopup:OnDestroy()
|
||
this.spLoader:Destroy()
|
||
|
||
end
|
||
|
||
return RoleGetInfoPopup
|
||
|