【编队优化】轩辕宝镜一键特殊处理

dev_chengFeng
ZhangBiao 2020-11-19 17:37:13 +08:00
parent c5c4efef63
commit d789b9e98e
2 changed files with 66 additions and 29 deletions

View File

@ -867,9 +867,6 @@ end
function this.SetOneKeyGo() function this.SetOneKeyGo()
--获取需要上阵的位置 --获取需要上阵的位置
local posArr=this.GetPosList() local posArr=this.GetPosList()
-- for i = 1, #posArr do
-- Log("可上阵位置索引"..posArr[i])
-- end
if #posArr==0 then if #posArr==0 then
PopupTipPanel.ShowTip(Language[10692]) PopupTipPanel.ShowTip(Language[10692])
return return
@ -878,32 +875,12 @@ function this.SetOneKeyGo()
local heros = HeroManager.GetAllHeroDatas(limitLevel) local heros = HeroManager.GetAllHeroDatas(limitLevel)
--按战力从大到小排序 --按战力从大到小排序
table.sort(heros,function(a,b) table.sort(heros,function(a,b)
-- local aWarPower = HeroManager.CalculateHeroAllProValList(1,a.dynamicId,false)[HeroProType.WarPower]
-- local bWarPower = HeroManager.CalculateHeroAllProValList(1,b.dynamicId,false)[HeroProType.WarPower]
-- if aWarPower==bWarPower then
-- return a.id>b.id
-- else
-- return aWarPower>bWarPower
-- end
if a.warPower == b.warPower then if a.warPower == b.warPower then
return a.id>b.id return a.id>b.id
else else
return a.warPower > b.warPower return a.warPower > b.warPower
end end
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
-- table.remove(heros,k)
-- break
-- end
-- end
-- end
-- if #heros == 0 then
-- return
-- end
--修改 upHeroSidTable 静态id 存储 有则跳过 --修改 upHeroSidTable 静态id 存储 有则跳过
local upHeroSidTable = {} local upHeroSidTable = {}
this.order = 0 this.order = 0
@ -927,12 +904,72 @@ function this.SetOneKeyGo()
end end
end end
end end
this.SetCardsData()
this.OnClickTabBtn(proId)
end
--缺几个空位 就上几个空位 --设置轩辕宝镜一键上阵
-- for n = 1, #posArr do function this.SetOneKeyGoWithCondition(Rules)
-- table.insert(this.choosedList, {heroId = heros[n].dynamicId, position=posArr[n]}) local rulesType = Rules[1][1]
-- end local rulesNum = Rules[1][2]
-- this.order=this.order+#posArr local curNum = 0
--获取需要上阵的位置
local posArr=this.GetPosList()
if #posArr==0 then
PopupTipPanel.ShowTip(Language[10692])
return
end
local heros = HeroManager.GetAllHeroDatas(limitLevel)
--按战力从大到小排序
table.sort(heros,function(a,b)
if a.warPower == b.warPower then
return a.id>b.id
else
return a.warPower > b.warPower
end
end)
--修改 upHeroSidTable 静态id 存储 有则跳过
local upHeroSidTable = {}
this.order = 0
this.choosedList = {}
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
if rulesType == v.heroConfig.PropertyName and curNum < rulesNum then
curNum = curNum + 1
upHeroSidTable[curSingleherodata.id] = curSingleherodata.id
table.insert(this.choosedList, {heroId = v.dynamicId, position=posArr[n]})
table.remove(posArr,n)
this.order = this.order + 1
break
end
end
end
end
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
upHeroSidTable[curSingleherodata.id] = curSingleherodata.id
table.insert(this.choosedList, {heroId = v.dynamicId, position=posArr[n]})
table.remove(posArr,n)
this.order = this.order + 1
break
end
end
end
end
this.SetCardsData() this.SetCardsData()
this.OnClickTabBtn(proId) this.OnClickTabBtn(proId)
end end

View File

@ -37,7 +37,7 @@ end
--- btn1点击回调事件 --- btn1点击回调事件
function this.On_Btn1_Click() function this.On_Btn1_Click()
this.root.SetOneKeyGo() this.root.SetOneKeyGoWithCondition(data.teamRules)
end end
-- 进入地图 -- 进入地图