HitFX, Early/Late display with ms #35
|
@ -31,9 +31,9 @@ local earlyLatePosition = game.GetSkinSetting("gameplay_earlyLatePosition")
|
|||
|
||||
local EarlyLate = {
|
||||
timer = 0,
|
||||
lastMillisec = 0,
|
||||
showEarlyLate = false,
|
||||
showMillisec = false,
|
||||
color = {},
|
||||
earlyLateText = "",
|
||||
millisecText = ""
|
||||
}
|
||||
|
||||
function EarlyLate.render(deltaTime)
|
||||
|
@ -49,7 +49,7 @@ function EarlyLate.render(deltaTime)
|
|||
local desh, fractionTable
|
||||
|
||||
if screenH > screenW then
|
||||
desh = 1920
|
||||
desh = 1600
|
||||
fractionTable = portraitHeightFractions
|
||||
else
|
||||
desh = 1080
|
||||
|
@ -63,41 +63,47 @@ function EarlyLate.render(deltaTime)
|
|||
gfx.LoadSkinFont("Digital-Serial-ExtraBold.ttf")
|
||||
gfx.FontSize(20 * scale)
|
||||
|
||||
if EarlyLate.showEarlyLate then
|
||||
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_BASELINE)
|
||||
local color = EarlyLate.color
|
||||
gfx.FillColor(color[1], color[2], color[3])
|
||||
|
||||
if EarlyLate.lastMillisec < 0 then
|
||||
gfx.FillColor(206, 94, 135)
|
||||
gfx.FastText("EARLY", screenCenterX - 100 * scale, y)
|
||||
else
|
||||
gfx.FillColor(53, 102, 197)
|
||||
gfx.FastText("LATE", screenCenterX - 100 * scale, y)
|
||||
end
|
||||
end
|
||||
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_BASELINE)
|
||||
|
||||
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
|
||||
gfx.FastText(EarlyLate.earlyLateText, screenCenterX - 100 * scale, y)
|
||||
gfx.FastText(EarlyLate.millisecText, screenCenterX + 100 * scale, y)
|
||||
end
|
||||
|
||||
function EarlyLate.TriggerAnimation(rating, millisec)
|
||||
local showEarlyLate = rating <= earlyLateFor
|
||||
local showMillisec = rating <= msFor
|
||||
local isEarly = millisec < 0
|
||||
|
||||
if showEarlyLate or showMillisec then
|
||||
EarlyLate.timer = 120
|
||||
EarlyLate.lastMillisec = millisec
|
||||
EarlyLate.showEarlyLate = showEarlyLate
|
||||
EarlyLate.showMillisec = showMillisec
|
||||
if millisec == 0 then return end
|
||||
if not showEarlyLate and not showMillisec then return end
|
||||
|
||||
if showEarlyLate then
|
||||
EarlyLate.earlyLateText = isEarly and "EARLY" or "LATE"
|
||||
else
|
||||
EarlyLate.earlyLateText = ""
|
||||
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
|
||||
|
||||
return EarlyLate
|
Loading…
Reference in New Issue