一键上阵修改

dev_chengFeng
zhangqiang 2020-07-13 15:08:32 +08:00
parent 3953a76280
commit 926ff911da
1 changed files with 33 additions and 11 deletions

View File

@ -820,22 +820,44 @@ function this.SetOneKeyGo()
end end
end) end)
--遍历英雄 去除已上阵英雄 --遍历英雄 去除已上阵英雄
for j = 1, #this.choosedList do -- for j = 1, #this.choosedList do
for k, v in ipairs(heros) do -- for k, v in ipairs(heros) do
if HeroManager.GetSingleHeroData(v.dynamicId).id== HeroManager.GetSingleHeroData(this.choosedList[j].heroId).id then -- if HeroManager.GetSingleHeroData(v.dynamicId).id== HeroManager.GetSingleHeroData(this.choosedList[j].heroId).id then
table.remove(heros,k) -- table.remove(heros,k)
break -- break
-- end
-- end
-- end
-- if #heros == 0 then
-- return
-- end
--修改 upHeroSidTable 静态id 存储 有则跳过
local upHeroSidTable = {}
for j = 1, #this.choosedList do
local curSingleherodata = HeroManager.GetSingleHeroData(this.choosedList[j].heroId)
upHeroSidTable[curSingleherodata.id] = curSingleherodata.id
end
for k, v in ipairs(heros) do
local curSingleherodata = HeroManager.GetSingleHeroData(v.dynamicId)
if not upHeroSidTable[curSingleherodata.id] then
-- LogGreen("this.choosedList "..#this.choosedList)
if #this.choosedList < 6 then
for n = 1, #posArr do
-- LogGreen("n posArr[n] "..n.." "..posArr[n])
upHeroSidTable[curSingleherodata.id] = curSingleherodata.id
table.insert(this.choosedList, {heroId = v.dynamicId, position=posArr[n]})
table.remove(posArr,n)
break
end
end end
end end
end end
if #heros == 0 then
return
end
--缺几个空位 就上几个空位 --缺几个空位 就上几个空位
for n = 1, #posArr do -- for n = 1, #posArr do
table.insert(this.choosedList, {heroId = heros[n].dynamicId, position=posArr[n]}) -- table.insert(this.choosedList, {heroId = heros[n].dynamicId, position=posArr[n]})
end -- end
this.order=this.order+#posArr this.order=this.order+#posArr
this.SetCardsData() this.SetCardsData()
this.OnClickTabBtn(proId) this.OnClickTabBtn(proId)