164 lines
7.8 KiB
Lua
164 lines
7.8 KiB
Lua
require("Base/BasePanel")
|
|
DropGetSSRHeroShopPanel = Inherit(BasePanel)
|
|
local heroConfigData = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
|
local passiveSkillConfig=ConfigManager.GetConfig(ConfigName.PassiveSkillConfig)
|
|
local passiveSkillLogicConfig=ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig)
|
|
local heroRankupConfig=ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
|
|
local heroBackData = {}
|
|
local callBack
|
|
local orginLayer
|
|
--初始化组件(用于子类重写)
|
|
function DropGetSSRHeroShopPanel:InitComponent()
|
|
self.spLoader = SpriteLoader.New()
|
|
orginLayer = 0
|
|
self.live2dRoot = Util.GetGameObject(self.gameObject, "live2dRoot")
|
|
self.bg = Util.GetGameObject(self.gameObject, "bg")
|
|
self.bg2 = Util.GetGameObject(self.gameObject, "bg2")
|
|
screenAdapte(self.bg2)
|
|
self.sureBtn = Util.GetGameObject(self.transform, "sureBtn")
|
|
self.UI_Effect_chouka = Util.GetGameObject(self.transform, "bg/UI_Effect_chouka")
|
|
|
|
|
|
self.sureBtn = Util.GetGameObject(self.transform, "sureBtn")
|
|
self.rolePanel = Util.GetGameObject(self.transform, "rolePanel")
|
|
self.heroName = Util.GetGameObject(self.transform, "rolePanel/Panel/name/heroName"):GetComponent("Text")
|
|
self.proImage = Util.GetGameObject(self.transform, "rolePanel/Panel/name/proImage/proImage/proImage"):GetComponent("Image")
|
|
self.starGrid = Util.GetGameObject(self.transform, "rolePanel/Panel/star")
|
|
self.posImage=Util.GetGameObject(self.transform,"rolePanel/Pos/PosImage"):GetComponent("Image")
|
|
self.posText=Util.GetGameObject(self.transform,"rolePanel/Pos/PosText"):GetComponent("Text")
|
|
self.info=Util.GetGameObject(self.gameObject,"rolePanel/Panel/Info")
|
|
self.infoTitleBg=Util.GetGameObject(self.info,"TitleBg")
|
|
self.infoTitle=Util.GetGameObject(self.infoTitleBg,"Title"):GetComponent("Text")
|
|
self.infoBody=Util.GetGameObject(self.info,"BodyBg/Viewport/Body"):GetComponent("Text")
|
|
self.infoBodyGo=Util.GetGameObject(self.info,"BodyBg")
|
|
end
|
|
|
|
--绑定事件(用于子类重写)
|
|
function DropGetSSRHeroShopPanel:BindEvent()
|
|
|
|
Util.AddClick(self.sureBtn, function()
|
|
self:ClosePanel()
|
|
end)
|
|
end
|
|
|
|
--添加事件监听(用于子类重写)
|
|
function DropGetSSRHeroShopPanel:AddListener()
|
|
|
|
end
|
|
|
|
--移除事件监听(用于子类重写)
|
|
function DropGetSSRHeroShopPanel:RemoveListener()
|
|
|
|
end
|
|
|
|
local heroStaticData
|
|
local testLiveGO
|
|
--界面打开时调用(用于子类重写)
|
|
function DropGetSSRHeroShopPanel:OnOpen(_heroBackData,func)
|
|
|
|
heroBackData = _heroBackData
|
|
callBack = func
|
|
end
|
|
|
|
function DropGetSSRHeroShopPanel:OnSortingOrderChange()
|
|
Util.AddParticleSortLayer(self.bg, self.sortingOrder - orginLayer)
|
|
self.live2dRoot:GetComponent("Canvas").sortingOrder = self.sortingOrder + 10
|
|
self.rolePanel:GetComponent("Canvas").sortingOrder = self.sortingOrder + 100
|
|
orginLayer = self.sortingOrder
|
|
end
|
|
|
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
|
function DropGetSSRHeroShopPanel:OnShow()
|
|
|
|
self.UI_Effect_chouka:SetActive(true)
|
|
SoundManager.PlaySound(SoundConfig.Sound_Recruit3)
|
|
heroStaticData = heroConfigData[heroBackData.heroId]
|
|
--TODO:动态加载立绘
|
|
testLiveGO = poolManager:LoadLive(GetResourcePath(heroStaticData.Painting), self.live2dRoot.transform,
|
|
Vector3.one * heroStaticData.Scale, Vector3.New(heroStaticData.Position[1],heroStaticData.Position[2],0))
|
|
local SkeletonGraphic = testLiveGO:GetComponent("SkeletonGraphic")
|
|
SetHEeroLiveToward(testLiveGO,heroStaticData.Toward,heroStaticData.Position)
|
|
local idle = function() SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true) end
|
|
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idle
|
|
poolManager:SetLiveClearCall(GetResourcePath(heroStaticData.Painting), testLiveGO, function ()
|
|
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idle
|
|
end)
|
|
|
|
self.infoTitle.text=GetLanguageStrById(heroStaticData.HeroLocationDesc1)
|
|
SetHeroStars(self.spLoader, self.starGrid, heroStaticData.Star,1,Vector2.New(52,52),-2,Vector2.New(0.5,0.5))
|
|
-- self.profession.sprite = self.spLoader:LoadSprite(GetJobSpriteStrByJobNum(heroStaticData.Profession))
|
|
self.proImage.sprite =self.spLoader:LoadSprite(GetProStrImageByProNum(heroStaticData.PropertyName))
|
|
self.heroName.text =GetLanguageStrById(heroStaticData.ReadingName) --string.format("lv.%s", heroData.lv)
|
|
--Util.GetGameObject(self.transform,"Pos"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetHeroPosBgStr(heroStaticData.Profession))
|
|
self.posImage.sprite=self.spLoader:LoadSprite(GetHeroPosStr(heroStaticData.Profession))
|
|
self.posText.text=GetLanguageStrById(heroStaticData.HeroLocation)
|
|
SetTextVerTial(self.posText.gameObject,Vector3.New(63.76,1.5,0),"MiddleLeft")
|
|
--指定星级开启info
|
|
self.info:SetActive(heroStaticData.Star == 5 or heroStaticData.Star == 4)
|
|
self.infoBodyGo:SetActive(heroStaticData.Star == 5)
|
|
self.infoTitle.text=GetLanguageStrById(heroStaticData.HeroLocationDesc1)
|
|
if heroStaticData.Star == 5 then
|
|
local t={}
|
|
local upStarSkillDataList={} --数据容器
|
|
--获取几星激活数据
|
|
for i = 1, #heroStaticData.OpenPassiveSkillRules do
|
|
if heroStaticData.OpenPassiveSkillRules[i][1] == 2 then
|
|
local passiveSkillConfig = passiveSkillConfig[heroStaticData.OpenPassiveSkillRules[i][3]]
|
|
if passiveSkillConfig and passiveSkillLogicConfig[passiveSkillConfig.Id].Judge == 1 and string.len(passiveSkillConfig.Desc) > 1 then
|
|
local d = {}
|
|
d.passiveSkillConfig = passiveSkillConfig
|
|
d.OpenPassiveSkillRules = heroStaticData.OpenPassiveSkillRules[i]
|
|
d.titleStr = "<size=34><color=#5AC383>"..NumToSimplenessFont[heroRankupConfig[heroStaticData.OpenPassiveSkillRules[i][2]].Phase[2]] .. Language[11718]
|
|
table.insert(upStarSkillDataList,d)
|
|
end
|
|
end
|
|
end
|
|
--数据插入t
|
|
for j = 1, #upStarSkillDataList do
|
|
if passiveSkillLogicConfig[upStarSkillDataList[j].passiveSkillConfig.Id].Judge == 1 then
|
|
table.insert(t,upStarSkillDataList[j].titleStr..GetLanguageStrById(upStarSkillDataList[j].passiveSkillConfig.Desc).."\n")
|
|
end
|
|
end
|
|
|
|
--获取法宝数据
|
|
local dTalis = ConfigManager.GetConfigData(ConfigName.HeroConfig,heroStaticData.Id).EquipTalismana--当前法宝数据 data[1]星级 data[2]法宝ID
|
|
local dowerAllData= ConfigManager.GetAllConfigsDataByKey(ConfigName.EquipTalismana,"TalismanaId",dTalis[2])--当前法宝全部天赋数据(天赋可能为空)
|
|
local dowerData={}--当前法宝全部技能数据(天赋不为空)
|
|
for k=1,#dowerAllData do
|
|
if dowerAllData[k].OpenSkillRules then
|
|
table.insert(dowerData, dowerAllData[k])
|
|
end
|
|
end
|
|
--数据插入t,保证在星数据后
|
|
for n=1,#dowerData do
|
|
if dowerData[n].Level==25 then
|
|
table.insert(t,Language[11719]..GetLanguageStrById(passiveSkillConfig[dowerData[n].OpenSkillRules[1]].Desc).."\n")
|
|
end
|
|
end
|
|
local s=table.concat(t)--将表里字符串拼接
|
|
--看这下面 是全角空格哦~
|
|
self.infoBody.text=string.sub(s,1,-2)--去除最后\n
|
|
end
|
|
|
|
PlayUIAnim(self.transform)
|
|
end
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
function DropGetSSRHeroShopPanel:OnClose()
|
|
if testLiveGO then
|
|
poolManager:UnLoadLive(GetResourcePath(heroStaticData.Painting), testLiveGO)
|
|
testLiveGO = nil
|
|
end
|
|
if callBack then
|
|
callBack()
|
|
end
|
|
end
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
function DropGetSSRHeroShopPanel:OnDestroy()
|
|
self.spLoader:Destroy()
|
|
end
|
|
|
|
return DropGetSSRHeroShopPanel
|
|
|