2020-08-25 15:46:38 +08:00
----- 神将合成 -----
2020-08-05 16:30:02 +08:00
local this = { }
local sortingOrder = 0
2020-08-06 18:34:04 +08:00
local itemConfig = ConfigManager.GetConfig ( ConfigName.ItemConfig )
local curIndex = 0
local curNeedHero = { }
local curSelectHero = { }
2020-08-08 11:06:01 +08:00
local curSelectHeroConfig = { }
2020-08-06 18:34:04 +08:00
local curSelectGO
local materidaIsCan = false
local tabs = { }
local needHeros = { }
2020-08-05 16:30:02 +08:00
function this : InitComponent ( gameObject )
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New ( )
2020-08-06 18:34:04 +08:00
this.compoundBtn = Util.GetGameObject ( gameObject , " CompoundHeroPanel_Compound/compoundBtn " )
2020-08-08 11:06:01 +08:00
needHeros = { }
2020-08-06 18:34:04 +08:00
for i = 1 , 4 do
2020-08-08 11:06:01 +08:00
needHeros [ i ] = Util.GetGameObject ( gameObject , " CompoundHeroPanel_Compound/titleGo/needHero " .. i )
2020-08-06 18:34:04 +08:00
end
2022-03-31 09:51:10 +08:00
for i = 1 , 6 do
2020-08-06 18:34:04 +08:00
tabs [ i ] = Util.GetGameObject ( gameObject , " CompoundHeroPanel_Compound/Tabs/grid/Btn " .. i )
end
this.selectBtn = Util.GetGameObject ( gameObject , " CompoundHeroPanel_Compound/Tabs/selectBtn " )
this.heroPre = Util.GetGameObject ( gameObject , " CompoundHeroPanel_Compound/heroPre " )
this.ScrollBar = Util.GetGameObject ( gameObject , " CompoundHeroPanel_Compound/Scrollbar " ) : GetComponent ( " Scrollbar " )
local v2 = Util.GetGameObject ( gameObject , " CompoundHeroPanel_Compound/scroll " ) : GetComponent ( " RectTransform " ) . rect
this.ScrollView = SubUIManager.Open ( SubUIConfig.ScrollCycleView , Util.GetGameObject ( gameObject , " CompoundHeroPanel_Compound/scroll " ) . transform ,
2020-09-03 10:55:16 +08:00
this.heroPre , this.ScrollBar , Vector2.New ( - v2.x * 2 , - v2.y * 2 ) , 1 , 5 , Vector2.New ( 35 , 15 ) )
2020-08-06 18:34:04 +08:00
this.ScrollView . moveTween.MomentumAmount = 1
this.ScrollView . moveTween.Strength = 1
2020-08-08 11:06:01 +08:00
--up compound Hero info
this.compoundHero = Util.GetGameObject ( gameObject , " CompoundHeroPanel_Compound/titleGo/compoundHero/Hero " )
2020-09-05 16:16:10 +08:00
this.compoundHeroTipText = Util.GetGameObject ( gameObject , " CompoundHeroPanel_Compound/tipText " )
2021-04-09 12:26:35 +08:00
this.compoundHeroTipText : GetComponent ( " Text " ) . text = Language [ 10414 ]
2020-08-08 11:06:01 +08:00
this.compoundHerobg = Util.GetGameObject ( this.compoundHero , " Bg1 " ) : GetComponent ( " Image " )
this.compoundHerolv = Util.GetGameObject ( this.compoundHero , " lv/Text " ) : GetComponent ( " Text " )
this.compoundHerohp = Util.GetGameObject ( this.compoundHero , " hpProgress/hp " ) : GetComponent ( " Image " )
this.compoundHerohpPass = Util.GetGameObject ( this.compoundHero , " hpProgress/hpPass " ) : GetComponent ( " Image " )
this.compoundHerorage = Util.GetGameObject ( this.compoundHero , " rageProgress/rage " ) : GetComponent ( " Image " )
this.compoundHerofg = Util.GetGameObject ( this.compoundHero , " Bg2 " ) : GetComponent ( " Image " )
this.compoundHeropro = Util.GetGameObject ( this.compoundHero , " Pro/Image " ) : GetComponent ( " Image " )
this.compoundHerostarGrid = Util.GetGameObject ( this.compoundHero , " StarGrid " )
this.compoundHeroname = Util.GetGameObject ( this.compoundHero , " Name/Text " ) : GetComponent ( " Text " )
this.compoundHeroyuanImage = Util.GetGameObject ( this.compoundHero , " yuanImage " )
this.compoundHerolive = Util.GetGameObject ( this.compoundHero , " Mask/icon " ) : GetComponent ( " RawImage " )
this.compoundHerozs = Util.GetGameObject ( this.compoundHero , " zs " )
2020-08-17 11:39:41 +08:00
this.compoundHeroframe = Util.GetGameObject ( gameObject , " CompoundHeroPanel_Compound/titleGo/compoundHero/frame " )
2020-08-08 11:06:01 +08:00
Util.GetGameObject ( this.compoundHero , " hpProgress " ) . gameObject : SetActive ( false )
Util.GetGameObject ( this.compoundHero , " rageProgress " ) . gameObject : SetActive ( false )
Util.GetGameObject ( this.compoundHero , " UI_Effect_jinkuang_KaPai " ) . gameObject : SetActive ( false )
2020-08-05 16:30:02 +08:00
end
function this : BindEvent ( )
2020-08-06 18:34:04 +08:00
Util.AddClick ( this.compoundBtn , function ( )
this.Compound ( curIndex )
end )
2020-08-05 16:30:02 +08:00
end
function this : AddListener ( )
end
function this : RemoveListener ( )
end
2020-08-06 18:34:04 +08:00
local sortingOrder = 0
2020-08-05 16:30:02 +08:00
function this : OnSortingOrderChange ( _sortingOrder )
sortingOrder = _sortingOrder
end
function this : OnShow ( ... )
2021-05-19 10:27:55 +08:00
HeroManager.GetAllHeroCompoundRedPoint ( )
2020-08-07 14:23:05 +08:00
curIndex = 0
sortingOrder = 0
for i = 0 , # tabs - 1 do
local index = i
2021-04-21 13:12:04 +08:00
Util.GetGameObject ( tabs [ i + 1 ] , " Image " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetProStrImageByProNum ( index ) )
2020-08-07 14:23:05 +08:00
Util.AddOnceClick ( tabs [ i + 1 ] , function ( )
this.HeroCompoundBtnClick ( tabs [ i + 1 ] , index )
end )
end
this.HeroCompoundBtnClick ( tabs [ 1 ] , curIndex )
2020-08-06 18:34:04 +08:00
end
--英雄类型按钮点击事件
function this . HeroCompoundBtnClick ( _btn , _curIndex )
curIndex = _curIndex
this.SetBtnSelect ( _btn )
2020-08-26 19:44:29 +08:00
curSelectHeroConfig = nil
2020-08-06 18:34:04 +08:00
this.ShowCurrPosHeroCompound ( )
end
--显示当前阵营的英雄
function this . ShowCurrPosHeroCompound ( )
local heroDatas = this.GetAllHeroCompoundData ( curIndex )
2020-08-08 11:06:01 +08:00
this.SelectHeroShow ( nil )
2020-08-06 18:34:04 +08:00
this.ScrollView : SetData ( heroDatas , function ( index , go )
2020-08-07 14:23:05 +08:00
this.SingleHeroDataShow ( go , heroDatas [ index ] )
2021-02-26 14:52:59 +08:00
end , false , false )
2020-12-29 19:13:14 +08:00
-- this.ScrollView:ForeachItemGO(function(index, go)
-- Timer.New(function()
-- go.gameObject:SetActive(true)
-- PlayUIAnim(go.gameObject)
-- end, 0.001 * (index - 1)):Start()
-- end)
2020-08-06 18:34:04 +08:00
end
2020-08-08 18:18:26 +08:00
--显示当前阵营的英雄
function this . ShowCurrPosHeroCompound2 ( )
local heroDatas = this.GetAllHeroCompoundData ( curIndex )
this.ScrollView : SetData ( heroDatas , function ( index , go )
this.SingleHeroDataShow ( go , heroDatas [ index ] )
2021-02-26 14:52:59 +08:00
end , true , true )
2020-08-08 18:18:26 +08:00
this.SelectHeroShow ( curSelectHeroConfig )
2020-09-04 17:21:21 +08:00
2020-08-08 18:18:26 +08:00
end
2020-08-06 18:34:04 +08:00
--设置按钮选中
function this . SetBtnSelect ( _parObj )
this.selectBtn . transform : SetParent ( _parObj.transform )
this.selectBtn . transform.localScale = Vector3.one
this.selectBtn . transform.localPosition = Vector3.zero
end
2020-08-08 11:06:01 +08:00
function this . ShowTitleData ( curHeroCompoundData )
if curHeroCompoundData then
local _star = curHeroCompoundData.star
local heroData = curHeroCompoundData.haveHeroList [ 1 ] [ 1 ]
local heroConfig = heroData and heroData.heroConfig or curHeroCompoundData.config
2020-08-06 18:34:04 +08:00
this.compoundHero : SetActive ( true )
2020-08-17 11:39:41 +08:00
this.compoundHeroframe : SetActive ( false )
2022-02-17 15:13:26 +08:00
local upStarRankUpConfig
for k , v in ConfigPairs ( ConfigManager.GetConfig ( ConfigName.HeroRankupConfig ) ) do
if v.Star == heroConfig.Star and v.LimitStar == heroConfig.Star and v.OpenStar == heroConfig.Star + 1 then
upStarRankUpConfig = v
end
end
if HarmonyManager.GetSingleAdditions ( HarmonyAddType.AddLv ) < upStarRankUpConfig.LimitHongmengLevel then -- 鸿蒙阵神将共鸣等级
this.compoundHeroTipText : SetActive ( true )
this.compoundHeroTipText : GetComponent ( " Text " ) . text = string.format ( " <color=#ff0000>进阶需求鸿蒙阵等级:%s</color> " , upStarRankUpConfig.LimitHongmengLevel )
else
this.compoundHeroTipText : SetActive ( false )
end
2021-04-21 13:12:04 +08:00
this.compoundHerobg . sprite = this.spLoader : LoadSprite ( GetHeroCardStarBg [ _star ] )
2020-08-08 11:06:01 +08:00
local zsName = GetHeroCardStarZs [ _star ]
2021-04-21 13:12:04 +08:00
this.compoundHerofg . sprite = this.spLoader : LoadSprite ( GetHeroCardStarFg [ _star ] )
2020-08-08 11:06:01 +08:00
this.compoundHeroyuanImage : SetActive ( false )
SetCardStars ( this.compoundHerostarGrid , _star )
local curHeroHpVal = nil --FormationManager.GetFormationHeroHp(this.curFormationIndex,_heroData.dynamicId)
this.compoundHerohp . fillAmount = curHeroHpVal or 1
this.compoundHerohpPass . fillAmount = curHeroHpVal or 1
this.compoundHerorage . fillAmount = 0.5
2020-11-04 16:51:45 +08:00
local liveName = " "
local roleConfig = { }
local scale = { }
local livePos = { }
2020-11-10 10:16:01 +08:00
if curSelectHero and curSelectHero.heroConfig then
2020-11-04 16:51:45 +08:00
liveName = curSelectHero.live
if curSelectHero.skinId == 0 then
roleConfig = ConfigManager.GetConfigData ( ConfigName.RoleConfig , heroConfig.Id )
else
roleConfig = ConfigManager.GetConfigData ( ConfigName.RoleConfig , curSelectHero.skinId )
end
else
liveName = GetResourcePath ( heroConfig.Live )
roleConfig = ConfigManager.GetConfigData ( ConfigName.RoleConfig , heroConfig.Id )
end
2020-08-07 14:23:05 +08:00
local scale = roleConfig.play_liveScale
local livePos = Vector3.New ( roleConfig.offset [ 1 ] , roleConfig.offset [ 2 ] , 0 )
2020-08-08 11:06:01 +08:00
this.compoundHerolive . texture = CardRendererManager.GetSpineTexture ( 1 , liveName , Vector3.one * scale , livePos , true )
this.compoundHerolive . transform.localScale = Vector3.one
this.compoundHerolive . transform.localPosition = Vector3.zero
2021-11-29 13:21:23 +08:00
SetHEeroLiveToward ( this.compoundHerolive , heroConfig.Toward )
2021-04-21 13:12:04 +08:00
this.compoundHeropro . sprite = this.spLoader : LoadSprite ( GetProStrImageByProNum ( heroConfig.PropertyName ) )
2021-01-26 17:08:39 +08:00
this.compoundHeroname . text = GetLanguageStrById ( heroConfig.ReadingName )
2020-08-07 14:23:05 +08:00
if zsName == " " then
2020-08-08 11:06:01 +08:00
this.compoundHerozs : SetActive ( false )
else
this.compoundHerozs : SetActive ( true )
2021-04-21 13:12:04 +08:00
this.compoundHerozs : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( zsName )
2020-08-08 11:06:01 +08:00
end
if heroData then --第一位是否有英雄
this.compoundHerolv . text = heroData.lv
2020-08-06 18:34:04 +08:00
else
2020-08-08 11:06:01 +08:00
this.compoundHerolv . text = 1
2020-08-06 18:34:04 +08:00
end
else
this.compoundHero : SetActive ( false )
2020-08-17 11:39:41 +08:00
this.compoundHeroframe : SetActive ( true )
2020-08-06 18:34:04 +08:00
this.compoundHeroTipText : SetActive ( true )
2022-02-17 15:13:26 +08:00
this.compoundHeroTipText : GetComponent ( " Text " ) . text = Language [ 10414 ]
2020-08-06 18:34:04 +08:00
end
end
2020-08-08 11:06:01 +08:00
local upStarConsumeMaterial = { }
local upStarMaterialIsAll = { }
2020-08-08 15:51:55 +08:00
local curSelectUpStarData
local curSelectUpStarGo
local upStarRankUpConfig
2020-08-08 11:06:01 +08:00
--更新英雄进阶数据
function this . UpdateHeroUpStarData ( _curUpStarData )
--进阶吞英雄条件
if _curUpStarData then
upStarConsumeMaterial = { }
upStarMaterialIsAll = { }
2021-07-06 14:53:15 +08:00
for i = 2 , # needHeros do
needHeros [ i ] : SetActive ( false )
end
2020-08-08 11:06:01 +08:00
for i = 1 , # _curUpStarData.upStarMaterialsData do
local upStarMaterialsData = _curUpStarData.upStarMaterialsData [ i ]
local curUpStarData = _curUpStarData.upStarData [ i ]
local go = needHeros [ i + 1 ]
go : SetActive ( true )
upStarConsumeMaterial [ i ] = { }
2020-11-03 19:19:13 +08:00
upStarMaterialIsAll [ i ] = 2
2020-08-08 11:06:01 +08:00
local proImage = Util.GetGameObject ( go.transform , " iconbg/proImage " )
local iconDefault = Util.GetGameObject ( go.transform , " iconDefault " )
local icon = Util.GetGameObject ( go.transform , " icon " )
local frame = Util.GetGameObject ( go.transform , " frame " )
local addBtn = Util.GetGameObject ( go.transform , " add " )
local addBtnImage = Util.GetGameObject ( go.transform , " add/add " )
2020-08-12 20:59:20 +08:00
local num = Util.GetGameObject ( go.transform , " lv/num " )
2020-08-08 11:06:01 +08:00
local starGrid = Util.GetGameObject ( go.transform , " iconbg/starGrid " )
2020-08-12 20:59:20 +08:00
Util.GetGameObject ( go.transform , " nameText " ) : GetComponent ( " Text " ) . text = this.GetNeedHeroName ( upStarMaterialsData )
2020-08-08 11:06:01 +08:00
proImage : SetActive ( false )
if upStarMaterialsData.Issame == 1 or upStarMaterialsData.IsId > 0 then
iconDefault : SetActive ( false )
icon : SetActive ( true )
proImage : SetActive ( true )
if upStarMaterialsData.Issame == 1 then
2021-04-21 13:12:04 +08:00
icon : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetResourcePath ( _curUpStarData.config . Icon ) )
frame : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetHeroQuantityImageByquality ( _curUpStarData.config . Quality , upStarMaterialsData.StarLimit ) )
proImage : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetProStrImageByProNum ( _curUpStarData.config . PropertyName ) )
2020-08-08 11:06:01 +08:00
elseif upStarMaterialsData.IsId > 0 then
local heroConfig = ConfigManager.GetConfigData ( ConfigName.HeroConfig , upStarMaterialsData.IsId )
2021-04-21 13:12:04 +08:00
icon : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetResourcePath ( heroConfig.Icon ) )
frame : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetHeroQuantityImageByquality ( heroConfig.Quality , upStarMaterialsData.StarLimit ) )
proImage : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetProStrImageByProNum ( heroConfig.PropertyName ) )
2020-08-08 11:06:01 +08:00
end
else
if upStarMaterialsData.IsSameClan == 1 then
proImage : SetActive ( true )
2021-04-21 13:12:04 +08:00
proImage : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetProStrImageByProNum ( _curUpStarData.config . PropertyName ) )
2020-08-08 11:06:01 +08:00
end
iconDefault : SetActive ( true )
icon : SetActive ( false )
2021-04-21 13:12:04 +08:00
frame : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetHeroQuantityImageByquality ( nil , upStarMaterialsData.StarLimit ) )
2020-08-08 11:06:01 +08:00
end
-- local upStarHeroListData=HeroManager.GetUpStarHeroListData(curUpStarData.Id,curSelectHero)
-- if upStarHeroListData.state>0 then
-- addBtnImage:SetActive(true)
-- else
-- addBtnImage:SetActive(false)
-- end
2020-08-08 15:51:55 +08:00
num : GetComponent ( " Text " ) . text = string.format ( " <color=#FF0000FF>%s/%s</color> " , 0 , curUpStarData [ 4 ] )
2021-04-21 13:12:04 +08:00
SetHeroStars ( this.spLoader , starGrid , upStarMaterialsData.StarLimit , 1 , nil , - 15.3 )
2020-08-08 11:06:01 +08:00
Util.AddOnceClick ( addBtn , function ( )
2020-08-12 20:59:20 +08:00
if not curSelectHero then return end
2020-08-08 15:51:55 +08:00
curSelectUpStarData = curUpStarData
curSelectUpStarGo = go
local curShowHeroListData = this.SetShowHeroListData ( upStarConsumeMaterial , _curUpStarData.haveHeroList3 [ i + 1 ] )
--参数1 显示的herolist 2 3 升当前星的规则 4 打开RoleUpStarListPanel的界面
2020-08-10 10:56:17 +08:00
UIManager.OpenPanel ( UIName.CompoundHeroUpStarListPanel , curShowHeroListData , upStarMaterialsData , curUpStarData , this , upStarConsumeMaterial [ i ] , curSelectHero.heroConfig or curSelectHero )
2020-08-08 11:06:01 +08:00
end )
end
2020-08-08 15:51:55 +08:00
if curSelectHero then
--自动选择进阶妖灵师材料
this.AutoSelectUpStarHeroList ( _curUpStarData )
end
2020-08-08 11:06:01 +08:00
else
for i = 1 , # needHeros do
needHeros [ i ] : SetActive ( false )
end
end
2020-08-08 15:51:55 +08:00
end
--分析设置升星界面显示的英雄list数据 如果当前升星材料的坑位的英雄数据与 以其他坑位有重合并且选择上的英雄不显示 如果是当前坑位显示的英雄显示对勾
2020-08-08 18:18:26 +08:00
function this . SetShowHeroListData ( upStarConsumeMaterial , curHeroList , isFirstPos ) --1 消耗的总消耗组 2 当前坑位可选择的所有英雄
2023-04-21 14:18:03 +08:00
-- local curEndShowHeroListData={}
-- for i = 1, #curHeroList do
-- if curHeroList[i].dynamicId ~= curSelectHero.dynamicId then
-- curHeroList[i].isSelect=2
-- table.insert(curEndShowHeroListData,curHeroList[i])
-- elseif isFirstPos then
-- curHeroList[i].isSelect=1
-- table.insert(curEndShowHeroListData,curHeroList[i])
-- end
-- end
local curEndShowHeroListData2 = { }
2020-08-08 15:51:55 +08:00
for i = 1 , # curHeroList do
2023-04-21 14:18:03 +08:00
table.insert ( curEndShowHeroListData2 , curHeroList [ i ] )
end
local curEndShowHeroListData = { }
for i , v in pairs ( curEndShowHeroListData2 ) do
v.isSelect = 2
table.insert ( curEndShowHeroListData , v )
2020-08-08 15:51:55 +08:00
end
2020-08-08 18:18:26 +08:00
if isFirstPos then
return curEndShowHeroListData
else
for j = 1 , # upStarConsumeMaterial do
if upStarConsumeMaterial [ j ] and # upStarConsumeMaterial [ j ] > 0 then
for k = 1 , # upStarConsumeMaterial [ j ] do
2023-04-21 14:18:03 +08:00
-- if j==curSelectUpStarData[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
2020-08-08 18:18:26 +08:00
if j == curSelectUpStarData [ 2 ] then --curSelectUpStarData 当前坑位选择的英雄信息
for _ , v in pairs ( curEndShowHeroListData ) do
2023-04-21 14:18:03 +08:00
if v.type == RoleUpStarMatType.hero and v.dynamicId == upStarConsumeMaterial [ j ] [ k ] . dynamicId then
v.isSelect = 1
elseif v.type == RoleUpStarMatType.item and v.id == upStarConsumeMaterial [ j ] [ k ] . id and v.index == upStarConsumeMaterial [ j ] [ k ] . index then
2020-08-08 18:18:26 +08:00
v.isSelect = 1
end
2020-08-08 15:51:55 +08:00
end
2020-08-08 18:18:26 +08:00
else
for i , v in pairs ( curEndShowHeroListData ) do
2023-04-21 14:18:03 +08:00
if v.type == RoleUpStarMatType.hero and v.dynamicId == upStarConsumeMaterial [ j ] [ k ] . dynamicId then
curEndShowHeroListData [ i ] = nil
elseif v.type == RoleUpStarMatType.item and v.id == upStarConsumeMaterial [ j ] [ k ] . id and v.index == upStarConsumeMaterial [ j ] [ k ] . index then
2020-08-08 18:18:26 +08:00
curEndShowHeroListData [ i ] = nil
end
2020-08-08 15:51:55 +08:00
end
end
end
end
end
end
local curList = { }
for _ , v in pairs ( curEndShowHeroListData ) do
table.insert ( curList , v )
end
return curList
end
2020-08-26 19:44:29 +08:00
2020-08-08 15:51:55 +08:00
--升星选择祭品后刷新界面
function this . AutoSelectUpStarHeroList ( _curUpStarData )
local curUpStarData = _curUpStarData.upStarMaterialsData
if curUpStarData and # curUpStarData > 0 then
for i = 1 , # curUpStarData do
curSelectUpStarData = curUpStarData [ i ]
local upStarHeroListData = _curUpStarData.haveHeroList3 [ i + 1 ]
local curSelectHeroList = { }
if curSelectUpStarData.Issame == 1
or curSelectUpStarData.IsId > 0
2020-08-10 10:56:17 +08:00
or ( curSelectUpStarData.IsSameClan == 1 and curSelectUpStarData.StarLimit == 3 and ( ( curSelectHero.heroConfig and curSelectHero.heroConfig . Qualiy ~= 3 ) or ( not curSelectHero.heroConfig and curSelectHero.Qualiy ~= 3 ) ) ) then
2020-08-08 15:51:55 +08:00
if LengthOfTable ( upStarHeroListData ) >= _curUpStarData.upStarData [ i ] [ 4 ] then
2020-08-10 10:56:17 +08:00
-- curSelectUpStarGo = needHeros[i + 1]
2020-08-08 15:51:55 +08:00
for j = 1 , LengthOfTable ( upStarHeroListData ) do
if # curSelectHeroList < _curUpStarData.upStarData [ i ] [ 4 ] then
2023-04-21 14:18:03 +08:00
-- if upStarHeroListData[j] and upStarHeroListData[j].dynamicId and upStarHeroListData[j].lockState == 0 and (curSelectHero.heroConfig and upStarHeroListData[j].dynamicId ~= curSelectHero.dynamicId) and upStarHeroListData[j].isFormation == ""
if upStarHeroListData [ j ] . type == RoleUpStarMatType.item or upStarHeroListData [ j ] . type == RoleUpStarMatType.hero and upStarHeroListData [ j ] . lockState == 0 and upStarHeroListData [ j ] . isFormation == " "
2021-01-26 14:47:01 +08:00
and not HarmonyManager.IsChangeColor ( upStarHeroListData [ j ] . dynamicId ) and not HarmonyManager : IsEnvoy ( upStarHeroListData [ j ] . dynamicId ) then
2020-08-08 15:51:55 +08:00
table.insert ( curSelectHeroList , upStarHeroListData [ j ] )
end
end
end
2020-08-10 10:56:17 +08:00
this.UpdateUpStarPosHeroData ( curSelectHeroList , _curUpStarData.upStarData [ i ] , needHeros [ i + 1 ] )
2020-08-08 15:51:55 +08:00
end
end
end
end
end
--刷新当前升星坑位英雄的信息
2020-08-10 10:56:17 +08:00
function this . UpdateUpStarPosHeroData ( curSelectHeroList , _upStarData , go )
local upStarData = _upStarData or curSelectUpStarData
local curGo = go or curSelectUpStarGo
2020-08-08 15:51:55 +08:00
if LengthOfTable ( curSelectHeroList ) < upStarData [ 4 ] then
upStarMaterialIsAll [ upStarData [ 2 ] ] = 2
2020-08-10 10:56:17 +08:00
Util.GetGameObject ( curGo.transform , " add/add " ) : SetActive ( true )
2020-08-08 15:51:55 +08:00
-- local upStarHeroListData=HeroManager.GetUpStarHeroListData(curSelectUpStarData.upStarMaterialsData.Id,curHeroData)
-- if upStarHeroListData.state<=0 then
-- Util.GetGameObject(curSelectUpStarGo.transform,"add/add"):SetActive(false)
-- end
2020-08-10 10:56:17 +08:00
Util.GetGameObject ( curGo.transform , " num " ) : GetComponent ( " Text " ) . text = string.format ( " <color=#FF0000FF>%s/%s</color> " , LengthOfTable ( curSelectHeroList ) , upStarData [ 4 ] )
2020-08-08 15:51:55 +08:00
else
upStarMaterialIsAll [ upStarData [ 2 ] ] = 1
2020-08-10 10:56:17 +08:00
Util.GetGameObject ( curGo.transform , " add/add " ) : SetActive ( false )
2020-08-13 11:11:26 +08:00
Util.GetGameObject ( curGo.transform , " num " ) : GetComponent ( " Text " ) . text = string.format ( " <color=#00FF06>%s/%s</color> " , LengthOfTable ( curSelectHeroList ) , upStarData [ 4 ] )
2020-08-08 15:51:55 +08:00
end
local curUpStarConsumeMaterial = { }
for i , v in pairs ( curSelectHeroList ) do
table.insert ( curUpStarConsumeMaterial , v.dynamicId )
end
upStarConsumeMaterial [ upStarData [ 2 ] ] = curUpStarConsumeMaterial
2020-08-10 10:56:17 +08:00
-- for i = 1, #upStarConsumeMaterial do
2021-04-21 16:36:12 +08:00
-- --LogGreen("选择升星位置的英雄数量 "..#upStarConsumeMaterial[i])
2020-08-10 10:56:17 +08:00
-- if #upStarConsumeMaterial[i]>0 then
-- for j = 1, #upStarConsumeMaterial[i] do
2021-04-21 16:36:12 +08:00
-- --LogGreen("选择升星位置的英雄都有谁 "..upStarConsumeMaterial[i][j])
2020-08-10 10:56:17 +08:00
-- end
-- end
-- end
2020-08-08 11:06:01 +08:00
end
2020-08-08 18:18:26 +08:00
--刷新当前升星坑位英雄的信息
function this . UpdateUpStarPosHeroData2 ( curSelectHeroList )
2021-04-21 16:36:12 +08:00
-- --LogGreen("LengthOfTable(curSelectHeroList) "..LengthOfTable(curSelectHeroList))
2020-08-08 18:18:26 +08:00
if LengthOfTable ( curSelectHeroList ) < 1 then
Util.GetGameObject ( curSelectUpStarGo.transform , " add/add " ) : SetActive ( true )
curSelectHero = nil
-- 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 ) , 1 )
else
for key , value in pairs ( curSelectHeroList ) do
curSelectHero = value
2020-08-08 19:27:10 +08:00
--自动选择进阶妖灵师材料
this.compoundHerolv . text = curSelectHero.lv
2020-08-08 18:18:26 +08:00
end
2020-08-08 19:27:10 +08:00
local _curUpStarData = this.GetAllHeroCompoundData2 ( curSelectHeroConfig.config , curSelectHeroConfig , true )
if curSelectHero then this.UpdateHeroUpStarData ( _curUpStarData ) end
2020-08-08 18:18:26 +08:00
Util.GetGameObject ( curSelectUpStarGo.transform , " add/add " ) : SetActive ( false )
2020-08-13 11:11:26 +08:00
Util.GetGameObject ( curSelectUpStarGo.transform , " num " ) : GetComponent ( " Text " ) . text = string.format ( " <color=#00FF06>%s/%s</color> " , LengthOfTable ( curSelectHeroList ) , 1 )
2020-11-04 16:56:24 +08:00
this.ShowTitleData ( curSelectHeroConfig )
this.UpdateFirstHeroUpStarData ( curSelectHeroConfig )
2020-11-04 16:51:45 +08:00
end
2020-08-08 18:18:26 +08:00
end
2021-01-26 14:47:01 +08:00
--更新英雄进阶数据 ((not HarmonyManager:IsEnvoy(curSelectHero.dynamicId) )and (not HarmonyManager.IsInfo(curSelectHero.dynamicId)) )
2020-08-08 11:06:01 +08:00
function this . UpdateFirstHeroUpStarData ( curHeroCompoundData )
local go = needHeros [ 1 ]
local proImage = Util.GetGameObject ( go.transform , " iconbg/proImage " )
local iconDefault = Util.GetGameObject ( go.transform , " iconDefault " )
local icon = Util.GetGameObject ( go.transform , " icon " )
local frame = Util.GetGameObject ( go.transform , " frame " )
local addBtn = Util.GetGameObject ( go.transform , " add " )
local addBtnImage = Util.GetGameObject ( go.transform , " add/add " )
2020-08-12 20:59:20 +08:00
local num = Util.GetGameObject ( go.transform , " lv/num " )
2020-08-08 11:06:01 +08:00
local starGrid = Util.GetGameObject ( go.transform , " iconbg/starGrid " )
if curSelectHero or curHeroCompoundData then
local heroConfig = curSelectHero and curSelectHero.heroConfig or curHeroCompoundData.config
2021-01-26 17:08:39 +08:00
Util.GetGameObject ( go.transform , " nameText " ) : GetComponent ( " Text " ) . text = GetLanguageStrById ( heroConfig.ReadingName )
2020-08-08 11:06:01 +08:00
go : SetActive ( true )
proImage : SetActive ( true )
iconDefault : SetActive ( false )
2020-11-04 16:51:45 +08:00
addBtnImage : SetActive ( false )
2021-04-21 13:12:04 +08:00
frame : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetHeroQuantityImageByquality ( heroConfig.Quality , heroConfig.Star ) )
proImage : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetProStrImageByProNum ( heroConfig.PropertyName ) )
SetHeroStars ( this.spLoader , starGrid , heroConfig.Star , 1 , nil , - 15.3 )
2021-01-26 14:47:01 +08:00
if curSelectHero and curSelectHero.heroConfig then
2020-08-13 11:11:26 +08:00
num : GetComponent ( " Text " ) . text = string.format ( " <color=#00FF06>%s/%s</color> " , 1 , 1 )
2021-04-21 16:36:12 +08:00
--LogGreen("curSelectHero.icon:"..curSelectHero.icon)
2021-04-21 13:12:04 +08:00
icon : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( curSelectHero.icon )
2020-08-08 11:06:01 +08:00
else
2021-04-21 13:12:04 +08:00
icon : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetResourcePath ( heroConfig.Icon ) )
2020-08-08 11:06:01 +08:00
num : GetComponent ( " Text " ) . text = string.format ( " <color=#FF0000FF>%s/%s</color> " , 0 , 1 )
end
2020-08-08 18:18:26 +08:00
Util.AddOnceClick ( addBtn , function ( )
2020-08-12 20:59:20 +08:00
if not curSelectHero then return end
2020-08-08 18:18:26 +08:00
curSelectUpStarData = nil
curSelectUpStarGo = go
local curShowHeroListData = this.SetShowHeroListData ( upStarConsumeMaterial , curHeroCompoundData.haveHeroList3 [ 1 ] , true )
--参数1 显示的herolist 2 3 升当前星的规则 4 打开RoleUpStarListPanel的界面
UIManager.OpenPanel ( UIName.CompoundHeroFirstUpStarListPanel , curShowHeroListData , this , curSelectHero )
end )
2020-08-08 11:06:01 +08:00
else
needHeros [ 1 ] : SetActive ( false )
end
end
2020-08-07 14:23:05 +08:00
--数据显示
function this . SingleHeroDataShow ( _go , _heroData )
local go = _go
local heroData = _heroData
2021-04-21 13:12:04 +08:00
Util.GetGameObject ( go.transform , " frame " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetHeroQuantityImageByquality ( heroData.config . Quality , heroData.star ) )
2020-08-07 14:23:05 +08:00
Util.GetGameObject ( go.transform , " lv " ) : SetActive ( false ) -- :GetComponent("Text").text = heroData.lv
2021-04-21 13:12:04 +08:00
Util.GetGameObject ( go.transform , " icon " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetResourcePath ( heroData.config . Icon ) )
Util.GetGameObject ( go.transform , " posIcon " ) : SetActive ( false ) --:GetComponent("Image").sprite = this.spLoader:LoadSprite(heroData.professionIcon)
Util.GetGameObject ( go.transform , " proIcon " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetProStrImageByProNum ( heroData.config . PropertyName ) )
2020-08-07 14:23:05 +08:00
local formationMask = Util.GetGameObject ( go.transform , " formationMask " )
2021-04-09 12:26:35 +08:00
formationMask : SetActive ( false ) --(heroData.isFormation ~= "" and heroData.isFormation ~= Language[10410]) or heroData.lockState == 1)
2020-08-07 14:23:05 +08:00
local starGrid = Util.GetGameObject ( go.transform , " star " )
2021-04-21 13:12:04 +08:00
SetHeroStars ( this.spLoader , starGrid , heroData.star , 1 , nil , nil , Vector2.New ( 0 , 1 ) )
2020-08-07 14:23:05 +08:00
local progress1 = Util.GetGameObject ( go.transform , " progressBg/progress1 " ) --红
local progress2 = Util.GetGameObject ( go.transform , " progressBg/progress2 " ) --蓝
local progressText = Util.GetGameObject ( go.transform , " progressBg/progressText " ) : GetComponent ( " Text " )
2021-04-08 20:48:17 +08:00
Util.GetGameObject ( go.transform , " Text " ) : GetComponent ( " Text " ) . text = SubString2 ( GetLanguageStrById ( heroData.config . ReadingName ) , 8 )
2020-08-07 14:23:05 +08:00
local num = LengthOfTable ( heroData.haveHeroList2 ) / heroData.needNum
progress1 : SetActive ( LengthOfTable ( heroData.haveHeroList2 ) < heroData.needNum )
progress2 : SetActive ( LengthOfTable ( heroData.haveHeroList2 ) >= heroData.needNum )
progress1 : GetComponent ( " Image " ) . fillAmount = num
progress2 : GetComponent ( " Image " ) . fillAmount = num
2022-02-17 15:13:26 +08:00
local isShowRed = true
for k , v in ConfigPairs ( ConfigManager.GetConfig ( ConfigName.HeroRankupConfig ) ) do
if v.Star == heroData.config . Star and v.LimitStar == heroData.config . Star and v.OpenStar == heroData.config . Star + 1 then
upStarRankUpConfig = v
break
end
end
if upStarRankUpConfig and HarmonyManager.GetSingleAdditions ( HarmonyAddType.AddLv ) < upStarRankUpConfig.LimitHongmengLevel then -- 鸿蒙阵神将共鸣等级
isShowRed = false
end
Util.GetGameObject ( go.transform , " redPoint " ) : SetActive ( LengthOfTable ( heroData.haveHeroList2 ) >= heroData.needNum and isShowRed )
2020-08-07 14:23:05 +08:00
progressText.text = LengthOfTable ( heroData.haveHeroList2 ) .. " / " .. heroData.needNum
local cardBtn = Util.GetGameObject ( go.transform , " icon " )
local choosed = Util.GetGameObject ( go.transform , " choosed " )
choosed : SetActive ( false )
2020-08-08 11:06:01 +08:00
if curSelectHeroConfig and curSelectHeroConfig.config and curSelectHeroConfig.config . Id == _heroData.config . Id then
2020-08-07 14:23:05 +08:00
choosed : SetActive ( true )
curSelectGO = choosed
2020-08-10 10:56:17 +08:00
-- this.SelectHeroShow(curSelectHeroConfig)
2020-08-06 18:34:04 +08:00
end
2020-08-07 14:23:05 +08:00
Util.AddOnceClick ( cardBtn , function ( )
2020-08-08 11:06:01 +08:00
if curSelectHeroConfig and curSelectHeroConfig.config then
if curSelectHeroConfig.config . Id == _heroData.config . Id then
choosed : SetActive ( false )
curSelectHeroConfig = nil
curSelectGO = nil
this.SelectHeroShow ( nil )
return
else
curSelectHeroConfig = heroData
if curSelectGO then
curSelectGO : SetActive ( false )
end
choosed : SetActive ( true )
curSelectGO = choosed
this.SelectHeroShow ( curSelectHeroConfig )
end
2020-08-06 18:34:04 +08:00
else
2020-08-08 11:06:01 +08:00
curSelectHeroConfig = heroData
2020-08-06 18:34:04 +08:00
choosed : SetActive ( true )
2020-08-07 14:23:05 +08:00
curSelectGO = choosed
2020-08-08 11:06:01 +08:00
this.SelectHeroShow ( curSelectHeroConfig )
2020-08-06 18:34:04 +08:00
end
end )
2021-04-20 10:17:57 +08:00
Util.AddLongPressClick ( cardBtn , function ( )
UIManager.OpenPanel ( UIName.RoleGetInfoPopup , false , heroData.config . Id , heroData.star )
end , 0.5 )
2020-08-06 18:34:04 +08:00
end
function this . Compound ( )
2020-08-10 16:17:13 +08:00
if not curSelectHero or ( curSelectHero and not curSelectHero.heroConfig ) then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 10415 ] )
2020-08-10 11:28:25 +08:00
return
end
2022-02-17 15:13:26 +08:00
2020-08-08 15:51:55 +08:00
for k , v in ConfigPairs ( ConfigManager.GetConfig ( ConfigName.HeroRankupConfig ) ) do
if v.Star == curSelectHero.heroConfig . Star and v.LimitStar == curSelectHero.heroConfig . Star and v.OpenStar == curSelectHero.heroConfig . Star + 1 then
upStarRankUpConfig = v
end
2020-08-06 18:34:04 +08:00
end
2022-02-17 15:13:26 +08:00
if HarmonyManager.GetSingleAdditions ( HarmonyAddType.AddLv ) < upStarRankUpConfig.LimitHongmengLevel then -- 鸿蒙阵神将共鸣等级
PopupTipPanel.ShowTip ( " 鸿蒙阵等级需达到 " .. upStarRankUpConfig.LimitHongmengLevel )
return
end
2020-08-08 15:51:55 +08:00
local isUpStarMaterialsHero = true
for i = 1 , # upStarMaterialIsAll do
if upStarMaterialIsAll [ i ] == 2 then
isUpStarMaterialsHero = false
2020-08-06 18:34:04 +08:00
end
2020-08-08 15:51:55 +08:00
end
if isUpStarMaterialsHero then
NetManager.HeroUpStarEvent ( curSelectHero.dynamicId , upStarConsumeMaterial , function ( msg )
UIManager.OpenPanel ( UIName.RoleUpStarSuccessPanel , curSelectHero , upStarRankUpConfig.Id , upStarRankUpConfig.OpenLevel , function ( )
local dropItemTabs = BagManager.GetTableByBackDropData ( msg )
if # dropItemTabs > 0 then
2020-08-12 20:59:20 +08:00
BagManager.SetDropIsSHowEquipPrint ( false )
2020-08-08 15:51:55 +08:00
UIManager.OpenPanel ( UIName.RewardItemPopup , msg , 1 , function ( )
this.DeleteUpStarMaterials ( )
end )
else
this.DeleteUpStarMaterials ( )
end
end )
2020-08-06 18:34:04 +08:00
end )
2020-08-08 15:51:55 +08:00
-- 进阶音效
PlaySoundWithoutClick ( SoundConfig.Sound_Recruit3 )
else
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 10415 ] )
2020-08-08 15:51:55 +08:00
end
end
--扣除升星 消耗的材料 更新英雄数据
function this . DeleteUpStarMaterials ( )
2021-08-10 14:52:07 +08:00
HeroManager.UpdateSingleHeroDatas ( curSelectHero.dynamicId , nil , curSelectHero.star + 1 , nil , upStarRankUpConfig.Id , true )
2020-08-08 15:51:55 +08:00
HeroManager.UpdateSingleHeroSkillData ( curSelectHero.dynamicId )
--本地数据删除材料英雄
for i = 1 , # upStarConsumeMaterial do
2021-04-21 16:36:12 +08:00
--LogGreen("DeleteHeroDatas "..#upStarConsumeMaterial[i])
2020-08-08 18:18:26 +08:00
for j = 1 , # upStarConsumeMaterial [ i ] do
2021-04-21 16:36:12 +08:00
--LogGreen("DeleteHeroDatas "..upStarConsumeMaterial[i][j])
2020-08-08 18:18:26 +08:00
end
2020-08-08 15:51:55 +08:00
HeroManager.DeleteHeroDatas ( upStarConsumeMaterial [ i ] )
end
--刷新界面
2020-08-08 18:18:26 +08:00
this.ShowCurrPosHeroCompound2 ( )
2020-08-06 18:34:04 +08:00
end
-- tab节点显示自定义
function this . TabAdapter ( tab , index , status )
local tabLab = Util.GetGameObject ( tab , " Text " )
local tabImage = Util.GetGameObject ( tab , " Image " )
2021-04-21 13:12:04 +08:00
tabImage : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( _TabData [ index ] [ status ] )
2020-08-06 18:34:04 +08:00
tabImage : GetComponent ( " Image " ) : SetNativeSize ( )
tabLab : GetComponent ( " Text " ) . text = _TabData [ index ] . name
tabLab : GetComponent ( " Text " ) . color = _TabFontColor [ status ]
tabImage.transform . localPosition = Vector3.New ( tabImage.transform . localPosition.x , _TabImagePos [ status ] , 0 ) ;
end
--切换视图
function this . SwitchView ( index )
this.OnClickTabBtn ( index )
2020-08-05 16:30:02 +08:00
end
function this : OnClose ( )
2020-08-08 11:06:01 +08:00
curNeedHero = { }
curSelectHero = { }
curSelectHeroConfig = { }
curSelectGO = nil
2020-08-05 16:30:02 +08:00
end
function this : OnDestroy ( )
2021-04-21 13:12:04 +08:00
this.spLoader : Destroy ( )
2020-08-05 16:30:02 +08:00
end
2020-08-06 18:34:04 +08:00
local heroRankupGroup = ConfigManager.GetConfig ( ConfigName.HeroRankupGroup )
2020-08-07 14:23:05 +08:00
local upSortHeroList , downSoryHeroList
local allCompoundHeroConFigData = { }
2020-08-06 18:34:04 +08:00
--获取英雄可合成数据(所有可以英雄四星生五星 五星生六星)
function this . GetAllHeroCompoundData ( index )
2020-08-07 14:23:05 +08:00
upSortHeroList , downSoryHeroList = HeroManager.ByCompoundHeroGetAllHeros ( )
allCompoundHeroConFigData = { }
2020-08-06 18:34:04 +08:00
for _ , configInfo in ConfigPairs ( ConfigManager.GetConfig ( ConfigName.HeroConfig ) ) do
2021-03-19 18:00:46 +08:00
if ( configInfo.Star == 4 or configInfo.Star == 5 ) and ( index == 0 or configInfo.PropertyName == index ) and configInfo.Hide == 0 then
2020-08-06 18:34:04 +08:00
local curHeroCompoundData = { }
curHeroCompoundData.star = configInfo.Star + 1
curHeroCompoundData.config = configInfo
2020-08-07 14:23:05 +08:00
curHeroCompoundData.haveHeroList = { } --可以选择的英雄数量 [1][2][3] 无重数据
curHeroCompoundData.haveHeroList2 = { } --可以选择的英雄数量 记数量去重用 did = didData
curHeroCompoundData.haveHeroList3 = { } --可以选择的英雄数量 [1][2][3] 重数据
curHeroCompoundData.needNum = 1 --需要英雄数量 第一位先加上
curHeroCompoundData.haveHeroList [ 1 ] = { }
curHeroCompoundData.haveHeroList3 [ 1 ] = { }
2020-08-08 11:06:01 +08:00
curHeroCompoundData.upStarData = { }
curHeroCompoundData.upStarMaterialsData = { }
2020-08-07 14:23:05 +08:00
--其后几位加数量
if configInfo.RankupConsumeMaterial then
for i = 1 , # configInfo.RankupConsumeMaterial do
if configInfo.RankupConsumeMaterial [ i ] [ 1 ] == curHeroCompoundData.star then
curHeroCompoundData.needNum = curHeroCompoundData.needNum + configInfo.RankupConsumeMaterial [ i ] [ 4 ]
curHeroCompoundData.haveHeroList [ configInfo.RankupConsumeMaterial [ i ] [ 2 ] + 1 ] = { }
curHeroCompoundData.haveHeroList3 [ configInfo.RankupConsumeMaterial [ i ] [ 2 ] + 1 ] = { }
2020-08-08 11:06:01 +08:00
curHeroCompoundData.upStarData [ i ] = configInfo.RankupConsumeMaterial [ i ]
table.insert ( curHeroCompoundData.upStarData , configInfo.RankupConsumeMaterial [ i ] )
table.insert ( curHeroCompoundData.upStarMaterialsData , heroRankupGroup [ configInfo.RankupConsumeMaterial [ i ] [ 3 ] ] )
2020-08-07 14:23:05 +08:00
end
end
end
for key , bagHeroValue in pairs ( downSoryHeroList ) do
2020-08-06 18:34:04 +08:00
--第一位
2020-08-07 14:23:05 +08:00
-- if LengthOfTable(curHeroCompoundData.haveHeroList2) >= curHeroCompoundData.needNum then return end
2020-08-06 18:34:04 +08:00
if bagHeroValue.heroConfig . Id == configInfo.Id and ( ( bagHeroValue.heroConfig . Star == 4 and bagHeroValue.star == 4 ) or ( bagHeroValue.heroConfig . Star == 5 and bagHeroValue.star == 5 ) ) then
2020-08-07 14:23:05 +08:00
if # curHeroCompoundData.haveHeroList [ 1 ] < 1 then
table.insert ( curHeroCompoundData.haveHeroList [ 1 ] , bagHeroValue )
curHeroCompoundData.haveHeroList2 [ bagHeroValue.dynamicId ] = bagHeroValue
end
table.insert ( curHeroCompoundData.haveHeroList3 [ 1 ] , bagHeroValue )
2020-08-06 18:34:04 +08:00
end
2020-08-07 14:23:05 +08:00
end
this.GetAllHeroCompoundData2 ( configInfo , curHeroCompoundData )
2020-08-08 18:18:26 +08:00
if curSelectHeroConfig and curSelectHeroConfig.config and curSelectHeroConfig.config . Id == curHeroCompoundData.config . Id then
curSelectHeroConfig = curHeroCompoundData
end
2021-04-21 16:36:12 +08:00
-- --LogGreen("curHeroCompoundData.needNum "..curHeroCompoundData.needNum.." "..LengthOfTable(curHeroCompoundData.haveHeroList2))
2020-08-07 14:23:05 +08:00
table.insert ( allCompoundHeroConFigData , curHeroCompoundData )
end
end
2020-08-10 10:56:17 +08:00
table.sort ( allCompoundHeroConFigData , function ( a , b )
local lengthA = LengthOfTable ( a.haveHeroList2 )
local lengthB = LengthOfTable ( b.haveHeroList2 )
if ( ( a.needNum == lengthA ) and ( b.needNum == lengthB ) ) or ( ( a.needNum ~= lengthA ) and ( b.needNum ~= lengthB ) ) then
if a.config . Star == b.config . Star then
return a.config . Id < b.config . Id
else
2020-08-10 16:17:13 +08:00
return a.config . Star < b.config . Star
2020-08-10 10:56:17 +08:00
end
else
return a.needNum == lengthA and not b.needNum ~= lengthB
end
end )
2020-08-07 14:23:05 +08:00
return allCompoundHeroConFigData
end
function this . GetAllHeroCompoundData2 ( configInfo , curHeroCompoundData , isGet )
if isGet then
for i = 2 , # curHeroCompoundData.haveHeroList do
curHeroCompoundData.haveHeroList [ i ] = { }
curHeroCompoundData.haveHeroList3 [ i ] = { }
end
curHeroCompoundData.haveHeroList2 [ curHeroCompoundData.haveHeroList [ 1 ] [ 1 ] . dynamicId ] = curHeroCompoundData.haveHeroList [ 1 ] [ 1 ]
end
for key , bagHeroValue in pairs ( upSortHeroList ) do
--其后几位
if configInfo.RankupConsumeMaterial then
for i = 1 , # configInfo.RankupConsumeMaterial do
if configInfo.RankupConsumeMaterial [ i ] [ 1 ] == curHeroCompoundData.star then
local curNeedHeroData = nil
local heroRankUpGroup = heroRankupGroup [ configInfo.RankupConsumeMaterial [ i ] [ 3 ] ]
if heroRankUpGroup.Issame == 1 then --需要同名卡
if bagHeroValue.id == configInfo.Id then
2020-08-06 18:34:04 +08:00
if bagHeroValue.star == heroRankUpGroup.StarLimit then
if heroRankUpGroup.IsSameClan == 1 then
if bagHeroValue.property == configInfo.PropertyName then
if heroRankUpGroup.IsId > 0 then
if bagHeroValue.id == heroRankUpGroup.IsId then
curNeedHeroData = bagHeroValue
end
else
curNeedHeroData = bagHeroValue
end
end
else
if heroRankUpGroup.IsId > 0 then
if bagHeroValue.id == heroRankUpGroup.IsId then
curNeedHeroData = bagHeroValue
end
else
curNeedHeroData = bagHeroValue
end
end
end
end
2020-08-07 14:23:05 +08:00
else
if bagHeroValue.star == heroRankUpGroup.StarLimit then
if heroRankUpGroup.IsSameClan == 1 then
if bagHeroValue.property == configInfo.PropertyName then
if heroRankUpGroup.IsId > 0 then
if bagHeroValue.id == heroRankUpGroup.IsId then
curNeedHeroData = bagHeroValue
end
else
curNeedHeroData = bagHeroValue
end
end
else
if heroRankUpGroup.IsId > 0 then
if bagHeroValue.id == heroRankUpGroup.IsId then
curNeedHeroData = bagHeroValue
end
else
curNeedHeroData = bagHeroValue
end
end
end
end
if # curHeroCompoundData.haveHeroList [ configInfo.RankupConsumeMaterial [ i ] [ 2 ] + 1 ] < configInfo.RankupConsumeMaterial [ i ] [ 4 ] then
2020-08-08 11:06:01 +08:00
if curNeedHeroData and not curHeroCompoundData.haveHeroList2 [ curNeedHeroData.dynamicId ] then
2021-04-21 16:36:12 +08:00
-- --LogGreen("SID "..curHeroCompoundData.config.Id.." pos "..configInfo.RankupConsumeMaterial[i][2] + 1 .." curNeedHeroData.dynamicId "..curNeedHeroData.dynamicId)
2020-08-07 14:23:05 +08:00
table.insert ( curHeroCompoundData.haveHeroList [ configInfo.RankupConsumeMaterial [ i ] [ 2 ] + 1 ] , curNeedHeroData )
curHeroCompoundData.haveHeroList2 [ curNeedHeroData.dynamicId ] = curNeedHeroData
2020-08-06 18:34:04 +08:00
end
end
2020-08-07 14:23:05 +08:00
if curNeedHeroData then
table.insert ( curHeroCompoundData.haveHeroList3 [ configInfo.RankupConsumeMaterial [ i ] [ 2 ] + 1 ] , curNeedHeroData )
end
2020-08-06 18:34:04 +08:00
end
end
end
end
2020-08-07 14:23:05 +08:00
if isGet then
return curHeroCompoundData
end
end
--点击获取数据
function this . SelectHeroShow ( curHeroCompoundData )
2020-08-08 11:06:01 +08:00
if curHeroCompoundData then
2020-08-10 10:56:17 +08:00
curSelectHero = curHeroCompoundData.haveHeroList [ 1 ] [ 1 ] or curHeroCompoundData.config
2020-08-08 11:06:01 +08:00
this.ShowTitleData ( curHeroCompoundData )
this.UpdateFirstHeroUpStarData ( curHeroCompoundData )
this.UpdateHeroUpStarData ( curHeroCompoundData )
else
curSelectHero = nil
this.ShowTitleData ( nil )
this.UpdateFirstHeroUpStarData ( nil )
this.UpdateHeroUpStarData ( nil )
end
2020-08-06 18:34:04 +08:00
end
2020-08-12 20:59:20 +08:00
function this . GetNeedHeroName ( heroRankUpGroup )
if curSelectHero then
local curConFig = curSelectHero.heroConfig and curSelectHero.heroConfig or curSelectHero
if heroRankUpGroup.Issame == 1 then --需要同名卡
2021-01-26 17:08:39 +08:00
return GetLanguageStrById ( curConFig.ReadingName )
2020-08-12 20:59:20 +08:00
end
if heroRankUpGroup.IsId > 0 then --需要指定id
2021-01-26 17:08:39 +08:00
return GetLanguageStrById ( ConfigManager.GetConfigData ( ConfigName.HeroConfig , heroRankUpGroup.IsId ) . ReadingName )
2020-08-12 20:59:20 +08:00
end
if heroRankUpGroup.IsSameClan == 1 then --需要是否同系
2021-04-09 12:26:35 +08:00
return string.format ( Language [ 10416 ] , heroRankUpGroup.StarLimit )
2020-08-12 20:59:20 +08:00
end
else
return " "
end
end
2021-04-21 13:12:04 +08:00
return this