摘星阁英雄列表排序
parent
cfa84cff79
commit
5eb0d6fcba
|
@ -234,6 +234,7 @@ function this:SetData()
|
|||
end
|
||||
---设置显示英雄列表
|
||||
function this.SetHeroList(_roleDatas)
|
||||
HeroManager.SortHeroDatas(_roleDatas)
|
||||
this.scrollView:SetData(_roleDatas, function(index, go)
|
||||
if index==1 then
|
||||
this.SetHeroSelect(go)
|
||||
|
@ -243,6 +244,26 @@ function this.SetHeroList(_roleDatas)
|
|||
end, true,false)
|
||||
end
|
||||
|
||||
--英雄排序
|
||||
function this:SortHeroDatas(_heroDatas)
|
||||
--上阵最优先,星级优先,同星级等级优先,同星级同等级按sortId排序。排序时降序排序。
|
||||
table.sort(_heroDatas, function(a, b)
|
||||
if a.star == b.star then
|
||||
if a.heroConfig.Natural ==b.heroConfig.Natural then
|
||||
if a.lv == b.lv then
|
||||
return a.heroConfig.Id < b.heroConfig.Id
|
||||
else
|
||||
return a.lv > b.lv
|
||||
end
|
||||
else
|
||||
return a.heroConfig.Natural > b.heroConfig.Natural
|
||||
end
|
||||
else
|
||||
return a.star > b.star
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--设置每条英雄数据
|
||||
function this.SingleHeroDataShow(_go, _heroData)
|
||||
local go=_go
|
||||
|
@ -310,7 +331,7 @@ function this.SingleHeroDataShow(_go, _heroData)
|
|||
|
||||
Util.AddOnceClick(go, function()
|
||||
curSelectHero=_heroData
|
||||
this:SetData()
|
||||
this:Refresh()
|
||||
this.SetHeroSelect(go)
|
||||
end)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue