require("Base/BasePanel")
RoleAwakeSuccessPanel = Inherit(BasePanel)
local this=RoleAwakeSuccessPanel
this.skillConfig=ConfigManager.GetConfig(ConfigName.SkillConfig)
local passiveSkillConfig=ConfigManager.GetConfig(ConfigName.PassiveSkillConfig)
local orginLayer = 20
local callBack = nil
local heroRankupConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
local passiveSkillLogicConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig)
--初始化组件(用于子类重写)
function RoleAwakeSuccessPanel:InitComponent()
this.spLoader = SpriteLoader.New()
orginLayer = 20
this.BtnBack = Util.GetGameObject(self.transform, "backBtn")
this.mask = Util.GetGameObject(self.transform, "mask")
this.live2dRoot=Util.GetGameObject(self.transform,"live2dRoot")
this.heroName = Util.GetGameObject(self.transform, "heroInfo/nameAndPossLayout/heroName"):GetComponent("Text")
this.profession = Util.GetGameObject(self.transform, "Pos/PosImage"):GetComponent("Image")
this.proImage = Util.GetGameObject(self.transform, "heroInfo/nameAndPossLayout/proImage/proImage"):GetComponent("Image")
this.starGrid = Util.GetGameObject(self.transform, "heroInfo/sartAndLvLayout")
this.posBgImage=Util.GetGameObject(self.transform,"Pos"):GetComponent("Image")
this.posText=Util.GetGameObject(self.transform,"Pos/PosText"):GetComponent("Text")
this.lvEndInfo=Util.GetGameObject(self.transform, "proInfo/lvEndText"):GetComponent("Text")
this.UI_Effect_choukaSSR = Util.GetGameObject(self.transform, "UI_Effect_chouka_SSR")
this.prefab = Util.GetGameObject(self.gameObject, "proInfo/pre")
this.ScrollParentView1 = Util.GetGameObject(self.gameObject, "proInfo/ScrollFitter")
this.ScrollView1 = SubUIManager.Open(SubUIConfig.ScrollFitterView, this.ScrollParentView1.transform,
this.prefab, Vector2.New(1017.6, 287.5), 1, 1)
end
--绑定事件(用于子类重写)
function RoleAwakeSuccessPanel:BindEvent()
Util.AddClick(this.BtnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
end
--添加事件监听(用于子类重写)
function RoleAwakeSuccessPanel:AddListener()
end
--移除事件监听(用于子类重写)
function RoleAwakeSuccessPanel:RemoveListener()
end
function RoleAwakeSuccessPanel:OnSortingOrderChange()
Util.AddParticleSortLayer(this.UI_Effect_choukaSSR, self.sortingOrder - orginLayer)
this.mask:GetComponent("Canvas").overrideSorting = true
this.mask:GetComponent("Canvas").sortingOrder = self.sortingOrder - 30
Util.SetParticleSortLayer(this.starGrid,self.sortingOrder + 1)
orginLayer = self.sortingOrder
end
local curHeroData
--界面打开时调用(用于子类重写)
function RoleAwakeSuccessPanel:OnOpen(_curHeroData,_nextHeroUpStarId,_curHeroRankUpConfigOpenLevel,_callBack)
curHeroData=_curHeroData
local nextHeroUpStarId=_nextHeroUpStarId
local curHeroRankUpConfigOpenLevel=_curHeroRankUpConfigOpenLevel
callBack = _callBack
this.UI_Effect_choukaSSR:SetActive(true)
this.LiveName = GetResourcePath(curHeroData.heroConfig.Live)
this.LiveGO = poolManager:LoadLive(this.LiveName, this.live2dRoot.transform,
Vector3.one * curHeroData.heroConfig.Scale, Vector3.New(curHeroData.heroConfig.Position[1],curHeroData.heroConfig.Position[2],0))
local star,starType = curHeroData.GetStar(1)
SetHEeroLiveToward(this.LiveGO,curHeroData.heroConfig.Toward,curHeroData.heroConfig.Position)
local starSize = Vector2.New(60,60)
local starScale = -11
if starType == 3 then
starSize = Vector2.New(1,-15)
starScale = -13
end
SetHeroStars(this.spLoader, this.starGrid, star,starType,starSize,starScale,Vector2.New(0.5,0.5))
Util.SetParticleSortLayer(this.starGrid,self.sortingOrder + 1)
this.profession.sprite = this.spLoader:LoadSprite(GetHeroPosStr(curHeroData.heroConfig.Profession))
this.proImage.sprite =this.spLoader:LoadSprite(GetProStrImageByProNum(curHeroData.changeProId))
this.heroName.text =GetLanguageStrById(curHeroData.heroConfig.ReadingName)
this.posBgImage.sprite=this.spLoader:LoadSprite(GetHeroPosBgStr(curHeroData.heroConfig.Profession))
this.posText.text=GetLanguageStrById(curHeroData.heroConfig.HeroLocation)
this.lvEndInfo.text=string.format(Language[11791],curHeroRankUpConfigOpenLevel)
local TalentData = this.GetNewTalentDataShow()
LogPink("TalentData "..#TalentData)
this.ScrollView1:SetData(TalentData, function(index, go)
this.SingOldTalentDataShow(go, TalentData[index])
end)
end
function this.GetNewTalentDataShow()
local breakSkillDataList = {}
local upStarSkillDataList = {}
if curHeroData.heroConfig.Awaken then
for i = 1, #curHeroData.heroConfig.Awaken do
local Desc = GetLanguageStrById(passiveSkillConfig[curHeroData.heroConfig.Awaken[i][3]].Desc)
if curHeroData.heroConfig.Awaken[i][1] == 1 then--突破
-- local titleStr = NumToSimplenessFont[heroRankupConfig[curHeroData.heroConfig.Awaken[i][2]].Phase[2]] .. "阶激活:"
-- local curBreakId = curHeroData.heroConfig.Awaken[i][2]
-- if breakSkillDataList[curBreakId] then
-- breakSkillDataList[curBreakId] = {index = curBreakId,type = 1,str = breakSkillDataList[curBreakId].str .. " "..Desc..""}
-- else
-- breakSkillDataList[curBreakId] = {index = curBreakId,type = 1,str =""..titleStr..Desc..""}
-- end
else--升星
local curUpStarId = curHeroData.heroConfig.Awaken[i][2]
local titleStr = NumToSimplenessFont[heroRankupConfig[curUpStarId].Phase[2]] .. Language[11792]
local _passiveSkillId = passiveSkillConfig[curHeroData.heroConfig.Awaken[i][3]].Id
-- 觉醒成功,非特性不再显示
if passiveSkillLogicConfig[_passiveSkillId].Judge == 1 then
if upStarSkillDataList[curUpStarId] then
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,type = 2,index = curUpStarId,str = upStarSkillDataList[curUpStarId].str .. " "..Desc..""}
else
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,type = 2,index = curUpStarId,str =""..titleStr..Desc..""}
end
end
end
end
end
-- local breakSkillDataList2 = {}
-- for i, v in pairs(breakSkillDataList) do
-- table.insert(breakSkillDataList2,v)
-- end
-- table.sort(breakSkillDataList2, function(a,b) return a.index