* improve leaderboard

This commit is contained in:
FajsiEx 2021-11-27 21:49:32 +01:00
parent 40828199f5
commit 5152d2e0b4
2 changed files with 15 additions and 9 deletions

View File

@ -42,7 +42,7 @@ function render(deltaTime)
resetLayoutInformation();
gfx.Scale(scale, scale);
Banner.render(deltaTime, users);
Banner.render(deltaTime, users, gameplay.user_id);
UserPanel.render(deltaTime, score, gameplay.scoreReplays[1]);
SongPanel.render(deltaTime,

View File

@ -4,7 +4,7 @@ local bannerBaseImage = gfx.CreateSkinImage("gameplay/banner/base.png", 0)
local BANNER_W = 1080;
local BANNER_H = 368;
local drawScoreboard = function (users)
local drawScoreboard = function (users, currentUserId)
if (users == nil) then
return
end
@ -13,27 +13,33 @@ local drawScoreboard = function (users)
gfx.FontSize(32)
local x = 16;
local y = 500;
local basey = 510;
gfx.LoadSkinFont("Digital-Serial-Bold.ttf")
for i, u in ipairs(users) do
local y = y + 40;
local y = basey + i*28;
if (u.id == currentUserId) then
gfx.FillColor(128,192,255);
else
gfx.FillColor(255,255,255);
end
gfx.FontSize(26)
gfx.Text(u.name, x, y)
gfx.Text('#' .. i .. ' ' .. u.name, x, y)
gfx.FontSize(26)
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
gfx.Text(string.format("%04d", math.floor(u.score/10000)), x+128, y)
gfx.Text(string.format("%04d", math.floor(u.score/10000)), x+128+32, y)
local lastFourDigits = ((u.score / 10000) - math.floor(u.score / 10000))*10000
gfx.FontSize(22)
gfx.Text(string.format("%04d", math.floor(lastFourDigits)), x+186, y+1)
gfx.Text(string.format("%04d", math.floor(lastFourDigits)), x+186+32, y+1)
end
end
local render = function (deltaTime, users)
local render = function (deltaTime, users, currentUserId)
local resx, resy = game.GetResolution();
if (resx > resy) then
return
@ -54,7 +60,7 @@ local render = function (deltaTime, users)
0
);
drawScoreboard(users);
drawScoreboard(users, currentUserId);
end
return {