+ hit stats to results screen (without longs and vols and the chart)
This commit is contained in:
parent
45f32eefa4
commit
8a2529d6db
|
@ -6,17 +6,20 @@ local desh = 1920
|
||||||
|
|
||||||
local bgSfxPlayed = false;
|
local bgSfxPlayed = false;
|
||||||
|
|
||||||
local backgroundImage = gfx.CreateSkinImage("bg.png", 1);
|
local backgroundImage = gfx.CreateSkinImage("bg.png", 0);
|
||||||
|
|
||||||
local topBarImage = gfx.CreateSkinImage("result/top_bar.png", 1);
|
local topBarImage = gfx.CreateSkinImage("result/top_bar.png", 0);
|
||||||
local jacketPanelImage = gfx.CreateSkinImage("result/panels/jacket.png", 1);
|
local jacketPanelImage = gfx.CreateSkinImage("result/panels/jacket.png", 0);
|
||||||
local rightPanelImage = gfx.CreateSkinImage("result/panels/right.png", 1);
|
local rightPanelImage = gfx.CreateSkinImage("result/panels/right.png", 0);
|
||||||
local bottomPanelImage = gfx.CreateSkinImage("result/panels/bottom.png", 1);
|
local bottomPanelImage = gfx.CreateSkinImage("result/panels/bottom.png", 0);
|
||||||
|
|
||||||
local jacketImage = gfx.CreateSkinImage("result/default_jacket.png", 1);
|
local jacketImage = gfx.CreateSkinImage("result/default_jacket.png", 0);
|
||||||
|
|
||||||
local transitionEnterScale = 0;
|
local transitionEnterScale = 0;
|
||||||
|
|
||||||
|
local rightPanelX = 0;
|
||||||
|
local rightPanelY = 850;
|
||||||
|
|
||||||
local jacketPanelX = 0;
|
local jacketPanelX = 0;
|
||||||
local jacketPanelY = 820;
|
local jacketPanelY = 820;
|
||||||
|
|
||||||
|
@ -24,6 +27,29 @@ 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 earlyLateBarsStats = {
|
||||||
|
earlyErrors = 0;
|
||||||
|
earlyNears = 0;
|
||||||
|
criticals = 0;
|
||||||
|
lateNears = 0;
|
||||||
|
lateErrors = 0;
|
||||||
|
};
|
||||||
|
local objectTypeTimingStats = {
|
||||||
|
chip = {
|
||||||
|
criticals = 0,
|
||||||
|
nears = 0,
|
||||||
|
errors = 0,
|
||||||
|
},
|
||||||
|
long = {
|
||||||
|
criticals = 0,
|
||||||
|
errors = 0,
|
||||||
|
},
|
||||||
|
vol = {
|
||||||
|
criticals = 0,
|
||||||
|
errors = 0,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
game.LoadSkinSample("result")
|
game.LoadSkinSample("result")
|
||||||
|
|
||||||
function resetLayoutInformation()
|
function resetLayoutInformation()
|
||||||
|
@ -47,7 +73,6 @@ local drawTopBar = function()
|
||||||
local tw, th = gfx.ImageSize(topBarImage);
|
local tw, th = gfx.ImageSize(topBarImage);
|
||||||
gfx.ImageRect(0, -th * (1 - Easing.outQuad(transitionEnterScale)), desw, th,
|
gfx.ImageRect(0, -th * (1 - Easing.outQuad(transitionEnterScale)), desw, th,
|
||||||
topBarImage, 1, 0);
|
topBarImage, 1, 0);
|
||||||
gfx.ClosePath();
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,16 +81,48 @@ local drawRightPanel = function()
|
||||||
local tw, th = gfx.ImageSize(rightPanelImage);
|
local tw, th = gfx.ImageSize(rightPanelImage);
|
||||||
|
|
||||||
gfx.ImageRect(
|
gfx.ImageRect(
|
||||||
0+(RIGHT_PANEL_TRANSTION_ENTER_OFFSET * (1 - Easing.outQuad(transitionEnterScale))),
|
rightPanelX,
|
||||||
850,
|
rightPanelY,
|
||||||
tw,
|
tw,
|
||||||
th,
|
th,
|
||||||
rightPanelImage,
|
rightPanelImage,
|
||||||
Easing.outQuad(transitionEnterScale),
|
Easing.outQuad(transitionEnterScale),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
end
|
||||||
|
|
||||||
gfx.ClosePath();
|
local drawRightPanelContent = function ()
|
||||||
|
|
||||||
|
-- Draw song name and artist
|
||||||
|
gfx.FontSize(28)
|
||||||
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
||||||
|
gfx.Text(result.realTitle, rightPanelX + 435, rightPanelY + 108);
|
||||||
|
gfx.Text(result.artist, rightPanelX + 435, rightPanelY + 143);
|
||||||
|
|
||||||
|
-- Draw err/early/critical/late/err texts
|
||||||
|
gfx.FontSize(24)
|
||||||
|
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE)
|
||||||
|
gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
|
||||||
|
|
||||||
|
gfx.Text(earlyLateBarsStats.earlyErrors, rightPanelX + 683, rightPanelY + 370);
|
||||||
|
gfx.Text(earlyLateBarsStats.earlyNears, rightPanelX + 683, rightPanelY + 401);
|
||||||
|
gfx.Text(earlyLateBarsStats.criticals, rightPanelX + 683, rightPanelY + 432);
|
||||||
|
gfx.Text(earlyLateBarsStats.lateNears, rightPanelX + 683, rightPanelY + 463);
|
||||||
|
gfx.Text(earlyLateBarsStats.lateErrors, rightPanelX + 683, rightPanelY + 494);
|
||||||
|
|
||||||
|
-- Draw hit stats based on objects
|
||||||
|
-- CHIP
|
||||||
|
gfx.Text(objectTypeTimingStats.chip.criticals, rightPanelX + 255, rightPanelY + 365);
|
||||||
|
gfx.Text(objectTypeTimingStats.chip.nears, rightPanelX + 255, rightPanelY + 395);
|
||||||
|
gfx.Text(objectTypeTimingStats.chip.errors, rightPanelX + 255, rightPanelY + 425);
|
||||||
|
-- LONG
|
||||||
|
gfx.Text('???', rightPanelX + 333, rightPanelY + 365);
|
||||||
|
gfx.Text('-', rightPanelX + 333, rightPanelY + 395);
|
||||||
|
gfx.Text('???', rightPanelX + 333, rightPanelY + 425);
|
||||||
|
-- VOL
|
||||||
|
gfx.Text('???', rightPanelX + 411, rightPanelY + 365);
|
||||||
|
gfx.Text('-', rightPanelX + 411, rightPanelY + 395);
|
||||||
|
gfx.Text('???', rightPanelX + 411, rightPanelY + 425);
|
||||||
end
|
end
|
||||||
|
|
||||||
local drawBottomPanel = function ()
|
local drawBottomPanel = function ()
|
||||||
|
@ -81,8 +138,6 @@ local drawBottomPanel = function ()
|
||||||
Easing.outQuad(transitionEnterScale),
|
Easing.outQuad(transitionEnterScale),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
gfx.ClosePath();
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local drawJacketPanel = function()
|
local drawJacketPanel = function()
|
||||||
|
@ -98,12 +153,10 @@ local drawJacketPanel = function()
|
||||||
Easing.outQuad(transitionEnterScale),
|
Easing.outQuad(transitionEnterScale),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
gfx.ClosePath();
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local drawJacketPanelContent = function ()
|
local drawJacketPanelContent = function ()
|
||||||
gfx.BeginPath()
|
gfx.BeginPath();
|
||||||
gfx.ImageRect(
|
gfx.ImageRect(
|
||||||
jacketPanelX+12,
|
jacketPanelX+12,
|
||||||
jacketPanelY+26,
|
jacketPanelY+26,
|
||||||
|
@ -113,7 +166,6 @@ local drawJacketPanelContent = function ()
|
||||||
Easing.outQuad(transitionEnterScale),
|
Easing.outQuad(transitionEnterScale),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
gfx.ClosePath()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local tickTransitions = function(deltaTime)
|
local tickTransitions = function(deltaTime)
|
||||||
|
@ -124,17 +176,55 @@ local tickTransitions = function(deltaTime)
|
||||||
transitionEnterScale = 1
|
transitionEnterScale = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rightPanelX = 0+(RIGHT_PANEL_TRANSTION_ENTER_OFFSET * (1 - Easing.outQuad(transitionEnterScale)))
|
||||||
jacketPanelX = 40 + (JACKET_PANEL_TRANSTION_ENTER_OFFSET * (1 - Easing.outQuad(transitionEnterScale)))
|
jacketPanelX = 40 + (JACKET_PANEL_TRANSTION_ENTER_OFFSET * (1 - Easing.outQuad(transitionEnterScale)))
|
||||||
end
|
end
|
||||||
|
|
||||||
result_set = function ()
|
result_set = function ()
|
||||||
if result.jacketPath ~= nil and result.jacketPath ~= "" then
|
if result.jacketPath ~= nil and result.jacketPath ~= "" then
|
||||||
jacketImage = gfx.CreateImage(result.jacketPath, 1)
|
jacketImage = gfx.CreateImage(result.jacketPath, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- This only counts the "CHIP" objects, not LONGs or LAZERs
|
||||||
|
for hitStatIndex = 1, #result.noteHitStats do
|
||||||
|
local hitStat = result.noteHitStats[hitStatIndex];
|
||||||
|
|
||||||
|
if (hitStat.rating == 0) then -- Miss
|
||||||
|
objectTypeTimingStats.chip.errors = objectTypeTimingStats.chip.errors + 1;
|
||||||
|
|
||||||
|
if hitStat.delta < 0 then
|
||||||
|
earlyLateBarsStats.earlyErrors = earlyLateBarsStats.earlyErrors + 1;
|
||||||
|
else
|
||||||
|
earlyLateBarsStats.lateErrors = earlyLateBarsStats.lateErrors + 1;
|
||||||
|
end
|
||||||
|
elseif hitStat.rating == 1 then
|
||||||
|
objectTypeTimingStats.chip.nears = objectTypeTimingStats.chip.nears + 1;
|
||||||
|
|
||||||
|
if hitStat.delta < 0 then
|
||||||
|
earlyLateBarsStats.earlyNears = earlyLateBarsStats.earlyNears + 1;
|
||||||
|
else
|
||||||
|
earlyLateBarsStats.lateNears = earlyLateBarsStats.lateNears + 1;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
objectTypeTimingStats.chip.criticals = objectTypeTimingStats.chip.criticals + 1;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- misses on LONGs or LAZERs are automatically late errors
|
||||||
|
-- so we add errors that are not ealy or late to late errors
|
||||||
|
earlyLateBarsStats.lateErrors = earlyLateBarsStats.lateErrors + (result.misses - earlyLateBarsStats.lateErrors - earlyLateBarsStats.earlyErrors)
|
||||||
|
|
||||||
|
-- criticals are same for all objects so we just copy them from results
|
||||||
|
earlyLateBarsStats.criticals = result.perfects
|
||||||
|
end
|
||||||
|
|
||||||
render = function(deltaTime, showStats)
|
render = function(deltaTime, showStats)
|
||||||
|
gfx.Save();
|
||||||
resetLayoutInformation()
|
resetLayoutInformation()
|
||||||
|
gfx.ResetTransform();
|
||||||
|
gfx.ResetScissor();
|
||||||
|
|
||||||
|
gfx.BeginPath()
|
||||||
gfx.Scale(scale, scale)
|
gfx.Scale(scale, scale)
|
||||||
|
|
||||||
gfx.ImageRect(0, 0, desw, desh, backgroundImage, 1, 0);
|
gfx.ImageRect(0, 0, desw, desh, backgroundImage, 1, 0);
|
||||||
|
@ -142,15 +232,19 @@ render = function(deltaTime, showStats)
|
||||||
drawTopBar()
|
drawTopBar()
|
||||||
drawBottomPanel()
|
drawBottomPanel()
|
||||||
drawRightPanel()
|
drawRightPanel()
|
||||||
|
drawRightPanelContent()
|
||||||
drawJacketPanel()
|
drawJacketPanel()
|
||||||
drawJacketPanelContent()
|
drawJacketPanelContent()
|
||||||
|
|
||||||
handleSfx()
|
handleSfx()
|
||||||
|
|
||||||
-- debug
|
-- debug
|
||||||
|
gfx.FontSize(18)
|
||||||
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
|
||||||
gfx.Text('DELTA: ' .. deltaTime .. ' // TRANSITION_ENTER_SCALE: ' ..
|
gfx.Text('DELTA: ' .. deltaTime .. ' // TRANSITION_ENTER_SCALE: ' ..
|
||||||
transitionEnterScale .. ' // EASING_OUT_QUAD: ' ..
|
transitionEnterScale .. ' // EASING_OUT_QUAD: ' ..
|
||||||
Easing.outQuad(transitionEnterScale), 255, 255);
|
Easing.outQuad(transitionEnterScale), 8, 8);
|
||||||
|
|
||||||
tickTransitions(deltaTime)
|
tickTransitions(deltaTime)
|
||||||
|
gfx.Restore();
|
||||||
end
|
end
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Loading…
Reference in New Issue