From 1614afb3bf030872d7e650f5c70eccb641afb9be Mon Sep 17 00:00:00 2001 From: ZhangBiao Date: Mon, 23 Aug 2021 15:45:10 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=8E=92=E5=BA=8F=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E4=BF=AE=E6=94=B9=E7=A5=9E=E5=B0=86=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E6=8E=92=E5=BA=8F=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/RoleInfo/RoleListPanel.lua | 54 +++++++++---------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleListPanel.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleListPanel.lua index 43b1db7e4c..6b7dc7907d 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleListPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleListPanel.lua @@ -255,56 +255,52 @@ function this:SetSelectBtn() this.selectBtn.transform:SetParent(tabs[proId].transform) this.selectBtn:GetComponent("RectTransform").localPosition = Vector3.zero end + function this:SortHeroDatas(_heroDatas) - --上阵最优先,星级优先,同星级等级优先,同星级同等级按sortId排序。排序时降序排序。 table.sort(_heroDatas, function(a, b) + --如果都在编队或都不在编队 if (teamHero[a.dynamicId] and teamHero[b.dynamicId]) or (not teamHero[a.dynamicId] and not teamHero[b.dynamicId]) then - if sortType==SortTypeConst.Lv then - if a.lv ==b.lv then - if a.heroConfig.Quality ==b.heroConfig.Quality then--Natural + --根据等级排列 + if sortType == SortTypeConst.Lv then + --判断等级是否相同 + if a.lv == b.lv then + --判断战力是否相同 + if a.warPower == b.warPower then + ---判断星级是否相同 if a.star == b.star then - if a.warPower == b.warPower then - if a.heroConfig.Natural ==b.heroConfig.Natural then--Natural - return a.heroConfig.Id < b.heroConfig.Id - else - return a.heroConfig.Natural > b.heroConfig.Natural - end - else - return a.warPower > b.warPower - end + --返回图鉴排序 + return a.heroConfig.Sort < b.heroConfig.Sort else return a.star > b.star end else - return a.heroConfig.Quality > b.heroConfig.Quality + return a.warPower > b.warPower end else - return a.lv>b.lv + return a.lv > b.lv end + --根据品阶排列 elseif sortType==SortTypeConst.Natural then - if a.heroConfig.Quality ==b.heroConfig.Quality then--Natural - if a.star == b.star then + --是否星级相同 + if a.star == b.star then + --判断战力是否相同 + if a.warPower == b.warPower then + --判断等级是否相同 if a.lv == b.lv then - if a.warPower == b.warPower then - if a.heroConfig.Natural ==b.heroConfig.Natural then--Natural - return a.heroConfig.Id < b.heroConfig.Id - else - return a.heroConfig.Natural > b.heroConfig.Natural - end - else - return a.warPower > b.warPower - end + --返回图鉴排序 + return a.heroConfig.Sort < b.heroConfig.Sort else return a.lv > b.lv end else - return a.star > b.star + return a.lv > b.lv end else - return a.heroConfig.Quality > b.heroConfig.Quality + return a.star > b.star end - end + end else + --一个在一个不在先返回在的+不在的 return teamHero[a.dynamicId] and not teamHero[b.dynamicId] end end)