From e96bfbdbf52d2867e0947cae0311e09479808718 Mon Sep 17 00:00:00 2001 From: gaoxin Date: Mon, 26 Oct 2020 14:57:01 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=81=B5=E5=85=BD=E3=80=91=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=85=A8=E9=83=A8=E7=81=B5=E5=85=BD=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9=E8=BF=94=E5=9B=9E=E6=95=B0?= =?UTF-8?q?=E7=BB=84=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=89=93=E5=BC=80=E7=81=B5?= =?UTF-8?q?=E5=85=BD=E4=BF=A1=E6=81=AF=E7=95=8C=E9=9D=A2=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Pokemon/PokemonManager.lua | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua index 132a97788a..521f100c22 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua @@ -59,7 +59,32 @@ function this.GetSinglePokemonData(_did) end --获取所有灵兽数据 function this.GetPokemonDatas() - return pokemons + local list = {} + for k,v in pairs(pokemons) do + table.insert(list, v) + end + -- 排序 + local AllPokemonFormationDids = PokemonManager.GetAllPokemonFormationDids() + table.sort(list, function(a,b) + if AllPokemonFormationDids[a.dynamicId] and AllPokemonFormationDids[b.dynamicId] or not AllPokemonFormationDids[a.dynamicId] and not AllPokemonFormationDids[b.dynamicId] then + if spiritAnimal[a.id].Quality == spiritAnimal[b.id].Quality then + if a.star == b.star then + if a.lv == b.lv then + return a.id < b.id + else + return a.lv > b.lv + end + else + return a.star > b.star + end + else + return spiritAnimal[a.id].Quality > spiritAnimal[b.id].Quality + end + else + return AllPokemonFormationDids[a.dynamicId] and not AllPokemonFormationDids[b.dynamicId] + end + end) + return list end --获取所有灵兽数据 function this.GetPokemonResolveDatas()