miduo_client/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleAwakeSuccessPanel.lua

184 lines
8.4 KiB
Lua
Raw Normal View History

2021-04-21 13:12:04 +08:00
require("Base/BasePanel")
2020-11-07 15:15:49 +08:00
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)
2020-11-09 20:05:51 +08:00
local passiveSkillLogicConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig)
2020-11-07 15:15:49 +08:00
--初始化组件(用于子类重写)
function RoleAwakeSuccessPanel:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-11-07 15:15:49 +08:00
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)
2020-11-07 15:15:49 +08:00
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
2021-11-04 10:46:25 +08:00
Util.SetParticleSortLayer(this.starGrid,self.sortingOrder + 1)
2020-11-07 15:15:49 +08:00
orginLayer = self.sortingOrder
end
local curHeroData
2020-11-07 15:15:49 +08:00
--界面打开时调用(用于子类重写)
function RoleAwakeSuccessPanel:OnOpen(_curHeroData,_nextHeroUpStarId,_curHeroRankUpConfigOpenLevel,_callBack)
curHeroData=_curHeroData
2020-11-07 15:15:49 +08:00
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)
2021-10-27 12:50:15 +08:00
local starSize = Vector2.New(60,60)
local starScale = -11
if starType == 3 then
2021-11-04 10:46:25 +08:00
starSize = Vector2.New(1,-15)
2021-10-27 12:50:15 +08:00
starScale = -13
end
SetHeroStars(this.spLoader, this.starGrid, star,starType,starSize,starScale,Vector2.New(0.5,0.5))
2021-11-04 10:46:25 +08:00
Util.SetParticleSortLayer(this.starGrid,self.sortingOrder + 1)
2021-04-21 13:12:04 +08:00
this.profession.sprite = this.spLoader:LoadSprite(GetHeroPosStr(curHeroData.heroConfig.Profession))
this.proImage.sprite =this.spLoader:LoadSprite(GetProStrImageByProNum(curHeroData.changeProId))
2021-01-26 17:08:39 +08:00
this.heroName.text =GetLanguageStrById(curHeroData.heroConfig.ReadingName)
2021-04-21 13:12:04 +08:00
this.posBgImage.sprite=this.spLoader:LoadSprite(GetHeroPosBgStr(curHeroData.heroConfig.Profession))
2021-01-26 17:08:39 +08:00
this.posText.text=GetLanguageStrById(curHeroData.heroConfig.HeroLocation)
2021-03-02 16:53:12 +08:00
this.lvEndInfo.text=string.format(Language[11791],curHeroRankUpConfigOpenLevel)
2020-11-07 15:15:49 +08:00
local TalentData = this.GetNewTalentDataShow()
LogPink("TalentData "..#TalentData)
2020-11-07 15:15:49 +08:00
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
2021-01-26 17:08:39 +08:00
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 .. "  <color=#66FF00>"..Desc.."</color>"}
-- else
-- breakSkillDataList[curBreakId] = {index = curBreakId,type = 1,str ="<color=#66FF00>"..titleStr..Desc.."</color>"}
-- end
2020-11-07 15:15:49 +08:00
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 .. "  <color=#66FF00>"..Desc.."</color>"}
else
upStarSkillDataList[curUpStarId] = {passiveSkillId = _passiveSkillId,type = 2,index = curUpStarId,str ="<color=#66FF00>"..titleStr..Desc.."</color>"}
end
end
2020-11-07 15:15:49 +08:00
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<b.index end)
2020-11-07 15:15:49 +08:00
local upStarSkillDataList2 = {}
for i, v in pairs(upStarSkillDataList) do
table.insert(upStarSkillDataList2,v)
end
table.sort(upStarSkillDataList2, function(a,b) return a.index<b.index end)
-- for i = 1, #upStarSkillDataList2 do
-- table.insert(breakSkillDataList2,upStarSkillDataList2[i])
-- end
return upStarSkillDataList2
2020-11-07 15:15:49 +08:00
end
function this.SingOldTalentDataShow(go,data)
local breakGo = Util.GetGameObject(go, "breakSkillTextPre")
local upStarGo = Util.GetGameObject(go, "upStarSkillTextPre")
if data.type == 1 then--突破
breakGo:SetActive(true)
upStarGo:SetActive(false)
breakGo:GetComponent("Text").text = data.str
else
breakGo:SetActive(false)
upStarGo:SetActive(true)
local kongStr = ""
if passiveSkillLogicConfig[data.passiveSkillId].Judge == 1 then
kongStr = "   "
else
kongStr = ""
end
Util.GetGameObject(upStarGo.transform, "Image"):SetActive(passiveSkillLogicConfig[data.passiveSkillId].Judge == 1)
upStarGo:GetComponent("Text").text = kongStr .. data.str
end
end
--界面关闭时调用(用于子类重写)
function RoleAwakeSuccessPanel:OnClose()
if this.LiveName then
poolManager:UnLoadLive(this.LiveName, this.LiveGO)
this.LiveName = nil
end
if callBack then
callBack()
callBack = nil
end
end
--界面销毁时调用(用于子类重写)
function RoleAwakeSuccessPanel:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-11-07 15:15:49 +08:00
end
2021-04-21 13:12:04 +08:00
return RoleAwakeSuccessPanel