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

462 lines
25 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00
require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
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
2020-05-09 13:31:21 +08:00
--初始化组件(用于子类重写)
function RoleGetInfoPopup:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-05-09 13:31:21 +08:00
this.mask=Util.GetGameObject(self.transform, "BackMask")
2020-05-09 13:31:21 +08:00
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")
2024-01-12 15:48:14 +08:00
this.title=Util.GetGameObject(self.transform, "bg/title"):GetComponent("Text")
this.title.text="英雄"
2020-07-24 20:03:06 +08:00
this.starGrid = Util.GetGameObject(self.transform, "RoleInfo/sartAndLvLayout")
2020-05-09 13:31:21 +08:00
--定位描述
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")
2021-02-24 11:47:07 +08:00
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)
2021-02-19 17:50:10 +08:00
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")
2021-04-21 13:12:04 +08:00
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) )
2021-02-19 17:50:10 +08:00
atk_Image:SetNativeSize()
hp_Image:SetNativeSize()
phyDef_Image:SetNativeSize()
magDef_Image:SetNativeSize()
2020-05-09 13:31:21 +08:00
-- 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")
2024-09-11 21:30:46 +08:00
Util.GetGameObject(self.transform,"RoleInfo/Panel/Other/TalismanBtn/Text"):GetComponent("Text").text="意念"
2020-05-09 13:31:21 +08:00
this.talentBtn=Util.GetGameObject(self.transform,"RoleInfo/Panel/Other/talentBtn")
this.talentProgress=Util.GetGameObject(self.transform,"RoleInfo/Panel/Other/talentBtn/progress"):GetComponent("Text")
2021-01-26 17:08:39 +08:00
2020-05-09 13:31:21 +08:00
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)
2020-05-09 13:31:21 +08:00
-- 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
2020-05-09 13:31:21 +08:00
end
function RoleGetInfoPopup:OnShow()
allSkillDatas = HeroManager.GetCurHeroSidAndCurStarAllSkillDatas2(heroSId,heroStar)
2020-05-09 13:31:21 +08:00
local heroSData=ConfigManager.GetConfigData(ConfigName.HeroConfig, heroSId)
--heroStar=heroSData.MaxRank
2020-05-09 13:31:21 +08:00
if isGet then
this.GetShowPanelData()
--天赋
this.talentBtn:SetActive(heroSData.OpenPassiveSkillRules ~= nil)
Util.AddOnceClick(this.talentBtn,function()
UIManager.OpenPanel(UIName.RoleTalentPopup,heroSData,0,0)
end)
2020-05-09 13:31:21 +08:00
else
this.NoGetShowPanelData()
end
LogError("breakid=="..breakId.." upstarid=="..upStarId)
2025-03-21 17:36:34 +08:00
local talentBtnImage = heroStar == HeroManager.awakeNextStarIndex and "UI_hz_zhonghe02_24" or "UI_hz_zhonghe02_24"
2021-04-21 13:12:04 +08:00
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
2020-05-09 13:31:21 +08:00
--技能 布局变动
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)
2020-05-09 13:31:21 +08:00
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)
2020-05-09 13:31:21 +08:00
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
2020-05-09 13:31:21 +08:00
for i = 1, this.skillGrid.transform.childCount do
this.skillGrid.transform:GetChild(i-1).gameObject:SetActive(false)
end
2020-05-09 13:31:21 +08:00
for i = 1, #skillList do
2021-01-26 17:08:39 +08:00
if skillList[i] and skillList[i].skillConfig and GetLanguageStrById(skillList[i].skillConfig.Name) then
2020-05-09 13:31:21 +08:00
local go = this.skillGrid.transform:GetChild(i-1).gameObject
go:SetActive(true)
2021-04-21 13:12:04 +08:00
Util.GetGameObject(go.transform,"s"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(skillList[i].skillConfig.Icon))
2021-02-24 18:17:46 +08:00
local sText = Util.GetGameObject(go.transform,"s/Text"):GetComponent("Text")
sText.text=GetLanguageStrById(skillList[i].skillConfig.Name)
2024-01-17 11:21:50 +08:00
sText.fontSize = GetCurLanguage() ~= 2 and 25 or 25
2021-04-21 13:12:04 +08:00
Util.GetGameObject(go.transform,"SkillTypeImage"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetSkillType(allSkillDatas[i]))
2025-03-21 17:31:12 +08:00
local typeName = Util.GetGameObject(go.transform,"SkillTypeImage/Text")
typeName:GetComponent("Text").text= GetSkillTypeDes(skillList[i])
2020-05-09 13:31:21 +08:00
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
2022-05-19 21:33:38 +08:00
skillData.isOpen=skillList[i].isOpen
skillData.needStar=skillList[i].needStar
2020-05-09 13:31:21 +08:00
local maxLv= HeroManager.GetHeroSkillMaxLevel(heroSData.Id,skillData.skillConfig.Type)
local nextData
local panel
2022-05-19 22:24:02 +08:00
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
2020-05-09 13:31:21 +08:00
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
2021-04-21 13:12:04 +08:00
-- self.talismanFrame.sprite=this.spLoader:LoadSprite(TalismanBubble[itemConfig[heroSData.EquipTalismana[2]].Quantity])
this.talismanIcon.sprite = this.spLoader:LoadSprite(GetResourcePath(itemConfig[heroSData.EquipTalismana[2]].ResourceID))
2020-05-09 13:31:21 +08:00
end
Util.AddOnceClick(this.talismanBtn.gameObject,function()
2023-12-06 16:58:51 +08:00
--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)
2020-05-09 13:31:21 +08:00
end)
end
function this.ShowHeroLive(_heroSConfigData)
2023-11-15 16:42:13 +08:00
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))
2020-05-09 13:31:21 +08:00
local SkeletonGraphic = this.testLiveGO:GetComponent("SkeletonGraphic")
2024-01-12 15:48:14 +08:00
--local position=_heroSConfigData.Position
--position[2]=_heroSConfigData.Position[2]-250
local pos1={}
pos1[1]=_heroSConfigData.Position[1]
2024-01-22 20:37:25 +08:00
pos1[2]=_heroSConfigData.Position[2]---250
2024-01-12 15:48:14 +08:00
SetHEeroLiveToward(this.testLiveGO,_heroSConfigData.Toward,pos1)
2020-05-09 13:31:21 +08:00
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)
--资质相关
2021-04-21 13:12:04 +08:00
-- this.qualityImage.sprite=GetQuantityImage(this.spLoader, _heroSConfigData.Natural)
2020-05-09 13:31:21 +08:00
-- 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
--定位描述相关
2023-12-06 16:58:51 +08:00
--this.posBgImage.sprite=this.spLoader:LoadSprite(GetHeroPosBgStr(_heroSConfigData.Profession))
2021-04-21 13:12:04 +08:00
this.posImage.sprite=this.spLoader:LoadSprite(GetHeroPosStr(_heroSConfigData.Profession))
2021-01-26 17:08:39 +08:00
this.posText.text=GetLanguageStrById(_heroSConfigData.HeroLocation)
SetTextVerTial(this.posText.gameObject,Vector3.New(67.5,0,0),"MiddleLeft")
this.heroName.text = GetLanguageStrById(_heroSConfigData.ReadingName)
2020-05-09 13:31:21 +08:00
-- this.posText.text = HeroOccupationDef[_heroSConfigData.Profession]
2021-04-21 13:12:04 +08:00
-- this.posImage.sprite = this.spLoader:LoadSprite(GetJobSpriteStrByJobNum(_heroSConfigData.Profession))
this.profession.sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(_heroSConfigData.PropertyName))
2020-05-09 13:31:21 +08:00
-- 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)
--星级
2021-04-21 13:12:04 +08:00
SetHeroStars(this.spLoader, this.starGrid, heroBackData.star,2,Vector2.New(60,60),-11.92,Vector2.New(0.5,0.5))
2020-05-09 13:31:21 +08:00
--属性
2021-01-22 16:53:50 +08:00
local allAddProVal=HeroPropManager.GetHeroProp(heroBackData.id)
2020-05-09 13:31:21 +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]
breakId = heroBackData.breakId
upStarId = heroBackData.starBreakId
2020-05-09 13:31:21 +08:00
-- 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)
2021-04-21 13:12:04 +08:00
-- this.skill1.transform:GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(allSkillDatas[1].skillConfig.Icon))
2020-05-09 13:31:21 +08:00
-- 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)
2021-04-21 13:12:04 +08:00
-- this.skill2.transform:GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(allSkillDatas[2].skillConfig.Icon))
2020-05-09 13:31:21 +08:00
-- 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)
2021-04-21 13:12:04 +08:00
SetHeroStars(this.spLoader, this.starGrid, heroStar,2,Vector2.New(60,60),-11.92)
2020-05-09 13:31:21 +08:00
--属性
2020-06-18 20:39:29 +08:00
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]
2020-05-09 13:31:21 +08:00
-- 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)
2021-04-21 13:12:04 +08:00
-- this.skill1.transform:GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(allSkillDatas[1].skillConfig.Icon))
2020-05-09 13:31:21 +08:00
-- 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)
2021-04-21 13:12:04 +08:00
-- this.skill2.transform:GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(allSkillDatas[2].skillConfig.Icon))
2020-05-09 13:31:21 +08:00
-- 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
2020-06-18 20:39:29 +08:00
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
2020-06-18 20:39:29 +08:00
if isCalculateStarVal then
--等级
curLvNum = heroRankupConfig.OpenLevel
--解锁天赋
2020-06-18 20:39:29 +08:00
for i, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.HeroRankupConfig)) do
if v.OpenStar == _starNum and v.Star==heroConFigData.Star then
2020-06-18 20:39:29 +08:00
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
2020-06-18 20:39:29 +08:00
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
2020-05-09 13:31:21 +08:00
--界面关闭时调用(用于子类重写)
function RoleGetInfoPopup:OnClose()
poolManager:UnLoadLive(this.testLiveGO.name, this.testLiveGO)
this.testLiveGO = nil
end
--界面销毁时调用(用于子类重写)
function RoleGetInfoPopup:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-05-09 13:31:21 +08:00
end
2021-04-21 13:12:04 +08:00
return RoleGetInfoPopup