* sort ir scores in lb by score & + some debug logs
This commit is contained in:
parent
125edef116
commit
7e3e2badc2
|
@ -604,7 +604,7 @@ function drawIrLeaderboard()
|
||||||
-- local irScore = irLeaderboard[i];
|
-- local irScore = irLeaderboard[i];
|
||||||
|
|
||||||
if irScore then
|
if irScore then
|
||||||
local rank = irScore.ranking
|
local rank = index;
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
|
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.Text(LEADERBOARD_PLACE_NAMES[rank], sbBarContentLeftX-40, scoreBoardY + sbBarHeight/2 + rank*sbBarHeight);
|
gfx.Text(LEADERBOARD_PLACE_NAMES[rank], sbBarContentLeftX-40, scoreBoardY + sbBarHeight/2 + rank*sbBarHeight);
|
||||||
|
@ -677,7 +677,7 @@ function refreshIrLeaderboard(deltaTime)
|
||||||
if not IRData.Active then
|
if not IRData.Active then
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
if irRequestStatus ~= 1 then -- Only continue if the leaderboard is requesteded, but not loading or loaded.
|
if irRequestStatus ~= 1 then -- Only continue if the leaderboard is requesteded, but not loading or loaded.
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -725,16 +725,25 @@ end
|
||||||
function onIrLeaderboardFetched(res)
|
function onIrLeaderboardFetched(res)
|
||||||
irRequestStatus = res.statusCode;
|
irRequestStatus = res.statusCode;
|
||||||
|
|
||||||
|
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
|
if res.statusCode == IRData.States.Success then
|
||||||
local tempIrLeaderboard = res.body;
|
game.Log('Raw IR reposonse: ' .. dump(res.body), game.LOGGER_ERROR)
|
||||||
|
local tempIrLB = res.body;
|
||||||
|
|
||||||
for i, tempScore in ipairs(tempIrLeaderboard) do
|
table.sort(tempIrLB, function (a,b)
|
||||||
irLeaderboard[tempScore.ranking] = tempScore
|
-- game.Log(a.score .. ' ?? ' .. b.score, game.LOGGER_ERROR)
|
||||||
end
|
return a.score > b.score
|
||||||
|
end)
|
||||||
|
|
||||||
local song = songwheel.songs[selectedIndex];
|
-- for i, tempScore in ipairs(tempIrLeaderboard) do
|
||||||
local diff = song and song.difficulties[selectedDifficulty] or false;
|
-- irLeaderboard[tempScore.ranking] = tempScore
|
||||||
irLeaderboardsCache[diff.hash] = irLeaderboard;
|
-- end
|
||||||
|
|
||||||
|
irLeaderboard = tempIrLB;
|
||||||
|
|
||||||
game.Log(dump(irLeaderboard), game.LOGGER_ERROR)
|
game.Log(dump(irLeaderboard), game.LOGGER_ERROR)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue