miduo_client/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponGetInfoPopup.lua

190 lines
9.3 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")
Util.GetGameObject(self.transform, "bg/title"):GetComponent("Text").text = Language[11187]
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))
--属性
--LogError("pokemonBackData.tempId=="..pokemonBackData.tempId.." pokemonBackData.star=="..pokemonBackData.star.." pokemonBackData.level=="..pokemonBackData.level)
local allAddProVal = GodWeaponManager.GetSinglePokemonAddProData2(pokemonBackData.tempId, pokemonBackData.star,
pokemonBackData.level)
Util.GetGameObject(proList[0].transform, "proName"):GetComponent("Text").text = Language[10539]
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 = GetLanguageStrById(
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")
skillName.text = GetLanguageStrById(skills[i].Name)
skillIcon.sprite = this.spLoader:LoadSprite(GetResourcePath(skills[i].Icon))
Util.AddOnceClick(skillIcon.gameObject, function()
local allSkillData = ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.ShenBingSkill, "SkillPanDuan",
skills[i].SkillPanDuan, "SpiritAnimalMatch", skills[i].SpiritAnimalMatch)
UIManager.OpenPanel(UIName.GodWeaponSkillInfoPopup, skills[i].Name, allSkillData)
end)
end
end
function this.NoGetShowPanelData()
local pokemonSData = ConfigManager.GetConfigData(ConfigName.ShenBing, pokemonSid)
this.heroName.text = GetStringByEquipQua(pokemonSData.Quality, GetLanguageStrById(pokemonSData.Name))
--SetTextVerTial(this.heroName, Vector3.New(96.87, 0, 0))
this.liveRoot.sprite = this.spLoader:LoadSprite(GetResourcePath(pokemonSData.Icon))
--星级
PokemonManager.SetHeroStars(this.spLoader, this.starGrid, pokemonSData.MaxStar, 2, Vector2.New(60, 60))
--属性
local allAddProVal = GodWeaponManager.GetSinglePokemonAddProData2(pokemonSid, pokemonSData.MaxStar,
pokemonSData.MaxLevel) --this.CalculateHeroAllProValList(heroSData,heroStar,heroStar ~= heroSData.Star)
Util.GetGameObject(proList[0].transform, "proName"):GetComponent("Text").text = Language[10539]
Util.GetGameObject(proList[0].transform, "proValue"):GetComponent("Text").text = pokemonSData.MaxLevel ..
"/" .. 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 = GetLanguageStrById(
value)
Util.GetGameObject(proList[index].transform, "Image"):GetComponent("Image").sprite = this.spLoader
:LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.PropertyConfig, key).PropertyIcon))
end
end
local skills = ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.ShenBingSkill, "SpiritAnimalMatch", pokemonSid,
"StarMatch", pokemonSData.MaxStar)
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 = GetLanguageStrById(skills[i].Name)
skillIcon.sprite = this.spLoader:LoadSprite(GetResourcePath(skills[i].Icon))
Util.AddOnceClick(skillIcon.gameObject, function()
--UIManager.OpenPanel(UIName.PokemonSkillInfoPopup,pokemonSid,pokemonSData.MaxLevel,pokemonSData.MaxStar)
local allSkillData = ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.ShenBingSkill, "SkillPanDuan",
skills[i].SkillPanDuan, "SpiritAnimalMatch", skills[i].SpiritAnimalMatch)
UIManager.OpenPanel(UIName.GodWeaponSkillInfoPopup, skills[i].Name, allSkillData)
end)
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