Merge pull request 'feature/TASK-26-timing-windows' (#13) from feature/TASK-26-timing-windows into master

Reviewed-on: #13
This commit is contained in:
Kuenaimaku 2022-03-27 01:27:22 +00:00
commit 20700c4631
2 changed files with 71 additions and 0 deletions

View File

@ -180,6 +180,13 @@ local irText = ''
game.LoadSkinSample("result") game.LoadSkinSample("result")
game.LoadSkinSample("shutter") game.LoadSkinSample("shutter")
local function isHard(result)
if result.flags == nil then
return result.gauge_type == 1
end
return result.flags & 1 == 1
end
local handleSfx = function() local handleSfx = function()
if not bgSfxPlayed then if not bgSfxPlayed then
game.PlaySample("result", true) game.PlaySample("result", true)
@ -188,6 +195,55 @@ local handleSfx = function()
end end
end end
local drawGraph = function(x,y,w,h)
if isHard(result) then
gfx.BeginPath()
gfx.Rect(x,y,w,103)
gfx.FillColor(26,26,26,255)
gfx.Fill()
gfx.FillColor(255,255,255,255)
else
gfx.BeginPath()
gfx.Rect(x,y,w,h-68)
gfx.FillColor(55,27,51,255)
gfx.Fill()
gfx.BeginPath()
gfx.Rect(x,y+30,w,72)
gfx.FillColor(7,24,28,255)
gfx.Fill()
gfx.FillColor(255,255,255,255)
end
gfx.BeginPath()
gfx.MoveTo(x,y + h + 2 - h * result.gaugeSamples[1])
for i = 2, #result.gaugeSamples do
gfx.LineTo(x + i * w / #result.gaugeSamples,y + h + 2 - h * result.gaugeSamples[i])
end
if isHard(result) then
gfx.StrokeWidth(3)
gfx.StrokeColor(232,163,10)
gfx.Stroke()
gfx.Scissor(x, y + h *0.01, w, h*0.98)
gfx.Stroke()
gfx.ResetScissor()
gfx.Scissor(x, y + h * 0.99, w, (h * 0.03) + 4)
gfx.StrokeColor(255,0,0)
gfx.Stroke()
gfx.ResetScissor()
else
gfx.StrokeWidth(3)
gfx.StrokeColor(46,211,241)
gfx.Scissor(x, y + h * 0.3, w, (h * 0.7) + 4)
gfx.Stroke()
gfx.ResetScissor()
gfx.Scissor(x, y, w, h*0.3)
gfx.StrokeColor(215,48,182)
gfx.Stroke()
gfx.ResetScissor()
end
end
function drawTimingBar(y, value, max, type) function drawTimingBar(y, value, max, type)
gfx.BeginPath(); gfx.BeginPath();
@ -516,8 +572,23 @@ local drawBottomPanelContent = function(deltatime)
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE) gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE)
gfx.Text(result.medianHitDelta.." ms", rightX, baseY); gfx.Text(result.medianHitDelta.." ms", rightX, baseY);
gfx.Text(math.floor(result.meanHitDelta).." ms", rightX, baseY + detailTextMargin); gfx.Text(math.floor(result.meanHitDelta).." ms", rightX, baseY + detailTextMargin);
--Draw Graph
drawGraph(leftX-22, baseY-18, 454, 98);
--draw Recommended Offset
local delta = math.floor(result.medianHitDelta);
local songOffset = 0;
if (songOffset == nil) then songOffset = 0; end
local offset = tonumber(songOffset) + delta;
gfx.FillColor(255,255,255,255);
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_TOP)
gfx.Text('RECOMMENDED SONG OFFSET:', leftX + 367, baseY + 89);
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.Text(string.format("%dms", offset), leftX + 370, baseY + 89);
end end
local drawJacketPanel = function() local drawJacketPanel = function()
gfx.BeginPath(); gfx.BeginPath();
local tw, th = gfx.ImageSize(jacketPanelImage); local tw, th = gfx.ImageSize(jacketPanelImage);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 210 KiB