ExperimentalGear/scripts/download/songplate.lua

118 lines
4.6 KiB
Lua

local Dim = require("common.dimensions")
local difbar = require("components.diff_rectangle")
local desw, desh = Dim.design.width,Dim.design.height
local xnum = 190
local ynum = 24
local ImageStorage = {
plate = gfx.CreateSkinImage("nautica/room_panel.png", 1),
nameplate = gfx.CreateSkinImage("nautica/panel_name.png", 1),
price = gfx.CreateSkinImage("nautica/pw_or_price_panel.png", 1),
jacket = gfx.CreateSkinImage("nautica/bg_jacket.png", 1),
nodif = gfx.CreateSkinImage("nautica/no_dif.png", 1),
dot = gfx.CreateSkinImage("nautica/dot.png", 1),
}
local DrawSongPlate = function(song,x,y,downloaded)
--nautica song list
if screenState ~= "roomList" then
local jw,jh = gfx.ImageSize(ImageStorage.plate); -- if bpm is a think change l_panel to n_panel
gfx.BeginPath();
gfx.ImageRect(x,y, jw/1.17, jh/1.17, ImageStorage.plate,1,0);
that = 9.5
why = 1
local jw,jh = gfx.ImageSize(ImageStorage.jacket);
gfx.BeginPath();
gfx.ImageRect(x+that,y+5+why, jw/1.17, jh/1.17, ImageStorage.jacket,1,0);
gfx.BeginPath()
gfx.ImageRect(x+that+8.9,y+5+19, jw/1.4, jh/1.4, song.jacket, 1, 0)
local jw,jh = gfx.ImageSize(ImageStorage.nodif);
for i=1,4 do
gfx.BeginPath();
gfx.ImageRect(x+30+(i*115),y+106, jw/1.09, jh/1.09, ImageStorage.nodif,1,0);
end
local jw,jh = gfx.ImageSize(ImageStorage.nameplate);
gfx.BeginPath();
gfx.ImageRect(x+147,y+5, jw/1.17, jh/1.17, ImageStorage.nameplate,1,0);
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.FontSize(30)
gfx.Text(song.title,x+xnum,y+ynum)
gfx.Text(song.artist,x+xnum,y+ynum+40)
local jw,jh = gfx.ImageSize(ImageStorage.dot);
gfx.BeginPath();
gfx.SetImageTint(255,9,253)
gfx.ImageRect(x,y, jw/1.17, jh/1.17, ImageStorage.dot,1,0);
gfx.SetImageTint(255,255,255)
local jw,jh = gfx.ImageSize(ImageStorage.nodif);
for i, diff in ipairs(song.charts) do
if diff.difficulty == 1 then --nov
difbar.render(deltaTime, x+260+(-1*115),y+106, jw/150, diff.difficulty, diff.level);
elseif diff.difficulty == 2 then --adv
difbar.render(deltaTime, x+260+(0*115),y+106, jw/150, diff.difficulty, diff.level);
elseif diff.difficulty == 3 then --exh
difbar.render(deltaTime, x+260+(1*115),y+106, jw/150, diff.difficulty, diff.level);
elseif diff.difficulty == 4 then ---mxm and up
difbar.render(deltaTime, x+260+(2*115),y+106, jw/150, diff.difficulty, diff.level);
end
end
local jw,jh = gfx.ImageSize(ImageStorage.price);
gfx.BeginPath();
gfx.ImageRect(x+650,y+69, jw/1.17, jh/1.17, ImageStorage.price,1,0);
local buy = "AP 8000"
local jw,jh = gfx.ImageSize(ImageStorage.dot);
gfx.FontSize(30)
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE)
if not downloaded[song.id] then
gfx.BeginPath()
gfx.Text(string.upper(buy),x+868,y+90)
elseif downloaded[song.id] == "Downloading" then
gfx.BeginPath()
gfx.Text(string.upper(buy), x+868,y+90)
elseif downloaded[song.id] == "Downloaded" then
gfx.BeginPath()
gfx.Text(string.upper(buy), x+868,y+90)
end
if song.status == "Playing" then
gfx.BeginPath()
gfx.FontSize(24)
gfx.Text(string.upper(song.status), x+878-10, y+25)
end
if downloaded[song.id] == "Downloaded" then
gfx.BeginPath()
gfx.SetImageTint(240,246,0)
gfx.ImageRect(x,y, jw/1.17, jh/1.17, ImageStorage.dot,1,0);
gfx.SetImageTint(255,255,255)
elseif downloaded[song.id] == "Downloading" then
gfx.BeginPath()
gfx.SetImageTint(240,20,0)
gfx.ImageRect(x,y, jw/1.17, jh/1.17, ImageStorage.dot,1,0);
gfx.SetImageTint(255,255,255)
end
if song.status == "Playing" then
gfx.BeginPath();
gfx.SetImageTint(0,246,2)
gfx.ImageRect(x,y, jw/1.17, jh/1.17, ImageStorage.dot,1,0);
gfx.SetImageTint(255,255,255)
end
end
end
return {draw = DrawSongPlate}