diff --git a/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua b/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua index 3fed15ef00..c9fb722647 100644 --- a/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua +++ b/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua @@ -820,22 +820,44 @@ function this.SetOneKeyGo() end end) --遍历英雄 去除已上阵英雄 - for j = 1, #this.choosedList do - for k, v in ipairs(heros) do - if HeroManager.GetSingleHeroData(v.dynamicId).id== HeroManager.GetSingleHeroData(this.choosedList[j].heroId).id then + -- for j = 1, #this.choosedList do + -- for k, v in ipairs(heros) do + -- if HeroManager.GetSingleHeroData(v.dynamicId).id== HeroManager.GetSingleHeroData(this.choosedList[j].heroId).id then - table.remove(heros,k) - break + -- table.remove(heros,k) + -- 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 - if #heros == 0 then - return - end + --缺几个空位 就上几个空位 - for n = 1, #posArr do - table.insert(this.choosedList, {heroId = heros[n].dynamicId, position=posArr[n]}) - end + -- for n = 1, #posArr do + -- table.insert(this.choosedList, {heroId = heros[n].dynamicId, position=posArr[n]}) + -- end this.order=this.order+#posArr this.SetCardsData() this.OnClickTabBtn(proId)