2021-10-09 22:09:25 +02:00
|
|
|
|
|
|
|
local VolforceWindow = require('components.volforceWindow');
|
|
|
|
|
|
|
|
local desw = 1080;
|
|
|
|
local desh = 1920;
|
|
|
|
|
2021-11-25 19:38:59 +01:00
|
|
|
local isLandscape = false;
|
|
|
|
|
2021-10-09 22:09:25 +02:00
|
|
|
local bgImage = gfx.CreateSkinImage("gameplay/user_panel/bg.png", 0);
|
|
|
|
|
2021-10-25 21:39:16 +02:00
|
|
|
local appealCardImage = gfx.CreateSkinImage("crew/appeal_card.png", 0);
|
2021-10-09 22:14:24 +02:00
|
|
|
local danBadgeImage = gfx.CreateSkinImage("dan.png", 0);
|
2021-10-25 21:39:16 +02:00
|
|
|
local idolFrameImage = gfx.CreateSkinImage("crew/frame.png", 0);
|
2021-10-09 22:14:24 +02:00
|
|
|
|
2021-10-09 22:09:25 +02:00
|
|
|
|
2021-10-09 22:21:48 +02:00
|
|
|
local username = game.GetSkinSetting('username') or '';
|
|
|
|
|
2021-11-25 19:38:59 +01:00
|
|
|
local drawBestDiff = function (deltaTime, score, bestReplay, y)
|
2021-10-28 18:28:49 +02:00
|
|
|
if not bestReplay then return end
|
|
|
|
|
|
|
|
-- Calculate the difference between current and best play
|
|
|
|
local difference = score - bestReplay.currentScore
|
|
|
|
local prefix = "=" -- used to properly display negative values
|
|
|
|
|
|
|
|
gfx.BeginPath()
|
|
|
|
gfx.FontSize(26)
|
|
|
|
|
|
|
|
gfx.FillColor(255, 255, 255)
|
|
|
|
if difference < 0 then
|
|
|
|
-- If we're behind the best score, separate the minus sign and change the color
|
|
|
|
gfx.FillColor(255, 90, 70)
|
|
|
|
difference = math.abs(difference)
|
|
|
|
prefix = "-"
|
|
|
|
|
|
|
|
elseif difference > 0 then
|
|
|
|
gfx.FillColor(120, 146, 218)
|
|
|
|
difference = math.abs(difference)
|
|
|
|
prefix = "+"
|
|
|
|
end
|
|
|
|
|
|
|
|
gfx.LoadSkinFont("Digital-Serial-Bold.ttf")
|
|
|
|
gfx.FontSize(26)
|
|
|
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
2021-11-25 19:38:59 +01:00
|
|
|
gfx.Text(prefix, 130, y+177)
|
|
|
|
gfx.Text(string.format("%04d", math.floor(difference/10000)), 150, y+177)
|
2021-10-28 18:28:49 +02:00
|
|
|
|
|
|
|
local lastFourDigits = ((difference / 10000) - math.floor(difference / 10000))*10000
|
|
|
|
gfx.FontSize(22)
|
2021-11-25 19:38:59 +01:00
|
|
|
gfx.Text(string.format("%04d", math.floor(lastFourDigits)), 208, y+178)
|
2021-10-28 18:28:49 +02:00
|
|
|
end
|
|
|
|
|
2021-10-09 22:09:25 +02:00
|
|
|
local tickTransitions = function (deltaTime)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2021-10-28 18:28:49 +02:00
|
|
|
local render = function (deltaTime, score, bestReplay)
|
2021-12-02 21:53:30 +01:00
|
|
|
gfx.ResetTransform()
|
2021-11-25 19:38:59 +01:00
|
|
|
|
|
|
|
local resx, resy = game.GetResolution();
|
|
|
|
isLandscape = resx > resy;
|
|
|
|
|
|
|
|
if (isLandscape) then
|
|
|
|
desw = 1920;
|
|
|
|
desh = 1080;
|
|
|
|
else
|
|
|
|
desw = 1080;
|
|
|
|
desh = 1920;
|
|
|
|
end
|
|
|
|
|
|
|
|
local x = 0;
|
|
|
|
local y = desh*0.35; -- Approx. pos of the user panel against the height of the screen is 0.35
|
|
|
|
|
2021-10-09 22:09:25 +02:00
|
|
|
tickTransitions(deltaTime)
|
|
|
|
|
2021-12-02 03:41:12 +01:00
|
|
|
local scale = resy / desh
|
|
|
|
gfx.Scale(scale, scale)
|
|
|
|
|
2021-10-25 21:39:16 +02:00
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
0,
|
2021-11-25 19:38:59 +01:00
|
|
|
y,
|
2021-10-25 21:39:16 +02:00
|
|
|
449*0.85,
|
|
|
|
336*0.85,
|
|
|
|
idolFrameImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
|
2021-10-09 22:09:25 +02:00
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
0,
|
2021-11-25 19:38:59 +01:00
|
|
|
y,
|
2021-10-09 22:09:25 +02:00
|
|
|
449*0.85,
|
|
|
|
336*0.85,
|
|
|
|
bgImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
|
2021-10-09 22:21:48 +02:00
|
|
|
-- Draw appeal card
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
10,
|
2021-11-25 19:38:59 +01:00
|
|
|
y+117,
|
2021-10-09 22:21:48 +02:00
|
|
|
150*0.62,
|
|
|
|
192*0.62,
|
|
|
|
appealCardImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
|
|
|
|
-- Draw username
|
|
|
|
gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
|
|
|
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
|
|
|
gfx.FontSize(26)
|
2021-11-25 19:38:59 +01:00
|
|
|
gfx.Text(username, 150, y+152);
|
2021-10-09 22:21:48 +02:00
|
|
|
|
2021-10-28 18:28:49 +02:00
|
|
|
-- Draw best score diff
|
2021-11-25 19:38:59 +01:00
|
|
|
drawBestDiff(deltaTime, score, bestReplay, y);
|
2021-10-28 18:28:49 +02:00
|
|
|
|
2021-10-09 22:14:24 +02:00
|
|
|
-- Draw dan badge & volforce
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
117,
|
2021-11-25 19:38:59 +01:00
|
|
|
y+206,
|
2021-10-09 22:14:24 +02:00
|
|
|
294*0.32, -- what are these whacky measurements
|
|
|
|
84*0.32,
|
|
|
|
danBadgeImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
|
2021-11-25 19:38:59 +01:00
|
|
|
VolforceWindow.render(deltaTime, 220, y+197)
|
2021-12-02 03:41:12 +01:00
|
|
|
|
|
|
|
gfx.ResetTransform()
|
2021-10-09 22:09:25 +02:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
return {
|
|
|
|
render=render
|
|
|
|
}
|