112 lines
2.9 KiB
Lua
112 lines
2.9 KiB
Lua
local Easing = require('common.easings');
|
|
local Footer = require('components.footer');
|
|
|
|
local VolforceWindow = require('components.volforceWindow')
|
|
|
|
local resx, resy = game.GetResolution()
|
|
local desw = 1080
|
|
local desh = 1920
|
|
local scale = 1
|
|
|
|
local BAR_ALPHA = 191;
|
|
local HEADER_HEIGHT = 100
|
|
|
|
|
|
local backgroundImage = gfx.CreateSkinImage("challenge_result/bg.png", 0);
|
|
local playerInfoOverlayBgImage = gfx.CreateSkinImage("challenge_result/player_info_overlay_bg.png", 0);
|
|
|
|
local headerTitleImage = gfx.CreateSkinImage("challenge_result/header/title.png", 0);
|
|
|
|
|
|
local username = game.GetSkinSetting('username');
|
|
local appealCardImage = gfx.CreateSkinImage("appeal_card.png", 0);
|
|
local danBadgeImage = gfx.CreateSkinImage("dan/inf.png", 0);
|
|
local crewImage = gfx.CreateSkinImage("crew in game/near noah vw.png", 0);
|
|
|
|
local irHeartbeatRequested = false;
|
|
local IRserverName = '';
|
|
|
|
function resetLayoutInformation()
|
|
resx, resy = game.GetResolution()
|
|
desw = 1080
|
|
desh = 1920
|
|
scale = resx / desw
|
|
end
|
|
|
|
function drawBackground()
|
|
gfx.BeginPath()
|
|
gfx.ImageRect(0, 0, desw, desh, backgroundImage, 1, 0);
|
|
end
|
|
|
|
function drawHeader()
|
|
gfx.BeginPath();
|
|
gfx.FillColor(0, 0, 0, BAR_ALPHA);
|
|
gfx.Rect(0, 0, desw, HEADER_HEIGHT);
|
|
gfx.Fill();
|
|
gfx.ClosePath()
|
|
|
|
gfx.ImageRect(desw/2 - 209, HEADER_HEIGHT/2 - 52, 419, 105, headerTitleImage, 1, 0)
|
|
end
|
|
|
|
function drawPlayerInfo()
|
|
-- Draw crew
|
|
gfx.BeginPath()
|
|
gfx.ImageRect(460, 215, 522, 362, crewImage, 1, 0);
|
|
|
|
-- Draw the info bg
|
|
gfx.BeginPath()
|
|
gfx.ImageRect(300, 352, 374*0.85, 222*0.85, playerInfoOverlayBgImage, 1, 0);
|
|
|
|
-- Draw appeal card
|
|
gfx.BeginPath();
|
|
gfx.ImageRect(145, 364, 103*1.25, 132*1.25, appealCardImage, 1, 0);
|
|
|
|
-- Draw description
|
|
gfx.FontSize(28)
|
|
gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
|
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
|
gfx.Text('Hellooooooo', 310, 370);
|
|
|
|
-- Draw username
|
|
gfx.FontSize(40)
|
|
gfx.Text(username, 310, 413);
|
|
|
|
-- Draw IR server name
|
|
gfx.FontSize(28)
|
|
gfx.Text(IRserverName, 310, 453);
|
|
|
|
-- Draw dan badge
|
|
gfx.BeginPath();
|
|
gfx.ImageRect(311, 490, 107*1.25, 29*1.25, danBadgeImage, 1, 0);
|
|
end
|
|
|
|
local IR_HeartbeatResponse = function(res)
|
|
if res.statusCode == IRData.States.Success then
|
|
IRserverName = res.body.serverName .. ' ' .. res.body.irVersion;
|
|
else
|
|
game.Log("Can't connect to IR!", game.LOGGER_WARNING)
|
|
end
|
|
end
|
|
|
|
local IR_Handle = function()
|
|
if not irHeartbeatRequested then
|
|
IR.Heartbeat(IR_HeartbeatResponse)
|
|
irHeartbeatRequested = true;
|
|
end
|
|
end
|
|
|
|
function render(deltaTime)
|
|
gfx.ResetTransform();
|
|
resetLayoutInformation();
|
|
gfx.Scale(scale,scale);
|
|
|
|
IR_Handle()
|
|
|
|
drawBackground()
|
|
|
|
drawPlayerInfo()
|
|
|
|
|
|
drawHeader()
|
|
Footer.draw(deltaTime);
|
|
end |