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

1201 lines
53 KiB
Lua
Raw Normal View History

2020-11-03 15:17:48 +08:00
require("Base/BasePanel")
RoleInfoLayout = Inherit(BasePanel)
local this = RoleInfoLayout
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local heroRankupConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
local heroSkinConfig = ConfigManager.GetConfig(ConfigName.HeroSkin)
local skillConfig = ConfigManager.GetConfig(ConfigName.SkillConfig)
local passiveSkillConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillConfig)
local passiveSkillLogicConfig=ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig)
2020-11-03 15:17:48 +08:00
local costItemList--升级突破静态材料
local isUpLvMaterials=true--升级 突破 材料是否充足
local allAddProVal={}--所有属性加成值
local lvUpShowProList={}--升级后展示的属性提升list
local isHeroUpTuPo=false--是否可突破
local upTuPoRankUpConfig={}--即将要突破的数据
local upStarRankUpConfig={}--即将要升星的数据
local curStarRankUpConfig={}--当前升星的数据
local curTuPoRankUpConfig={}--当前突破的数据
2022-11-04 16:28:16 +08:00
local costId=0
2020-11-03 15:17:48 +08:00
--长按升级状态
2022-01-12 13:37:39 +08:00
local _isClicked = false --是否点击
2020-11-03 15:17:48 +08:00
local _isReqLvUp = false
2022-01-12 13:37:39 +08:00
local _isLongPress = false --是否长按
this.timePressStarted = 0--监听长按事件
2020-11-03 15:17:48 +08:00
this.priThread = nil--协同程序播放升级属性提升值动画用
local oldLv = 0
local curHeroData--当前英雄信息
local parent = {}
local isUpZhen = false--当前英雄是否上阵
local isHeroUpStar
local herodatas = {}
this.isPressed = false
2022-01-12 13:37:39 +08:00
local timer = 0
local proSort = {
[1] = HeroProType.Attack,
[2] = HeroProType.Hp,
[3] = HeroProType.PhysicalDefence,
[4] = HeroProType.MagicDefence,
}
function RoleInfoLayout:New(gameObject)
local b = {}
b.gameObject = gameObject
b.transform = gameObject.transform
setmetatable(b, { __index = RoleInfoLayout })
return b
end
2020-11-03 15:17:48 +08:00
--初始化组件(用于子类重写)
function RoleInfoLayout:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
this.playplyanim = Util.GetGameObject(self.gameObject,"playplyanim")
this.lvRoot = Util.GetGameObject(self.gameObject,"content/lv")
this.lv = Util.GetGameObject(self.gameObject,"content/lv/proValue"):GetComponent("Text")
2022-01-14 10:17:19 +08:00
this.pos = Util.GetGameObject(self.gameObject,"content/Pos")
this.posImage = Util.GetGameObject(this.pos,"PosImage"):GetComponent("Image")
this.posText = Util.GetGameObject(this.pos,"PosText"):GetComponent("Text")
this.proList = {}
for i = 1,4 do
this.proList[i] = {}
2023-08-04 18:58:14 +08:00
this.proList[i].go = Util.GetGameObject(self.gameObject,"content/pro/bg/proPre"..i)
this.proList[i].proImage = Util.GetGameObject(this.proList[i].go,"Image"):GetComponent("Image")
this.proList[i].value = Util.GetGameObject(this.proList[i].go,"proValue"):GetComponent("Text")
end
this.allProButton = Util.GetGameObject(self.gameObject,"content/pro")
this.posBtn = Util.GetGameObject(self.gameObject,"content/posBtn")
this.posInfo = Util.GetGameObject(this.posBtn,"PosInfo"):GetComponent("Text")
2023-08-04 18:58:14 +08:00
this.proTip = Util.GetGameObject(self.gameObject,"content/pro/bg/tishi")
this.skillGrid=Util.GetGameObject(self.gameObject,"content/skill")
this.skillGrid2=Util.GetGameObject(self.gameObject,"content/skill2")
this.selsectSkillImage=Util.GetGameObject(this.skillGrid,"selsectSkillImage")
this.skillList = {}
2022-01-14 18:48:23 +08:00
this.skillBtnsList = {}
this.skillBtnsRoot = Util.GetGameObject(self.gameObject,"content/skillBtns")
this.skillGridCanvas = this.skillBtnsRoot:GetComponent("Canvas")
2022-01-14 10:17:19 +08:00
for i = 1,5 do
this.skillList[i] = {}
this.skillList[i].go = Util.GetGameObject(this.skillGrid,"sBg"..i)
this.skillList[i].icon = Util.GetGameObject(this.skillList[i].go,"icon"):GetComponent("Image")
2022-01-14 16:14:52 +08:00
this.skillList[i].pos = Util.GetGameObject(this.skillList[i].go,"pos/icon"):GetComponent("Image")
this.skillList[i].pro = Util.GetGameObject(this.skillList[i].go,"pro"):GetComponent("Image")
this.skillList[i].proText = Util.GetGameObject(this.skillList[i].pro.gameObject,"Text"):GetComponent("Text")
this.skillList[i].skillName = Util.GetGameObject(this.skillList[i].go,"skillName"):GetComponent("Text")
2022-01-14 10:17:19 +08:00
this.skillList[i].skillIma = Util.GetGameObject(this.skillList[i].go,"image")
this.skillList[i].frame = Util.GetGameObject(this.skillList[i].go,"frame"):GetComponent("Image")
2022-01-14 18:48:23 +08:00
this.skillBtnsList[i] = Util.GetGameObject(this.skillBtnsRoot,"sBg"..i)
end
this.line1 = Util.GetGameObject(this.skillGrid,"line1")
this.line2 = Util.GetGameObject(this.skillGrid,"line2")
2022-01-14 18:48:23 +08:00
this.line3 = Util.GetGameObject(this.skillBtnsRoot,"line1")
this.line4 = Util.GetGameObject(this.skillBtnsRoot,"line2")
this.upLv = Util.GetGameObject(self.gameObject,"content/upLv")
--升级
this.itemPre=Util.GetGameObject(this.upLv,"costPre")
this.itemGrid=Util.GetGameObject(this.upLv,"itemGrid")
this.costList = {}
for i = 1,this.itemGrid.transform.childCount do
2023-08-04 18:58:14 +08:00
if this.itemGrid.transform:GetChild(i - 1).gameObject.name=="Image" then
goto label
end
this.costList[#this.costList+1] = {}
this.costList[#this.costList].go = this.itemGrid.transform:GetChild(i - 1)
this.costList[#this.costList].icon = Util.GetGameObject( this.costList[#this.costList].go,"icon"):GetComponent("Image")
this.costList[#this.costList].costText = Util.GetGameObject( this.costList[#this.costList].go,"Text"):GetComponent("Text")
::label::
end
this.upLvBtn=Util.GetGameObject(this.upLv,"upLvBtn")
2022-11-15 16:35:48 +08:00
this.upMaxLvBtn=Util.GetGameObject(this.upLv,"upMaxLvBtn")
this.upLvBtnRedPoint=Util.GetGameObject(this.upLvBtn,"redPoint")
2022-11-16 14:01:40 +08:00
this.upMaxLvBtnRedPoint=Util.GetGameObject(this.upMaxLvBtn,"redPoint")
this.upLvTrigger = Util.GetEventTriggerListener(this.upLvBtn)
this.upLvBtnText=Util.GetGameObject(this.upLvBtn,"Text"):GetComponent("Text")
this.upLvBtnImage=this.upLvBtn:GetComponent("Image")
this.tipUpLv=Util.GetGameObject(this.upLv,"tip"):GetComponent("Text")
this.noUpLvText=Util.GetGameObject(self.gameObject,"content/noUpLvText")
this.gongmingText=Util.GetGameObject(self.gameObject,"gongming")
this.hognmengzhenTip = Util.GetGameObject(this.gongmingText,"hognmengzhenTip")
this.hognmengbeiTip = Util.GetGameObject(this.gongmingText,"hognmengbeiTip")
this.lvUpGo=Util.GetGameObject(self.gameObject,"lvUpGo")
this.lvUpGoImage=Util.GetGameObject(self.gameObject,"lvUpGo/Image")
2022-01-15 14:34:55 +08:00
this.lvUpGoImage:SetActive(false)
for i = 1, 5 do
2020-11-03 15:17:48 +08:00
lvUpShowProList[i]=Util.GetGameObject(this.lvUpGo.transform,"proPreParent/proPre"..i)
end
lvUpShowProList[5]:SetActive(false)
2022-01-14 10:17:19 +08:00
2020-11-03 15:17:48 +08:00
end
2021-09-01 10:08:25 +08:00
function RoleInfoLayout:OnPointerUp(Pointgo,data)--抬起
if self.isPressed then
self.isPressed = false
self:RefreshBottom(true)
end
end
--点击或长按处理升级处理
function RoleInfoLayout:OnPointerDown(Pointgo,data)--按下
self.isPressed = true
2020-11-03 15:17:48 +08:00
end
--绑定事件(用于子类重写)
function RoleInfoLayout:BindEvent()
--角色定位按钮
Util.AddClick(this.posBtn,function()
UIManager.OpenPanel(UIName.RolePosInfoPopup,curHeroData.heroConfig,curHeroData.star)
2022-11-15 16:35:48 +08:00
end)
--一键升级
Util.AddClick(this.upMaxLvBtn, function()
2022-12-28 13:59:16 +08:00
if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
PopupTipPanel.ShowTip("等级已达上限")
return
end
2022-11-15 16:35:48 +08:00
local oldUpMaxLv=this:CalUpMaxLv()
2022-12-19 15:27:18 +08:00
local openLv=this.GetCurHeroLvLimit()
if curHeroData.lv>=openLv then
2022-11-15 16:35:48 +08:00
PopupTipPanel.ShowTip("等级已达上限")
return
end
if this.isGongMing then
PopupTipPanel.ShowTip("神将正在共鸣中,无法升级!")
return
end
2022-12-19 15:27:18 +08:00
if curHeroData.lv<this.GetCurHeroLvLimit() and oldUpMaxLv==curHeroData.lv then
2022-12-23 14:56:30 +08:00
-- PopupTipPanel.ShowTip("材料不足")
this:ShowCostNotEnoughTip()
2022-11-15 16:35:48 +08:00
return
end
this:DeleteLvUpMaterials(oldUpMaxLv)
this:LongLvUpClick(oldUpMaxLv)
end)
2020-11-03 15:17:48 +08:00
--升级
Util.AddClick(this.upLvBtn, function()
2021-07-09 16:56:05 +08:00
if this.isGongMing then
PopupTipPanel.ShowTip("神将正在共鸣中,无法升级!")
return
end
2020-11-03 15:17:48 +08:00
end)
--长按升级按下状态
this._onPointerDown = function(Pointgo, data)
2021-07-09 16:56:05 +08:00
if this.isGongMing then
return
end
2022-01-12 13:37:39 +08:00
_isLongPress = false
2020-11-03 15:17:48 +08:00
_isClicked = true
2022-01-12 13:37:39 +08:00
this.timePressStarted = Time.realtimeSinceStartup
2020-11-03 15:17:48 +08:00
oldLv = curHeroData.lv
this.isPressed = true
2022-01-12 13:37:39 +08:00
timer = 0
_isReqLvUp = false
2020-11-03 15:17:48 +08:00
end
--长按升级抬起状态
this._onPointerUp = function(Pointgo, data)
2022-01-12 13:37:39 +08:00
if Time.realtimeSinceStartup - RoleInfoLayout.timePressStarted <= 0.4 then
this:LvUpClick(false)
2021-07-09 16:56:05 +08:00
end
2022-01-12 13:37:39 +08:00
if _isReqLvUp then
2020-11-03 15:17:48 +08:00
this:LongLvUpClick(oldLv)
2022-01-12 13:37:39 +08:00
end
2020-11-03 15:17:48 +08:00
_isClicked = false
_isLongPress = false
this.isPressed = false
2022-01-12 13:37:39 +08:00
timer = 0
2020-11-03 15:17:48 +08:00
end
this.upLvTrigger.onPointerDown = this.upLvTrigger.onPointerDown + this._onPointerDown
this.upLvTrigger.onPointerUp = this.upLvTrigger.onPointerUp + this._onPointerUp
--显示所有属性
Util.AddClick(this.allProButton, function()
2021-05-12 17:40:38 +08:00
UIManager.OpenPanel(UIName.RoleProInfoPopup,allAddProVal,curHeroData.heroConfig,true,nil)
2020-11-03 15:17:48 +08:00
end)
end
--添加事件监听(用于子类重写)
function RoleInfoLayout:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.UpdateHeroUpLvAndBreakMaterialShow)
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, this.SkillInfoPopupClose)
2020-11-03 15:17:48 +08:00
end
--移除事件监听(用于子类重写)
function RoleInfoLayout:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold,this.UpdateHeroUpLvAndBreakMaterialShow)
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, this.SkillInfoPopupClose)
end
function this.SkillInfoPopupClose(panelType, p)
2020-11-03 15:17:48 +08:00
end
function RoleInfoLayout:OnShow()
self.gameObject:SetActive(true)
2020-11-03 15:17:48 +08:00
FixedUpdateBeat:Add(this.OnUpdate, self)--长按方法注册
end
function RoleInfoLayout:SetData(_sortinglayer,_parent,_curHerodata,_isUpZhen,_heroDatas)
2020-11-03 15:17:48 +08:00
this.sortingOrder = _sortinglayer
curHeroData = _curHerodata
parent = _parent
isUpZhen = _isUpZhen
herodatas = _heroDatas
this:UpdateHeroInfoData()
this:GetCurHeroUpLvOrUpStarSData()
this:UpdateHeroUpLvAndBreakData()--升级
--角色定位按钮
this.posBtn.gameObject:SetActive(curHeroData.heroConfig.ShowHeroLocation==1)
2022-01-15 18:29:18 +08:00
this.posInfo.text = curHeroData.star < 11 and curHeroData.heroConfig.HeroLocationDesc1 or curHeroData.heroConfig.HeroLocationDesc4
2022-01-14 17:57:12 +08:00
ForceRebuildLayout(this.posBtn.transform)
this.SkillInfo()
2020-11-03 15:17:48 +08:00
end
--更新英雄情报数据
function this:UpdateHeroInfoData()
curTuPoRankUpConfig = heroRankupConfig[curHeroData.breakId]
curStarRankUpConfig = heroRankupConfig[curHeroData.upStarId]
2020-11-03 15:17:48 +08:00
--计算面板属性
local WarPower
2020-11-03 15:17:48 +08:00
if isUpZhen then
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
2020-11-03 15:17:48 +08:00
else
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
2020-11-03 15:17:48 +08:00
end
for i = 1,#this.proList do
this:ProShow(this.proList[i],allAddProVal,proSort[i])
end
2022-11-15 16:35:48 +08:00
local curLvEnd = this.GetCurHeroLvLimit()
-- if curHeroData.breakId > 0 then
-- curLvEnd = heroRankupConfig[curHeroData.breakId].OpenLevel
-- end
-- if curHeroData.upStarId > 0 then
-- if heroRankupConfig[curHeroData.upStarId].OpenLevel > curLvEnd then
-- curLvEnd = heroRankupConfig[curHeroData.upStarId].OpenLevel
-- end
-- end
2021-01-09 14:30:35 +08:00
if HarmonyManager.IsChangeColor(curHeroData.dynamicId) then
2021-01-14 21:11:53 +08:00
-- body#FFCC00
2021-01-09 14:30:35 +08:00
this.lv.text= "<color=green>"..curHeroData.lv.."</color>"
2021-01-20 10:37:02 +08:00
elseif HarmonyManager:IsEnvoy(curHeroData.dynamicId) and HarmonyManager:HongMengTowerUpLimit() >= HarmonyManager.TowerStartLimit then
2021-01-14 21:11:53 +08:00
this.lv.text= "<color=#FFCC00>"..curHeroData.lv.."</color>"
2021-01-09 14:30:35 +08:00
else
this.lv.text= curHeroData.lv.."/"..curLvEnd
end
ForceRebuildLayout(this.lvRoot.transform)
2022-01-14 10:17:19 +08:00
this.posImage.sprite =this.spLoader:LoadSprite(curHeroData.professionIcon)
2023-08-11 19:03:48 +08:00
--this.posImage:SetNativeSize()
2022-01-14 10:17:19 +08:00
this.posText.text=GetLanguageStrById(curHeroData.heroConfig.HeroLocation)
2020-11-03 15:17:48 +08:00
--技能点击特殊处理
this.selsectSkillImage:SetActive(false)
--this.UpdateHeroUpStarProUpSkillShow()
2020-11-03 15:17:48 +08:00
end
function this:ProShow(go,allAddProVal,HeroProType,nextallAddProVal)
--go.proName.text = GetLanguageStrById(curProSConFig.Info)..""
go.proImage.sprite = this.spLoader:LoadSprite(PropertyTypeIconDef[HeroProType])
go.value.text = allAddProVal[HeroProType]
end
2022-11-15 16:35:48 +08:00
function this.GetCurHeroLvLimit()
local curLvEnd = 30
if curHeroData.breakId > 0 then
curLvEnd = heroRankupConfig[curHeroData.breakId].OpenLevel
end
2022-12-19 15:27:18 +08:00
if curHeroData.lv>= curLvEnd and curHeroData.upStarId > 0 then
2022-11-15 16:35:48 +08:00
if heroRankupConfig[curHeroData.upStarId].OpenLevel > curLvEnd then
curLvEnd = heroRankupConfig[curHeroData.upStarId].OpenLevel
end
end
return curLvEnd
end
2022-01-14 10:17:19 +08:00
function this.GetSkillsDataOld()
local skillList = {}
local skillIdList = {}
if curHeroData.heroConfig.OpenSkillRules then
for i = 1, #curHeroData.heroConfig.OpenSkillRules do
if not skillIdList[curHeroData.heroConfig.OpenSkillRules[i][2]] then
local heroSkill = {}
heroSkill.skillId = curHeroData.heroConfig.OpenSkillRules[i][2]
heroSkill.skillConfig = skillConfig[heroSkill.skillId]
if curHeroData.star >= curHeroData.heroConfig.OpenSkillRules[i][1] then
heroSkill.state = 1
else
heroSkill.state = 0
end
2022-01-11 14:23:24 +08:00
heroSkill.star = curHeroData.heroConfig.OpenSkillRules[i][1]
heroSkill.quality = 0
heroSkill.skillType = 0
skillIdList[curHeroData.heroConfig.OpenSkillRules[i][2]] = curHeroData.heroConfig.OpenSkillRules[i][2]
table.insert(skillList, heroSkill)
end
end
2020-11-03 15:17:48 +08:00
end
if curHeroData.star < 11 then
if curHeroData.heroConfig.OpenPassiveSkillRules then
for i = 1, #curHeroData.heroConfig.OpenPassiveSkillRules do
if curHeroData.heroConfig.OpenPassiveSkillRules[i][1] == 2 and passiveSkillLogicConfig[curHeroData.heroConfig.OpenPassiveSkillRules[i][3]].Judge == 1 then
if not skillIdList[curHeroData.heroConfig.OpenPassiveSkillRules[i][3]] then
local heroSkill = {}
heroSkill.skillId = curHeroData.heroConfig.OpenPassiveSkillRules[i][3]
heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId]
if curHeroData.star >= curHeroData.heroConfig.OpenPassiveSkillRules[i][2] - 1 then
heroSkill.state = 1
else
heroSkill.state = 0
end
2022-01-11 14:23:24 +08:00
heroSkill.star = curHeroData.heroConfig.OpenPassiveSkillRules[i][2] - 1
heroSkill.quality = 0
heroSkill.skillType = 1
skillIdList[curHeroData.heroConfig.OpenPassiveSkillRules[i][3]] = curHeroData.heroConfig.OpenPassiveSkillRules[i][3]
table.insert(skillList, heroSkill)
end
end
end
end
else
local heroSkillList = this.GetAwakenSkill()
if heroSkillList then
for i = 1, #heroSkillList do
table.insert(skillList, heroSkillList[i])
end
end
if curHeroData.heroConfig.MaxRank > 11 then
for i = 1, #curHeroData.heroConfig.Awaken do
if curHeroData.heroConfig.Awaken[i][1] == 2 and curHeroData.heroConfig.Awaken[i][2] == 27 then
local heroSkill = {}
heroSkill.skillId = curHeroData.heroConfig.Awaken[i][3]
heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId]
if curHeroData.star == 14 then
heroSkill.state = 1
else
heroSkill.state = 0 --是否置灰
end
2022-01-11 14:23:24 +08:00
heroSkill.star = 14
heroSkill.quality = 1 --决定技能的品质框
heroSkill.skillType = 0 --是否显示对比技能
table.insert(skillList, heroSkill)
break
end
end
end
end
return skillList
2020-11-03 15:17:48 +08:00
end
function this.SkillInfo()
this.skillGrid2:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1
2022-05-19 20:43:41 +08:00
local maxStar=curHeroData.heroConfig.MaxRank
local skillList = HeroManager.GetCurHeroSidAndCurStarAllSkillDatas2(curHeroData.heroConfig.Id,maxStar,curHeroData.star)
local skillList2
if maxStar>9 then
skillList2 = HeroManager.GetCurHeroSidAndCurStarAllSkillDatas2(curHeroData.heroConfig.Id,10,curHeroData.star)
else
end
for i = 1, this.skillGrid2.transform.childCount do
this.skillGrid2.transform:GetChild(i-1).gameObject:SetActive(false)
end
for i = 1, #skillList do
if skillList[i] and skillList[i].skillConfig and GetLanguageStrById(skillList[i].skillConfig.Name) then
local go = this.skillGrid2.transform:GetChild(i-1).gameObject
go:SetActive(true)
Util.GetGameObject(go.transform,"icon"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(skillList[i].skillConfig.Icon))
local typeImg=Util.GetGameObject(go.transform,"pos/icon")
typeImg:GetComponent("Image").sprite=this.spLoader:LoadSprite(GetSkillType(skillList[i]))
local sText = Util.GetGameObject(go.transform,"skillName"):GetComponent("Text")
sText.text=GetLanguageStrById(skillList[i].skillConfig.Name)
sText.fontSize = GetCurLanguage() ~= 2 and 30 or 25
Util.SetGray(go,skillList[i].isOpen)
if skillList[i].isOpen then
2023-12-05 15:59:32 +08:00
if skillList[i].needStar==15 then
2022-11-02 16:26:40 +08:00
sText.text="飞升5解锁"
2023-12-05 15:59:32 +08:00
elseif skillList[i].needStar==13 then
sText.text="飞升3解锁"
2022-05-19 20:43:41 +08:00
else
sText.text=NumToSimplenessFont[skillList[i].needStar].."星解锁"
end
end
local pro=Util.GetGameObject(go.transform,"pro")
local proText=Util.GetGameObject(go.transform,"pro/Text"):GetComponent("Text")
2022-05-19 19:04:21 +08:00
if skillList[i].skillConfig.Skilltips and skillList[i].skillConfig.Skilltips~=0 then
pro:SetActive(true)
proText.text=SkillProType[skillList[i].skillConfig.Skilltips]
else
pro:SetActive(false)
end
Util.AddOnceClick(go, function()
if Game.GlobalEvent:HasEvent(GameEvent.UI.OnClose, triggerCallBack) then
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
end
this.selsectSkillImage:SetActive(true)
this.selsectSkillImage.transform.position=Util.GetGameObject(go.transform,"icon").transform.position
local skillData = {}
skillData.skillConfig = skillList[i].skillConfig
skillData.isOpen=skillList[i].isOpen
skillData.needStar=skillList[i].needStar
local nextData=nil
2022-05-19 20:43:41 +08:00
-- if curHeroData.star<11 and i>2 then
-- nextData=skillList2[i]
-- end
local maxLv= HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id,skillData.skillConfig.Type)
2022-05-19 22:12:14 +08:00
if skillList2 and skillList2[i] and i>2 then
2022-05-19 20:43:41 +08:00
nextData=skillList2[i]
nextData.isOpen=skillList2[i].isOpen
nextData.needStar=skillList2[i].needStar
--飞升技能
if i==6 then
panel = UIManager.OpenPanel(UIName.SkillInfoPopup,skillData,1,10,maxLv,i)
else
panel = UIManager.OpenPanel(UIName.SkillInfoPopup,nextData,1,10,maxLv,i,skillData)
end
else
panel = UIManager.OpenPanel(UIName.SkillInfoPopup,skillData,1,10,maxLv,i)
end
--local panel = UIManager.OpenPanel(UIName.SkillInfoPopup,skillData,1,10,maxLv,i,nextData)
this.skillGrid2:GetComponent("Canvas").sortingOrder = panel.sortingOrder + 1
triggerCallBack = function (panelType, p)
if panelType == UIName.SkillInfoPopup and panel == p then --监听到SkillInfoPopup关闭把层级设回去
this.skillGrid2:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
this.selsectSkillImage:SetActive(false)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack)
end)
end
end
end
function this.GetAwakenSkill()
local starIdlist = {}
local skillIdList = {}
local skillList = {}
if curHeroData.heroConfig.Awaken then
for i = 1, #curHeroData.heroConfig.Awaken do
if curHeroData.heroConfig.Awaken[i][1] == 2 and passiveSkillLogicConfig[curHeroData.heroConfig.Awaken[i][3]].Judge == 1 and curHeroData.heroConfig.Awaken[i][2] < 12 then
if not skillIdList[curHeroData.heroConfig.Awaken[i][3]] and not starIdlist[curHeroData.heroConfig.Awaken[i][2]] then
local heroSkill = {}
heroSkill.skillId = curHeroData.heroConfig.Awaken[i][3]
heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId]
if curHeroData.star >= curHeroData.heroConfig.Awaken[i][2] - 1 then
heroSkill.state = 1
else
heroSkill.state = 0
end
2022-01-11 14:44:16 +08:00
heroSkill.star = curHeroData.heroConfig.Awaken[i][2] - 1
heroSkill.quality = 1
heroSkill.skillType = 0
starIdlist[curHeroData.heroConfig.Awaken[i][2]] = curHeroData.heroConfig.Awaken[i][2]
skillIdList[curHeroData.heroConfig.Awaken[i][3]] = curHeroData.heroConfig.Awaken[i][3]
table.insert(skillList, heroSkill)
end
end
end
end
return skillList
end
2022-01-14 10:17:19 +08:00
function this.GetSkillsData()
local skillList = {}
local skillIdList = {}
if curHeroData.heroConfig.OpenSkillRules then
for i = 1, #curHeroData.heroConfig.OpenSkillRules do
2022-01-17 10:56:38 +08:00
if curHeroData.heroConfig.OpenSkillRules[i][1] == curHeroData.star then
2022-01-14 10:17:19 +08:00
local heroSkill = {}
heroSkill.skillId = curHeroData.heroConfig.OpenSkillRules[i][2]
heroSkill.skillConfig = skillConfig[heroSkill.skillId]
heroSkill.Type = heroSkill.skillConfig.Type --角标
heroSkill.Skilltips = heroSkill.skillConfig.Skilltips --右角标
heroSkill.Name = nil
heroSkill.Icon = GetResourcePath(heroSkill.skillConfig.Icon) --图标
if curHeroData.star >= curHeroData.heroConfig.OpenSkillRules[i][1] then
heroSkill.state = 1 --是否置灰 -1不显示 0置灰 1显示不置灰
else
heroSkill.state = 0
end
heroSkill.quality = 0 --是否白金背景框
table.insert(skillList, heroSkill)
end
end
end
local heroSkill = {}
if curHeroData.heroConfig.EquipTalismana and #curHeroData.heroConfig.EquipTalismana > 1 then
local dowerAllData = ConfigManager.GetAllConfigsDataByKey(ConfigName.EquipTalismana,"TalismanaId",curHeroData.heroConfig.EquipTalismana[2])
for i = 1,#dowerAllData do
if dowerAllData[i].OpenSkillRules and dowerAllData[i].Level==25 then --特性显示
heroSkill.skillId = dowerAllData[i].OpenSkillRules[1]
heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId]
heroSkill.Type = 4
heroSkill.Skilltips = nil
heroSkill.Name = nil
heroSkill.Icon = GetResourcePath(heroSkill.skillConfig.Icon)
local curLv = HeroManager.GetTalismanLv(curHeroData.dynamicId)
if curLv >= dowerAllData[i].Level then
heroSkill.state = 1
else
heroSkill.state = 0
end
heroSkill.quality = 0
table.insert(skillList, heroSkill)
end
end
else
heroSkill.state = -1
end
--天赋
local heroSkill = {}
heroSkill.skillId = 0
heroSkill.skillConfig = nil
heroSkill.Skilltips = nil
2022-01-19 16:57:17 +08:00
local OpenPassiveSkillRules = curHeroData.star >= HeroManager.awakeNextStarIndex and curHeroData.heroConfig.Awaken or curHeroData.heroConfig.OpenPassiveSkillRules
OpenPassiveSkillRules=GetPassiveByMaxStar(curHeroData.heroConfig,OpenPassiveSkillRules)
LogError("breakid=="..curHeroData.breakId.." upstarid=="..curHeroData.upStarId)
2022-01-14 10:17:19 +08:00
if OpenPassiveSkillRules then
local openlists,compoundOpenNum,compoundNum,allUpStarOpenData = HeroManager.GetAllPassiveSkillIds(curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId)
2022-04-26 11:45:13 +08:00
-- LogError("#OpenPassiveSkillRules=="..#OpenPassiveSkillRules.." compoundNum=="..compoundNum)
2022-01-14 10:17:19 +08:00
heroSkill.Name = #openlists - compoundOpenNum .."/"..#OpenPassiveSkillRules - compoundNum
heroSkill.state = 1
2023-12-05 15:59:32 +08:00
if curHeroData.star == 11 then
2022-01-14 10:17:19 +08:00
heroSkill.Icon = "r_tongyong_feisheng_icon1" --飞升一
2022-01-14 14:52:56 +08:00
heroSkill.Type = 8
2022-01-14 10:17:19 +08:00
heroSkill.quality = 1
2023-12-05 15:59:32 +08:00
elseif curHeroData.star == 12 then
2022-01-14 10:17:19 +08:00
heroSkill.Icon = "r_tongyong_feisheng_icon2" --飞升二
2022-01-14 14:52:56 +08:00
heroSkill.Type = 8
2022-01-14 10:17:19 +08:00
heroSkill.quality = 1
elseif curHeroData.star > 13 then
heroSkill.Icon = "r_tongyong_feisheng_icon3" --飞升三
2022-01-14 14:52:56 +08:00
heroSkill.Type = 8
2022-01-14 10:17:19 +08:00
heroSkill.quality = 1
2023-12-05 15:59:32 +08:00
-- elseif curHeroData.star == 11 then
-- heroSkill.Icon = "r_tongyong_tianfu_icon" --觉醒
-- heroSkill.Type = 7
-- heroSkill.quality = 1
2022-01-14 10:50:51 +08:00
elseif curHeroData.heroConfig.Natural <= 5 then
heroSkill.Icon = "r_tongyong_feisheng_icon" --9星以下
heroSkill.Type = 5
heroSkill.quality = 0
elseif curHeroData.heroConfig.Natural == 6 or curHeroData.heroConfig.Natural == 7 then
heroSkill.Icon = "r_tongyong_tianfu_icon" --10星
heroSkill.Type = 6
heroSkill.quality = 0
2022-01-14 10:17:19 +08:00
end
table.insert(skillList, heroSkill)
else
heroSkill.state = -1
end
--神魂
local heroSkill = {}
heroSkill.skillId = 0
heroSkill.skillConfig = nil
2022-01-14 14:52:56 +08:00
heroSkill.Type = 9
2022-01-14 10:17:19 +08:00
heroSkill.Skilltips = nil
heroSkill.Name = nil
heroSkill.Icon = "r_tongyong_shenhun_icon"
if curHeroData.star < 11 or curHeroData.heroConfig.IsSoulOpen == 0 then
heroSkill.state = -1
else
if not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.shenhun) then
2022-01-17 13:23:19 +08:00
heroSkill.state = -1
heroSkill.Name = "100级开启"
2022-01-14 10:17:19 +08:00
else
heroSkill.state = 1
2022-01-17 13:56:06 +08:00
heroSkill.quality = 1
table.insert(skillList, heroSkill)
end
2022-01-14 10:17:19 +08:00
end
return skillList
end
function this.SetSelectSkillImage(parent)
this.selsectSkillImage:SetActive(true)
this.selsectSkillImage.transform:SetParent(parent.transform)
this.selsectSkillImage.transform.localPosition = Vector3.zero
this.selsectSkillImage.transform.localScale = Vector3.one
end
--单个技能显示
2022-01-14 10:17:19 +08:00
function this.UpdateHeroUpStarProUpSkillShowOld(skillGridGO,skillTabs,passiveSkills)
2022-01-12 14:35:27 +08:00
this.skillGridCanvas.sortingOrder = this.sortingOrder + 1
this.skillData = this.GetSkillsData()
for i = 1,math.max(#this.skillList,#this.skillData) do
this.skillList[i].icon.gameObject:GetComponent("Button").onClick:RemoveAllListeners()
if not this.skillData[i] then
this.skillList[i].go.gameObject:SetActive(false)
else
this.skillList[i].go.gameObject:SetActive(true)
if this.skillData[i].quality == 0 then
this.skillList[i].frame.gameObject:SetActive(false)
else
this.skillList[i].frame.gameObject:SetActive(true)
end
this.skillList[i].pos.sprite=this.spLoader:LoadSprite(SkillIconType[this.skillData[i].skillConfig.Type])--被动技
2022-01-14 11:26:13 +08:00
this.skillList[i].pos:SetNativeSize()
if this.skillData[i].skillConfig.Skilltips and this.skillData[i].skillConfig.Skilltips > 0 then
if this.skillData[i].skillConfig.Skilltips == 6 then
this.skillList[i].pro.sprite=this.spLoader:LoadSprite("r_hero_lvdi")--被动技
else
this.skillList[i].pro.sprite=this.spLoader:LoadSprite("r_hero_hongdi")--被动技
end
this.skillList[i].pro.gameObject:SetActive(true)
2022-01-14 11:26:13 +08:00
this.skillList[i].pro:SetNativeSize()
this.skillList[i].proText.text=SkillProType[this.skillData[i].skillConfig.Skilltips]
else
this.skillList[i].pro.gameObject:SetActive(false)
end
this.skillList[i].skillName.text= GetLanguageStrById(this.skillData[i].skillConfig.Name)--(curSkillData.skillId % 10)
this.skillList[i].icon.sprite=this.spLoader:LoadSprite(GetResourcePath(this.skillData[i].skillConfig.Icon))--被动技
if this.skillData[i].state == 0 then
2022-01-11 14:56:37 +08:00
local str = NumToChinese[this.skillData[i].star]..""
2023-12-05 15:59:32 +08:00
if this.skillData[i].star > 10 then
str = "飞升"..NumToChinese[this.skillData[i].star - 10]
2022-01-11 14:23:24 +08:00
end
this.skillList[i].skillName.text = str.."解锁"
Util.SetGray(this.skillList[i].go,true)
else
Util.SetGray(this.skillList[i].go,false)
end
Util.AddOnceClick(this.skillList[i].icon.gameObject, function()
2022-01-14 18:48:23 +08:00
this.SetSelectSkillImage(this.skillList[i].icon.gameObject)
local maxLv= HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id,this.skillData[i].skillConfig.Type)
if this.skillData[i].skillType == 0 then
this.skillPanel = UIManager.OpenPanel(UIName.SkillInfoPopup,this.skillData[i],1,10,maxLv,i,nil,GodSoulManager.GetGodSoulLv(curHeroData.dynamicId))
else
local awakenSkillList = this.GetAwakenSkill()
this.skillPanel = UIManager.OpenPanel(UIName.SkillInfoPopup,this.skillData[i],1,10,maxLv,i,nil,GodSoulManager.GetGodSoulLv(curHeroData.dynamicId),awakenSkillList[i-2])
end
2022-01-12 14:35:27 +08:00
this.skillGridCanvas.sortingOrder = this.skillPanel.sortingOrder + 1
end)
end
end
if #this.skillData > 2 then
this.line1.gameObject:SetActive(true)
else
this.line1.gameObject:SetActive(false)
end
if #this.skillData > 5 then
this.line2.gameObject:SetActive(true)
else
this.line2.gameObject:SetActive(false)
end
end
2022-01-14 10:17:19 +08:00
--单个技能显示
function this.UpdateHeroUpStarProUpSkillShow(skillGridGO,skillTabs,passiveSkills)
2022-01-14 18:48:23 +08:00
this.skillPanelId = 0
2022-01-14 10:17:19 +08:00
this.skillGridCanvas.sortingOrder = this.sortingOrder + 1
this.skillData = this.GetSkillsData()
for i = 1,math.max(#this.skillList,#this.skillData) do
2022-01-14 18:48:23 +08:00
this.skillBtnsList[i].gameObject:GetComponent("Button").onClick:RemoveAllListeners()
2022-01-14 10:17:19 +08:00
if not this.skillData[i] then
this.skillList[i].go.gameObject:SetActive(false)
2022-01-14 18:48:23 +08:00
this.skillBtnsList[i].gameObject:SetActive(false)
2022-01-14 10:17:19 +08:00
elseif this.skillData[i].state == -1 then
this.skillList[i].go.gameObject:SetActive(false)
2022-01-14 18:48:23 +08:00
this.skillBtnsList[i].gameObject:SetActive(false)
2022-01-14 10:17:19 +08:00
else
this.skillList[i].go.gameObject:SetActive(true)
2022-01-14 18:48:23 +08:00
this.skillBtnsList[i].gameObject:SetActive(true)
2022-01-14 10:17:19 +08:00
if this.skillData[i].quality == 0 then
this.skillList[i].frame.gameObject:SetActive(false)
else
this.skillList[i].frame.gameObject:SetActive(true)
end
this.skillList[i].pos.sprite=this.spLoader:LoadSprite(SkillIconType[this.skillData[i].Type])--被动技
2022-01-14 11:26:13 +08:00
this.skillList[i].pos:SetNativeSize()
2022-01-14 10:17:19 +08:00
if this.skillData[i].Skilltips and this.skillData[i].Skilltips > 0 then
if this.skillData[i].Skilltips == 6 then
this.skillList[i].pro.sprite=this.spLoader:LoadSprite("r_hero_lvdi")--被动技
else
this.skillList[i].pro.sprite=this.spLoader:LoadSprite("r_hero_hongdi")--被动技
end
this.skillList[i].pro.gameObject:SetActive(true)
this.skillList[i].proText.text=SkillProType[this.skillData[i].Skilltips]
else
this.skillList[i].pro.gameObject:SetActive(false)
end
this.skillList[i].icon.sprite=this.spLoader:LoadSprite(this.skillData[i].Icon)--被动技
if this.skillData[i].Name then
this.skillList[i].skillName.text = this.skillData[i].Name
this.skillList[i].skillIma.gameObject:SetActive(true)
else
this.skillList[i].skillName.text = ""
this.skillList[i].skillIma.gameObject:SetActive(false)
end
if this.skillData[i].state == 0 then
Util.SetGray(this.skillList[i].go,true)
else
Util.SetGray(this.skillList[i].go,false)
end
2022-01-14 18:48:23 +08:00
Util.AddOnceClick(this.skillBtnsList[i].gameObject, function()
2022-01-14 10:17:19 +08:00
this.SetSelectSkillImage(this.skillList[i].icon.gameObject)
2022-01-14 18:48:23 +08:00
if this.skillPanel then
UIManager.ClosePanel(this.skillPanelId)
end
2022-01-14 10:17:19 +08:00
if this.skillData[i].Type < 5 then
local maxLv= HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id,this.skillData[i].Type)
2022-01-14 11:26:13 +08:00
if this.skillData[i].Type == 4 and this.skillData[i].state == 0 then
2023-12-08 21:57:53 +08:00
this.skillPanel = UIManager.OpenPanel(UIName.SkillInfoPopup,this.skillData[i],1,10,maxLv,i,nil,GodSoulManager.GetGodSoulLv(curHeroData.dynamicId),"\n<color=#FF0000>(生命卡25级解锁)</color>")
2022-01-14 18:48:23 +08:00
this.skillPanelId = UIName.SkillInfoPopup
2022-01-14 11:26:13 +08:00
else
this.skillPanel = UIManager.OpenPanel(UIName.SkillInfoPopup,this.skillData[i],1,10,maxLv,i,nil,GodSoulManager.GetGodSoulLv(curHeroData.dynamicId))
2022-01-14 18:48:23 +08:00
this.skillPanelId = UIName.SkillInfoPopup
end
2022-01-14 10:17:19 +08:00
else
2022-01-14 14:52:56 +08:00
if this.skillData[i].Type > 4 and this.skillData[i].Type < 9 then
2022-01-14 18:48:23 +08:00
this.skillPanel = UIManager.OpenPanel(UIName.RoleTalentPopup,curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId)
this.skillPanelId = UIName.RoleTalentPopup
2022-01-14 14:52:56 +08:00
elseif this.skillData[i].Type == 9 then
2022-01-14 10:17:19 +08:00
if this.skillData[i].state == 0 then
2022-01-14 18:48:23 +08:00
this.skillPanel = UIManager.OpenPanel(UIName.RoleGodSoulLayout,curHeroData.heroConfig,11)
this.skillPanelId = UIName.RoleGodSoulLayout
2022-01-14 10:17:19 +08:00
else
2022-01-14 18:48:23 +08:00
this.skillPanel = UIManager.OpenPanel(UIName.RoleGodSoulLayout,curHeroData)
this.skillPanelId = UIName.RoleGodSoulLayout
2022-01-14 10:17:19 +08:00
end
end
2022-01-14 18:48:23 +08:00
end
this.skillGridCanvas.sortingOrder = this.skillPanel.sortingOrder + 1
2022-01-14 10:17:19 +08:00
end)
end
end
if #this.skillData > 2 then
this.line1.gameObject:SetActive(true)
2022-01-14 18:48:23 +08:00
this.line3.gameObject:SetActive(true)
2022-01-14 10:17:19 +08:00
else
this.line1.gameObject:SetActive(false)
2022-01-14 18:48:23 +08:00
this.line3.gameObject:SetActive(false)
2022-01-14 10:17:19 +08:00
end
if #this.skillData > 4 then
this.line2.gameObject:SetActive(true)
2022-01-14 18:48:23 +08:00
this.line4.gameObject:SetActive(true)
2022-01-14 10:17:19 +08:00
else
this.line2.gameObject:SetActive(false)
2022-01-14 18:48:23 +08:00
this.line4.gameObject:SetActive(false)
2022-01-14 10:17:19 +08:00
end
end
2020-11-03 15:17:48 +08:00
--更新英雄升级 和 突破 的材料显示
function this:UpdateHeroUpLvAndBreakMaterialShow()
if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
costItemList=upTuPoRankUpConfig.ConsumeMaterial
else
costItemList=ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, curHeroData.lv).Consume
end
if curHeroData.lv>=HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then
this.noUpLvText:SetActive(true)
this.upLv:SetActive(false)
-- 长按升到最大级了,会无法触发抬起事件,主动调用一下
if _isLongPress then
this._onPointerUp()
end
2020-11-03 15:17:48 +08:00
else
2020-12-18 16:37:56 +08:00
this.noUpLvText:SetActive(false)
2020-11-03 15:17:48 +08:00
this.upLv:SetActive(true)
isUpLvMaterials=true
for i = 1, math.max(#this.costList,#costItemList) do
this.costList[i].go.gameObject:GetComponent("Button").onClick:RemoveAllListeners()
if not costItemList[i] then
this.costList[i].go.gameObject:SetActive(false)
2020-11-03 15:17:48 +08:00
else
if not this.costList[i] then
2020-11-03 15:17:48 +08:00
else
this.costList[i].go.gameObject:SetActive(true)
this.costList[i].icon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(costItemList[i][1]))
if BagManager.GetItemCountById(costItemList[i][1])<costItemList[i][2] then
isUpLvMaterials=false
2022-11-04 16:28:16 +08:00
costId=costItemList[i][1]
this.costList[i].costText.text=string.format("<color=#FF0000FF>%s</color>",costItemList[i][2])
else
this.costList[i].costText.text=string.format("<color=#c5dedb>%s</color>",costItemList[i][2])
end
Util.AddOnceClick(this.costList[i].go.gameObject,function()
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,costItemList[i][1])
end)
2020-11-03 15:17:48 +08:00
end
end
end
end
2021-07-09 16:56:05 +08:00
this.isGongMing = HarmonyManager.IsGongMing(curHeroData)
if this.isGongMing then
2020-12-18 16:37:56 +08:00
this.gongmingText:SetActive(true)
2022-01-11 15:40:22 +08:00
this.hognmengbeiTip.gameObject:SetActive(HarmonyManager:HongMengTowerUpLimit() > 0)
this.hognmengzhenTip.gameObject:SetActive(not (HarmonyManager:HongMengTowerUpLimit() > 0))
2020-12-18 16:37:56 +08:00
this.upLv:SetActive(false)
this.noUpLvText:SetActive(false)
return
else
this.gongmingText:SetActive(false)
end
--红点检测
local upLvRedpoint = HeroManager.LvUpBtnRedPoint(curHeroData)
this.upLvBtnRedPoint:SetActive(upLvRedpoint)
2022-11-16 14:01:40 +08:00
this.upMaxLvBtnRedPoint:SetActive(upLvRedpoint)
2021-10-20 18:02:09 +08:00
parent:CheckRedPointType(RoleInfoPanelIndex.qingbao,upLvRedpoint)
2020-11-03 15:17:48 +08:00
end
--获取当前英雄的下一突破 和 升星 静态数据
function RoleInfoLayout:GetCurHeroUpLvOrUpStarSData()
isHeroUpTuPo = false
isHeroUpStar = false
upTuPoRankUpConfig = {}
upStarRankUpConfig = {}
local heroRankUpConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
for i, v in ConfigPairs(heroRankUpConfig) do
if v.Star==curHeroData.heroConfig.Star then--初始星级相等
if v.Show==1 then -- 1 突破
if v.Id ~= curHeroData.breakId and curHeroData.lv == v.LimitLevel then--and curHeroData.star == v.LimitStar
2022-01-12 13:37:39 +08:00
-- Log("突破 "..v.Id)
2020-11-03 15:17:48 +08:00
isHeroUpTuPo = true
upTuPoRankUpConfig = v
end
end
if v.Show==2 then -- 2 升星
if v.Id ~= curHeroData.upStarId and curHeroData.star == v.LimitStar then
2022-01-12 13:37:39 +08:00
-- Log("升星 "..v.Id)
2020-11-03 15:17:48 +08:00
upStarRankUpConfig=v
isHeroUpStar=true
end
end
end
end
2022-01-12 13:37:39 +08:00
-- Log("isHeroUpTuPo"..tostring(isHeroUpTuPo).." isHeroUpStar:"..tostring(isHeroUpStar))
2020-11-03 15:17:48 +08:00
end
--更新英雄升级 和 突破数据
function this:UpdateHeroUpLvAndBreakData()
-- 升级获取突破 和 升星相应heroRankUpConfig静态数据
2022-01-14 17:57:12 +08:00
--LogError("isHeroUpStar "..tostring(isHeroUpStar))
if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then--当前突破全部完成
this.itemGrid.gameObject:SetActive(true)
this.tipUpLv.gameObject:SetActive(false)
2022-01-14 17:57:12 +08:00
this.upLvBtnText.text=Language[11805]
2022-12-28 13:47:06 +08:00
this.upMaxLvBtn.gameObject:SetActive(false)
2022-01-14 17:57:12 +08:00
this.tipUpLv.text=Language[11804]
this.tipUpLv.gameObject:SetActive(false)
else
this.upLvBtnText.text=Language[11063]
2022-12-28 13:47:06 +08:00
this.upMaxLvBtn.gameObject:SetActive(true)
2022-01-14 17:57:12 +08:00
if isHeroUpStar and curStarRankUpConfig and curHeroData.lv >= curStarRankUpConfig.OpenLevel then--当前突破全部完成
this.tipUpLv.text=Language[11804]
2022-01-17 10:59:48 +08:00
this.tipUpLv.gameObject:SetActive(false)
this.itemGrid.gameObject:SetActive(true)
2022-01-12 13:37:39 +08:00
else
2022-01-14 17:57:12 +08:00
this.itemGrid.gameObject:SetActive(true)
this.tipUpLv.gameObject:SetActive(false)
2020-11-03 15:17:48 +08:00
end
end
this:UpdateHeroUpLvAndBreakMaterialShow()
end
function RoleInfoLayout:OnSortingOrderChange()
end
2020-11-03 15:17:48 +08:00
--升级按钮点击事件处理
function RoleInfoLayout:LvUpClick(isSingleLvUp)
if curHeroData.lv>=HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then
2021-03-12 14:31:52 +08:00
PopupTipPanel.ShowTip(Language[11788])
2020-11-03 15:17:48 +08:00
_isClicked = false
2022-01-12 13:37:39 +08:00
_isLongPress = false
this.isPressed = false
timer = 0
2020-11-03 15:17:48 +08:00
return
end
2022-01-14 17:57:12 +08:00
2022-01-12 13:37:39 +08:00
--可以升星 是当前星级突破已满,等级也到了突破最大等级
2020-11-03 15:17:48 +08:00
if isHeroUpStar and upStarRankUpConfig and curTuPoRankUpConfig and curTuPoRankUpConfig.JudgeClass==1 and curHeroData.lv >= curTuPoRankUpConfig.OpenLevel then--当前突破全部完成
if curStarRankUpConfig then--进阶过处理
2022-01-12 13:37:39 +08:00
--等级到达当前星级开放的最大等级
2020-11-03 15:17:48 +08:00
if curHeroData.lv == curStarRankUpConfig.OpenLevel then
2022-01-12 13:37:39 +08:00
--是否能升星
if curHeroData.star >= curHeroData.heroConfig.MaxRank then
2023-12-07 01:11:27 +08:00
MsgPanel.ShowOne("当前英雄已达最大星级")
return
end
2020-11-03 15:17:48 +08:00
_isClicked = false
2021-03-12 14:31:52 +08:00
local showTipStr = Language[11808]
local showIndex = RoleInfoPanelIndex.jinjie
2021-03-12 14:31:52 +08:00
local showBtnTipStr = Language[11809]
2020-11-11 19:50:49 +08:00
if curHeroData.star == HeroManager.awakeStarIndex then
2021-03-12 14:31:52 +08:00
showTipStr = Language[11810]
showBtnTipStr = Language[11811]
showIndex = RoleInfoPanelIndex.juexing
2020-11-16 14:57:46 +08:00
end
if showIndex == RoleInfoPanelIndex.juexing then
2020-11-16 14:57:46 +08:00
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.RoleAwake) then
MsgPanel.ShowTwo(showTipStr, nil, function()
parent:SetSelectBtn(showIndex)
parent:OnPageTabChange(showIndex)
2021-03-12 14:31:52 +08:00
end,Language[10731],showBtnTipStr)
2020-11-16 14:57:46 +08:00
else
2021-03-12 14:31:52 +08:00
PopupTipPanel.ShowTip(Language[11812])--需要先进行觉醒!
2020-11-16 14:57:46 +08:00
end
2020-11-11 19:50:49 +08:00
else
2020-11-16 14:57:46 +08:00
MsgPanel.ShowTwo(showTipStr, nil, function()
parent:SetSelectBtn(showIndex)
parent:OnPageTabChange(showIndex)
2021-03-12 14:31:52 +08:00
end,Language[10731],showBtnTipStr)
2020-11-11 19:50:49 +08:00
end
2020-11-03 15:17:48 +08:00
else
2022-01-14 17:57:12 +08:00
if isHeroUpTuPo and oldLv == upTuPoRankUpConfig.LimitLevel then --点击按钮之前的等级 == 突破最大等级 说明是突破
if isUpLvMaterials then
this:DeleteLvUpMaterials()
else
2022-11-04 16:28:16 +08:00
--PopupTipPanel.ShowTip(Language[11813])
this:ShowCostNotEnoughTip()
2022-01-14 17:57:12 +08:00
end
_isClicked = false
_isLongPress = false
this.isPressed = false
timer = 0
elseif not isHeroUpTuPo or curHeroData.lv < upTuPoRankUpConfig.LimitLevel then
if isUpLvMaterials then
this:DeleteLvUpMaterials()
2020-11-03 15:17:48 +08:00
else
2022-01-14 17:57:12 +08:00
_isClicked = false
if isHeroUpTuPo and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
2022-11-04 16:28:16 +08:00
this:ShowCostNotEnoughTip()
2022-01-14 17:57:12 +08:00
else
2022-11-04 16:28:16 +08:00
this:ShowCostNotEnoughTip()
2022-01-14 17:57:12 +08:00
end
2020-11-03 15:17:48 +08:00
end
end
end
else--从未进阶过处理
_isClicked = false
2021-03-12 14:31:52 +08:00
MsgPanel.ShowTwo(Language[11808], nil, function()
parent:SetSelectBtn(RoleInfoPanelIndex.jinjie)
parent:OnPageTabChange(RoleInfoPanelIndex.jinjie)
2021-03-12 14:31:52 +08:00
end,Language[10731],Language[11809])
2020-11-03 15:17:48 +08:00
end
2022-01-12 13:37:39 +08:00
elseif isHeroUpTuPo and oldLv == upTuPoRankUpConfig.LimitLevel then --点击按钮之前的等级 == 突破最大等级 说明是突破
2020-11-03 15:17:48 +08:00
if isUpLvMaterials then
2022-01-12 13:37:39 +08:00
this:DeleteLvUpMaterials()
2020-11-03 15:17:48 +08:00
else
2022-11-04 16:28:16 +08:00
this:ShowCostNotEnoughTip()
2022-01-12 13:37:39 +08:00
end
_isClicked = false
_isLongPress = false
this.isPressed = false
timer = 0
elseif not isHeroUpTuPo or curHeroData.lv < upTuPoRankUpConfig.LimitLevel then
if isUpLvMaterials then
this:DeleteLvUpMaterials()
else
2022-11-04 16:28:16 +08:00
this:ShowCostNotEnoughTip()
2020-11-03 15:17:48 +08:00
_isClicked = false
2022-01-12 13:37:39 +08:00
_isLongPress = false
this.isPressed = false
timer = 0
2020-11-03 15:17:48 +08:00
end
end
end
2022-11-04 16:28:16 +08:00
function RoleInfoLayout:ShowCostNotEnoughTip()
if isHeroUpTuPo then
PopupTipPanel.ShowTip(BagManager.GetItemNameById(costId).."不足无法突破")
else
PopupTipPanel.ShowTip(BagManager.GetItemNameById(costId).."不足无法升级")
end
2022-11-15 15:57:48 +08:00
2022-12-23 14:56:30 +08:00
local item=BagManager.GetItemDataByTimeIsGold(costId)
if item then
UIManager.OpenPanel(UIName.BagResolveAnCompoundPanel, 4,item)
else
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,costId)
end
--local _itemData = BagManager.bagDatas[itemSid]
2022-11-15 15:57:48 +08:00
2022-11-04 17:49:27 +08:00
--if costId==4 then
2022-11-15 15:57:48 +08:00
2022-11-04 17:49:27 +08:00
--end
2022-11-04 16:28:16 +08:00
end
2022-11-15 16:35:48 +08:00
function RoleInfoLayout:CalUpMaxLv()
local calOldLv=curHeroData.lv
local upMaxCostList={}
for i = curHeroData.lv, this.GetCurHeroLvLimit() do
local costList=ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, i).Consume
2022-11-23 15:28:32 +08:00
for j = 1, #costList do
local costxxId=costList[j][1]
local costxxNum=costList[j][2]
2022-11-15 16:35:48 +08:00
if upMaxCostList[costxxId] then
costxxNum=costxxNum+upMaxCostList[costxxId]
end
2022-11-23 15:28:32 +08:00
local havexxNum= BagManager.GetItemCountById(costList[j][1])
if havexxNum<costxxNum or calOldLv==this.GetCurHeroLvLimit() then
2022-11-15 16:35:48 +08:00
return calOldLv
end
2022-11-23 15:28:32 +08:00
upMaxCostList[costxxId]=costxxNum
2022-11-15 16:35:48 +08:00
end
2022-11-23 15:28:32 +08:00
calOldLv=i+1
2022-11-15 16:35:48 +08:00
end
return calOldLv
end
2022-11-04 16:28:16 +08:00
2020-11-03 15:17:48 +08:00
--长按升级结束后请求协议
function RoleInfoLayout:LongLvUpClick(oldLv)
NetManager.HeroLvUpEvent(curHeroData.dynamicId,curHeroData.lv,oldLv,function (msg)
this:DeleteLvUpMaterials2(msg)
end)
end
--扣除升级 突破 消耗的材料 更新英雄数据
2022-11-15 16:35:48 +08:00
function RoleInfoLayout:DeleteLvUpMaterials(targetLv)
2022-01-12 13:37:39 +08:00
_isReqLvUp = true
2022-11-15 16:35:48 +08:00
2022-01-12 13:37:39 +08:00
for i = 1, #costItemList do
--Log(string.format("扣除id=%s 数量=%s",costItemList[i][1],costItemList[i][2]))
BagManager.HeroLvUpUpdateItemsNum(costItemList[i][1],costItemList[i][2])
end
if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
UIManager.OpenPanel(UIName.RoleUpLvBreakSuccessPanel,curHeroData,upTuPoRankUpConfig.Id,upTuPoRankUpConfig.OpenLevel)
curHeroData.breakId=upTuPoRankUpConfig.Id
curHeroData.breakId=curHeroData.breakId
if curHeroData.star<upTuPoRankUpConfig.OpenStar then
curHeroData.star=upTuPoRankUpConfig.OpenStar
curHeroData.star=curHeroData.star
2020-11-03 15:17:48 +08:00
end
2022-01-12 13:37:39 +08:00
else
2022-11-15 16:35:48 +08:00
if targetLv then
curHeroData.lv=targetLv
else
curHeroData.lv=curHeroData.lv + 1
end
2022-01-12 13:37:39 +08:00
PopupTipPanel.ShowTip(Language[11867])
2020-11-03 15:17:48 +08:00
end
2022-01-12 13:37:39 +08:00
2020-11-03 15:17:48 +08:00
--Log("刷新英雄库里单个英雄数据 "..curHeroData.dynamicId.." "..curHeroData.lv.." "..curHeroData.star.." "..curHeroData.breakId.." "..curHeroData.upStarId)
--刷新英雄库里单个英雄数据
if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
2022-01-15 14:34:55 +08:00
-- this.lvUpGoImage:SetActive(false)
2020-11-03 15:17:48 +08:00
-- 突破音效
PlaySoundWithoutClick(SoundConfig.Sound_Breach)
else
2022-01-15 14:34:55 +08:00
-- this.lvUpGoImage:SetActive(true)
2020-11-03 15:17:48 +08:00
-- 升级音效
PlaySoundWithoutClick(SoundConfig.Sound_Upgrade)
end
2022-01-12 13:37:39 +08:00
HeroManager.UpdateSingleHeroDatas(curHeroData.dynamicId,curHeroData.lv,curHeroData.star,curHeroData.breakId,curHeroData.upStarId,true)
2020-11-03 15:17:48 +08:00
local allAddProValOld = allAddProVal
parent:UpdateHeroInfoData()--刷新界面
this.ShowProAddVal(allAddProValOld)
end
2022-11-04 16:28:16 +08:00
2020-11-03 15:17:48 +08:00
--连续升级更新后端英雄数据
function RoleInfoLayout:DeleteLvUpMaterials2(msg)
for i, v in pairs(herodatas) do
if curHeroData == v then
if msg then
curHeroData.lv=msg.targetLevel
-- Log("后端更新猎妖师技术前端刷新界面 "..msg.targetLevel)
2020-11-03 15:17:48 +08:00
end
v.lv=curHeroData.lv
end
end
2021-02-20 17:55:57 +08:00
if msg then
HeroManager.UpdateSingleHeroDatas(curHeroData.dynamicId,msg.targetLevel,curHeroData.star,curHeroData.breakId,curHeroData.upStarId,true)
else
HeroManager.UpdateSingleHeroDatas(curHeroData.dynamicId,curHeroData.lv,curHeroData.star,curHeroData.breakId,curHeroData.upStarId,true)
end
2020-11-03 15:17:48 +08:00
parent:UpdateHeroInfoData()--刷新界面
2021-03-30 10:38:59 +08:00
parent.upLvEffect:SetActive(false)
parent.upLvEffect:SetActive(true)
2020-11-03 15:17:48 +08:00
end
2022-01-12 13:37:39 +08:00
local oldFrame = 0
2020-11-03 15:17:48 +08:00
--长按升级处理
function this.OnUpdate()
if _isClicked then
2022-01-12 13:37:39 +08:00
--长按
if Time.realtimeSinceStartup - this.timePressStarted > 0.4 then
if timer <= 0 then
2022-01-14 16:14:52 +08:00
timer = timer + 0.1
2022-01-12 13:37:39 +08:00
_isLongPress = true
this:LvUpClick(false)
2022-01-12 13:37:39 +08:00
end
if Time.frameCount - oldFrame > 0 then
oldFrame = Time.frameCount
timer = timer - Time.deltaTime
2020-11-03 15:17:48 +08:00
end
end
2022-01-12 13:37:39 +08:00
end
2020-11-03 15:17:48 +08:00
end
--播放升级 属性提升动画
function this.ShowProAddVal(allAddProValOld)
this.lvUpGo:SetActive(true)
Util.GetGameObject(lvUpShowProList[1], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.Attack]-allAddProValOld[HeroProType.Attack]
Util.GetGameObject(lvUpShowProList[2], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.Hp]-allAddProValOld[HeroProType.Hp]
Util.GetGameObject(lvUpShowProList[3], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.PhysicalDefence]-allAddProValOld[HeroProType.PhysicalDefence]
Util.GetGameObject(lvUpShowProList[4], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.MagicDefence]-allAddProValOld[HeroProType.MagicDefence]
--Util.GetGameObject(lvUpShowProList[5], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.Speed]-allAddProValOld[HeroProType.Speed]
this.ThreadShowProAddVal()
end
function this.ThreadShowProAddVal()
if this.priThread then
coroutine.stop(this.priThread)
this.priThread = nil
end
table.walk(lvUpShowProList, function(privilegeItem)
privilegeItem:SetActive(false)
end)
this.priThread = coroutine.start(function()
for i = 1, 4 do
lvUpShowProList[i]:SetActive(false)
PlayUIAnims(lvUpShowProList[i])
coroutine.wait(0.04)
lvUpShowProList[i]:SetActive(true)
coroutine.wait(0.08)
end
this.lvUpGo:SetActive(false)
end)
end
function RoleInfoLayout:OnHide()
self.gameObject:SetActive(false)
2020-11-03 15:17:48 +08:00
end
function RoleInfoLayout:OnClose()
FixedUpdateBeat:Remove(this.OnUpdate, self)
if this.priThread then
coroutine.stop(this.priThread)
-- 关闭显示
for i = 1, 4 do
lvUpShowProList[i]:SetActive(false)
end
this.lvUpGo:SetActive(false)
2020-11-03 15:17:48 +08:00
this.priThread = nil
end
this.proList = {}
this.skillList = {}
this.costList = {}
2020-11-03 15:17:48 +08:00
end
return RoleInfoLayout