【大闹天宫】一键上阵招募英雄
parent
8376d74230
commit
78ead0e8ad
|
@ -989,4 +989,49 @@ function this.SetOneKeyGoWithCondition(Rules)
|
|||
this.OnClickTabBtn(proId)
|
||||
end
|
||||
|
||||
--设置大闹天宫一键上阵
|
||||
function this.SetOneKeyGoExpedition()
|
||||
--获取需要上阵的位置
|
||||
local posArr=this.GetPosList()
|
||||
if #posArr==0 then
|
||||
PopupTipPanel.ShowTip(Language[10692])
|
||||
return
|
||||
end
|
||||
local theros = HeroManager.GetAllHeroDatas(limitLevel)
|
||||
theros = ExpeditionManager.GetAllHeroDatas(theros,limitLevel)
|
||||
--按战力从大到小排序
|
||||
table.sort(theros,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(theros) 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.OnClickTabBtn(proId)
|
||||
end
|
||||
|
||||
return FormationPanelV2
|
|
@ -20,7 +20,7 @@ end
|
|||
--- btn1点击回调事件
|
||||
|
||||
function this.On_Btn1_Click()
|
||||
this.root.SetOneKeyGo()
|
||||
this.root.SetOneKeyGoExpedition()
|
||||
end
|
||||
|
||||
function this.On_Btn2_Click()
|
||||
|
|
Loading…
Reference in New Issue