英雄合成预设更新

dev_chengFeng
zhangqiang 2020-08-07 14:23:05 +08:00
parent f09a0448bc
commit f2d743a343
3 changed files with 5407 additions and 7221 deletions

View File

@ -47,16 +47,16 @@ function this:OnSortingOrderChange(_sortingOrder)
sortingOrder = _sortingOrder
end
function this:OnShow(...)
-- curIndex = 0
-- sortingOrder =0
-- for i = 0,#tabs - 1 do
-- local index=i
-- Util.GetGameObject(tabs[i + 1], "Image"):GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(index))
-- Util.AddOnceClick(tabs[i + 1], function()
-- this.HeroCompoundBtnClick(tabs[i + 1],index)
-- end)
-- end
-- this.HeroCompoundBtnClick(tabs[1],curIndex)
curIndex = 0
sortingOrder =0
for i = 0,#tabs - 1 do
local index=i
Util.GetGameObject(tabs[i + 1], "Image"):GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(index))
Util.AddOnceClick(tabs[i + 1], function()
this.HeroCompoundBtnClick(tabs[i + 1],index)
end)
end
this.HeroCompoundBtnClick(tabs[1],curIndex)
end
@ -72,7 +72,7 @@ function this.ShowCurrPosHeroCompound()
curSelectHero = nil
this.ShowTitleData(curSelectHero)
this.ScrollView:SetData(heroDatas, function (index, go)
this.SingleItemDataShow(go, heroDatas[index])
this.SingleHeroDataShow(go, heroDatas[index])
end)
end
@ -83,140 +83,116 @@ function this.SetBtnSelect(_parObj)
this.selectBtn.transform.localScale = Vector3.one
this.selectBtn.transform.localPosition=Vector3.zero
end
function this.ShowTitleData(_data)
if _data then
function this.ShowTitleData(_heroData,_star)
if _heroData then
LogGreen("_heroData ".._heroData.icon)
this.compoundHero:SetActive(true)
this.compoundHeroTipText:SetActive(false)
local go=this.compoundHero
local heroData=_data
local frame=Util.GetGameObject(go,"frame"):GetComponent("Image")
local icon=Util.GetGameObject(go, "icon"):GetComponent("Image")
local lv= Util.GetGameObject(go, "lv/Text"):GetComponent("Text")
local pro= Util.GetGameObject(go, "proIcon"):GetComponent("Image")
local starGrid = Util.GetGameObject(go, "star")
local yuanImage = Util.GetGameObject(go, "yuanImage")
local choosedObj = Util.GetGameObject(go, "choosed")
local hpExp = Util.GetGameObject(go, "hpExp")
frame.sprite=Util.LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality,heroData.star))
icon.sprite=Util.LoadSprite(heroData.icon)
lv.text=heroData.lv
pro.sprite= Util.LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName))
SetHeroStars(starGrid, heroData.star,1,Vector2.New(30,30),-8)
--血量显示
local curHeroHpVal = FormationManager.GetFormationHeroHp(this.curFormationIndex,_heroData.dynamicId)
yuanImage:SetActive(heroData.createtype == 1)
if not curHeroHpVal then
Util.SetGray(go,false)
hpExp:SetActive(false)
local heroData=_heroData
local o = this.compoundHero
local bg=Util.GetGameObject(o,"Bg1"):GetComponent("Image")
local lv=Util.GetGameObject(o,"lv/Text"):GetComponent("Text")
local hp = Util.GetGameObject(o,"hpProgress/hp"):GetComponent("Image")
local hpPass = Util.GetGameObject(o,"hpProgress/hpPass"):GetComponent("Image")
local rage = Util.GetGameObject(o,"rageProgress/rage"):GetComponent("Image")
bg.sprite = Util.LoadSprite(GetHeroCardStarBg[_star])
Util.GetGameObject(o,"hpProgress").gameObject:SetActive(false)
Util.GetGameObject(o,"rageProgress").gameObject:SetActive(false)
local fg=Util.GetGameObject(o,"Bg2"):GetComponent("Image")
local pro=Util.GetGameObject(o,"Pro/Image"):GetComponent("Image")
local starGrid=Util.GetGameObject(o,"StarGrid")
local name=Util.GetGameObject(o,"Name/Text"):GetComponent("Text")
local yuanImage=Util.GetGameObject(o,"yuanImage")
local live = Util.GetGameObject(o, "Mask/icon"):GetComponent("RawImage")
local liveName = GetResourcePath(heroData.heroConfig.Live)
local roleConfig = ConfigManager.GetConfigData(ConfigName.RoleConfig, heroData.heroConfig.Id)
local scale = roleConfig.play_liveScale
local livePos = Vector3.New(roleConfig.offset[1], roleConfig.offset[2], 0)
live.texture = CardRendererManager.GetSpineTexture(1, liveName, Vector3.one * scale, livePos, true)
live.transform.localScale = Vector3.one
live.transform.localPosition = Vector3.zero
local zs = Util.GetGameObject(o, "zs")
local zsName = GetHeroCardStarZs[_star]
if zsName == "" then
zs:SetActive(false)
else
hpExp:SetActive(true)
hpExp:GetComponent("Slider").value = curHeroHpVal
if curHeroHpVal <= 0 then
Util.SetGray(go,true)
else
Util.SetGray(go,false)
end
zs:SetActive(true)
zs:GetComponent("Image").sprite = Util.LoadSprite(zsName)
end
yuanImage:SetActive(heroData.createtype == 1)
lv.text=heroData.lv
fg.sprite = Util.LoadSprite(GetHeroCardStarFg[_star])
pro.sprite=Util.LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName))
SetCardStars(starGrid,_star)
Util.GetGameObject(o,"UI_Effect_jinkuang_KaPai").gameObject:SetActive(false)
name.text=heroData.heroConfig.ReadingName
local curHeroHpVal = FormationManager.GetFormationHeroHp(this.curFormationIndex,_heroData.dynamicId)
hp.fillAmount = curHeroHpVal or 1
hpPass.fillAmount = curHeroHpVal or 1
rage.fillAmount = 0.5
else
LogGreen("_data nil ")
this.compoundHero:SetActive(false)
this.compoundHeroTipText:SetActive(true)
end
end
--显示金币数量
function this.ShowGoldNum(_costData,_num)
local needGoldNum = _costData[1][2]*_num
local id=_costData[1][1]
if needGoldNum > BagManager.GetItemCountById(id) then
materidaIsCan = false
this.needGoldText.text = string.format("<color=#FF0011>%s</color>", needGoldNum)
else
materidaIsCan = true
this.needGoldText.text =string.format("<color=#FCF5D3FF>%s</color>", needGoldNum)
end
this.numText.text = compoundNum
Util.SetGray(this.addBtn,false)
Util.SetGray(this.subtractBtn,false)
this.addBtn:GetComponent("Button").enabled = true
this.subtractBtn:GetComponent("Button").enabled = true
if compoundNum >= compoundMaxNum then
Util.SetGray(this.addBtn,true)
this.addBtn:GetComponent("Button").enabled = false
end
if compoundNum <= 1 then
Util.SetGray(this.subtractBtn,true)
this.subtractBtn:GetComponent("Button").enabled = false
end
if compoundNum == 0 then
Util.SetGray(this.addBtn,true)
Util.SetGray(this.subtractBtn,true)
this.addBtn:GetComponent("Button").enabled = false
this.subtractBtn:GetComponent("Button").enabled = false
end
end
function this.ShowTitleEquipData(_go,_itemData,_frame,_id)
Util.GetGameObject(_go.transform,"frame"):GetComponent("Image").sprite=Util.LoadSprite(_frame)
Util.GetGameObject(_go.transform,"icon"):GetComponent("Image").sprite=Util.LoadSprite(_itemData.icon)
Util.GetGameObject(_go.transform,"proImg"):GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(itemConfig[_itemData.Id].PropertyName))
Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text=_itemData.name
Util.GetGameObject(_go.transform, "star").gameObject:SetActive(false)
Util.AddClick(Util.GetGameObject(_go.transform,"icon"), function()
--UIManager.OpenPanel(UIName.HandBookEquipInfoPanel, _itemData.Id)
UIManager.OpenPanel(UIName.RewardTalismanSingleShowPopup, 0,nil,_id, 0, 0,nil)
end)
end
--宝物列表宝物数据显示
function this.SingleItemDataShow(_go,_itemData)
Util.GetGameObject(_go.transform,"frame"):GetComponent("Image").sprite=Util.LoadSprite(_itemData.frame)
Util.GetGameObject(_go.transform,"icon"):GetComponent("Image").sprite=Util.LoadSprite(_itemData.icon)
Util.GetGameObject(_go,"proImg"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(itemConfig[_itemData.Id].PropertyName))
Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text=_itemData.name
SetHeroStars(Util.GetGameObject(_go.transform, "star"), 0)
local choosed =Util.GetGameObject(_go.transform, "choosed")
choosed.gameObject:SetActive(curSelectEquip.Id == _itemData.Id)
local redPoint = Util.GetGameObject(_go.transform,"redPoint")
local haveCount=LengthOfTable(EquipTreasureManager.GetBagCompoundEquipDatasByequipSData(_itemData))
redPoint:SetActive( haveCount>= _itemData.quaUpCount)
if curSelectEquip.Id == _itemData .Id then
curSelectGO = _go
--数据显示
function this.SingleHeroDataShow(_go,_heroData)
local go = _go
local heroData = _heroData
Util.GetGameObject(go.transform, "frame"):GetComponent("Image").sprite = Util.LoadSprite(GetHeroQuantityImageByquality(heroData.config.Quality,heroData.star))
Util.GetGameObject(go.transform, "lv"):SetActive(false)-- :GetComponent("Text").text = heroData.lv
Util.GetGameObject(go.transform, "icon"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(heroData.config.Icon))
Util.GetGameObject(go.transform, "posIcon"):SetActive(false)--:GetComponent("Image").sprite = Util.LoadSprite(heroData.professionIcon)
Util.GetGameObject(go.transform, "proIcon"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(heroData.config.PropertyName))
local formationMask = Util.GetGameObject(go.transform, "formationMask")
formationMask:SetActive(false)--(heroData.isFormation ~= "" and heroData.isFormation ~= Language[11108]) or heroData.lockState == 1)
local starGrid = Util.GetGameObject(go.transform, "star")
SetHeroStars(starGrid, heroData.star,1,nil,nil,Vector2.New(0,1))
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")
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
progressText.text = LengthOfTable(heroData.haveHeroList2).."/"..heroData.needNum
local cardBtn = Util.GetGameObject(go.transform, "icon")
local choosed = Util.GetGameObject(go.transform, "choosed")
choosed:SetActive(false)
if curSelectHero and curSelectHero.config.Id == _heroData.config.Id then
choosed:SetActive(true)
curSelectGO = choosed
end
Util.AddOnceClick(Util.GetGameObject(_go.transform,"icon"), function()
if curSelectEquip.Id == _itemData .Id then
Util.AddOnceClick(cardBtn, function()
if curSelectHero and curSelectHero.config.Id == _heroData.config.Id then
choosed:SetActive(false)
curSelectHero = nil
curSelectGO = nil
this.SelectHeroShow(nil)
return
else
curSelectEquip = _itemData
curSelectHero = heroData
choosed:SetActive(true)
if curSelectGO then
Util.GetGameObject(curSelectGO.transform, "choosed"):SetActive(false)
curSelectGO = _go
curSelectGO:SetActive(false)
end
curSelectGO = choosed
this.SelectHeroShow(curSelectHero)
end
this.ShowTitleData(_itemData)
end)
Util.AddLongPressClick(Util.GetGameObject(_go.transform,"icon"), function()
--UIManager.OpenPanel(UIName.HandBookEquipInfoPanel, _itemData.Id)
end, 0.5)
end
--加减方法
function this.CompoundNumChange(type)
if type == 1 then--加
compoundNum = compoundNum + 1
else--减
compoundNum = compoundNum - 1
end
--LogError("compoundNum "..compoundNum)
this.ShowGoldNum(curSelectEquip.costCoin,compoundNum)
end
function this.Compound()
--LogError(" `````````````````` "..curIndex.." "..curSelectEquip.Star.." "..compoundNum)
if compoundNum <= 0 then
PopupTipPanel.ShowTip(Language[10431])
return
end
if not materidaIsCan then
PopupTipPanel.ShowTip(Language[12193])
-- UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = UpViewRechargeType.Gold })
return
end
NetManager.ComplexTreasureRequest(curSelectEquip.equipType,curIndex,curSelectEquip.quantity,compoundNum,function(msg)
@ -229,118 +205,6 @@ function this.Compound()
end)
end
--一种装备一种装备的循环检测 金币能合成的数量 与 背包装备能合成的数量 取最小值 然后扣除临时消耗道具
--最后所有装备存在curPosEquips 与 之前背包 bagPosEquips 作比较 看合成了什么装备 删除了什么装备 和计算消耗材料
function this.AutoCompound(_position)
--表数据
local curPosEquips = EquipTreasureManager.GetAllTabletTreasuresByRaceAndType(_position)--,curSelectEquip.equipType)
--实际数据
local curPosEquipsData = EquipTreasureManager.GeEquipTreasureDatas(_position)
local totalGoldNum = 0
--jwelConfig.RankupResourcess对应所有背包数据
local bagNums = {}
--循环宝物的表消耗道具,得出对应的背包数据
for i = 1, #curPosEquips do
local equipData = curPosEquips[i]
for j = 1, #equipData.costCoin do
if not bagNums[equipData.costCoin[j][1]] then
bagNums[equipData.costCoin[j][1]] = BagManager.GetItemCountById(equipData.costCoin[j][1])
end
end
end
-- --LogGreen(LengthOfTable(bagNums))
-- for n,m in pairs(bagNums) do
-- --LogGreen("bagNums id:"..n.." num:"..m)
-- end
--循环宝物的表数据,得到可以合成的宝物数量
for i = 1, #curPosEquips do
local equipData = curPosEquips[i]
--从表消耗道具得出可以合成的数量
local materialEndNum = -1
--循环宝物的表消耗数据,得出对应的消耗数据
for j = 1, #equipData.costCoin do
--可以合成的宝物数量
local config = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.JewelConfig,"Location",equipData.equipType,"Level",equipData.quantity-1,"Race",_position)
local curItmeCompoundNums = math.floor(bagNums[config.RankupResources[j][1]] / config.RankupResources[j][2])
if materialEndNum == -1 then
materialEndNum = curItmeCompoundNums
elseif materialEndNum > curItmeCompoundNums then
materialEndNum = curItmeCompoundNums
end
end
--LogGreen("materialEndNum:"..materialEndNum)
if materialEndNum > 0 then
--可消耗宝物的数量 (没有强化,没有精炼,没有装备,同样的位置,品级-1
local materialHaveNum= curPosEquipsData[equipData.equipType][equipData.quantity-1]
--LogGreen("equipData.quantity-1:".. equipData.quantity - 1 .."num:".. materialHaveNum)
--可以合成的
local nextCompoundNum = math.floor(materialHaveNum / equipData.quaUpCount)
--LogGreen("可以合成:".. nextCompoundNum .."个品质为"..equipData.quantity.."的宝器")
--消耗物品可以合成的和材料合成的作比较,取最小值
local endCompoundNum = materialEndNum > nextCompoundNum and nextCompoundNum or materialEndNum
--LogGreen("结合材料可以合成:".. endCompoundNum .."个品质为"..equipData.quantity.."的宝器")
--如果当前品质宝物可以合成就把当前品质的id及合成的数量储存判断下一个品质加上当前合成的是否能多合成
if endCompoundNum > 0 then
local config = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.JewelConfig,"Location",equipData.equipType,"Level",equipData.quantity-1,"Race",_position)
if not config then
LogRed("Location:".. equipData.equipType .." Level".. equipData.quantity-1 .." Race".. _position)
else
for j = 1, #config.RankupResources do
bagNums[config.RankupResources[j][1]] =
bagNums[config.RankupResources[j][1]] - endCompoundNum * config.RankupResources[j][2]
totalGoldNum = totalGoldNum + endCompoundNum * config.RankupResources[j][2]
--LogGreen("合成:".. endCompoundNum .."个品质为"..equipData.quantity.."的宝器需要消耗"..config.RankupResources[j][1].." "..endCompoundNum * config.RankupResources[j][2])
--LogGreen("bagNums[config.RankupResources[j][1]]:"..bagNums[config.RankupResources[j][1]])
end
--消耗之后剩余的数量
--LogGreen("消耗curPosEquipsData[equipData.equipType][equipData.quantity - 1]之前:"..curPosEquipsData[equipData.equipType][equipData.quantity - 1])
curPosEquipsData[equipData.equipType][equipData.quantity - 1] = materialHaveNum - (endCompoundNum * equipData.quaUpCount)
--LogGreen("合成:".. endCompoundNum .."个品质为"..equipData.quantity.."的宝器需要消耗".. equipData.quantity - 1 .." "..endCompoundNum * equipData.quaUpCount)
--LogGreen("消耗curPosEquipsData[equipData.equipType][equipData.quantity - 1]之后:"..curPosEquipsData[equipData.equipType][equipData.quantity - 1])
--LogGreen("合成curPosEquipsData[equipData.equipType][equipData.quantity]之前:"..curPosEquipsData[equipData.equipType][equipData.quantity])
curPosEquipsData[equipData.equipType][equipData.quantity] = curPosEquipsData[equipData.equipType][equipData.quantity] + endCompoundNum
--LogGreen("合成curPosEquipsData[equipData.equipType][equipData.quantity]之后:"..curPosEquipsData[equipData.equipType][equipData.quantity])
end
end
end
end
local origiData = EquipTreasureManager.GeEquipTreasureDatas(_position)
local endReward={}
for i, v in pairs(curPosEquipsData) do
for n, m in pairs(v) do
--LogGreen("m:"..m.." origiData[i][n]:"..origiData[i][n])
if m > origiData[i][n] then
local config = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.JewelConfig,"Location",i,"Level",n,"Race",_position)
--LogGreen("config.id:"..config.Id.." num:"..m - origiData[i][n])
table.insert(endReward,{config.Id,m - origiData[i][n]})
end
end
end
if LengthOfTable(endReward) < 1 then
PopupTipPanel.ShowTip(Language[12258])
return
end
--BagManager.GetItemCountById(14) -
--LogGreen("totalGoldNum:"..totalGoldNum)
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.TreasureCompound,totalGoldNum,endReward,function ()
NetManager.ComplexTreasureRequest(curSelectEquip.equipType,curIndex,0,0, function(msg)
for i = 1, #msg.equipIds do
EquipTreasureManager.RemoveTreasureByIdDyn(msg.equipIds[i])
end
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
this.ShowCurrPosTreasures()
end)
end)
end)
end
-- tab节点显示自定义
function this.TabAdapter(tab, index, status)
local tabLab = Util.GetGameObject(tab, "Text")
@ -362,53 +226,67 @@ end
function this:OnDestroy()
end
local heroRankupGroup = ConfigManager.GetConfig(ConfigName.HeroRankupGroup)
local upSortHeroList,downSoryHeroList
local allCompoundHeroConFigData = {}
--获取英雄可合成数据(所有可以英雄四星生五星 五星生六星)
function this.GetAllHeroCompoundData(index)
local allHeros = HeroManager.GetAllHeros()
local allCompoundHeroConFigData = {}
upSortHeroList,downSoryHeroList = HeroManager.ByCompoundHeroGetAllHeros()
allCompoundHeroConFigData = {}
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(ConfigName.HeroConfig)) do
if (configInfo.Star == 4 or configInfo.Star == 5) and (index == 0 or configInfo.PropertyName == index)then
local curHeroCompoundData = {}
curHeroCompoundData.star = configInfo.Star + 1
curHeroCompoundData.config = configInfo
curHeroCompoundData.needHero = {}--第一位是需要升星的本体集合 其后是升星相应的英雄信息
for key, bagHeroValue in pairs(allHeros) do
--第一位
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
bagHeroValue.needNum = 1
table.insert(curHeroCompoundData.needHero[1],bagHeroValue)
curHeroCompoundData.haveHeroList = {}--可以选择的英雄数量 [1][2][3] 无重数据
curHeroCompoundData.haveHeroList2 = {}--可以选择的英雄数量 记数量去重用 did = didData
curHeroCompoundData.haveHeroList3 = {}--可以选择的英雄数量 [1][2][3] 重数据
curHeroCompoundData.needNum = 1--需要英雄数量 第一位先加上
curHeroCompoundData.haveHeroList[1] = {}
curHeroCompoundData.haveHeroList3[1] = {}
--其后几位加数量
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] = {}
end
end
--其后几位
if configInfo.RankupConsumeMaterial then
for i = 1, #configInfo.RankupConsumeMaterial do
if configInfo.RankupConsumeMaterial[i][1] == curHeroCompoundData.star then
local curNeedHeroData = {}
local heroRankUpGroup = heroRankupGroup[configInfo.RankupConsumeMaterial[i][3]]
if heroRankUpGroup.Issame == 1 then --需要同名卡
if bagHeroValue.id == configInfo.Id then
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
else
end
for key, bagHeroValue in pairs(downSoryHeroList) do
--第一位
-- if LengthOfTable(curHeroCompoundData.haveHeroList2) >= curHeroCompoundData.needNum then return end
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
if #curHeroCompoundData.haveHeroList[1] < 1 then
table.insert(curHeroCompoundData.haveHeroList[1],bagHeroValue)
curHeroCompoundData.haveHeroList2[bagHeroValue.dynamicId] = bagHeroValue
end
table.insert(curHeroCompoundData.haveHeroList3[1],bagHeroValue)
end
end
this.GetAllHeroCompoundData2(configInfo,curHeroCompoundData)
table.insert(allCompoundHeroConFigData,curHeroCompoundData)
end
end
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
if bagHeroValue.star == heroRankUpGroup.StarLimit then
if heroRankUpGroup.IsSameClan == 1 then
if bagHeroValue.property == configInfo.PropertyName then
@ -431,16 +309,49 @@ function this.GetAllHeroCompoundData(index)
end
end
end
curNeedHeroData.needNum = configInfo.RankupConsumeMaterial[i][4]
table.insert(curHeroCompoundData.needHero[configInfo.RankupConsumeMaterial[i][2] + 1],curNeedHeroData)
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
if curNeedHeroData and not curHeroCompoundData[curNeedHeroData.dynamicId] then
table.insert(curHeroCompoundData.haveHeroList[configInfo.RankupConsumeMaterial[i][2] + 1],curNeedHeroData)
curHeroCompoundData.haveHeroList2[curNeedHeroData.dynamicId] = curNeedHeroData
end
end
if curNeedHeroData then
table.insert(curHeroCompoundData.haveHeroList3[configInfo.RankupConsumeMaterial[i][2] + 1],curNeedHeroData)
end
end
end
table.insert(allCompoundHeroConFigData,curHeroCompoundData)
end
end
return allCompoundHeroConFigData
if isGet then
return curHeroCompoundData
end
end
--点击获取数据
function this.SelectHeroShow(curHeroCompoundData)
this.ShowTitleData(curHeroCompoundData.haveHeroList[1][1],curHeroCompoundData.star)
end
return this

View File

@ -2878,7 +2878,37 @@ function this.ResetHero(dynamicloadId)
heroDatas[dynamicloadId].breakId = 0
end
end
function this.GetAllHeros()
return heroDatas
function this.ByCompoundHeroGetAllHeros()
local upSortHeroList = {}
local downSoryHeroList = {}
for i, v in pairs(heroDatas) do
if v.star == 4 or v.star == 5 then--四星 五星 才能加
table.insert(upSortHeroList,v)
table.insert(downSoryHeroList,v)
end
end
table.sort(downSoryHeroList, function(a,b)
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
end)
table.sort(upSortHeroList, function(a,b)
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
end)
return upSortHeroList,downSoryHeroList
end
return this