Compare commits

...

2 Commits

Author SHA1 Message Date
domdoc 96f331e1e3 Fixed Early/Late text or ms show when it shouldn't 2022-05-26 12:21:11 +02:00
domdoc e5594c5978 Adjusted STANDARD Early/Late position 2022-05-26 12:00:22 +02:00
1 changed files with 39 additions and 33 deletions

View File

@ -14,14 +14,14 @@ local compare = {
local portraitHeightFractions = { local portraitHeightFractions = {
["UPPER+"] = 2.4, ["UPPER+"] = 2.4,
["UPPER"] = 3, ["UPPER"] = 3,
["STANDARD"] = 4, ["STANDARD"] = 4.2,
["LOWER"] = 5.3, ["LOWER"] = 5.3,
} }
local landscapeHeightFractions = { local landscapeHeightFractions = {
["UPPER+"] = 1.5, ["UPPER+"] = 1.5,
["UPPER"] = 2.7, ["UPPER"] = 2.7,
["STANDARD"] = 5.1, ["STANDARD"] = 4.1,
["LOWER"] = 6.7, ["LOWER"] = 6.7,
} }
@ -31,9 +31,9 @@ local earlyLatePosition = game.GetSkinSetting("gameplay_earlyLatePosition")
local EarlyLate = { local EarlyLate = {
timer = 0, timer = 0,
lastMillisec = 0, color = {},
showEarlyLate = false, earlyLateText = "",
showMillisec = false, millisecText = ""
} }
function EarlyLate.render(deltaTime) function EarlyLate.render(deltaTime)
@ -49,7 +49,7 @@ function EarlyLate.render(deltaTime)
local desh, fractionTable local desh, fractionTable
if screenH > screenW then if screenH > screenW then
desh = 1920 desh = 1600
fractionTable = portraitHeightFractions fractionTable = portraitHeightFractions
else else
desh = 1080 desh = 1080
@ -63,41 +63,47 @@ function EarlyLate.render(deltaTime)
gfx.LoadSkinFont("Digital-Serial-ExtraBold.ttf") gfx.LoadSkinFont("Digital-Serial-ExtraBold.ttf")
gfx.FontSize(20 * scale) gfx.FontSize(20 * scale)
if EarlyLate.showEarlyLate then local color = EarlyLate.color
gfx.FillColor(color[1], color[2], color[3])
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_BASELINE) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_BASELINE)
if EarlyLate.lastMillisec < 0 then gfx.FastText(EarlyLate.earlyLateText, screenCenterX - 100 * scale, y)
gfx.FillColor(206, 94, 135) gfx.FastText(EarlyLate.millisecText, screenCenterX + 100 * scale, y)
gfx.FastText("EARLY", screenCenterX - 100 * scale, y)
else
gfx.FillColor(53, 102, 197)
gfx.FastText("LATE", screenCenterX - 100 * scale, y)
end
end
if EarlyLate.showMillisec then
local msString = string.format("%dms", EarlyLate.lastMillisec)
if EarlyLate.lastMillisec >= 0 then
msString = "+"..msString -- prepend + sign for lates
end
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_BASELINE)
gfx.FastText(msString, screenCenterX + 100 * scale, y)
end
end end
function EarlyLate.TriggerAnimation(rating, millisec) function EarlyLate.TriggerAnimation(rating, millisec)
local showEarlyLate = rating <= earlyLateFor local showEarlyLate = rating <= earlyLateFor
local showMillisec = rating <= msFor local showMillisec = rating <= msFor
local isEarly = millisec < 0
if showEarlyLate or showMillisec then if millisec == 0 then return end
EarlyLate.timer = 120 if not showEarlyLate and not showMillisec then return end
EarlyLate.lastMillisec = millisec
EarlyLate.showEarlyLate = showEarlyLate if showEarlyLate then
EarlyLate.showMillisec = showMillisec EarlyLate.earlyLateText = isEarly and "EARLY" or "LATE"
else
EarlyLate.earlyLateText = ""
end end
if showMillisec then
local millisecText = string.format("%dms", millisec)
-- prepend + sign for lates
millisecText = isEarly and millisecText or "+"..millisecText
EarlyLate.millisecText = millisecText
else
EarlyLate.millisecText = ""
end
if isEarly then
EarlyLate.color = {206, 94, 135}
else
EarlyLate.color = {53, 102, 197}
end
EarlyLate.timer = 120
end end
return EarlyLate return EarlyLate