miduo_client/Assets/ManagedResources/~Lua/Modules/CompoundHero/view/CompoundHero_Compound.lua

496 lines
26 KiB
Lua
Raw Normal View History

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)
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
for i = 1, 5 do
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,
this.heroPre, this.ScrollBar, Vector2.New(-v2.x*2, -v2.y*2), 1, 5, Vector2.New(50,15))
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")
this.compoundHeroTipText = Util.GetGameObject(gameObject, "CompoundHeroPanel_Compound/titleGo/compoundHero/tipText")
this.compoundHeroTipText:GetComponent("Text").text = "请选择需要合成的神将"
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")
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(...)
2020-08-07 14:23:05 +08:00
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)
2020-08-06 18:34:04 +08:00
end
--英雄类型按钮点击事件
function this.HeroCompoundBtnClick(_btn,_curIndex)
curIndex = _curIndex
this.SetBtnSelect(_btn)
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])
2020-08-06 18:34:04 +08:00
end)
end
--设置按钮选中
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)
this.compoundHeroTipText:SetActive(false)
2020-08-08 11:06:01 +08:00
this.compoundHerobg.sprite = Util.LoadSprite(GetHeroCardStarBg[_star])
local zsName = GetHeroCardStarZs[_star]
this.compoundHerofg.sprite = Util.LoadSprite(GetHeroCardStarFg[_star])
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
local liveName = GetResourcePath(heroConfig.Live)
local roleConfig = ConfigManager.GetConfigData(ConfigName.RoleConfig, heroConfig.Id)
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
this.compoundHeropro.sprite=Util.LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
this.compoundHeroname.text=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)
this.compoundHerozs:GetComponent("Image").sprite = Util.LoadSprite(zsName)
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)
this.compoundHeroTipText:SetActive(true)
end
end
2020-08-08 11:06:01 +08:00
local upStarConsumeMaterial = {}
local upStarMaterialIsAll = {}
--更新英雄进阶数据
function this.UpdateHeroUpStarData(_curUpStarData)
--进阶吞英雄条件
if _curUpStarData then
upStarConsumeMaterial={}
upStarMaterialIsAll = {}
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]={}
upStarMaterialIsAll[i]=false
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")
local num = Util.GetGameObject(go.transform,"num")
local num = Util.GetGameObject(go.transform,"num")
local starGrid = Util.GetGameObject(go.transform, "iconbg/starGrid")
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
icon:GetComponent("Image").sprite=Util.LoadSprite(GetResourcePath(_curUpStarData.config.Icon))
frame:GetComponent("Image").sprite=Util.LoadSprite(GetHeroQuantityImageByquality(_curUpStarData.config.Quality, upStarMaterialsData.StarLimit))
proImage:GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(_curUpStarData.config.PropertyName))
elseif upStarMaterialsData.IsId>0 then
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, upStarMaterialsData.IsId)
icon:GetComponent("Image").sprite=Util.LoadSprite(GetResourcePath(heroConfig.Icon))
frame:GetComponent("Image").sprite=Util.LoadSprite(GetHeroQuantityImageByquality(heroConfig.Quality, upStarMaterialsData.StarLimit))
proImage:GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
end
else
if upStarMaterialsData.IsSameClan ==1 then
proImage:SetActive(true)
proImage:GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(_curUpStarData.config.PropertyName))
end
iconDefault:SetActive(true)
icon:SetActive(false)
frame:GetComponent("Image").sprite=Util.LoadSprite(GetHeroQuantityImageByquality(nil,upStarMaterialsData.StarLimit))
end
-- local upStarHeroListData=HeroManager.GetUpStarHeroListData(curUpStarData.Id,curSelectHero)
-- if upStarHeroListData.state>0 then
-- addBtnImage:SetActive(true)
-- else
-- addBtnImage:SetActive(false)
-- end
if #_curUpStarData.haveHeroList[i + 1] >= curUpStarData[4] then
num:GetComponent("Text").text=string.format("<color=#FFFFFF>%s/%s</color>",#_curUpStarData.haveHeroList[i + 1],curUpStarData[4])
else
num:GetComponent("Text").text=string.format("<color=#FF0000FF>%s/%s</color>",#_curUpStarData.haveHeroList[i + 1],curUpStarData[4])
end
SetHeroStars(starGrid, upStarMaterialsData.StarLimit,1,nil,-15.3)
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,upStarMaterialsData,curUpStarData,this,upStarConsumeMaterial[i],curSelectHero)
end)
end
else
for i = 1, #needHeros do
needHeros[i]:SetActive(false)
end
end
--自动选择进阶妖灵师材料
-- self:AutoSelectUpStarHeroList(curUpStarData)
end
--更新英雄进阶数据
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")
local num = Util.GetGameObject(go.transform,"num")
local num = Util.GetGameObject(go.transform,"num")
local starGrid = Util.GetGameObject(go.transform, "iconbg/starGrid")
if curSelectHero or curHeroCompoundData then
local heroConfig = curSelectHero and curSelectHero.heroConfig or curHeroCompoundData.config
go:SetActive(true)
proImage:SetActive(true)
iconDefault:SetActive(false)
addBtnImage:SetActive(false)
icon:GetComponent("Image").sprite=Util.LoadSprite(GetResourcePath(heroConfig.Icon))
frame:GetComponent("Image").sprite=Util.LoadSprite(GetHeroQuantityImageByquality(heroConfig.Quality, heroConfig.Star))
proImage:GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
SetHeroStars(starGrid, heroConfig.Star,1,nil,-15.3)
if curSelectHero then
num:GetComponent("Text").text=string.format("<color=#FFFFFF>%s/%s</color>",1,1)
else
num:GetComponent("Text").text=string.format("<color=#FF0000FF>%s/%s</color>",0,1)
end
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
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)
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-08 11:06:01 +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)
end
function this.Compound()
if compoundNum <= 0 then
PopupTipPanel.ShowTip(Language[10431])
return
end
if not materidaIsCan then
PopupTipPanel.ShowTip(Language[12193])
return
end
NetManager.ComplexTreasureRequest(curSelectEquip.equipType,curIndex,curSelectEquip.quantity,compoundNum,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
-- tab节点显示自定义
function this.TabAdapter(tab, index, status)
local tabLab = Util.GetGameObject(tab, "Text")
local tabImage = Util.GetGameObject(tab,"Image")
tabImage:GetComponent("Image").sprite = Util.LoadSprite(_TabData[index][status])
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()
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
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
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)
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
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
-- 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
curSelectHero = curHeroCompoundData.haveHeroList[1][1]
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-05 16:30:02 +08:00
return this