From d4bb9ded6c877d56302ef7f385e81f65cbd301c3 Mon Sep 17 00:00:00 2001 From: jiaoyangna <3046463818@qq.com> Date: Mon, 1 Mar 2021 20:05:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E9=98=9F=E7=95=8C=E9=9D=A2=20?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Formation/FormationPanelV2.lua | 7 ++++++- .../Formation/View/FourElementFormation.lua | 21 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua b/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua index b78b2d4e97..e600e05e7b 100644 --- a/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua +++ b/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua @@ -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 = {} diff --git a/Assets/ManagedResources/~Lua/Modules/Formation/View/FourElementFormation.lua b/Assets/ManagedResources/~Lua/Modules/Formation/View/FourElementFormation.lua index b79a0d202e..c9493dacea 100644 --- a/Assets/ManagedResources/~Lua/Modules/Formation/View/FourElementFormation.lua +++ b/Assets/ManagedResources/~Lua/Modules/Formation/View/FourElementFormation.lua @@ -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)