【灵兽】获取全部灵兽信息接口修改返回数组,修复打开灵兽信息界面报错

gaoxin 2020-10-26 14:57:01 +08:00
parent 21f8a21aec
commit e96bfbdbf5
1 changed files with 26 additions and 1 deletions

View File

@ -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()