This commit is contained in:
RealFD 2022-06-05 18:33:12 +02:00
parent a2cd411f4c
commit 553c4c60d8
7 changed files with 197 additions and 98 deletions

View File

@ -5,17 +5,19 @@ header["user-agent"] = "unnamed_sdvx_clone"
local Dim = require("common.dimensions")
local Wallpaper = require("components.wallpaper")
local Background = require('components.background');
local getpanel = require("multi.roomList.getpanel")
local getroom = require("multi.roomList.getroom")
local curser = gfx.CreateSkinImage("multi/roomselect/room_panel_glow.png",1)
local jacketFallback = gfx.CreateSkinImage("song_select/loading.png", 0)
local diffColors = {{50,50,127}, {50,127,50}, {127,50,50}, {127, 50, 127}}
local entryW = 770
local entryH = 320
local entryH = 320/1.5
local resX,resY = Dim.design.width,Dim.design.height
local xCount = math.max(1, math.floor(resX / entryW))
local yCount = math.max(1, math.floor(resY / entryH))
local xOffset = (resX - xCount * entryW) / 2
local xCount = math.max(1, math.floor(resX / entryW)/2)
local yCount = math.max(1, math.floor(resY / entryH)/2)
local xOffset = (resX - xCount * entryW) / 3
local cursorPos = 0
local cursorPosX = 0
local cursorPosY = 0
@ -41,6 +43,21 @@ local needsReload = false
local yOffset = 0
local headerMatchingImage = gfx.CreateSkinImage("titlescreen/title.png", 1);
local BAR_ALPHA = 191;
local HEADER_HEIGHT = 100
function drawHeader()
gfx.BeginPath()
gfx.FillColor(0, 0, 0, BAR_ALPHA)
gfx.Rect(0, 0, resX, HEADER_HEIGHT)
gfx.Fill()
gfx.ClosePath()
gfx.ImageRect(resX / 2 - 200, HEADER_HEIGHT / 2 - 20, 400, 40, headerMatchingImage, 1, 0)
end
function addsong(song)
if song.jacket_url ~= nil then
song.jacket = gfx.LoadWebImageJob(song.jacket_url, jacketFallback, 250, 250)
@ -90,66 +107,13 @@ end
Http.GetAsync(nextUrl, header, gotSongsCallback)
function render_song(song, x,y)
--[[
gfx.Save()
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.Translate(x,y)
gfx.Scissor(0,0,750,300)
gfx.BeginPath()
gfx.FillColor(0,0,0,140)
gfx.Rect(0,0,750,300)
gfx.Fill()
gfx.FillColor(255,255,255)
gfx.FontSize(30)
gfx.Text(song.title, 2,2)
gfx.FontSize(24)
gfx.Text(song.artist, 2,26)
if song.jacket_url ~= nil and song.jacket == jacketFallback then
song.jacket = gfx.LoadWebImageJob(song.jacket_url, jacketFallback, 250, 250)
end
gfx.BeginPath()
gfx.ImageRect(0, 50, 250, 250, song.jacket, 1, 0)
gfx.BeginPath()
gfx.Rect(250,50,500,250)
gfx.FillColor(55,55,55,128)
gfx.Fill()
for i, diff in ipairs(song.charts) do
local col = diffColors[diff.difficulty]
local diffY = 50 + 250/4 * (diff.difficulty - 1)
gfx.BeginPath()
gfx.Rect(250,diffY, 500, 250 / 4)
gfx.FillColor(col[1], col[2], col[3])
gfx.Fill()
gfx.FillColor(255,255,255)
gfx.FontSize(40)
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
gfx.Text(string.format("%d Effected by %s", diff.level, diff.effector), 255, diffY + 250 / 8)
end
if downloaded[song.id] then
gfx.BeginPath()
gfx.Rect(0,0,750,300)
gfx.FillColor(0,0,0,127)
gfx.Fill()
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
gfx.FontSize(60)
gfx.FillColor(255,255,255)
gfx.Text(downloaded[song.id], 375, 150)
elseif song.status then
gfx.BeginPath()
gfx.Rect(0,0,750,300)
gfx.FillColor(0,0,0,127)
gfx.Fill()
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
gfx.FontSize(60)
gfx.FillColor(255,255,255)
gfx.Text(song.status, 375, 150)
end
gfx.ResetScissor()
gfx.Save()
gfx.Translate(x,y)
getroom(song,x,y,downloaded)
gfx.Restore()
]]
end
function load_more()
@ -162,11 +126,11 @@ end
function render_cursor()
local x = displayCursorPosX * entryW
local y = displayCursorPosY * entryH
gfx.BeginPath()
gfx.Rect(x,y,750,300)
gfx.StrokeColor(255,128,0)
gfx.StrokeWidth(5)
gfx.Stroke()
jw,jh = gfx.ImageSize(curser);
gfx.BeginPath();
gfx.SetImageTint(255,195,0) -- orange
gfx.ImageRect(x, y,jw,jh,curser,1,0)
end
function render_loading()
@ -207,12 +171,10 @@ end
function render_info()
gfx.Save()
gfx.ResetTransform()
gfx.FillColor(255,255,255)
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT, gfx.TEXT_ALIGN_BOTTOM)
gfx.FontSize(70)
gfx.Text("Nautica", resX-2, resX-20)
gfx.FontSize(20)
gfx.Text("https://ksm.dev/", resX-13, resX-3)
gfx.Text("https://ksm.dev/", resX+70, resX-5)
gfx.Restore()
end
@ -224,6 +186,9 @@ function render(deltaTime)
Dim.transformToScreenSpace()
Background.draw(deltaTime)
drawHeader()
getpanel()
gfx.LoadSkinFont("NotoSans-Regular.ttf");
displayCursorPosX = displayCursorPosX - (displayCursorPosX - cursorPosX) * deltaTime * 10
@ -233,17 +198,22 @@ function render(deltaTime)
elseif displayCursorPosY - yOffset < 0 then
yOffset = yOffset - (yOffset - displayCursorPosY)
end
gfx.Translate(xOffset, 50 - yOffset * entryH)
gfx.Translate(xOffset, 500 - yOffset * entryH)
for i, song in ipairs(songs) do
if math.abs(cursorPos - i) <= xCount * yCount + xCount then
i = i - 1
local x = entryW * (i % xCount)
local y = math.floor(i / xCount) * entryH
local y = math.floor(i / xCount) * entryH/2
render_song(song, x, y)
if math.abs(#songs - i) < 4 then load_more() end
end
end
render_cursor()
if needsReload then reload_songs() end
if screenState == 1 then render_level_filters()
elseif screenState == 2 then render_sorting_selection()

View File

@ -1,39 +1,54 @@
local Dim = require("common.dimensions")
local DigiSerBold = "Digital-Serial-Bold.ttf";
local getroom = require("multi.roomList.getroom")
local desw,desh = Dim.design.width,Dim.design.height
local lobbypanelX = 0;
local lobbypanelY = (1080/2.5)-56;
lobbypanelX = 0;
lobbypanelY = (1080/2.5)-56;
local l_base_panel = gfx.CreateSkinImage("multi/roomselect/lobby_select.png",1);
local l_color = gfx.CreateSkinImage("multi/roomselect/lobby_select_color.png", 1);
local l_grad = gfx.CreateSkinImage("multi/roomselect/lobby_select_gradiant.png", 1);
local l_name = gfx.CreateSkinImage("multi/roomselect/multi_station.png",1);
local l_load = gfx.CreateSkinImage("multi/roomselect/lobby_not_loaded.png",1)
local l_mult = gfx.CreateSkinImage("multi/roomselect/multi_station.png",1);
local l_naut = gfx.CreateSkinImage("multi/roomselect/nautica/nautica_station.png",1);
local getpanel = function()
if screenState == "roomList" then
local jw,jh = gfx.ImageSize(l_base_panel);
gfx.BeginPath();
gfx.ImageRect(lobbypanelX, lobbypanelY, jw, jh, l_base_panel,1,0);
gfx.BeginPath();
gfx.ImageRect(lobbypanelX, lobbypanelY, jw, jh, l_color,1,0);
-- do the lobby oder here
draw_rooms(desw/2, desh - 290);
getroom()
gfx.BeginPath();
gfx.ImageRect(lobbypanelX, lobbypanelY, jw, jh, l_grad,1,0);
local nw,nh = gfx.ImageSize(l_name);
gfx.BeginPath();
gfx.ImageRect(lobbypanelX+445, lobbypanelY+9, nw, nh, l_name,1,0);
local nw,nh = gfx.ImageSize(l_mult);
gfx.BeginPath();
gfx.ImageRect(lobbypanelX+445, lobbypanelY+9, nw, nh, l_mult,1,0);
if not loading then
custom_button("Create new room",40+(desw/2), 530+(desh/2),l_load,DigiSerBold,70,new_room)
gfx.BeginPath()
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
custom_button("Create new room",40+(desw/2), 530+(desh/2),l_load,"Digital-Serial-Bold.ttf",70,new_room)
end
end
if screenState ~= "roomList" then
local jw,jh = gfx.ImageSize(l_base_panel);
gfx.BeginPath();
gfx.ImageRect(lobbypanelX, lobbypanelY, jw, jh, l_base_panel,1,0);
gfx.BeginPath();
gfx.ImageRect(lobbypanelX, lobbypanelY, jw, jh, l_color,1,0);
gfx.BeginPath();
gfx.ImageRect(lobbypanelX, lobbypanelY, jw, jh, l_grad,1,0);
local nw,nh = gfx.ImageSize(l_naut);
gfx.BeginPath();
gfx.ImageRect(lobbypanelX+445, lobbypanelY+9, nw, nh, l_naut,1,0);
end
end

View File

@ -0,0 +1,123 @@
local Dim = require("common.dimensions")
local textscramble = require("components.textscrambler")
local difbar = require("components.diff_rectangle")
local desw, desh = Dim.design.width,Dim.design.height
local l_panel = gfx.CreateSkinImage("multi/roomselect/room_panel.png",1);
local n_cost,l_pw = gfx.CreateSkinImage("multi/roomselect/pw_or_price_panel.png",1);
local n_panel = gfx.CreateSkinImage("multi/roomselect/nautica/nautica_panel.png",1);
local n_panel_ja = gfx.CreateSkinImage("multi/roomselect/nautica/nautica_bg_jacket.png",1);
local n_nodif = gfx.CreateSkinImage("multi/roomselect/nautica/no_dif.png",1);
local n_play_dot = gfx.CreateSkinImage("multi/roomselect/nautica/nautica_pl_dot.png",1);
local info_panel = gfx.CreateSkinImage("multi/roomselect/room_panel_name_or_song.png",1);
local getroom = function(song,x,y,downloaded)
--multiplayer room list
if screenState == "roomList" then
-- local jw,jh = gfx.ImageSize(l_panel);
-- gfx.BeginPath();
-- gfx.ImageRect(lobbypanelX, lobbypanelY, jw, jh, l_panel,1,0);
-- do the lobby oder here
draw_rooms(desw/2, desh - 290);
end
--nautica song list
if screenState ~= "roomList" then
local jw,jh = gfx.ImageSize(l_panel); -- if bpm is a think change l_panel to n_panel
gfx.BeginPath();
gfx.ImageRect(x,y, jw, jh, l_panel,1,0);
local jw,jh = gfx.ImageSize(n_panel_ja);
gfx.BeginPath();
gfx.ImageRect(x+3,y+5, jw, jh, n_panel_ja,1,0);
if song.jacket_url ~= nil and song.jacket == jacketFallback then
song.jacket = gfx.LoadWebImageJob(song.jacket_url, jacketFallback, 250, 250)
end
gfx.BeginPath()
gfx.ImageRect(x+3+8.9,y+5+19, jw/1.19, jh/1.3, song.jacket, 1, 0)
local jw,jh = gfx.ImageSize(n_nodif);
for i=1,4 do
gfx.BeginPath();
gfx.ImageRect(x+30+(i*115),y+106, jw/1.09, jh/1.09, n_nodif,1,0);
end
local jw,jh = gfx.ImageSize(info_panel);
gfx.BeginPath();
gfx.ImageRect(x+147,y+5, jw, jh, info_panel,1,0);
local xnum = 190
local ynum = 24
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.Scissor(0, 0,1080,1040)
textscramble.textmaker(song.title,30,500,x+xnum,y+ynum,500,30,500,0,1)
textscramble.textmaker(song.artist,30,420,x+xnum,y+ynum+40,420,30,500,0,1)
local jw,jh = gfx.ImageSize(n_play_dot);
gfx.BeginPath();
gfx.SetImageTint(255,9,253)
gfx.ImageRect(x+764, y+11, jw, jh, n_play_dot,1,0);
gfx.SetImageTint(255,255,255)
local jw,jh = gfx.ImageSize(n_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);
elseif diff.difficulty == 4 then ---mxm and up
difbar.render(deltaTime, x+260+(2*115),y+106, jw/150, diff.difficulty+1, diff.level);
end
end
local jw,jh = gfx.ImageSize(n_cost);
gfx.BeginPath();
gfx.ImageRect(x+650,y+69, jw, jh, n_cost,1,0);
local buy = 8000
gfx.FontSize(30)
if not downloaded[song.id] then
gfx.BeginPath()
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
gfx.Text(buy.." AP",x+830,y+92)
elseif downloaded[song.id] then
buy = "0"--downloaded[song.id]
gfx.BeginPath()
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
gfx.Text(buy.." AP", x+830,y+92)
end
if song.status == "Playing" then
gfx.BeginPath()
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
gfx.FontSize(24)
gfx.Text(song.status, x+878-50, y+24)
local jw,jh = gfx.ImageSize(n_play_dot);
gfx.BeginPath();
gfx.SetImageTint(0,246,2)
gfx.ImageRect(x+764, y+11, jw, jh, n_play_dot,1,0);
gfx.SetImageTint(255,255,255)
end
end
end
return getroom

View File

@ -513,18 +513,9 @@ end
function render_room_list(deltaTime)
Background.draw(deltaTime)
drawHeader()
getpanel()
gfx.BeginPath()
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
gfx.FontSize(70)
-- draw_button("Create new room", desw/2, Dim.design.height-40-buttonHeight, desw/2, new_room);
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB