* sort ir scores in lb by score & + some debug logs

This commit is contained in:
FajsiEx 2021-12-16 20:49:11 +01:00
parent 125edef116
commit 7e3e2badc2
1 changed files with 18 additions and 9 deletions

View File

@ -604,7 +604,7 @@ function drawIrLeaderboard()
-- local irScore = irLeaderboard[i];
if irScore then
local rank = irScore.ranking
local rank = index;
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
gfx.BeginPath();
gfx.Text(LEADERBOARD_PLACE_NAMES[rank], sbBarContentLeftX-40, scoreBoardY + sbBarHeight/2 + rank*sbBarHeight);
@ -725,16 +725,25 @@ end
function onIrLeaderboardFetched(res)
irRequestStatus = res.statusCode;
if res.statusCode == IRData.States.Success then
local tempIrLeaderboard = res.body;
for i, tempScore in ipairs(tempIrLeaderboard) do
irLeaderboard[tempScore.ranking] = tempScore
end
local song = songwheel.songs[selectedIndex];
local diff = song and song.difficulties[selectedDifficulty] or false;
irLeaderboardsCache[diff.hash] = irLeaderboard;
game.Log(diff.hash, game.LOGGER_ERROR)
if res.statusCode == IRData.States.Success then
game.Log('Raw IR reposonse: ' .. dump(res.body), game.LOGGER_ERROR)
local tempIrLB = res.body;
table.sort(tempIrLB, function (a,b)
-- game.Log(a.score .. ' ?? ' .. b.score, game.LOGGER_ERROR)
return a.score > b.score
end)
-- for i, tempScore in ipairs(tempIrLeaderboard) do
-- irLeaderboard[tempScore.ranking] = tempScore
-- end
irLeaderboard = tempIrLB;
game.Log(dump(irLeaderboard), game.LOGGER_ERROR)
else