183 lines
8.7 KiB
Lua
183 lines
8.7 KiB
Lua
|
require("Base/BasePanel")
|
|||
|
GodWeaponGetInfoPopup = Inherit(BasePanel)
|
|||
|
local this=GodWeaponGetInfoPopup
|
|||
|
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
|||
|
local pokemonBackData
|
|||
|
local pokemonSid
|
|||
|
local isGet
|
|||
|
local proList = {}
|
|||
|
local skillList={}
|
|||
|
--初始化组件(用于子类重写)
|
|||
|
function GodWeaponGetInfoPopup:InitComponent()
|
|||
|
this.spLoader = SpriteLoader.New()
|
|||
|
|
|||
|
this.BtnBack=Util.GetGameObject(self.transform, "bg/btnBack")
|
|||
|
this.liveRoot=Util.GetGameObject(self.transform, "bg/liveRoot"):GetComponent("Image")
|
|||
|
this.heroName = Util.GetGameObject(self.transform, "bg/nameInfo/nameText"):GetComponent("Text")
|
|||
|
this.starGrid = Util.GetGameObject(self.transform, "bg/PokemonInfo/starGrid(Clone)")
|
|||
|
--属性
|
|||
|
for i = 0, 4 do
|
|||
|
proList[i] = Util.GetGameObject(self.transform,"bg/PokemonInfo/pro/singlePro ("..i..")")
|
|||
|
end
|
|||
|
--技能
|
|||
|
for i = 1, 2 do
|
|||
|
skillList[i] = Util.GetGameObject(self.transform,"bg/PokemonInfo/skillGrid/skill"..i)
|
|||
|
skillList[i]:SetActive(false)
|
|||
|
end
|
|||
|
this.skillGrid=Util.GetGameObject(self.transform,"bg/PokemonInfo/skillGrid")
|
|||
|
this.skillPre=Util.GetGameObject(self.transform,"bg/PokemonInfo/skill")
|
|||
|
|
|||
|
end
|
|||
|
local triggerCallBack
|
|||
|
--绑定事件(用于子类重写)
|
|||
|
function GodWeaponGetInfoPopup:BindEvent()
|
|||
|
|
|||
|
Util.AddClick(this.BtnBack, function()
|
|||
|
self:ClosePanel()
|
|||
|
end)
|
|||
|
end
|
|||
|
--添加事件监听(用于子类重写)
|
|||
|
function GodWeaponGetInfoPopup:AddListener()
|
|||
|
|
|||
|
end
|
|||
|
|
|||
|
--移除事件监听(用于子类重写)
|
|||
|
function GodWeaponGetInfoPopup:RemoveListener()
|
|||
|
|
|||
|
end
|
|||
|
|
|||
|
--界面打开时调用(用于子类重写)
|
|||
|
function GodWeaponGetInfoPopup:OnOpen(_isGet,data)--data 未获得的时候为灵兽静态ID 获得的时候为本地数据
|
|||
|
|
|||
|
isGet=_isGet
|
|||
|
if isGet then
|
|||
|
pokemonBackData = data
|
|||
|
else
|
|||
|
pokemonSid = data
|
|||
|
end
|
|||
|
end
|
|||
|
function GodWeaponGetInfoPopup:OnShow()
|
|||
|
if isGet then
|
|||
|
this.GetShowPanelData()
|
|||
|
else
|
|||
|
this.NoGetShowPanelData()
|
|||
|
end
|
|||
|
end
|
|||
|
function this.GetShowPanelData()
|
|||
|
local pokemonSData=ConfigManager.GetConfigData(ConfigName.ShenBing, pokemonBackData.tempId)
|
|||
|
this.heroName.text = GetStringByEquipQua(pokemonSData.Quality, GetLanguageStrById(pokemonSData.Name))
|
|||
|
SetTextVerTial(this.heroName,Vector3.New(96.87,0,0))
|
|||
|
--this.ShowPokemonLive(pokemonSData)
|
|||
|
this.liveRoot.sprite=this.spLoader:LoadSprite(GetResourcePath(pokemonSData.Icon))
|
|||
|
--星级
|
|||
|
PokemonManager.SetHeroStars(this.spLoader, this.starGrid, pokemonBackData.star,2,Vector2.New(60,60))
|
|||
|
--属性
|
|||
|
local allAddProVal=GodWeaponManager.GetSinglePokemonAddProDataByLvAndStar(pokemonBackData.tempId,pokemonBackData.level,pokemonBackData.star)
|
|||
|
Util.GetGameObject(proList[0].transform,"proName"):GetComponent("Text").text =Language[10453]
|
|||
|
Util.GetGameObject(proList[0].transform,"proValue"):GetComponent("Text").text = pokemonBackData.level
|
|||
|
Util.GetGameObject(proList[0].transform,"Image"):GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_jinengdian05")
|
|||
|
local index = 0
|
|||
|
for key, value in pairs(allAddProVal) do
|
|||
|
index = index + 1
|
|||
|
if proList[index] then
|
|||
|
Util.GetGameObject(proList[index].transform,"proName"):GetComponent("Text").text = GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.PropertyConfig,key).Info)
|
|||
|
Util.GetGameObject(proList[index].transform,"proValue"):GetComponent("Text").text = value
|
|||
|
Util.GetGameObject(proList[index].transform,"Image"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.PropertyConfig,key).PropertyIcon))
|
|||
|
end
|
|||
|
end
|
|||
|
LogError("pokemonBackData.tempId=="..pokemonBackData.tempId.." pokemonBackData.star=="..pokemonBackData.star)
|
|||
|
local skills=ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.ShenBingSkill,"SpiritAnimalMatch",pokemonBackData.tempId,"StarMatch",pokemonBackData.star)
|
|||
|
for i = 1, #skillList do
|
|||
|
skillList[i]:SetActive(false)
|
|||
|
end
|
|||
|
for i = 1, #skills do
|
|||
|
skillList[i]:SetActive(true)
|
|||
|
local skillName=Util.GetGameObject(skillList[i].transform,"nameText"):GetComponent("Text")
|
|||
|
local skillIcon=Util.GetGameObject(skillList[i].transform,"icon"):GetComponent("Image")
|
|||
|
local skillBtn=Util.GetGameObject(skillList[i].transform,"bg/PokemonInfo/skill/icon")
|
|||
|
skillName.text=skills[i].Name
|
|||
|
skillIcon.sprite= this.spLoader:LoadSprite(GetResourcePath(skills[i].Icon))
|
|||
|
end
|
|||
|
|
|||
|
-- local curSkillId = 0
|
|||
|
-- local skillArray = ConfigManager.GetConfigData(ConfigName.SpiritAnimal,pokemonBackData.tempId).SkillArray
|
|||
|
-- for i = 1, #skillArray do
|
|||
|
-- if skillArray[i][1] == pokemonBackData.star then
|
|||
|
-- curSkillId = skillArray[i][2]
|
|||
|
-- end
|
|||
|
-- end
|
|||
|
-- local curSkillConFig = ConfigManager.GetConfigData(ConfigName.SpiritAnimalSkill,curSkillId)
|
|||
|
-- this.skillName.text = GetLanguageStrById(curSkillConFig.Name)
|
|||
|
-- this.skillLvGo:SetActive(true)
|
|||
|
-- this.skillLv.text = curSkillConFig.Level
|
|||
|
-- this.skillIcon.sprite = this.spLoader:LoadSprite(GetResourcePath(curSkillConFig.Icon))
|
|||
|
Util.AddOnceClick(this.skillBtn, function()
|
|||
|
UIManager.OpenPanel(UIName.PokemonSkillInfoPopup,pokemonBackData.tempId,pokemonBackData.level,pokemonBackData.star)
|
|||
|
end)
|
|||
|
end
|
|||
|
function this.NoGetShowPanelData()
|
|||
|
local pokemonSData=ConfigManager.GetConfigData(ConfigName.SpiritAnimal, pokemonSid)
|
|||
|
this.heroName.text = GetStringByEquipQua(pokemonSData.Quality, GetLanguageStrById(pokemonSData.Name))
|
|||
|
SetTextVerTial(this.heroName,Vector3.New(96.87,0,0))
|
|||
|
--this.ShowPokemonLive(pokemonSData)
|
|||
|
--星级
|
|||
|
PokemonManager.SetHeroStars(this.spLoader, this.starGrid, 0,2,Vector2.New(60,60))
|
|||
|
--属性
|
|||
|
local allAddProVal = PokemonManager.GetSinglePokemonAddProDataBySid(pokemonSid) --this.CalculateHeroAllProValList(heroSData,heroStar,heroStar ~= heroSData.Star)
|
|||
|
Util.GetGameObject(proList[0].transform,"proName"):GetComponent("Text").text =Language[10453]
|
|||
|
Util.GetGameObject(proList[0].transform,"proValue"):GetComponent("Text").text = "1/"..pokemonSData.MaxLevel
|
|||
|
Util.GetGameObject(proList[0].transform,"Image"):GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_jinengdian05")
|
|||
|
local index = 0
|
|||
|
for key, value in pairs(allAddProVal) do
|
|||
|
index = index + 1
|
|||
|
if proList[index] then
|
|||
|
Util.GetGameObject(proList[index].transform,"proName"):GetComponent("Text").text = GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.PropertyConfig,key).Info)
|
|||
|
Util.GetGameObject(proList[index].transform,"proValue"):GetComponent("Text").text = value
|
|||
|
Util.GetGameObject(proList[index].transform,"Image"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.PropertyConfig,key).PropertyIcon))
|
|||
|
end
|
|||
|
end
|
|||
|
local curSkillId = 0
|
|||
|
local skillArray = ConfigManager.GetConfigData(ConfigName.SpiritAnimal,pokemonSid).SkillArray
|
|||
|
for i = 1, #skillArray do
|
|||
|
if skillArray[i][1] == 0 then
|
|||
|
curSkillId = skillArray[i][2]
|
|||
|
end
|
|||
|
end
|
|||
|
local curSkillConFig = ConfigManager.GetConfigData(ConfigName.SpiritAnimalSkill,curSkillId)
|
|||
|
this.skillName.text = GetLanguageStrById(curSkillConFig.Name)
|
|||
|
this.skillLvGo:SetActive(false)
|
|||
|
-- this.skillLv.text = curSkillConFig.Level
|
|||
|
this.skillIcon.sprite = this.spLoader:LoadSprite(GetResourcePath(curSkillConFig.Icon))
|
|||
|
Util.AddOnceClick(this.skillBtn, function()
|
|||
|
-- UIManager.OpenPanel(UIName.PokemonSkillInfoPopup,pokemonSid,1,0)
|
|||
|
UIManager.OpenPanel(UIName.PokemonAllSkillInfoPopup,pokemonSid,1,0)
|
|||
|
end)
|
|||
|
end
|
|||
|
|
|||
|
function this.ShowPokemonLive(_heroSConfigData)
|
|||
|
LogPink("_heroSConfigData.Live ".._heroSConfigData.Live)
|
|||
|
this.testLiveGO = poolManager:LoadLive(GetResourcePath(_heroSConfigData.Live), 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 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)
|
|||
|
end
|
|||
|
--界面关闭时调用(用于子类重写)
|
|||
|
function GodWeaponGetInfoPopup:OnClose()
|
|||
|
|
|||
|
poolManager:UnLoadLive(this.testLiveGO.name, this.testLiveGO)
|
|||
|
this.testLiveGO = nil
|
|||
|
end
|
|||
|
|
|||
|
--界面销毁时调用(用于子类重写)
|
|||
|
function GodWeaponGetInfoPopup:OnDestroy()
|
|||
|
this.spLoader:Destroy()
|
|||
|
|
|||
|
end
|
|||
|
|
|||
|
return GodWeaponGetInfoPopup
|
|||
|
|