+ best badge to results with highscores

This commit is contained in:
FajsiEx 2021-07-28 22:25:26 +02:00
parent 10416a2882
commit 79e9a15ef6
3 changed files with 15 additions and 6 deletions

View File

@ -15,6 +15,8 @@ local bottomPanelImage = gfx.CreateSkinImage("result/panels/bottom.png", 0);
local defaultJacketImage = gfx.CreateSkinImage("result/default_jacket.png", 0); local defaultJacketImage = gfx.CreateSkinImage("result/default_jacket.png", 0);
local bestScoreBadgeImage = gfx.CreateSkinImage("result/best.png", 0);
local appealCardImage = gfx.CreateSkinImage("appeal_card.png", 0); local appealCardImage = gfx.CreateSkinImage("appeal_card.png", 0);
local danBadgeImage = gfx.CreateSkinImage("dan/inf.png", 0); local danBadgeImage = gfx.CreateSkinImage("dan/inf.png", 0);
local volforceBadgeImage = gfx.CreateSkinImage("volforce/10.png", 0); local volforceBadgeImage = gfx.CreateSkinImage("volforce/10.png", 0);
@ -175,6 +177,13 @@ end
local scoreNumber = load_number_image("score_num"); local scoreNumber = load_number_image("score_num");
local drawRightPanelContent = function() local drawRightPanelContent = function()
local highScoreScore = 0;
if highScore then
highScoreScore = highScore.score
end
local highScoreDelta = result.score - highScoreScore
-- Draw song name and artist -- Draw song name and artist
gfx.FontSize(28) gfx.FontSize(28)
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
@ -185,6 +194,12 @@ local drawRightPanelContent = function()
draw_number(rightPanelX+580, rightPanelY+192, 1.0, math.floor(result.score / 10000), 4, scoreNumber, true, 0.42, 1.12) draw_number(rightPanelX+580, rightPanelY+192, 1.0, math.floor(result.score / 10000), 4, scoreNumber, true, 0.42, 1.12)
draw_number(rightPanelX+768, rightPanelY+202, 1.0, result.score, 4, scoreNumber, true, 0.25, 1.12) draw_number(rightPanelX+768, rightPanelY+202, 1.0, result.score, 4, scoreNumber, true, 0.25, 1.12)
-- If this is the highscore, draw over the glowing best badge
if highScoreDelta > 0 then
gfx.BeginPath();
gfx.ImageRect(rightPanelX+364, rightPanelY+167, 97, 53, bestScoreBadgeImage, 1, 0);
end
-- Draw grade -- Draw grade
local gradeImageKey = string.gsub(result.grade, '+', '_P'); local gradeImageKey = string.gsub(result.grade, '+', '_P');
local gradeImage = gradeImages[gradeImageKey] or gradeImages.D local gradeImage = gradeImages[gradeImageKey] or gradeImages.D
@ -196,12 +211,6 @@ local drawRightPanelContent = function()
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE) gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE)
gfx.LoadSkinFont('Digital-Serial-Bold.ttf') gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
local highScoreScore = 0;
if highScore then
highScoreScore = highScore.score
end
local highScoreDelta = result.score - highScoreScore
local deltaPrefix = '-' local deltaPrefix = '-'
if highScoreDelta > 0 then if highScoreDelta > 0 then
deltaPrefix = '+' deltaPrefix = '+'

BIN
textures/result/best.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 174 KiB