* improve leaderboard
This commit is contained in:
parent
40828199f5
commit
5152d2e0b4
|
@ -42,7 +42,7 @@ function render(deltaTime)
|
||||||
resetLayoutInformation();
|
resetLayoutInformation();
|
||||||
gfx.Scale(scale, scale);
|
gfx.Scale(scale, scale);
|
||||||
|
|
||||||
Banner.render(deltaTime, users);
|
Banner.render(deltaTime, users, gameplay.user_id);
|
||||||
|
|
||||||
UserPanel.render(deltaTime, score, gameplay.scoreReplays[1]);
|
UserPanel.render(deltaTime, score, gameplay.scoreReplays[1]);
|
||||||
SongPanel.render(deltaTime,
|
SongPanel.render(deltaTime,
|
||||||
|
|
|
@ -4,7 +4,7 @@ local bannerBaseImage = gfx.CreateSkinImage("gameplay/banner/base.png", 0)
|
||||||
local BANNER_W = 1080;
|
local BANNER_W = 1080;
|
||||||
local BANNER_H = 368;
|
local BANNER_H = 368;
|
||||||
|
|
||||||
local drawScoreboard = function (users)
|
local drawScoreboard = function (users, currentUserId)
|
||||||
if (users == nil) then
|
if (users == nil) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -13,27 +13,33 @@ local drawScoreboard = function (users)
|
||||||
gfx.FontSize(32)
|
gfx.FontSize(32)
|
||||||
|
|
||||||
local x = 16;
|
local x = 16;
|
||||||
local y = 500;
|
local basey = 510;
|
||||||
|
|
||||||
gfx.LoadSkinFont("Digital-Serial-Bold.ttf")
|
gfx.LoadSkinFont("Digital-Serial-Bold.ttf")
|
||||||
|
|
||||||
for i, u in ipairs(users) do
|
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.FontSize(26)
|
||||||
gfx.Text(u.name, x, y)
|
gfx.Text('#' .. i .. ' ' .. u.name, x, y)
|
||||||
|
|
||||||
gfx.FontSize(26)
|
gfx.FontSize(26)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
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
|
local lastFourDigits = ((u.score / 10000) - math.floor(u.score / 10000))*10000
|
||||||
gfx.FontSize(22)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
local render = function (deltaTime, users)
|
local render = function (deltaTime, users, currentUserId)
|
||||||
local resx, resy = game.GetResolution();
|
local resx, resy = game.GetResolution();
|
||||||
if (resx > resy) then
|
if (resx > resy) then
|
||||||
return
|
return
|
||||||
|
@ -54,7 +60,7 @@ local render = function (deltaTime, users)
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
drawScoreboard(users);
|
drawScoreboard(users, currentUserId);
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue