+ best score and best score delta to results & / crash when chart has no jacket

This commit is contained in:
FajsiEx 2021-07-28 17:12:04 +02:00
parent d0042a11ad
commit de7101682d
1 changed files with 27 additions and 4 deletions

View File

@ -13,7 +13,7 @@ local jacketPanelImage = gfx.CreateSkinImage("result/panels/jacket.png", 0);
local rightPanelImage = gfx.CreateSkinImage("result/panels/right.png", 0); local rightPanelImage = gfx.CreateSkinImage("result/panels/right.png", 0);
local bottomPanelImage = gfx.CreateSkinImage("result/panels/bottom.png", 0); local bottomPanelImage = gfx.CreateSkinImage("result/panels/bottom.png", 0);
local jacketImage = gfx.CreateSkinImage("result/default_jacket.png", 0); local defaultJacketImage = gfx.CreateSkinImage("result/default_jacket.png", 0);
local gradeImages = { local gradeImages = {
S = gfx.CreateSkinImage("score/S.png", 0), S = gfx.CreateSkinImage("score/S.png", 0),
@ -44,6 +44,8 @@ local JACKET_PANEL_TRANSTION_ENTER_OFFSET = -128;
local RIGHT_PANEL_TRANSTION_ENTER_OFFSET = 128; local RIGHT_PANEL_TRANSTION_ENTER_OFFSET = 128;
local BOTTOM_PANEL_TRANSTION_ENTER_OFFSET = 128; local BOTTOM_PANEL_TRANSTION_ENTER_OFFSET = 128;
local highScore;
local earlyLateBarsStats = { local earlyLateBarsStats = {
earlyErrors = 0, earlyErrors = 0,
earlyNears = 0, earlyNears = 0,
@ -57,6 +59,7 @@ local objectTypeTimingStats = {
vol = {criticals = 0, errors = 0} vol = {criticals = 0, errors = 0}
} }
game.LoadSkinSample("result") game.LoadSkinSample("result")
function resetLayoutInformation() function resetLayoutInformation()
@ -172,11 +175,29 @@ local drawRightPanelContent = function()
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(rightPanelX+890, rightPanelY+130, 85, 85, gradeImage, 1, 0); gfx.ImageRect(rightPanelX+890, rightPanelY+130, 85, 85, gradeImage, 1, 0);
-- Draw err/early/critical/late/err texts -- Draw best score
gfx.FontSize(24) gfx.FontSize(20)
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 = '-'
if highScoreDelta > 0 then
deltaPrefix = '+'
end
highScoreDelta = math.abs(highScoreDelta);
gfx.Text(string.format("%08d", highScoreScore), rightPanelX + 962, rightPanelY + 239);
gfx.Text(deltaPrefix .. string.format("%08d", highScoreDelta), rightPanelX + 962, rightPanelY + 259);
-- Draw err/early/critical/late/err texts
gfx.FontSize(24)
gfx.Text(earlyLateBarsStats.earlyErrors, rightPanelX + 683, gfx.Text(earlyLateBarsStats.earlyErrors, rightPanelX + 683,
rightPanelY + 370); rightPanelY + 370);
gfx.Text(earlyLateBarsStats.earlyNears, rightPanelX + 683, rightPanelY + 401); gfx.Text(earlyLateBarsStats.earlyNears, rightPanelX + 683, rightPanelY + 401);
@ -238,7 +259,7 @@ end
local drawJacketPanelContent = function() local drawJacketPanelContent = function()
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(jacketPanelX + 12, jacketPanelY + 26, 273, 273, jacketImage, gfx.ImageRect(jacketPanelX + 12, jacketPanelY + 26, 273, 273, jacketImage or defaultJacketImage,
Easing.outQuad(transitionEnterScale), 0); Easing.outQuad(transitionEnterScale), 0);
end end
@ -262,6 +283,8 @@ result_set = function()
jacketImage = gfx.CreateImage(result.jacketPath, 0) jacketImage = gfx.CreateImage(result.jacketPath, 0)
end end
highScore = result.highScores[1];
-- This only counts the "CHIP" objects, not LONGs or LAZERs -- This only counts the "CHIP" objects, not LONGs or LAZERs
for hitStatIndex = 1, #result.noteHitStats do for hitStatIndex = 1, #result.noteHitStats do
local hitStat = result.noteHitStats[hitStatIndex]; local hitStat = result.noteHitStats[hitStatIndex];