From 65e3e5d0a52b7adfecc5f34073bee3cfe39e46ab Mon Sep 17 00:00:00 2001 From: FajsiEx Date: Mon, 16 Aug 2021 18:41:44 +0200 Subject: [PATCH] + gauge fill to results --- scripts/result.lua | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/scripts/result.lua b/scripts/result.lua index 1490dd3..5083e3a 100644 --- a/scripts/result.lua +++ b/scripts/result.lua @@ -46,6 +46,13 @@ local gaugeTypeBadgeImages = { gfx.CreateSkinImage("result/gauge_type_badges/effective.png", 0), } +local gaugeEffFailFillImage = gfx.CreateSkinImage("gameplay/gauges/effective/gauge_fill_fail.png", 0) +local gaugeEffPassFillImage = gfx.CreateSkinImage("gameplay/gauges/effective/gauge_fill_pass.png", 0) +local gaugeExcFillImage = gfx.CreateSkinImage("gameplay/gauges/excessive/gauge_fill.png", 0) +local gaugePermFillImage = gfx.CreateSkinImage("gameplay/gauges/permissive/gauge_fill.png", 0) +local gaugeBlastiveFillImage = gfx.CreateSkinImage("gameplay/gauges/blastive/gauge_fill.png", 0) + + local difficultyLabelImages = { gfx.CreateSkinImage("diff/1 novice.png", 0), gfx.CreateSkinImage("diff/2 advanced.png", 0), @@ -263,6 +270,57 @@ local drawRightPanelContent = function() -- Draw gauge % gfx.FontSize(24) gfx.Text(math.floor(result.gauge * 100) .. '%', rightPanelX + 984, rightPanelY + 295); + + -- Draw gauge fill + local gaugeFillImage = gaugeEffPassFillImage; + local gaugeBreakpoint = 0; + + if result.gauge_type == 0 then + gaugeBreakpoint = 0.7; + + if result.gauge <= 0.7 then + gaugeFillImage = gaugeEffFailFillImage; + else + gaugeFillImage = gaugeEffPassFillImage; + end + + elseif result.gauge_type == 1 then + gaugeFillImage = gaugeExcFillImage; + gaugeBreakpoint = 0.3; + elseif result.gauge_type == 2 then + gaugeFillImage = gaugePermFillImage; + elseif result.gauge_type == 3 then -- BLASTIVE RATE + gaugeFillImage = gaugeBlastiveFillImage; + end + + local gaugePosX = rightPanelX+1027; + local gaugePosY = rightPanelY+309; + local FillW, FillH = 9, 236; + + gfx.BeginPath(); + gfx.Scissor(gaugePosX, gaugePosY+(FillH-(FillH*(result.gauge))), FillW, FillH*(result.gauge)) + gfx.ImageRect(gaugePosX, gaugePosY, FillW, FillH, gaugeFillImage, 1, 0); + gfx.ResetScissor(); + + + -- Draw the breakpoint line if needed + if (gaugeBreakpoint > 0) then + gfx.Save() + gfx.BeginPath() + gfx.GlobalAlpha(0.75); + + local lineY = gaugePosY+(FillH-(FillH*(gaugeBreakpoint))) + + gfx.MoveTo(gaugePosX, lineY) + gfx.LineTo(gaugePosX+10, lineY) + + gfx.StrokeWidth(2) + gfx.StrokeColor(255,255,255) + gfx.Stroke() + + gfx.ClosePath() + gfx.Restore() + end -- Draw err/early/critical/late/err texts