编队界面 排序修改

dev_chengFeng
jiaoyangna 2021-03-01 20:05:31 +08:00
parent d3e6de38bb
commit d4bb9ded6c
2 changed files with 27 additions and 1 deletions

View File

@ -521,12 +521,17 @@ end
--设置英雄列表数据
function this.SetRoleList(_roleDatas, isTop)
this.SortHeroDatas(_roleDatas)
if panelType == FORMATION_TYPE.FOUR_ELEMENT then
this.opView.SortHeroDatas(_roleDatas)
else
this.SortHeroDatas(_roleDatas)
end
-- local curFormation = FormationManager.formationList[this.curFormationIndex]
this.scrollView:SetData(_roleDatas, function(index, go)
this.SingleHeroDataShow(go, _roleDatas[index])
end, not isTop)
end
--排序英雄数据
function this.SortHeroDatas(_heroDatas)
local choosed = {}

View File

@ -61,6 +61,27 @@ function this.GetHeros(limitLevel)
return heros
end
function this.SortHeroDatas1(data)
for i = 1 ,#data do
if not HeroManager.IsHaveHero(data[i].dynamicId) then
data[i].fourElementSortId = 1
else
data[i].fourElementSortId = 0
end
end
table.sort(data,function(a,b)
if a.fourElementSortId == b.fourElementSortId then
if a.warPower == b.warPower then
return a.star > b.star
else
return a.warPower > b.warPower
end
else
return a.fourElementSortId > b.fourElementSortId
end
end)
end
--- btn1点击回调事件
function this.On_Btn1_Click()
this.root.SetOneKeyGo(curType,6)