2020-05-09 13:31:21 +08:00
require ( " Base/BasePanel " )
RoleInfoPanel = Inherit ( BasePanel )
local this = RoleInfoPanel
--升级升星
local curHeroData --当前英雄信息
local leftHeroData --左边预加载英雄信息
local rightHeroData --右边预加载英雄信息
local heroDatas --所有英雄list信息
local itemConfig = ConfigManager.GetConfig ( ConfigName.ItemConfig )
local heroRankupConfig = ConfigManager.GetConfig ( ConfigName.HeroRankupConfig )
local propertyConfig = ConfigManager.GetConfig ( ConfigName.PropertyConfig )
local index --当前英雄在 英雄列表中的索引
local costItemList --升级突破静态材料
local isUpLvMaterials = true --升级 突破 材料是否充足
local isUpStarMaterials = true --升星 材料是否充足
local curSelectUpStarData --当前选择升星坑位的数据
local curSelectUpStarGo --当前选择升星坑位的预设
local upStarConsumeMaterial = { } --升星消耗的英雄组 {{1坑位英雄信息}{2坑位英雄信息}{}}
local upStarMaterialIsAll = { } --升星消耗的英雄组是否满足 {{1满足}{2不满足}{}}
local allAddProVal = { } --所有属性加成值
local lvUpShowProList = { } --升级后展示的属性提升list
local soulPrintData = { } --魂印数据
local isHeroUpTuPo = false --是否可突破
local isHeroUpStar = false --是否可升星
local upTuPoRankUpConfig = { } --即将要突破的数据
local upStarRankUpConfig = { } --即将要升星的数据
local curTuPoRankUpConfig = { } --当前突破的数据
local curStarRankUpConfig = { } --当前升星的数据
--长按升级状态
local _isClicked = false
local _isReqLvUp = false
local _isLongPress = false
2020-05-15 16:52:35 +08:00
RoleInfoPanel.timePressStarted = 0 --监听长按事件
2020-05-09 13:31:21 +08:00
this.priThread = nil --协同程序播放升级属性提升值动画用
local isUpZhen = false --当前英雄是否上阵
local isClickLeftOrRightBtn = true --点击左右按钮切换英雄播放动画状态
local teamHero = { } --主线编队成员信息
local talismanIsOpen = false --法宝是否开启
local soulPrintIsOpen = false --魂印是否开启
local isTriggerLongClick = false --长按是否升过级
local pinjieImage = { " r_hero_pinjiebiao_01 " , " r_hero_pinjiebiao_02 " } --该死的品阶图片 1是未激活 2是激活
--初始化组件(用于子类重写)
function RoleInfoPanel : InitComponent ( )
self.BtnBack = Util.GetGameObject ( self.transform , " btnBack " )
this.optionUp = Util.GetGameObject ( self.gameObject , " optionUp " ) --上部按钮组
this.helpBtn = Util.GetGameObject ( this.optionUp , " helpBtn " )
this.helpPosition = this.helpBtn : GetComponent ( " RectTransform " ) . localPosition
this.posBtn = Util.GetGameObject ( this.optionUp , " posBtn " ) --角色定位按钮
this.shareBtn = Util.GetGameObject ( this.optionUp , " shareBtn " ) --分享按钮
self.live2dRoot = Util.GetGameObject ( self.gameObject , " live2dRoot " )
self.bg = Util.GetGameObject ( self.gameObject , " bg " )
self.starGrid = Util.GetGameObject ( self.transform , " rolePanel/info/sartAndLvLayout/starGrid " )
self.posImage = Util.GetGameObject ( self.transform , " rolePanel/info/nameAndPossLayout/posImage/posImage/posImage " ) : GetComponent ( " Image " )
self.posText = Util.GetGameObject ( self.transform , " rolePanel/info/nameAndPossLayout/posText/posText " ) : GetComponent ( " Text " )
self.profession = Util.GetGameObject ( self.transform , " rolePanel/info/nameAndPossLayout/proImage/proImage " ) : GetComponent ( " Image " )
self.force = Util.GetGameObject ( self.transform , " powerBtn/value " ) : GetComponent ( " Text " )
this.upLvEffect = Util.GetGameObject ( self.transform , " powerBtn/effect " )
self.heroName = Util.GetGameObject ( self.transform , " rolePanel/info/nameAndPossLayout/heroName " ) : GetComponent ( " Text " )
self.level = Util.GetGameObject ( self.transform , " rolePanel/info/sartAndLvLayout/lvText " ) : GetComponent ( " Text " )
this.rolePanelOp = Util.GetGameObject ( self.transform , " rolePanel/layout " )
-- this.qualityImage=Util.GetGameObject(self.transform,"powerBtn/quality"):GetComponent("Image")
-- this.quality=Util.GetGameObject(self.transform,"powerBtn/quality/qualityText")
-- this.doubleQuality=Util.GetGameObject(self.transform,"powerBtn/quality/qualityDoubleText")
this.posBgImage = Util.GetGameObject ( self.transform , " powerBtn/Pos " ) : GetComponent ( " Image " )
this.posImage = Util.GetGameObject ( self.transform , " powerBtn/Pos/PosImage " ) : GetComponent ( " Image " )
this.posText = Util.GetGameObject ( self.transform , " powerBtn/Pos/PosText " ) : GetComponent ( " Text " )
self.btnInfo = Util.GetGameObject ( self.transform , " rolePanel/btnList/btnInfo " )
2020-06-03 19:09:01 +08:00
this.btnInfoRedPoint = Util.GetGameObject ( self.transform , " rolePanel/btnList/btnInfo/redPoint " )
2020-05-09 13:31:21 +08:00
self.btnUpStar = Util.GetGameObject ( self.transform , " rolePanel/btnList/btnUpStar " )
self.btnEquip = Util.GetGameObject ( self.transform , " rolePanel/btnList/btnEquip " )
self.btnStory = Util.GetGameObject ( self.transform , " rolePanel/btnList/btnStory " )
self.btnSkin = Util.GetGameObject ( self.transform , " rolePanel/btnList/btnSkin " )
this.selectBtn = Util.GetGameObject ( self.transform , " rolePanel/btnList/selectBtn " )
this.leftBtn = Util.GetGameObject ( self.transform , " leftBtn/GameObject " )
this.rightBtn = Util.GetGameObject ( self.transform , " rightBtn/GameObject " )
--英雄详情结构对象
this.roleInfoLayout = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout " )
this.roleUpStarLayout = Util.GetGameObject ( self.transform , " rolePanel/layout/roleUpStarLayout " )
this.roleStoryLayout = Util.GetGameObject ( self.transform , " rolePanel/layout/roleStoryLayout " )
this.roleSkinLayout = Util.GetGameObject ( self.transform , " rolePanel/layout/roleSkinLayout " )
this.upLvMaskPanle = Util.GetGameObject ( self.transform , " rolePanel/layout/upLvMaskPanle " )
self.curObj = Util.GetGameObject ( self.transform , " curObj " )
self.leftObj = Util.GetGameObject ( self.transform , " leftObj " )
self.rightObj = Util.GetGameObject ( self.transform , " rightObj " )
--情报
this.atkPro = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/pro/atk " )
this.hpPro = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/pro/hp " )
this.phyDef = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/pro/phyDef " )
this.magDef = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/pro/magDef " )
this.lv = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/pro/lv/proValue " ) : GetComponent ( " Text " )
this.skillGrid = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/skill " )
this.selsectSkillImage = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/selsectSkillImage " )
this.allProButton = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/allProButton " )
this.pinjieList = { } --品阶预设容器
this.pinjieRoot = Util.GetGameObject ( self.gameObject , " rolePanel/layout/roleInfoLayout/Pinjie " )
this.pinjiePre = Util.GetGameObject ( self.gameObject , " rolePanel/layout/roleInfoLayout/Pre " )
--升级
this.itemPre = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/upLv/itemPre " )
this.itemGrid = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/upLv/itemGrid " )
this.upLvBtn = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/upLvBtn " )
2020-06-03 19:09:01 +08:00
this.upLvBtnRedPoint = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/upLvBtn/redPoint " )
2020-05-09 13:31:21 +08:00
this.upLvTrigger = Util.GetEventTriggerListener ( this.upLvBtn )
this.upLvBtnText = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/upLvBtn/Text " ) : GetComponent ( " Text " )
this.upLvBtnImage = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/upLvBtn " ) : GetComponent ( " Image " )
this.upLvBtnTiShiText = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/upLv/Image/Text " ) : GetComponent ( " Text " )
this.upLvGoldBtn = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/upLv/gold " )
this.upLvGoldText = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/upLv/gold/Text " ) : GetComponent ( " Text " )
this.tipUpLv = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/upLv/tip " )
this.noUpLvText = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/noUpLvText " )
this.upLv = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/upLv " )
this.lvUpGo = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/lvUpGo " )
this.lvUpGoImage = Util.GetGameObject ( self.transform , " rolePanel/layout/roleInfoLayout/lvUpGo/Image " )
for i = 1 , 5 do
lvUpShowProList [ i ] = Util.GetGameObject ( this.lvUpGo . transform , " proPreParent/proPre " .. i )
end
2020-05-15 16:52:35 +08:00
lvUpShowProList [ 5 ] : SetActive ( false )
2020-05-09 13:31:21 +08:00
--升星
this.upStar = Util.GetGameObject ( self.transform , " rolePanel/layout/roleUpStarLayout/upStar " )
this.noUpStarText = Util.GetGameObject ( self.transform , " rolePanel/layout/roleUpStarLayout/noUpStarText " )
this.upStarPre = Util.GetGameObject ( this.upStar , " upStarPre " )
this.upStarGrid = Util.GetGameObject ( this.upStar , " grid " )
this.upStarBtn = Util.GetGameObject ( this.upStar , " btns/upStarBtn " )
2020-06-03 19:09:01 +08:00
this.upStarBtnRedPoint = Util.GetGameObject ( this.upStar , " btns/upStarBtn/redPoint " )
2020-05-09 13:31:21 +08:00
this.goldBtn = Util.GetGameObject ( this.upStar , " goldGrid/gold " )
this.goldText = Util.GetGameObject ( this.upStar , " goldGrid/gold/Text " ) : GetComponent ( " Text " )
this.goldImage = Util.GetGameObject ( this.upStar , " goldGrid/gold " )
this.gold2Btn = Util.GetGameObject ( this.upStar , " goldGrid/gold2 " )
this.gold2Text = Util.GetGameObject ( this.upStar , " goldGrid/gold2/Text " ) : GetComponent ( " Text " )
this.gold2Image = Util.GetGameObject ( this.upStar , " goldGrid/gold2 " )
this.roleUpStarLayoutTip = Util.GetGameObject ( this.upStar , " tip " ) : GetComponent ( " Text " )
this.roleUpStarRedPoint = Util.GetGameObject ( self.transform , " rolePanel/btnList/btnUpStar/redPoint " )
--升星属性
this.curStarGrid = Util.GetGameObject ( this.upStar . transform , " upStarProInfo/curStarGrid " )
this.nextStarGrid = Util.GetGameObject ( this.upStar . transform , " upStarProInfo/nextStarGrid " )
--this.curLvEnd = Util.GetGameObject(this.upStar.transform, "upStarProInfo/lvUp/curLvEnd"):GetComponent("Text")
--this.nextLvEnd = Util.GetGameObject(this.upStar.transform, "upStarProInfo/lvUp/nextLvEnd"):GetComponent("Text")
--this.proUpVal = Util.GetGameObject(this.upStar.transform, "upStarProInfo/proUp/upVal"):GetComponent("Text")
this.skillInfoGrid = Util.GetGameObject ( this.upStar . transform , " upStarProInfo/skillInfo " )
this.skillInfoGrid : SetActive ( false )
this.atkPro_UpStar = Util.GetGameObject ( self.transform , " rolePanel/layout/roleUpStarLayout/upStar/upStarProInfo/pro/atk " )
this.hpPro_UpStar = Util.GetGameObject ( self.transform , " rolePanel/layout/roleUpStarLayout/upStar/upStarProInfo/pro/hp " )
this.phyDef_UpStar = Util.GetGameObject ( self.transform , " rolePanel/layout/roleUpStarLayout/upStar/upStarProInfo/pro/phyDef " )
this.magDef_UpStar = Util.GetGameObject ( self.transform , " rolePanel/layout/roleUpStarLayout/upStar/upStarProInfo/pro/magDef " )
this.lv_UpStar = Util.GetGameObject ( self.transform , " rolePanel/layout/roleUpStarLayout/upStar/upStarProInfo/pro/lv/proValue " ) : GetComponent ( " Text " )
this.nextlv_UpStar = Util.GetGameObject ( self.transform , " rolePanel/layout/roleUpStarLayout/upStar/upStarProInfo/pro/lv/nextproValue " ) : GetComponent ( " Text " )
--装备
this.equipBtn = Util.GetGameObject ( self.transform , " option/equipBtn " )
this.soulPrintBtn = Util.GetGameObject ( self.transform , " option/soulPrintBtn " )
this.soulPrintBtnRedPoint = Util.GetGameObject ( self.transform , " option/soulPrintBtn/redPoint " )
this.equipBtnRedPoint = Util.GetGameObject ( self.transform , " option/equipBtn/redPoint " )
--法宝
2020-06-08 13:57:30 +08:00
this.talismanBtn = Util.GetGameObject ( self.transform , " option/talismanBtn " ) --该按钮控制入口显隐
this.talismanClick = Util.GetGameObject ( self.transform , " option/talismanBtn/panel " ) --控制按钮的点击事件 置灰
this.talismanBtnRedPoint = Util.GetGameObject ( self.transform , " option/talismanBtn/panel/redPoint " )
this.talismanInfo = Util.GetGameObject ( self.transform , " option/talismanBtn/info " ) --查看法宝特性按钮
2020-05-09 13:31:21 +08:00
self.dragView = SubUIManager.Open ( SubUIConfig.DragView , self.gameObject . transform )
self.dragView . transform : SetSiblingIndex ( 1 )
this.UpView = SubUIManager.Open ( SubUIConfig.UpView , self.gameObject . transform , { showType = UpViewOpenType.ShowLeft } )
screenAdapte ( self.bg )
--回溯
-- this.upReturn=Util.GetGameObject(this.upStar,"btns/upReturn")
-- this.upReturn2=Util.GetGameObject(this.noUpStarText,"upReturn")
--定位
-- self.infoText=Util.GetGameObject(self.transform,"rolePanel/layout/roleInfoLayout/Location/Info"):GetComponent("Text")
--上锁
this.lockBtn = Util.GetGameObject ( self.transform , " rolePanel/info/sartAndLvLayout/lockBtn " )
this.lockImage = Util.GetGameObject ( this.lockBtn . transform , " lock " )
this.unlockImage = Util.GetGameObject ( this.lockBtn . transform , " unlock " )
--传记
self.infoTextStory = Util.GetGameObject ( self.transform , " rolePanel/layout/roleStoryLayout/infoBg/infoRect/infoText " ) : GetComponent ( " Text " )
this.trigger = Util.GetEventTriggerListener ( self.dragView . gameObject )
this.trigger . onBeginDrag = this.trigger . onBeginDrag + this.OnBeginDrag
this.trigger . onDrag = this.trigger . onDrag + this.OnDrag
this.trigger . onEndDrag = this.trigger . onEndDrag + this.OnEndDrag
this.talentBtn = Util.GetGameObject ( self.transform , " talentBtn " )
this.talentProgress = Util.GetGameObject ( self.transform , " talentBtn/progress " ) : GetComponent ( " Text " )
this.talentTipStr = Util.GetGameObject ( self.transform , " rolePanel/layout/roleUpStarLayout/tipStr " ) : GetComponent ( " Text " )
this.talentTipStrGo = Util.GetGameObject ( self.transform , " rolePanel/layout/roleUpStarLayout/tipStr " )
end
local oldLv = 0
--绑定事件(用于子类重写)
function RoleInfoPanel : BindEvent ( )
Util.AddClick ( self.BtnBack , function ( )
PlaySoundWithoutClick ( SoundConfig.Sound_UICancel )
self : ClosePanel ( )
end )
--帮助按钮(暂时干掉)
-- Util.AddClick(this.helpBtn, function()
-- UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.RoleInfo,this.helpPosition.x,this.helpPosition.y)
-- end)
--角色定位按钮
Util.AddClick ( this.posBtn , function ( )
2020-05-15 16:52:35 +08:00
UIManager.OpenPanel ( UIName.RolePosInfoPopup , curHeroData.heroConfig )
2020-05-09 13:31:21 +08:00
end )
--情报按钮
Util.AddClick ( self.btnInfo , function ( )
RoleInfoPanel : OnClickBtnInfo ( )
end )
--进阶按钮
Util.AddClick ( self.btnUpStar , function ( )
RoleInfoPanel : OnClickBtnUpStar ( )
end )
--传记按钮
Util.AddClick ( self.btnStory , function ( )
RoleInfoPanel : OnClickBtnStory ( )
end )
--皮肤按钮
Util.AddClick ( self.btnSkin , function ( )
RoleInfoPanel : OnClickBtnSkin ( )
end )
--左切换按钮
Util.AddClick ( this.leftBtn , function ( )
this : LeftBtnOnClick ( )
end )
--右切换按钮
Util.AddClick ( this.rightBtn , function ( )
this : RightBtnOnClick ( )
end )
Util.AddClick ( this.dragView . gameObject , function ( )
local SkeletonGraphic = this.curLiveObj : GetComponent ( " SkeletonGraphic " )
SkeletonGraphic.AnimationState : SetAnimation ( 0 , " touch " , false )
end )
--升级
Util.AddClick ( this.upLvBtn , function ( )
2020-05-15 16:52:35 +08:00
if Time.realtimeSinceStartup - RoleInfoPanel.timePressStarted <= 0.4 then
2020-05-09 13:31:21 +08:00
self : LvUpClick ( true )
end
end )
--长按升级按下状态
this._onPointerDown = function ( Pointgo , data )
isTriggerLongClick = false
_isClicked = true
2020-05-15 16:52:35 +08:00
RoleInfoPanel.timePressStarted = Time.realtimeSinceStartup
2020-05-09 13:31:21 +08:00
oldLv = curHeroData.lv
end
--长按升级抬起状态
this._onPointerUp = function ( Pointgo , data )
if _isLongPress and isTriggerLongClick then
--连续升级抬起请求升级
self : LongLvUpClick ( oldLv )
end
_isClicked = false
_isLongPress = false
end
this.upLvTrigger . onPointerDown = this.upLvTrigger . onPointerDown + this._onPointerDown
this.upLvTrigger . onPointerUp = this.upLvTrigger . onPointerUp + this._onPointerUp
--升星
Util.AddClick ( this.upStarBtn , function ( )
self : StarUpClick ( )
end )
--回溯
-- Util.AddClick(this.upReturn, function()
-- self:HeroReturnEvent()
-- end)
--满星时回溯按钮
-- Util.AddClick(this.upReturn2, function()
-- self:HeroReturnEvent()
-- end)
--装备
Util.AddClick ( this.equipBtn , function ( )
UIManager.OpenPanel ( UIName.RoleEquipPanel , curHeroData , heroDatas , this , isUpZhen )
end )
--魂印
Util.AddClick ( this.soulPrintBtn , function ( )
if soulPrintIsOpen then
-- if(#soulPrintData>=1 and isUpZhen) then
-- RedPointManager.PlayerPrefsSetStr(PlayerManager.uid .. curHeroData.dynamicId, 1)
-- end
UIManager.OpenPanel ( UIName.SoulPrintPanel , curHeroData , heroDatas )
else
-- local equipSignSetting = ConfigManager.GetConfig(ConfigName.EquipSignSetting)
local EquipSignUnlock = ConfigManager.GetConfigData ( ConfigName.GameSetting , 1 ) . EquipSignUnlock
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11753 ] .. NumToSimplenessFont [ EquipSignUnlock [ 2 ] [ 2 ] ] .. Language [ 11832 ] )
2020-05-09 13:31:21 +08:00
end
end )
--显示所有属性
Util.AddClick ( this.allProButton , function ( )
2020-06-18 20:39:29 +08:00
UIManager.OpenPanel ( UIName.RoleProInfoPopup , allAddProVal , curHeroData.heroConfig , true )
2020-05-09 13:31:21 +08:00
end )
--法宝
2020-06-08 13:57:30 +08:00
Util.AddClick ( this.talismanClick , function ( )
2020-05-09 13:31:21 +08:00
if talismanIsOpen then
UIManager.OpenPanel ( UIName.RoleTalismanPanelV2 , curHeroData , heroDatas )
else
PopupTipPanel.ShowTip ( TalismanManager.GetCurHeroIsOpenTalismanTip ( ) )
end
end )
2020-06-08 13:57:30 +08:00
--查看法宝特性按钮
Util.AddClick ( this.talismanInfo , function ( )
UIManager.OpenPanel ( UIName.TalismanInfoPopup , curHeroData.heroConfig , 1 , 1 )
end )
2020-05-09 13:31:21 +08:00
--上锁
Util.AddClick ( this.lockBtn , function ( )
self : HeroLockEvent ( )
end )
Util.AddClick ( this.talentBtn , function ( )
UIManager.OpenPanel ( UIName.RoleTalentPopup , curHeroData.heroConfig , curHeroData.breakId , curHeroData.upStarId )
end )
end
--添加事件监听(用于子类重写)
function RoleInfoPanel : AddListener ( )
Game.GlobalEvent : AddEvent ( GameEvent.Bag . BagGold , this.UpdateHeroUpLvAndBreakMaterialShow )
Game.GlobalEvent : AddEvent ( GameEvent.Bag . BagGold , this.UpdateHeroUpStarMaterialShow )
end
--移除事件监听(用于子类重写)
function RoleInfoPanel : RemoveListener ( )
Game.GlobalEvent : RemoveEvent ( GameEvent.Bag . BagGold , this.UpdateHeroUpLvAndBreakMaterialShow )
Game.GlobalEvent : RemoveEvent ( GameEvent.Bag . BagGold , this.UpdateHeroUpStarMaterialShow )
end
--界面打开时调用(用于子类重写)
function RoleInfoPanel : OnOpen ( _curHeroData , _heroDatas , _isUpZhen )
curHeroData , heroDatas , isUpZhen = _curHeroData , _heroDatas , _isUpZhen
--SoulPrintManager.UnLockSoulPrintPos(_curHeroData)
end
function RoleInfoPanel : OnSortingOrderChange ( )
this.skillGrid : GetComponent ( " Canvas " ) . sortingOrder = this.sortingOrder + 1
--this.skillInfoGrid:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1
end
function RoleInfoPanel : OnShow ( )
isClickLeftOrRightBtn = true
this.upLvEffect : SetActive ( false )
for i = 1 , # heroDatas do
if curHeroData == heroDatas [ i ] then
index = i
end
end
teamHero = FormationManager.GetAllFormationHeroId ( )
this : UpdateLiveList ( ) --加载当前 和 左右数据
if this.leftLiveObj and leftHeroData then
2020-06-23 18:36:24 +08:00
LogError ( Language [ 11833 ] )
2020-05-09 13:31:21 +08:00
poolManager : UnLoadLive ( leftHeroData.live , this.leftLiveObj )
this.leftLiveObj = nil
end
if this.rightLiveObj and rightHeroData then
2020-06-23 18:36:24 +08:00
LogError ( Language [ 11834 ] )
2020-05-09 13:31:21 +08:00
poolManager : UnLoadLive ( rightHeroData.live , this.rightLiveObj )
this.rightLiveObj = nil
end
if this.curLiveObj and curHeroData then
2020-06-23 18:36:24 +08:00
LogError ( Language [ 11835 ] )
2020-05-09 13:31:21 +08:00
poolManager : UnLoadLive ( curHeroData.live , this.curLiveObj )
this.curLiveObj = nil
end
Util.ClearChild ( self.curObj . transform )
Util.ClearChild ( self.leftObj . transform )
Util.ClearChild ( self.rightObj . transform )
this.leftLiveObj = this : LoadHerolive ( leftHeroData , self.leftObj )
this.rightLiveObj = this : LoadHerolive ( rightHeroData , self.rightObj )
this.curLiveObj = this : LoadHerolive ( curHeroData , self.curObj )
self.dragView : SetDragGO ( this.curLiveObj )
this : UpdatePanelData ( ) --刷新界面方法
RoleInfoPanel : OnClickBtnInfo ( ) --初始化是默认显示详情
this.UpView : OnOpen ( { showType = UpViewOpenType.ShowLeft , panelType = PanelType.RoleInfo } )
FixedUpdateBeat : Add ( this.OnUpdate , self ) --长按方法注册
end
--刷新面板
function RoleInfoPanel : RefreshHeroDatas ( _curHeroData , _heroDatas , _isUpZhen )
self : OnOpen ( _curHeroData , _heroDatas , _isUpZhen )
end
--长按升级处理
function this . OnUpdate ( )
if _isClicked then
2020-05-15 16:52:35 +08:00
if Time.realtimeSinceStartup - RoleInfoPanel.timePressStarted > 0.4 then
2020-05-09 13:31:21 +08:00
_isLongPress = true
if not _isReqLvUp then
_isReqLvUp = true
this : LvUpClick ( false )
end
end
end
end
--更新界面已存数据
function this : UpdateLiveList ( )
local leftIndex = ( index - 1 > 0 and index - 1 or # heroDatas )
leftHeroData = heroDatas [ leftIndex ]
curHeroData = heroDatas [ index ]
local rightIndex = ( index + 1 <= # heroDatas and index + 1 or 1 )
rightHeroData = heroDatas [ rightIndex ]
end
--根据界面数据加载动态立绘
function this : LoadHerolive ( _heroData , _objPoint )
--TODO:动态加载立绘
local testLive = poolManager : LoadLive ( _heroData.live , _objPoint.transform ,
Vector3.one * _heroData.scale , Vector3.New ( _heroData.position [ 1 ] , _heroData.position [ 2 ] , 0 ) )
local SkeletonGraphic = testLive : GetComponent ( " SkeletonGraphic " )
local idle = function ( ) SkeletonGraphic.AnimationState : SetAnimation ( 0 , " idle " , true ) end
SkeletonGraphic.AnimationState . Complete = SkeletonGraphic.AnimationState . Complete + idle
poolManager : SetLiveClearCall ( _heroData.live , testLive , function ( )
SkeletonGraphic.AnimationState . Complete = SkeletonGraphic.AnimationState . Complete - idle
end )
return testLive
end
--更新界面显示
function this : UpdatePanelData ( )
this : UpdateHeroInfoData ( ) --详情
RoleInfoPanel : GetCurHeroUpLvOrUpStarSData ( ) --获取升级 突破 进阶数据
this : UpdateHeroUpLvAndBreakData ( ) --升级
this : UpdateHeroUpStarData ( ) --进阶
if curHeroData.heroConfig . GrowthSwitch then
RoleInfoPanel.HideAllLayout ( )
this.roleInfoLayout : SetActive ( true )
2020-06-23 18:36:24 +08:00
RoleInfoPanel : SetSelectBtn ( self.btnInfo , Language [ 11836 ] )
2020-05-09 13:31:21 +08:00
return
end
end
--更新英雄情报数据
function this : UpdateHeroInfoData ( )
if teamHero [ curHeroData.dynamicId ] then
isUpZhen = true
this.equipBtnRedPoint : SetActive ( # HeroManager.GetHeroIsUpEquip ( curHeroData.dynamicId ) > 0 )
2020-06-08 13:57:30 +08:00
this.talismanBtnRedPoint : SetActive ( HeroManager.GetIsShowTalismanRedPoint ( curHeroData ) )
2020-06-03 19:09:01 +08:00
this.soulPrintBtnRedPoint : SetActive ( HeroManager.GetIsShowSoulPrintRedPoint ( curHeroData ) )
2020-05-09 13:31:21 +08:00
else
isUpZhen = false
this.equipBtnRedPoint : SetActive ( false )
2020-06-08 13:57:30 +08:00
this.talismanBtnRedPoint : SetActive ( false )
2020-05-09 13:31:21 +08:00
this.soulPrintBtnRedPoint : SetActive ( false )
end
curTuPoRankUpConfig = heroRankupConfig [ curHeroData.breakId ]
curStarRankUpConfig = heroRankupConfig [ curHeroData.upStarId ]
--角色定位按钮
2020-05-25 19:16:23 +08:00
this.posBtn . gameObject : SetActive ( curHeroData.heroConfig . ShowHeroLocation == 1 )
2020-05-09 13:31:21 +08:00
--法宝按钮逻辑
2020-06-08 13:57:30 +08:00
this.talismanBtn . gameObject : SetActive ( TalismanManager.CheckTalismanIsInConfig ( curHeroData ) )
2020-05-09 13:31:21 +08:00
if TalismanManager.CheckTalismanIsInConfig ( curHeroData ) then
talismanIsOpen = TalismanManager.GetCurHeroIsOpenTalisman ( curHeroData )
2020-06-08 13:57:30 +08:00
this.talismanInfo . gameObject : SetActive ( not talismanIsOpen )
Util.SetGray ( this.talismanClick , not talismanIsOpen )
Util.GetGameObject ( this.talismanClick . transform , " lock " ) : SetActive ( not talismanIsOpen )
if not talismanIsOpen then
Util.GetGameObject ( this.talismanClick , " lock/Text " ) : GetComponent ( " Text " ) . text = TalismanManager.GetCurHeroIsOpenTalismanStr ( )
2020-05-09 13:31:21 +08:00
end
end
--魂印按钮逻辑
local EquipSignUnlock = ConfigManager.GetConfigData ( ConfigName.GameSetting , 1 ) . EquipSignUnlock
if curHeroData.heroConfig . RankupConsumeMaterial then
this.soulPrintBtn : SetActive ( PlayerManager.level >= EquipSignUnlock [ 1 ] [ 2 ] and ( # curHeroData.heroConfig . RankupConsumeMaterial + curHeroData.heroConfig . Star ) >= EquipSignUnlock [ 2 ] [ 2 ] )
else
this.soulPrintBtn : SetActive ( PlayerManager.level >= EquipSignUnlock [ 1 ] [ 2 ] and curHeroData.heroConfig . Star >= EquipSignUnlock [ 2 ] [ 2 ] )
end
soulPrintIsOpen = SoulPrintManager.GetSoulPrintIsOpen ( curHeroData )
Util.GetGameObject ( this.soulPrintBtn , " lock " ) : SetActive ( not soulPrintIsOpen )
Util.SetGray ( this.soulPrintBtn , not soulPrintIsOpen )
if not soulPrintIsOpen then
2020-06-23 18:36:24 +08:00
Util.GetGameObject ( this.soulPrintBtn , " lock/Text " ) : GetComponent ( " Text " ) . text = NumToSimplenessFont [ EquipSignUnlock [ 2 ] [ 2 ] ] .. Language [ 10488 ]
2020-05-09 13:31:21 +08:00
end
--天赋
this.talentBtn : SetActive ( curHeroData.heroConfig . OpenPassiveSkillRules ~= nil )
if curHeroData.heroConfig . OpenPassiveSkillRules then
2020-06-03 19:09:01 +08:00
local openlists , compoundOpenNum , compoundNum , allUpStarOpenData = HeroManager.GetAllPassiveSkillIds ( curHeroData.heroConfig , curHeroData.breakId , curHeroData.upStarId )
2020-05-09 13:31:21 +08:00
this.talentProgress . text = # openlists - compoundOpenNum .. " / " .. # curHeroData.heroConfig . OpenPassiveSkillRules - compoundNum
2020-06-03 19:09:01 +08:00
if allUpStarOpenData [ curHeroData.star + 1 ] then
2020-06-23 18:36:24 +08:00
this.talentTipStr . text = Language [ 11837 ] .. NumToSimplenessFont [ curHeroData.star + 1 ] .. Language [ 11838 ]
2020-06-03 19:09:01 +08:00
else
this.talentTipStr . text = " "
end
2020-05-09 13:31:21 +08:00
end
--情报
self.dragView : SetDragGO ( this.curLiveObj )
SetHeroStars ( self.starGrid , curHeroData.star )
--常规属性赋值
Util.GetGameObject ( self.transform , " rolePanel/layout/roleStoryLayout/infoBg/infoRect/infoText " ) : GetComponent ( " RectTransform " ) . anchoredPosition = Vector2.New ( - 2 , 0 )
local stroyStr = string.gsub ( curHeroData.heroConfig . HeroStory , " # " , " \n " )
self.infoTextStory . text = string.gsub ( stroyStr , " | " , " " ) --传记
self.posImage . sprite = Util.LoadSprite ( curHeroData.professionIcon )
self.posText . text = GetJobStrByJobNum ( curHeroData.profession )
self.level . text = curHeroData.lv .. " / " .. HeroManager.GetCurHeroStarLvEnd ( 1 , curHeroData )
self.heroName . text = curHeroData.name
self.profession . sprite = Util.LoadSprite ( GetProStrImageByProNum ( curHeroData.heroConfig . PropertyName ) )
--资质相关
-- this.qualityImage.sprite=GetQuantityImage(curHeroData.heroConfig.Natural)
-- this.quality:SetActive(curHeroData.heroConfig.Natural < 10)
-- this.doubleQuality:SetActive(curHeroData.heroConfig.Natural >= 10)
-- this.quality:GetComponent("Text").text = curHeroData.heroConfig.Natural
-- this.doubleQuality:GetComponent("Text").text = curHeroData.heroConfig.Natural
--定位描述相关
this.posBgImage . sprite = Util.LoadSprite ( GetHeroPosBgStr ( curHeroData.heroConfig . Profession ) )
this.posImage . sprite = Util.LoadSprite ( GetHeroPosStr ( curHeroData.heroConfig . Profession ) )
this.posText . text = curHeroData.heroConfig . HeroLocation
--动态品阶
local pId = 0 --当前突破的阶数
if curHeroData.breakId ~= 0 then
pId = heroRankupConfig [ curHeroData.breakId ] . Phase [ 2 ]
end
local hruConfig = ConfigManager.GetAllConfigsDataByDoubleKey ( ConfigName.HeroRankupConfig , " Star " , curHeroData.heroConfig . Star , " Show " , 1 ) --动态获取不同英雄最大突破等阶
for i = 1 , # hruConfig do --动态生成
local item = this.pinjieList [ i ]
if not item then
item = newObjToParent ( this.pinjiePre , this.pinjieRoot )
item.name = " Pre " .. i
this.pinjieList [ i ] = item
end
this.pinjieList [ i ] : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( i <= pId and pinjieImage [ 2 ] or pinjieImage [ 1 ] )
end
for n = 0 , this.pinjieRoot . transform.childCount - 1 do --超过品阶关闭显示
this.pinjieRoot . transform : GetChild ( n ) . gameObject : SetActive ( n + 1 <=# hruConfig )
end
this.unlockImage : SetActive ( curHeroData.lockState == 0 )
this.lockImage : SetActive ( curHeroData.lockState == 1 )
-- self.infoText.text =curHeroData.heroConfig.HeroLocation
--计算面板属性
2020-06-30 18:59:44 +08:00
if isUpZhen then
local formationList = FormationManager.GetFormationByID ( FormationTypeDef.FORMATION_NORMAL )
local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal ( formationList.teamHeroInfos )
allAddProVal = HeroManager.CalculateHeroAllProValList ( 1 , curHeroData.dynamicId , false , nil , nil , true , allHeroTeamAddProVal )
else
allAddProVal = HeroManager.CalculateHeroAllProValList ( 1 , curHeroData.dynamicId , false )
end
2020-05-09 13:31:21 +08:00
this : ProShow ( this.atkPro , allAddProVal , HeroProType.Attack )
this : ProShow ( this.hpPro , allAddProVal , HeroProType.Hp )
this : ProShow ( this.phyDef , allAddProVal , HeroProType.PhysicalDefence )
this : ProShow ( this.magDef , allAddProVal , HeroProType.MagicDefence )
local curLvEnd = 30
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
this.lv . text = curHeroData.lv .. " / " .. curLvEnd
self.force . text = allAddProVal [ HeroProType.WarPower ]
--技能点击特殊处理
this.selsectSkillImage : SetActive ( false )
--LogError("curHeroData.skillIdList curHeroData.passiveSkillList "..#curHeroData.skillIdList.." "..#curHeroData.passiveSkillList)
this.UpdateHeroUpStarProUpSkillShow ( this.skillGrid , curHeroData.skillIdList , curHeroData.passiveSkillList )
end
function this : ProShow ( go , allAddProVal , HeroProType , nextallAddProVal )
local curProSConFig = ConfigManager.GetConfigData ( ConfigName.PropertyConfig , HeroProType )
Util.GetGameObject ( go , " proName " ) : GetComponent ( " Text " ) . text = curProSConFig.Info .. " : "
Util.GetGameObject ( go , " proValue " ) : GetComponent ( " Text " ) . text = allAddProVal [ HeroProType ]
Util.GetGameObject ( go , " Image " ) : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetResourcePath ( propertyConfig [ HeroProType ] . PropertyIcon ) )
if nextallAddProVal then
Util.GetGameObject ( go , " nextproValue " ) : GetComponent ( " Text " ) . text = nextallAddProVal [ HeroProType ]
end
end
--更新英雄升级 和 突破数据
function this : UpdateHeroUpLvAndBreakData ( )
-- 升级获取突破 和 升星相应heroRankUpConfig静态数据
-- LogError("curHeroData "..curHeroData.breakId)
if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
2020-06-23 18:36:24 +08:00
this.tipUpLv : GetComponent ( " Text " ) . text = Language [ 11839 ]
2020-05-09 13:31:21 +08:00
this.tipUpLv : SetActive ( true )
2020-06-23 18:36:24 +08:00
this.upLvBtnText . text = Language [ 11840 ]
2020-05-09 13:31:21 +08:00
this.upLvBtnImage . sprite = Util.LoadSprite ( " r_hero_button_001 " ) --r_chouka_button_004
2020-06-23 18:36:24 +08:00
this.upLvBtnTiShiText . text = Language [ 11841 ]
2020-05-09 13:31:21 +08:00
_isClicked = false
_isReqLvUp = false
else
if curHeroData.lv < 30 then --策划规定三十级之前一直显示持续长按可快速升级
this.tipUpLv : SetActive ( true )
2020-06-23 18:36:24 +08:00
this.tipUpLv : GetComponent ( " Text " ) . text = Language [ 11842 ]
2020-05-09 13:31:21 +08:00
else
this.tipUpLv : SetActive ( false )
end
2020-06-23 18:36:24 +08:00
this.upLvBtnText . text = Language [ 11090 ]
2020-05-09 13:31:21 +08:00
this.upLvBtnImage . sprite = Util.LoadSprite ( " r_hero_button_002 " )
2020-06-23 18:36:24 +08:00
this.upLvBtnTiShiText . text = Language [ 11843 ]
2020-05-09 13:31:21 +08:00
if isHeroUpStar and upStarRankUpConfig and curTuPoRankUpConfig and curTuPoRankUpConfig.JudgeClass == 1 and curHeroData.lv >= curTuPoRankUpConfig.OpenLevel then --当前突破全部完成
if curStarRankUpConfig then --进阶过处理
if curHeroData.lv == curStarRankUpConfig.OpenLevel then
2020-06-23 18:36:24 +08:00
this.tipUpLv : GetComponent ( " Text " ) . text = Language [ 11839 ]
2020-05-09 13:31:21 +08:00
this.tipUpLv : SetActive ( true )
end
else --从未进阶过处理
2020-06-23 18:36:24 +08:00
this.tipUpLv : GetComponent ( " Text " ) . text = Language [ 11839 ]
2020-05-09 13:31:21 +08:00
this.tipUpLv : SetActive ( true )
end
end
end
this : UpdateHeroUpLvAndBreakMaterialShow ( )
2020-06-03 19:09:01 +08:00
local upLvRedpoint = HeroManager.LvUpBtnRedPoint ( curHeroData )
this.btnInfoRedPoint : SetActive ( upLvRedpoint )
this.upLvBtnRedPoint : SetActive ( upLvRedpoint )
2020-05-09 13:31:21 +08:00
end
--更新英雄升级 和 突破 的材料显示
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 )
this.upLvBtn : GetComponent ( " RectTransform " ) . anchoredPosition = Vector2.New ( 2098 , - 42.00134 )
else
Util.ClearChild ( this.itemGrid . transform )
this.noUpLvText : SetActive ( fFightEndLvUpPanelalse )
this.upLv : SetActive ( true )
this.upLvBtn : GetComponent ( " RectTransform " ) . anchoredPosition = Vector2.New ( 547.0023 , - 42.00134 )
isUpLvMaterials = true
for i = 1 , # costItemList do
if costItemList [ i ] [ 1 ] ~= 14 then
local go = newObject ( this.itemPre )
go.transform : SetParent ( this.itemGrid . transform )
go.transform . localScale = Vector3.one
go.transform . localPosition = Vector3.zero ;
go : SetActive ( true )
--Log("costItemList[i][1] "..costItemList[i][1])
if BagManager.GetItemCountById ( costItemList [ i ] [ 1 ] ) < costItemList [ i ] [ 2 ] then
isUpLvMaterials = false
go.transform : Find ( " Image " ) . gameObject : SetActive ( true ) --显示加号
Util.GetGameObject ( go.transform , " Text " ) : GetComponent ( " Text " ) . text = string.format ( " <color=#FF0000FF>%s/%s</color> " , PrintWanNum2 ( BagManager.GetItemCountById ( costItemList [ i ] [ 1 ] ) ) , PrintWanNum2 ( costItemList [ i ] [ 2 ] ) )
else
go.transform : Find ( " Image " ) . gameObject : SetActive ( false ) --隐藏加号
Util.GetGameObject ( go.transform , " Text " ) : GetComponent ( " Text " ) . text = string.format ( " <color=#FFFFFFFF>%s/%s</color> " , PrintWanNum2 ( BagManager.GetItemCountById ( costItemList [ i ] [ 1 ] ) ) , PrintWanNum2 ( costItemList [ i ] [ 2 ] ) )
end
Util.GetGameObject ( go.transform , " icon " ) : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetResourcePath ( itemConfig [ costItemList [ i ] [ 1 ] ] . ResourceID ) )
go.transform : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetQuantityImageByquality ( itemConfig [ costItemList [ i ] [ 1 ] ] . Quantity ) )
Util.AddOnceClick ( Util.GetGameObject ( go.transform , " icon " ) , function ( )
UIManager.OpenPanel ( UIName.RewardItemSingleShowPopup , costItemList [ i ] [ 1 ] )
end )
else
if BagManager.GetItemCountById ( costItemList [ i ] [ 1 ] ) < costItemList [ i ] [ 2 ] then
isUpLvMaterials = false
this.upLvGoldText . text = string.format ( " <color=#FF0000FF>%s</color> " , costItemList [ i ] [ 2 ] )
else
this.upLvGoldText . text = string.format ( " <color=#FFFFFFFF>%s</color> " , costItemList [ i ] [ 2 ] )
end
Util.AddOnceClick ( this.upLvGoldBtn , function ( )
UIManager.OpenPanel ( UIName.RewardItemSingleShowPopup , costItemList [ i ] [ 1 ] )
end )
end
end
end
end
local upStarPreList = { }
--更新英雄进阶数据
function this : UpdateHeroUpStarData ( )
--进阶材料
this : UpdateHeroUpStarMaterialShow ( )
--进阶属性提升
if upStarRankUpConfig and upStarRankUpConfig.Id then
this : UpdateHeroUpStarProUpShow ( )
end
--进阶吞英雄条件
Util.ClearChild ( this.upStarGrid . transform )
local curUpStarData = HeroManager.GetHeroCurUpStarInfo ( curHeroData.dynamicId )
if curUpStarData and # curUpStarData > 0 then
this.upStar : SetActive ( true )
this.noUpStarText : SetActive ( false )
this.talentTipStrGo : SetActive ( true )
upStarConsumeMaterial = { }
upStarMaterialIsAll = { }
upStarPreList = { }
for i = 1 , # curUpStarData do
local go = newObject ( this.upStarPre )
go.transform : SetParent ( this.upStarGrid . transform )
go.transform . localScale = Vector3.one
go.transform . localPosition = Vector3.zero ;
go : SetActive ( true )
go.transform . name = " upStarPre " .. i
upStarPreList [ i ] = go
upStarConsumeMaterial [ i ] = { }
upStarMaterialIsAll [ i ] = 2
Util.GetGameObject ( go.transform , " iconbg/proImage " ) : SetActive ( false )
if curUpStarData [ i ] . upStarMaterialsData.Issame == 1 or curUpStarData [ i ] . upStarMaterialsData.IsId > 0 then
Util.GetGameObject ( go.transform , " iconDefault " ) : SetActive ( false )
Util.GetGameObject ( go.transform , " icon " ) : SetActive ( true )
Util.GetGameObject ( go.transform , " iconbg/proImage " ) : SetActive ( true )
Util.GetGameObject ( go.transform , " iconbg/proImage " ) : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetProStrImageByProNum ( curHeroData.heroConfig . PropertyName ) )
if curUpStarData [ i ] . upStarMaterialsData.Issame == 1 then
Util.GetGameObject ( go.transform , " icon " ) : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetResourcePath ( curHeroData.heroConfig . Icon ) )
Util.GetGameObject ( go.transform , " frame " ) : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetHeroQuantityImageByquality ( curHeroData.heroConfig . Quality ) )
Util.GetGameObject ( go.transform , " iconbg/proImage " ) : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetProStrImageByProNum ( curHeroData.heroConfig . PropertyName ) )
elseif curUpStarData [ i ] . upStarMaterialsData.IsId > 0 then
local heroConfig = ConfigManager.GetConfigData ( ConfigName.HeroConfig , curUpStarData [ i ] . upStarMaterialsData.IsId )
Util.GetGameObject ( go.transform , " icon " ) : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetResourcePath ( heroConfig.Icon ) )
Util.GetGameObject ( go.transform , " frame " ) : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetHeroQuantityImageByquality ( heroConfig.Quality ) )
Util.GetGameObject ( go.transform , " iconbg/proImage " ) : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetProStrImageByProNum ( heroConfig.PropertyName ) )
end
else
if curUpStarData [ i ] . upStarMaterialsData.IsSameClan == 1 then
Util.GetGameObject ( go.transform , " iconbg/proImage " ) : SetActive ( true )
Util.GetGameObject ( go.transform , " iconbg/proImage " ) : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetProStrImageByProNum ( curHeroData.heroConfig . PropertyName ) )
end
Util.GetGameObject ( go.transform , " iconDefault " ) : SetActive ( true )
Util.GetGameObject ( go.transform , " icon " ) : SetActive ( false )
Util.GetGameObject ( go.transform , " frame " ) : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetHeroQuantityImageByquality ( curUpStarData [ i ] . upStarMaterialsData.StarLimit ) )
--
end
local upStarHeroListData = HeroManager.GetUpStarHeroListData ( curUpStarData [ i ] . upStarMaterialsData.Id , curHeroData )
if upStarHeroListData.state > 0 then
Util.GetGameObject ( go.transform , " add/add " ) : SetActive ( true )
else
Util.GetGameObject ( go.transform , " add/add " ) : SetActive ( false )
end
Util.GetGameObject ( go.transform , " num " ) : GetComponent ( " Text " ) . text = string.format ( " <color=#FF0000FF>%s/%s</color> " , 0 , curUpStarData [ i ] . upStarData [ 4 ] )
SetHeroStars ( Util.GetGameObject ( go.transform , " iconbg/starGrid " ) , curUpStarData [ i ] . upStarMaterialsData.StarLimit )
local addBtn = Util.GetGameObject ( go.transform , " add " )
Util.AddOnceClick ( addBtn , function ( )
curSelectUpStarData = curUpStarData [ i ]
curSelectUpStarGo = go
local curShowHeroListData = self : SetShowHeroListData ( upStarConsumeMaterial , upStarHeroListData.heroList )
--参数1 显示的herolist 2 3 升当前星的规则 4 打开RoleUpStarListPanel的界面
UIManager.OpenPanel ( UIName.RoleUpStarListPanel , curShowHeroListData , curUpStarData [ i ] . upStarMaterialsData , curUpStarData [ i ] . upStarData , this , upStarConsumeMaterial [ i ] , curHeroData )
end )
end
else
this.upStar : SetActive ( false )
this.noUpStarText : SetActive ( true )
this.talentTipStrGo : SetActive ( false )
end
--回溯按钮显隐
-- this.upReturn:SetActive(this:GetCurHeroIsOpenReturn())
-- this.upReturn2:SetActive(this:GetCurHeroIsOpenReturn())
--自动选择进阶妖灵师材料
self : AutoSelectUpStarHeroList ( curUpStarData )
end
--回溯按钮显隐
function this : GetCurHeroIsOpenReturn ( )
local gameSettingConFig = ConfigManager.GetConfigData ( ConfigName.GameSetting , 1 )
local isOpen = false
if gameSettingConFig.HeroReturn [ 1 ] == 1 then
if PlayerManager.level >= gameSettingConFig.HeroReturn [ 2 ] then
isOpen = true
end
elseif gameSettingConFig.HeroReturn [ 1 ] == 2 then
if curHeroData.star >= gameSettingConFig.HeroReturn [ 2 ] then
isOpen = true
end
end
return isOpen
end
--进阶属性提升
function RoleInfoPanel : UpdateHeroUpStarProUpShow ( )
if upStarRankUpConfig and upStarRankUpConfig.Id then
SetHeroStars ( this.curStarGrid , curHeroData.star )
SetHeroStars ( this.nextStarGrid , curHeroData.star + 1 )
--this.curLvEnd.text = HeroManager.GetCurHeroStarLvEnd(1,curHeroData)
--this.nextLvEnd.text = HeroManager.GetCurHeroStarLvEnd(2,curHeroData,curHeroData.breakId,upStarRankUpConfig.Id)
local nextUpStarConFig = ConfigManager.GetConfigData ( ConfigName.HeroRankupConfig , upStarRankUpConfig.Id )
local nextProUpVal = 0
if nextUpStarConFig then nextProUpVal = nextUpStarConFig.PropertiesDisplay end
--this.proUpVal.text = GetPropertyFormatStr(2, nextProUpVal)
--this.UpdateHeroUpStarProUpSkillShow(this.skillInfoGrid,self:NextStarUpSkillTabs())
local nextallAddProVal = HeroManager.CalculateHeroAllProValList ( 2 , curHeroData.dynamicId , false , curHeroData.breakId , upStarRankUpConfig.Id )
this : ProShow ( this.atkPro_UpStar , allAddProVal , HeroProType.Attack , nextallAddProVal )
this : ProShow ( this.hpPro_UpStar , allAddProVal , HeroProType.Hp , nextallAddProVal )
this : ProShow ( this.phyDef_UpStar , allAddProVal , HeroProType.PhysicalDefence , nextallAddProVal )
this : ProShow ( this.magDef_UpStar , allAddProVal , HeroProType.MagicDefence , nextallAddProVal )
this.lv_UpStar . text = HeroManager.GetCurHeroStarLvEnd ( 1 , curHeroData )
this.nextlv_UpStar . text = HeroManager.GetCurHeroStarLvEnd ( 2 , curHeroData , curHeroData.breakId , upStarRankUpConfig.Id )
end
end
function RoleInfoPanel : NextStarUpSkillTabs ( )
local curSkillUpLvOrNewTabs = { }
local curPassiveSkillUpLvOrNewTabs = { }
--主动技
if curHeroData.heroConfig . OpenSkillRules then
for i = 1 , # curHeroData.heroConfig . OpenSkillRules do
local curOpenSkillRules = curHeroData.heroConfig . OpenSkillRules
if curOpenSkillRules [ i ] [ 1 ] == curHeroData.star + 1 then
local skillIsUplvOrNew = true
for j = 1 , # curHeroData.skillIdList do
if curHeroData.skillIdList [ j ] . skillId == curOpenSkillRules [ i ] [ 2 ] then
skillIsUplvOrNew = false
end
end
if skillIsUplvOrNew then
local skilldata = { }
local skillId = curOpenSkillRules [ i ] [ 2 ]
if skillId % 10 > 1 then
skillId = skillId - 1
else
skilldata.isShowUpImage = false
end
skilldata.skillId = skillId
skilldata.skillConfig = ConfigManager.GetConfigData ( ConfigName.SkillConfig , skillId )
table.insert ( curSkillUpLvOrNewTabs , skilldata )
end
end
end
end
--被动技
--if curHeroData.heroConfig.OpenPassiveSkillRules then
-- for i = 1, #curHeroData.heroConfig.OpenPassiveSkillRules do
-- local curOpenPassiveSkillRules = curHeroData.heroConfig.OpenPassiveSkillRules
-- if curOpenPassiveSkillRules[i][1]==curHeroData.star+1 then
-- local skillIsUplvOrNew = true
-- for j = 1, #curHeroData.passiveSkillList do
-- if curHeroData.passiveSkillList[j].skillId == curOpenPassiveSkillRules[i][2] then
-- skillIsUplvOrNew = false
-- end
-- end
-- if skillIsUplvOrNew then
-- local skilldata={}
-- local skillId = curOpenPassiveSkillRules[i][2]
-- if skillId%10 > 1 then
-- skillId = skillId - 1
-- else
-- skilldata.isShowUpImage = false
-- end
-- skilldata.skillId=skillId
-- skilldata.skillConfig=ConfigManager.GetConfigData(ConfigName.PassiveSkillConfig,skillId)
-- table.insert(curPassiveSkillUpLvOrNewTabs,skilldata)
-- end
-- end
-- end
--end
return curSkillUpLvOrNewTabs , curPassiveSkillUpLvOrNewTabs
end
--单个技能显示
function this . UpdateHeroUpStarProUpSkillShow ( skillGridGO , skillTabs , passiveSkills )
skillGridGO : GetComponent ( " Canvas " ) . sortingOrder = this.sortingOrder + 1
local triggerCallBack
for i = 1 , skillGridGO.transform . childCount do
local go = skillGridGO.transform : GetChild ( i - 1 ) . gameObject
local skillType = Util.GetGameObject ( go.transform , " skillType " )
if # skillTabs >= i then --(#passiveSkills+#skillTabs)>=i then
local curSkillData = skillTabs [ i ]
if curSkillData and curSkillData.skillConfig and curSkillData.skillConfig . Name then
go : SetActive ( true )
local skillTypeImage = Util.GetGameObject ( go.transform , " skillImage/Image " ) : GetComponent ( " Image " )
--if skillType then
if curSkillData.skillConfig . Type == SkillType.Pu then
--skillType:GetComponent("Text").text=SkillTypeStr[SkillType.Pu]
skillTypeImage.sprite = Util.LoadSprite ( SkillIconType [ SkillType.Pu ] ) --普技
elseif curSkillData.skillConfig . Type == SkillType.Jue then
--skillType:GetComponent("Text").text=SkillTypeStr[SkillType.Jue]
skillTypeImage.sprite = Util.LoadSprite ( SkillIconType [ SkillType.Jue ] ) --绝技
elseif curSkillData.skillConfig . Type == SkillType.Bei then
--skillType:GetComponent("Text").text=SkillTypeStr[SkillType.Bei]
skillTypeImage.sprite = Util.LoadSprite ( SkillIconType [ SkillType.Bei ] ) --被动技
end
--end
local upGo = Util.GetGameObject ( go.transform , " up " )
if upGo then
if curSkillData.isShowUpImage ~= nil and curSkillData.isShowUpImage == false then
upGo : SetActive ( false )
else
upGo : SetActive ( true )
end
end
Util.GetGameObject ( go.transform , " icon " ) : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetResourcePath ( curSkillData.skillConfig . Icon ) ) --"i_act_ygmd2_2")
Util.GetGameObject ( go.transform , " skillImage/skillName " ) : GetComponent ( " Text " ) . text = curSkillData.skillConfig . Name --(curSkillData.skillId % 10)
else
go : SetActive ( false )
end
Util.AddOnceClick ( Util.GetGameObject ( go.transform , " icon " ) , 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 maxLv = HeroManager.GetHeroSkillMaxLevel ( curHeroData.heroConfig . Id , curSkillData.skillConfig . Type )
local panel = UIManager.OpenPanel ( UIName.SkillInfoPopup , curSkillData , 1 , 10 , maxLv , i )
skillGridGO : GetComponent ( " Canvas " ) . sortingOrder = panel.sortingOrder + 1
triggerCallBack = function ( panelType , p )
if panelType == UIName.SkillInfoPopup and panel == p then --监听到SkillInfoPopup关闭, 把层级设回去
skillGridGO : 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 )
else
go : SetActive ( false )
end
end
for i = 1 , # passiveSkills do
--LogError("passiveSkills "..passiveSkills[i].skillConfig.Id)
end
end
--升星选择祭品后刷新界面
function RoleInfoPanel : AutoSelectUpStarHeroList ( _curUpStarData )
local curUpStarData = _curUpStarData
if curUpStarData and # curUpStarData > 0 then
for i = 1 , # curUpStarData do
curSelectUpStarData = curUpStarData [ i ]
curSelectUpStarGo = upStarPreList [ i ]
local upStarHeroListData = HeroManager.GetUpStarHeroListData ( curUpStarData [ i ] . upStarMaterialsData.Id , curHeroData )
local curSelectHeroList = { }
if curUpStarData [ i ] . upStarMaterialsData.Issame == 1 or curUpStarData [ i ] . upStarMaterialsData.IsId > 0 or
( curUpStarData [ i ] . upStarMaterialsData.IsSameClan == 1 and curUpStarData [ i ] . upStarMaterialsData.StarLimit == 3 and curHeroData.heroConfig . Qualiy ~= 3 ) then
if LengthOfTable ( upStarHeroListData.heroList ) >= curUpStarData [ i ] . upStarData [ 4 ] then
for i = 1 , curUpStarData [ i ] . upStarData [ 4 ] do
if upStarHeroListData.heroList [ i ] . lockState == 0 and upStarHeroListData.heroList [ i ] . isFormation == " " then
table.insert ( curSelectHeroList , upStarHeroListData.heroList [ i ] )
end
end
self : UpdateUpStarPosHeroData ( curSelectHeroList )
end
end
end
end
--进阶红点
2020-06-03 19:09:01 +08:00
local upStarRedPointState = HeroManager.IsShowUpStarRedPoint ( curHeroData )
this.roleUpStarRedPoint : SetActive ( upStarRedPointState )
this.upStarBtnRedPoint : SetActive ( upStarRedPointState )
2020-05-09 13:31:21 +08:00
end
--更新英雄进阶材料显示
function this : UpdateHeroUpStarMaterialShow ( )
--进阶金币 妖壶条件
if upStarRankUpConfig then
isUpStarMaterials = true
local ConsumeMaterial = upStarRankUpConfig.ConsumeMaterial
if ConsumeMaterial and # ConsumeMaterial >= 2 then
if ConsumeMaterial [ 1 ] [ 2 ] > 0 then
this.goldImage : SetActive ( true )
this.goldImage : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetResourcePath ( itemConfig [ ConsumeMaterial [ 1 ] [ 1 ] ] . ResourceID ) )
if BagManager.GetItemCountById ( ConsumeMaterial [ 1 ] [ 1 ] ) < ConsumeMaterial [ 1 ] [ 2 ] then
isUpStarMaterials = false
this.goldText . text = string.format ( " <color=#FF0000FF>%s</color> " , ConsumeMaterial [ 1 ] [ 2 ] )
else
this.goldText . text = string.format ( " <color=#FFFFFFFF>%s</color> " , ConsumeMaterial [ 1 ] [ 2 ] )
end
Util.AddOnceClick ( this.goldBtn , function ( )
UIManager.OpenPanel ( UIName.RewardItemSingleShowPopup , ConsumeMaterial [ 1 ] [ 1 ] )
end )
else
this.goldImage : SetActive ( false )
end
if ConsumeMaterial [ 2 ] [ 2 ] > 0 then
this.gold2Image : SetActive ( true )
this.gold2Image : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( GetResourcePath ( itemConfig [ ConsumeMaterial [ 2 ] [ 1 ] ] . ResourceID ) )
if BagManager.GetItemCountById ( ConsumeMaterial [ 2 ] [ 1 ] ) < ConsumeMaterial [ 2 ] [ 2 ] then
isUpStarMaterials = false
this.gold2Text . text = string.format ( " <color=#FF0000FF>%s</color> " , ConsumeMaterial [ 2 ] [ 2 ] )
else
this.gold2Text . text = string.format ( " <color=#FFFFFFFF>%s</color> " , ConsumeMaterial [ 2 ] [ 2 ] )
end
Util.AddOnceClick ( this.gold2Btn , function ( )
UIManager.OpenPanel ( UIName.RewardItemSingleShowPopup , ConsumeMaterial [ 2 ] [ 1 ] )
end )
else
this.gold2Image : SetActive ( false )
end
end
end
end
--分析设置升星界面显示的英雄list数据 如果当前升星材料的坑位的英雄数据与 以其他坑位有重合并且选择上的英雄不显示 如果是当前坑位显示的英雄显示对勾
function RoleInfoPanel : SetShowHeroListData ( upStarConsumeMaterial , curHeroList ) --1 消耗的总消耗组 2 当前坑位可选择的所有英雄
--Log("#curHeroList "..#curHeroList)
local curEndShowHeroListData2 = { }
for i = 1 , # curHeroList do
table.insert ( curEndShowHeroListData2 , curHeroList [ i ] )
end
local curEndShowHeroListData = { }
for i , v in pairs ( curEndShowHeroListData2 ) do
v.isSelect = 2
table.insert ( curEndShowHeroListData , v )
end
for j = 1 , # upStarConsumeMaterial do
if upStarConsumeMaterial [ j ] and # upStarConsumeMaterial [ j ] > 0 then
for k = 1 , # upStarConsumeMaterial [ j ] do
if j == curSelectUpStarData.upStarData [ 2 ] then --curSelectUpStarData 当前坑位选择的英雄信息
for _ , v in pairs ( curEndShowHeroListData ) do
if v.dynamicId == upStarConsumeMaterial [ j ] [ k ] then
v.isSelect = 1
end
end
else
for i , v in pairs ( curEndShowHeroListData ) do
if v.dynamicId == upStarConsumeMaterial [ j ] [ k ] then
curEndShowHeroListData [ i ] = nil
end
end
end
end
end
end
local curList = { }
for _ , v in pairs ( curEndShowHeroListData ) do
table.insert ( curList , v )
end
return curList
end
--获取当前英雄的下一突破 和 升星 静态数据
function RoleInfoPanel : 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
--Log("突破 "..v.Id)
isHeroUpTuPo = true
upTuPoRankUpConfig = v
end
end
if v.Show == 2 then -- 2 升星
if v.Id ~= curHeroData.upStarId and curHeroData.star == v.LimitStar then
--Log("升星 "..v.Id)
upStarRankUpConfig = v
isHeroUpStar = true
end
end
end
end
end
--刷新当前升星坑位英雄的信息
function RoleInfoPanel : UpdateUpStarPosHeroData ( curSelectHeroList )
if LengthOfTable ( curSelectHeroList ) < curSelectUpStarData.upStarData [ 4 ] then
upStarMaterialIsAll [ curSelectUpStarData.upStarData [ 2 ] ] = 2
Util.GetGameObject ( curSelectUpStarGo.transform , " add/add " ) : SetActive ( true )
local upStarHeroListData = HeroManager.GetUpStarHeroListData ( curSelectUpStarData.upStarMaterialsData . Id , curHeroData )
if upStarHeroListData.state <= 0 then
Util.GetGameObject ( curSelectUpStarGo.transform , " add/add " ) : SetActive ( false )
end
Util.GetGameObject ( curSelectUpStarGo.transform , " num " ) : GetComponent ( " Text " ) . text = string.format ( " <color=#FF0000FF>%s/%s</color> " , LengthOfTable ( curSelectHeroList ) , curSelectUpStarData.upStarData [ 4 ] )
else
upStarMaterialIsAll [ curSelectUpStarData.upStarData [ 2 ] ] = 1
Util.GetGameObject ( curSelectUpStarGo.transform , " add/add " ) : SetActive ( false )
Util.GetGameObject ( curSelectUpStarGo.transform , " num " ) : GetComponent ( " Text " ) . text = string.format ( " <color=#FFFFFFFF>%s/%s</color> " , LengthOfTable ( curSelectHeroList ) , curSelectUpStarData.upStarData [ 4 ] )
end
local curUpStarConsumeMaterial = { }
for i , v in pairs ( curSelectHeroList ) do
table.insert ( curUpStarConsumeMaterial , v.dynamicId )
end
upStarConsumeMaterial [ curSelectUpStarData.upStarData [ 2 ] ] = curUpStarConsumeMaterial
for i = 1 , # upStarConsumeMaterial do
--Log("选择升星位置的英雄数量 "..#upStarConsumeMaterial[i])
if # upStarConsumeMaterial [ i ] > 0 then
for j = 1 , # upStarConsumeMaterial [ i ] do
--Log("选择升星位置的英雄都有谁 "..upStarConsumeMaterial[i][j])
end
end
end
end
--页签选中效果设置
function RoleInfoPanel : SetSelectBtn ( _btn , btnText )
this.selectBtn . transform : SetParent ( _btn.transform )
this.selectBtn . transform.localScale = Vector3.one
this.selectBtn . transform.localPosition = Vector3.zero
Util.GetGameObject ( this.selectBtn . transform , " Text " ) : GetComponent ( " Text " ) . text = btnText
end
--情报按钮点击
function RoleInfoPanel : OnClickBtnInfo ( )
--Log("情 报 情 报 情 报")
RoleInfoPanel.HideAllLayout ( )
this.roleInfoLayout : SetActive ( true )
2020-06-23 18:36:24 +08:00
RoleInfoPanel : SetSelectBtn ( self.btnInfo , Language [ 11836 ] )
2020-05-09 13:31:21 +08:00
end
--进阶按钮点击
function RoleInfoPanel : OnClickBtnUpStar ( )
if curHeroData.heroConfig . GrowthSwitch then
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11844 ] )
2020-05-09 13:31:21 +08:00
return
end
RoleInfoPanel.HideAllLayout ( )
this.roleUpStarLayout : SetActive ( true )
2020-06-23 18:36:24 +08:00
RoleInfoPanel : SetSelectBtn ( self.btnUpStar , Language [ 11845 ] )
2020-05-09 13:31:21 +08:00
end
--跳转直接到进阶界面
function this . JumpOnClickBtnUpStar ( )
this : OnClickBtnUpStar ( )
end
--传记按钮点击
function RoleInfoPanel : OnClickBtnStory ( )
RoleInfoPanel.HideAllLayout ( )
this.roleStoryLayout : SetActive ( true )
2020-07-03 11:27:25 +08:00
RoleInfoPanel : SetSelectBtn ( self.btnStory , Language [ 12158 ] )
2020-05-09 13:31:21 +08:00
--PopupTipPanel.ShowTip("内容未开放")
end
--皮肤按钮点击
function RoleInfoPanel : OnClickBtnSkin ( )
--RoleInfoPanel.HideAllLayout()
--this.roleSkinLayout:SetActive(true)
--RoleInfoPanel:SetSelectBtn(self.btnSkin, "皮肤")
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11100 ] )
2020-05-09 13:31:21 +08:00
end
--右切换按钮点击
function this : RightBtnOnClick ( )
if isClickLeftOrRightBtn == false then
return
end
isClickLeftOrRightBtn = false
this.rightBtn : GetComponent ( " Button " ) . enabled = false
index = ( index + 1 <= # heroDatas and index + 1 or 1 )
curHeroData = heroDatas [ index ]
if this.leftLiveObj then
poolManager : UnLoadLive ( leftHeroData.live , this.leftLiveObj )
this.leftLiveObj = nil
end
this.curLiveObj . transform : SetParent ( self.leftObj . transform )
this.curLiveObj : GetComponent ( " RectTransform " ) : DOAnchorPos ( Vector2.New ( curHeroData.position [ 1 ] , curHeroData.position [ 2 ] ) , 0.5 , false ) : SetEase ( Ease.Linear )
this.rightLiveObj . transform : SetParent ( self.curObj . transform )
this.rightLiveObj : GetComponent ( " RectTransform " ) : DOAnchorPos ( Vector2.New ( rightHeroData.position [ 1 ] , rightHeroData.position [ 2 ] ) , 0.5 , false ) : OnComplete ( function ( )
this : UpdateLiveList ( )
this.leftLiveObj = this.curLiveObj
this.curLiveObj = this.rightLiveObj
this.rightLiveObj = this : LoadHerolive ( rightHeroData , self.rightObj )
this : UpdatePanelData ( )
local SkeletonGraphic = this.curLiveObj : GetComponent ( " SkeletonGraphic " )
SkeletonGraphic.AnimationState : SetAnimation ( 0 , " touch " , false )
this.rightBtn : GetComponent ( " Button " ) . enabled = true
isClickLeftOrRightBtn = true
end ) : SetEase ( Ease.Linear )
end
--左切换按钮点击
function this : LeftBtnOnClick ( )
if isClickLeftOrRightBtn == false then
return
end
isClickLeftOrRightBtn = false
this.leftBtn : GetComponent ( " Button " ) . enabled = false
index = ( index - 1 > 0 and index - 1 or # heroDatas )
curHeroData = heroDatas [ index ]
if this.rightLiveObj then
poolManager : UnLoadLive ( rightHeroData.live , this.rightLiveObj )
this.rightLiveObj = nil
end
this.curLiveObj . transform : SetParent ( self.rightObj . transform )
this.curLiveObj : GetComponent ( " RectTransform " ) : DOAnchorPos ( Vector2.New ( curHeroData.position [ 1 ] , curHeroData.position [ 2 ] ) , 0.5 , false ) : SetEase ( Ease.Linear )
this.leftLiveObj . transform : SetParent ( self.curObj . transform )
this.leftLiveObj : GetComponent ( " RectTransform " ) : DOAnchorPos ( Vector2.New ( leftHeroData.position [ 1 ] , leftHeroData.position [ 2 ] ) , 0.5 , false ) : OnComplete ( function ( )
this : UpdateLiveList ( )
this.rightLiveObj = this.curLiveObj
this.curLiveObj = this.leftLiveObj
this.leftLiveObj = this : LoadHerolive ( leftHeroData , self.leftObj )
this : UpdatePanelData ( )
local SkeletonGraphic = this.curLiveObj : GetComponent ( " SkeletonGraphic " )
SkeletonGraphic.AnimationState : SetAnimation ( 0 , " touch " , false )
this.leftBtn : GetComponent ( " Button " ) . enabled = true
isClickLeftOrRightBtn = true
end ) : SetEase ( Ease.Linear )
end
--升级按钮点击事件处理
function RoleInfoPanel : LvUpClick ( isSingleLvUp )
--是否为最大等级
if curHeroData.lv >= HeroManager.heroLvEnd [ curHeroData.heroConfig . Id ] then
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11846 ] )
2020-05-09 13:31:21 +08:00
_isClicked = false
_isReqLvUp = false
return
end
--如果此时需要进阶 每次都要跳转
if isHeroUpStar and upStarRankUpConfig and curTuPoRankUpConfig and curTuPoRankUpConfig.JudgeClass == 1 and curHeroData.lv >= curTuPoRankUpConfig.OpenLevel then --当前突破全部完成
if curStarRankUpConfig then --进阶过处理
if curHeroData.lv == curStarRankUpConfig.OpenLevel then
_isClicked = false
_isReqLvUp = false
2020-06-23 18:36:24 +08:00
MsgPanel.ShowTwo ( Language [ 11847 ] , nil , function ( )
2020-05-09 13:31:21 +08:00
RoleInfoPanel : OnClickBtnUpStar ( )
2020-06-23 18:36:24 +08:00
end , Language [ 10719 ] , Language [ 11848 ] )
2020-05-09 13:31:21 +08:00
else
if isUpLvMaterials then
if isSingleLvUp then --是否是单次升级
NetManager.HeroLvUpEvent ( curHeroData.dynamicId , curHeroData.lv + 1 , curHeroData.lv , function ( msg )
self : DeleteLvUpMaterials ( isSingleLvUp , msg )
end )
else
isTriggerLongClick = true
self : DeleteLvUpMaterials ( isSingleLvUp )
end
else
_isClicked = false
_isReqLvUp = false
if isHeroUpTuPo and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11849 ] )
2020-05-09 13:31:21 +08:00
else
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11850 ] )
2020-05-09 13:31:21 +08:00
end
end
end
else --从未进阶过处理
_isClicked = false
_isReqLvUp = false
2020-06-23 18:36:24 +08:00
MsgPanel.ShowTwo ( Language [ 11847 ] , nil , function ( )
2020-05-09 13:31:21 +08:00
RoleInfoPanel : OnClickBtnUpStar ( )
2020-06-23 18:36:24 +08:00
end , Language [ 10719 ] , Language [ 11848 ] )
2020-05-09 13:31:21 +08:00
end
else
if isUpLvMaterials then
if isSingleLvUp then --是否是单次升级
local curUpLv = curHeroData.lv
if isHeroUpTuPo and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
curUpLv = curHeroData.lv
else
curUpLv = curHeroData.lv + 1
end
NetManager.HeroLvUpEvent ( curHeroData.dynamicId , curUpLv , curHeroData.lv , function ( msg )
self : DeleteLvUpMaterials ( isSingleLvUp , msg )
end )
else
isTriggerLongClick = true
self : DeleteLvUpMaterials ( isSingleLvUp )
end
else
_isClicked = false
_isReqLvUp = false
if isHeroUpTuPo and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11849 ] )
2020-05-09 13:31:21 +08:00
else
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11850 ] )
2020-05-09 13:31:21 +08:00
end
end
end
end
--长按升级结束后请求协议
function RoleInfoPanel : LongLvUpClick ( oldLv )
NetManager.HeroLvUpEvent ( curHeroData.dynamicId , curHeroData.lv , oldLv , function ( msg )
self : DeleteLvUpMaterials2 ( msg )
end )
end
--进阶按钮点击事件处理
function RoleInfoPanel : StarUpClick ( )
if curHeroData.lv >= HeroManager.heroLvEnd [ curHeroData.heroConfig . Id ] then
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11846 ] )
2020-05-09 13:31:21 +08:00
return
end
if curHeroData.lv < upStarRankUpConfig.LimitLevel then
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11851 ] .. upStarRankUpConfig.LimitLevel )
2020-05-09 13:31:21 +08:00
return
end
local isUpStarMaterialsHero = true
for i = 1 , # upStarMaterialIsAll do
if upStarMaterialIsAll [ i ] == 2 then
isUpStarMaterialsHero = false
end
end
if isUpStarMaterials and isUpStarMaterialsHero then
NetManager.HeroUpStarEvent ( curHeroData.dynamicId , upStarConsumeMaterial , function ( msg )
UIManager.OpenPanel ( UIName.RoleUpStarSuccessPanel , curHeroData , upStarRankUpConfig.Id , upStarRankUpConfig.OpenLevel , function ( )
local dropItemTabs = BagManager.GetTableByBackDropData ( msg )
if # dropItemTabs > 0 then
UIManager.OpenPanel ( UIName.RewardItemPopup , msg , 1 , function ( )
self : DeleteUpStarMaterials ( )
end )
else
self : DeleteUpStarMaterials ( )
end
end )
end )
-- 进阶音效
PlaySoundWithoutClick ( SoundConfig.Sound_Recruit3 )
else
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11852 ] )
2020-05-09 13:31:21 +08:00
end
end
--隐藏rolePanelOp下所有节点
function RoleInfoPanel : HideAllLayout ( )
local layoutCount = this.rolePanelOp . transform.childCount
for i = 0 , layoutCount - 1 do
this.rolePanelOp . transform : GetChild ( i ) . gameObject : SetActive ( false )
end
end
--界面关闭时调用(用于子类重写)
function RoleInfoPanel : OnClose ( )
--this.globalCurHeroData=nil
if this.leftLiveObj and leftHeroData then
poolManager : UnLoadLive ( leftHeroData.live , this.leftLiveObj )
this.leftLiveObj = nil
end
if this.rightLiveObj and rightHeroData then
poolManager : UnLoadLive ( rightHeroData.live , this.rightLiveObj )
this.rightLiveObj = nil
end
if this.curLiveObj and curHeroData then
poolManager : UnLoadLive ( curHeroData.live , this.curLiveObj )
this.curLiveObj = nil
end
this.leftBtn : GetComponent ( " Button " ) . enabled = true
this.rightBtn : GetComponent ( " Button " ) . enabled = true
FixedUpdateBeat : Remove ( this.OnUpdate , self )
if this.priThread then
coroutine.stop ( this.priThread )
this.priThread = nil
end
this.lvUpGo : SetActive ( false )
end
--界面销毁时调用(用于子类重写)
function RoleInfoPanel : OnDestroy ( )
this.pinjieList = { }
SubUIManager.Close ( this.UpView )
SubUIManager.Close ( SubUIConfig.DragView , this.dragView )
end
--扣除升级 突破 消耗的材料 更新英雄数据
function RoleInfoPanel : DeleteLvUpMaterials ( isSingleLvUp , msg )
if isSingleLvUp == false then --连续升级的时候需要自己先扣除
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
end
for i , v in pairs ( heroDatas ) do
if curHeroData == v then
if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
UIManager.OpenPanel ( UIName.RoleUpLvBreakSuccessPanel , curHeroData , upTuPoRankUpConfig.Id , upTuPoRankUpConfig.OpenLevel )
curHeroData.breakId = upTuPoRankUpConfig.Id
v.breakId = curHeroData.breakId
--突破有可能会升星
if curHeroData.star < upTuPoRankUpConfig.OpenStar then
curHeroData.star = upTuPoRankUpConfig.OpenStar
v.star = curHeroData.star
end
_isClicked = false
_isReqLvUp = false
else
if msg then
curHeroData.lv = msg.targetLevel
--Log("后端更新猎妖师技术前端刷新界面 "..msg.targetLevel)
else
curHeroData.lv = curHeroData.lv + 1
end
v.lv = curHeroData.lv
--PopupTipPanel.ShowTip("升级成功!")
end
end
end
--Log("刷新英雄库里单个英雄数据 "..curHeroData.dynamicId.." "..curHeroData.lv.." "..curHeroData.star.." "..curHeroData.breakId.." "..curHeroData.upStarId)
--刷新英雄库里单个英雄数据
if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
this.lvUpGoImage : SetActive ( false )
-- 突破音效
PlaySoundWithoutClick ( SoundConfig.Sound_Breach )
else
this.lvUpGoImage : SetActive ( true )
-- 升级音效
PlaySoundWithoutClick ( SoundConfig.Sound_Upgrade )
end
HeroManager.UpdateSingleHeroDatas ( curHeroData.dynamicId , curHeroData.lv , curHeroData.star , curHeroData.breakId , curHeroData.upStarId , isSingleLvUp )
local allAddProValOld = allAddProVal
this : UpdatePanelData ( ) --刷新界面
this.ShowProAddVal ( allAddProValOld )
this.upLvEffect : SetActive ( false )
this.upLvEffect : SetActive ( true )
_isReqLvUp = false
end
--连续升级更新后端英雄数据
function RoleInfoPanel : DeleteLvUpMaterials2 ( msg )
for i , v in pairs ( heroDatas ) do
if curHeroData == v then
if msg then
curHeroData.lv = msg.targetLevel
--Log("后端更新猎妖师技术前端刷新界面 "..msg.targetLevel)
end
v.lv = curHeroData.lv
end
end
HeroManager.UpdateSingleHeroDatas ( curHeroData.dynamicId , curHeroData.lv , curHeroData.star , curHeroData.breakId , curHeroData.upStarId , true )
this : UpdatePanelData ( ) --刷新界面
end
--扣除升星 消耗的材料 更新英雄数据
function RoleInfoPanel : DeleteUpStarMaterials ( )
HeroManager.UpdateSingleHeroDatas ( curHeroData.dynamicId , curHeroData.lv , curHeroData.star + 1 , curHeroData.breakId , upStarRankUpConfig.Id , true )
HeroManager.UpdateSingleHeroSkillData ( curHeroData.dynamicId )
for i , v in pairs ( heroDatas ) do
if curHeroData == v then
curHeroData = HeroManager.GetSingleHeroData ( curHeroData.dynamicId )
v = curHeroData
end
end
--本地数据删除材料英雄
for i = 1 , # upStarConsumeMaterial do
HeroManager.DeleteHeroDatas ( upStarConsumeMaterial [ i ] )
end
if HeroManager.heroListPanelProID ~= ProIdConst.All then
heroDatas = HeroManager.GetHeroDataByProperty ( HeroManager.heroListPanelProID )
else
heroDatas = HeroManager.GetAllHeroDatas ( )
end
if UIManager.IsOpen ( UIName.RoleInfoPanel ) then --当界面存在时需要刷新当前界面
this : SortHeroDatas ( heroDatas )
if this.leftLiveObj and leftHeroData then
poolManager : UnLoadLive ( leftHeroData.live , this.leftLiveObj )
this.leftLiveObj = nil
end
if this.rightLiveObj and rightHeroData then
poolManager : UnLoadLive ( rightHeroData.live , this.rightLiveObj )
this.rightLiveObj = nil
end
if this.curLiveObj and curHeroData then
poolManager : UnLoadLive ( curHeroData.live , this.curLiveObj )
this.curLiveObj = nil
end
for i = 1 , # heroDatas do
if curHeroData == heroDatas [ i ] then
index = i
end
end
this : UpdateLiveList ( )
this.leftLiveObj = this : LoadHerolive ( leftHeroData , self.leftObj )
this.rightLiveObj = this : LoadHerolive ( rightHeroData , self.rightObj )
this.curLiveObj = this : LoadHerolive ( curHeroData , self.curObj )
self.dragView : SetDragGO ( this.curLiveObj )
this : UpdatePanelData ( )
end
end
function this : SortHeroDatas ( _heroDatas )
--上阵最优先, 星级优先, 同星级等级优先, 同星级同等级按sortId排序。排序时降序排序。
table.sort ( _heroDatas , function ( a , b )
if ( teamHero [ a.dynamicId ] and teamHero [ b.dynamicId ] ) or
( not teamHero [ a.dynamicId ] and not teamHero [ b.dynamicId ] )
then
if a.heroConfig . Natural == b.heroConfig . Natural then
if a.star == b.star then
if a.lv == b.lv then
return a.heroConfig . Id < b.heroConfig . Id
else
return a.lv > b.lv
end
else
return a.star > b.star
end
else
return a.heroConfig . Natural > b.heroConfig . Natural
end
else
return teamHero [ a.dynamicId ] and not teamHero [ b.dynamicId ]
end
end )
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 ]
2020-05-15 16:52:35 +08:00
--Util.GetGameObject(lvUpShowProList[5], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.Speed]-allAddProValOld[HeroProType.Speed]
2020-05-09 13:31:21 +08:00
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 ( )
2020-05-15 16:52:35 +08:00
for i = 1 , 4 do
2020-05-09 13:31:21 +08:00
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 this . ShowGuideGo ( type ) --1 升级突破 2 进阶
if type == 1 then
JumpManager.ShowGuide ( UIName.RoleInfoPanel , this.upLvBtn )
elseif type == 2 then
--local btn = Util.GetGameObject(this.upStarGrid.transform, "upStarPre3")
--JumpManager.ShowGuide(UIName.RoleInfoPanel,btn)
-- 我要变强跳转过来显示小手
elseif type == - 1 then
JumpManager.ShowGuide ( UIName.RoleInfoPanel , this.upLvBtn )
elseif type == - 2 then
JumpManager.ShowGuide ( UIName.RoleInfoPanel , this.equipBtn )
elseif type == - 3 then
JumpManager.ShowGuide ( UIName.RoleInfoPanel , this.soulPrintBtn )
elseif type == - 4 then
2020-06-08 13:57:30 +08:00
JumpManager.ShowGuide ( UIName.RoleInfoPanel , this.talismanClick )
2020-05-09 13:31:21 +08:00
end
end
function RoleInfoPanel : HeroLockEvent ( )
if curHeroData.lockState == 1 then
curHeroData.lockState = 0
elseif curHeroData.lockState == 0 then
curHeroData.lockState = 1
end
NetManager.HeroLockEvent ( curHeroData.dynamicId , curHeroData.lockState , function ( )
if curHeroData.lockState == 1 then
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11853 ] )
2020-05-09 13:31:21 +08:00
elseif curHeroData.lockState == 0 then
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11791 ] )
2020-05-09 13:31:21 +08:00
end
HeroManager.UpdateSingleHeroLockState ( curHeroData.dynamicId , curHeroData.lockState )
this.unlockImage : SetActive ( curHeroData.lockState == 0 )
this.lockImage : SetActive ( curHeroData.lockState == 1 )
for i , v in pairs ( heroDatas ) do
if curHeroData == v then
v.lockState = curHeroData.lockState
end
end
end )
end
function RoleInfoPanel : HeroReturnEvent ( )
if isUpZhen then
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11854 ] )
2020-05-09 13:31:21 +08:00
return
end
if curHeroData.lockState == 1 then
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip ( Language [ 11855 ] )
2020-05-09 13:31:21 +08:00
return
end
UIManager.OpenPanel ( UIName.RoleReturnPanel , curHeroData , isUpZhen )
end
local beginV3
local endV3
local distance
function RoleInfoPanel : OnBeginDrag ( Pointgo , data )
beginV3 = this.curLiveObj . transform.anchoredPosition
end
function RoleInfoPanel : OnDrag ( Pointgo , data )
distance = Vector2.Distance ( beginV3 , this.curLiveObj . transform.anchoredPosition )
end
function RoleInfoPanel : OnEndDrag ( Pointgo , data )
endV3 = this.curLiveObj . transform.anchoredPosition
if distance > 250 and endV3.x < 0 then
this : RightBtnOnClick ( )
elseif distance > 250 and endV3.x > 0 then
this : LeftBtnOnClick ( )
else
this.curLiveObj : GetComponent ( " RectTransform " ) : DOAnchorPos ( Vector2.New ( curHeroData.position [ 1 ] , curHeroData.position [ 2 ] ) , 0.5 , false ) : SetEase ( Ease.Linear )
end
distance = 0
end
2020-06-03 19:09:01 +08:00
--升级红点
--function RoleInfoPanel:LvUpBtnRedPoint()
-- --是否为最大等级
-- if curHeroData.lv>=HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then
-- return false
-- end
-- --如果此时需要进阶 每次都要跳转
-- if isHeroUpStar and upStarRankUpConfig and curTuPoRankUpConfig and curTuPoRankUpConfig.JudgeClass==1 and curHeroData.lv >= curTuPoRankUpConfig.OpenLevel then--当前突破全部完成
-- if curStarRankUpConfig then--进阶过处理
-- if curHeroData.lv == curStarRankUpConfig.OpenLevel then
-- return false
-- else
-- if isUpLvMaterials then
-- return true
-- else
-- return false
-- end
-- end
-- else--从未进阶过处理
-- return false
-- end
-- else
-- if isUpLvMaterials then
-- return true
-- else
-- return false
-- end
-- end
-- return false
--end
--function this.IsShowUpStarRedPoint(curUpStarData)
-- if curHeroData.lv>=HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then
-- return false--培养已满
-- end
-- if upStarRankUpConfig and upStarRankUpConfig.LimitLevel then
-- if curHeroData.lv<upStarRankUpConfig.LimitLevel then
-- return false--等级不够
-- end
-- else
-- return false--不能升星
-- end
-- --前两位妖灵师消耗位置材料状态
-- for i = 1, #upStarMaterialIsAll do
-- if upStarMaterialIsAll[i]==2 and i ~= #upStarMaterialIsAll and #upStarMaterialIsAll ~= 1 then
-- return false
-- end
-- end
-- if isUpStarMaterials == false then
-- return false
-- end
-- --最后一位自由选择妖灵师消耗位置材料状态
-- local curUpStarHeroListData=HeroManager.GetUpStarHeroListData(curUpStarData[#curUpStarData].upStarMaterialsData.Id,curHeroData)
-- local notCanSelectHeroNum = 0
-- for i = 1, #upStarConsumeMaterial do
-- local curPosSetHeroDidTabs = upStarConsumeMaterial[i]
-- for k = 1, #curPosSetHeroDidTabs do
-- for j, v in pairs(curUpStarHeroListData.heroList) do
-- if curPosSetHeroDidTabs[k] == v.dynamicId then--与已选消耗冲突
-- notCanSelectHeroNum = notCanSelectHeroNum + 1
-- end
-- end
-- end
-- end
-- for j, v in pairs(curUpStarHeroListData.heroList) do
-- if v.isFormation ~= "" then-- 已上阵英雄
-- notCanSelectHeroNum = notCanSelectHeroNum + 1
-- end
-- end
-- if (LengthOfTable(curUpStarHeroListData.heroList) - notCanSelectHeroNum) < curUpStarData[#curUpStarData].upStarData[4] then
-- return false
-- end
-- return true
--end
2020-06-23 18:36:24 +08:00
return RoleInfoPanel