95% multilobby

This commit is contained in:
RealFD 2022-03-25 23:47:24 +01:00
parent 8dd46e733f
commit bbccab0294
8 changed files with 86 additions and 76 deletions

View File

@ -19,7 +19,7 @@ function textmaker(text, fontsize, maxWidth, x, y, w, h, lenght, scissorY, id) -
if (x2-x1) < maxWidth then if (x2-x1) < maxWidth then
gfx.Text(text,x,y) gfx.Text(text,x,y)
else else
gfx.Text(text,x-ScrollScales[id],y) gfx.Text(text,x,y) ---ScrollScales[id]
gfx.FillColor(255,255,0) gfx.FillColor(255,255,0)
end end

View File

@ -2,6 +2,9 @@ json = require "json"
local header = {} local header = {}
header["user-agent"] = "unnamed_sdvx_clone" header["user-agent"] = "unnamed_sdvx_clone"
local Dim = require("common.dimensions")
local Wallpaper = require("components.wallpaper")
local jacketFallback = gfx.CreateSkinImage("song_select/loading.png", 0) local jacketFallback = gfx.CreateSkinImage("song_select/loading.png", 0)
local diffColors = {{50,50,127}, {50,127,50}, {127,50,50}, {127, 50, 127}} local diffColors = {{50,50,127}, {50,127,50}, {127,50,50}, {127, 50, 127}}
local entryW = 770 local entryW = 770
@ -45,7 +48,7 @@ function addsong(song)
table.insert(songs, song) table.insert(songs, song)
end end
local yOffset = 0 local yOffset = 0
local backgroundImage = gfx.CreateSkinImage("bg.png", 1); local backgroundImage = require("components.background")
dlcache = io.open(cachepath, "r") dlcache = io.open(cachepath, "r")
if dlcache then if dlcache then
@ -219,8 +222,12 @@ function render_info()
end end
function render(deltaTime) function render(deltaTime)
gfx.BeginPath() Dim.updateResolution()
gfx.ImageRect(0, 0, resX, resY, backgroundImage, 1, 0); Wallpaper.render()
Dim.transformToDesignSpace()
backgroundImage.draw(deltaTime)
gfx.LoadSkinFont("NotoSans-Regular.ttf"); gfx.LoadSkinFont("NotoSans-Regular.ttf");
displayCursorPosX = displayCursorPosX - (displayCursorPosX - cursorPosX) * deltaTime * 10 displayCursorPosX = displayCursorPosX - (displayCursorPosX - cursorPosX) * deltaTime * 10
displayCursorPosY = displayCursorPosY - (displayCursorPosY - cursorPosY) * deltaTime * 10 displayCursorPosY = displayCursorPosY - (displayCursorPosY - cursorPosY) * deltaTime * 10

View File

@ -24,7 +24,9 @@ local temppanels = gfx.CreateSkinImage("song_select/textboard.png", 1);
local headerMatchingImage = gfx.CreateSkinImage("titlescreen/entry.png", 1); local headerMatchingImage = gfx.CreateSkinImage("titlescreen/entry.png", 1);
local m_4pb_panels = gfx.CreateSkinImage("multi/lobby/user_panel_2.png", 1); local m_4pb_panels_test = gfx.CreateSkinImage("multi/lobby/user_panel_2.png", 1);
local m_4pb_panels_bottom = gfx.CreateSkinImage("multi/lobby/opponent_bottom_panel.png", 1);
local m_4pb_panels_top = gfx.CreateSkinImage("multi/lobby/opponent_top_panel.png", 1);
local ready_bt = gfx.CreateSkinImage("multi/lobby/READY.png", 1); local ready_bt = gfx.CreateSkinImage("multi/lobby/READY.png", 1);
@ -83,6 +85,7 @@ game.LoadSkinSample("menu_click")
local loading = true; local loading = true;
local rooms = {}; local rooms = {};
local lobby_users = {}; local lobby_users = {};
local rank_users = {1,2,3,4};
local selected_room = nil; local selected_room = nil;
local user_id = nil; local user_id = nil;
local jacket = 0; local jacket = 0;
@ -193,9 +196,20 @@ m_own_info = function() -- bottom left -- done
gfx.FontSize(40) gfx.FontSize(40)
gfx.ImageRect(ownPanelX, ownPanelY, 343/1.18, 361/1.18,m_host_panel,1,0) gfx.ImageRect(ownPanelX, ownPanelY, 343/1.18, 361/1.18,m_host_panel,1,0)
gfx.Text(normname, ownPanelX+20, ownPanelY+78) gfx.Text(normname, ownPanelX+20, ownPanelY+78)
gfx.FontSize(22)
gfx.Text(msg,ownPanelX+20, ownPanelY+37)
gfx.Text(irText, ownPanelX+20, ownPanelY+288);
gfx.FontSize(22)
gfx.Text(irText, ownPanelX+5, ownPanelY+288); if showthing == true then
local jw , jh = gfx.ImageSize(ready_bt);
gfx.BeginPath();
gfx.ImageRect(ownPanelX+150, ownPanelY+232, jw/1.18, jh/1.18, ready_bt,1,0);
elseif showthing == false then
local jw , jh = gfx.ImageSize(ready_bt);
gfx.BeginPath();
gfx.ImageRect(x+ownPanelX, y+ownPanelY, jw/1.18, jh/1.18, ready_bt,0,0);
end
end end
@ -249,7 +263,9 @@ m_s_part = function () -- song info panel -- done
gfx.FontSize(24) gfx.FontSize(24)
gfx.Text("MISSING EFFECTOR!!!!", rightPanelX+463, rightPanelY+191) gfx.Text("MISSING EFFECTOR!!!!", rightPanelX+463, rightPanelY+191)
gfx.Text("MISSING ILLUSTRATOR!!!!", rightPanelX+463, rightPanelY+219) gfx.Text("MISSING ILLUSTRATOR!!!!", rightPanelX+463, rightPanelY+219)
else end
--[[
else
gfx.Text("HOST IS SELECTING SONG", rightPanelX+245, rightPanelY+50) gfx.Text("HOST IS SELECTING SONG", rightPanelX+245, rightPanelY+50)
gfx.Text(" ", rightPanelX+245, rightPanelY+88) gfx.Text(" ", rightPanelX+245, rightPanelY+88)
gfx.FontSize(24) gfx.FontSize(24)
@ -257,8 +273,7 @@ m_s_part = function () -- song info panel -- done
gfx.Text(" ", rightPanelX+463, rightPanelY+219) gfx.Text(" ", rightPanelX+463, rightPanelY+219)
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.FontSize(22) gfx.FontSize(22)
gfx.Text("BPM ?",rightPanelX+497, rightPanelY+118) gfx.Text("BPM ?",rightPanelX+497, rightPanelY+118)]]
end
end end
else else
if selected_song.min_bpm ~= selected_song.max_bpm then if selected_song.min_bpm ~= selected_song.max_bpm then
@ -350,24 +365,28 @@ m_info_part = function () -- the info panel
local jw , jh = gfx.ImageSize(m_info_panel); local jw , jh = gfx.ImageSize(m_info_panel);
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(infPanelX, infPanelY, jw/1.18, jh/1.18, m_info_panel,1,0); gfx.ImageRect(infPanelX, infPanelY, jw/1.18, jh/1.18, m_info_panel,1,0);
gfx.FontSize(24)
draw_checkbox("Excessive",infPanelX+160, infPanelY+49.25, toggle_hard, hard_mode, not start_game_soon) draw_checkbox("EXCESSIVE",infPanelX+160, infPanelY+50, toggle_hard, hard_mode, not start_game_soon)
draw_checkbox("Mirror",infPanelX+201.2, infPanelY+87.5, toggle_mirror, mirror_mode, not start_game_soon) draw_checkbox("MIRROR",infPanelX+187, infPanelY+87.5, toggle_mirror, mirror_mode, not start_game_soon)
draw_checkbox("Rotate",infPanelX+379.1, infPanelY+87.5, toggle_rotate, do_rotate, draw_checkbox("ROTATE",infPanelX+390, infPanelY+87.5, toggle_rotate, do_rotate,
(owner == user_id or host == user_id) and not start_game_soon) (owner == user_id or host == user_id) and not start_game_soon)
gfx.FillColor(255,255,255,100) gfx.FillColor(255,255,255,100)
gfx.Text("Leave",infPanelX+417.5, infPanelY+50) gfx.Text("LEAVE",infPanelX+417.5, infPanelY+49)
gfx.Text("START",infPanelX*1.61, infPanelY+35)
gfx.FillColor(255,255,255) gfx.FillColor(255,255,255)
gfx.FontSize(24) gfx.FontSize(24)
-- gfx.Text("FX-L/FX-R TO READY UP",infPanelX+290.5,infPanelY+269) gfx.Text("FX-L/FX-R TO SETTINGS",infPanelX+290.5,infPanelY+269)
gfx.Text("FX-L/FX-R TO EXCEED SEX",infPanelX+290.5,infPanelY+269) -- gfx.Text("START TO EXCEED SEX",infPanelX+290.5,infPanelY+269)
end end
user_setup = function () -- (semi new) user layering user_setup = function () -- (semi new) user layering
local distance = 350 local distance = 350
for i, user in ipairs(lobby_users) do for i, user in ipairs(lobby_users) do
gfx.Text("user "..i,100*i,100)
buttonY = 1142-360/1.2 buttonY = 1142-360/1.2
if owner == user_id and user.id ~= user_id then if owner == user_id and user.id ~= user_id then
@ -375,49 +394,23 @@ user_setup = function () -- (semi new) user layering
kick_user(user); kick_user(user);
end) end)
end end
if (owner == user_id or host == user_id) and user.id ~= host then
draw_button("H",16, buttonY+250, 50, function()
change_host(user);end)
end
if i == 1 then if i == 1 then
draw_user(user, -distance, 1142-360/1.2, 420/1.2, 330/1.2, i,215,245.5) draw_user(user, -distance, 1142-360/1.2, 420/1.2, 330/1.2,215,245.5)
if (owner == user_id or host == user_id) and user.id ~= host then
draw_button("H",-distance, buttonY, 50, function()
change_host(user);end)
end
elseif i == 2 then elseif i == 2 then
draw_user(user, 16, 1142-360/1.2, 420/1.2, 330/1.2, i,215,245.5) draw_user(user, 16, 1142-360/1.2, 420/1.2, 330/1.2,215,245.5)
if (owner == user_id or host == user_id) and user.id ~= host then
draw_button("H",16, buttonY+250, 50, function()
change_host(user);end)
end
elseif i == 3 then elseif i == 3 then
draw_user(user, 16+distance, 1142-360/1.2, 420/1.2, 330/1.2, i,215,245.5) draw_user(user, 16+distance, 1142-360/1.2, 420/1.2, 330/1.2,215,245.5)
if (owner == user_id or host == user_id) and user.id ~= host then
draw_button("H",16+distance, buttonY, 50, function()
change_host(user);end)
end
elseif i == 4 then elseif i == 4 then
draw_user(user, 16+distance+distance, 1142-360/1.2, 42030//1.2, 31.2, i,215,245.5) draw_user(user, 16+distance+distance, 1142-360/1.2, 42030//1.2, 31.2,215,245.5)
if (owner == user_id or host == user_id) and user.id ~= host then
draw_button("H",16+distance+distance, buttonY, 50, function()
change_host(user);end)
end
elseif i > 4 then elseif i > 4 then
draw_user(user, 16+distance+distance+distance+distance, 1142-360/1.2, 420/1.2, 330/1.2, i,215,245.5) draw_user(user, 16+distance+distance+distance+distance, 1142-360/1.2, 420/1.2, 330/1.2, i,215,245.5)
if (owner == user_id or host == user_id) and user.id ~= host then
draw_button("H",16+distance+distance+distance, buttonY, 25, function()
change_host(user);end)
end
end end
end end
end end
@ -472,18 +465,13 @@ draw_button = function(name, x, y, buttonWidth, hoverindex)
end end
draw_button_color = function(name, x, y, buttonWidth, hoverindex,img) draw_button_color = function(name, x, y, buttonWidth, hoverindex,img)
local rx = x - (buttonWidth / 2); local rx = x/buttonWidth;
local ty = y - (buttonHeight / 2); local ty = y-20;
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(rx,ty,buttonWidth,buttonHeight,img,1,0) gfx.ImageRect(rx,ty,buttonWidth/1.5,buttonHeight*2,img,1,0)
if mouse_clipped(rx,ty, buttonWidth, buttonHeight) then if mouse_clipped(rx,ty, buttonWidth/1.5, buttonHeight*2) then
hovered = hoverindex; hovered = hoverindex;
end end
gfx.Rect(rx - buttonBorder,
ty - buttonBorder,
buttonWidth + (buttonBorder * 2),
buttonHeight + (buttonBorder * 2));
gfx.BeginPath();
gfx.BeginPath(); gfx.BeginPath();
gfx.FillColor(255,255,255); gfx.FillColor(255,255,255);
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE); gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE);
@ -500,7 +488,6 @@ draw_checkbox = function(text, x, y, hoverindex, current, can_click)
gfx.FillColor(100,100,100,100); gfx.FillColor(100,100,100,100);
end end
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE); gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE);
gfx.FontSize(30);
gfx.Text(text, x, y) gfx.Text(text, x, y)
local xmin,ymin,xmax,ymax = gfx.TextBounds(x, y, text); local xmin,ymin,xmax,ymax = gfx.TextBounds(x, y, text);
@ -520,30 +507,39 @@ draw_checkbox = function(text, x, y, hoverindex, current, can_click)
end end
end; end;
draw_user = function(user, x, y , w, h, rank, breadx,bready) draw_user = function(user, x, y , w, h, breadx,bready)
local name = user.name local name = user.name
local showthing = false local showthing = false
if user.id == user_id then if user.id == user_id then
name = name name = name
end end
if user.id == host then
name = name if user.id == host then
elseif user.ready then name = name..' (host)'
showthing = true elseif user.missing_map then
elseif not user.ready then name = name..' (NO CHART)'
showthing = false elseif user.ready then
end name = name..' (ready)'
showthing = true
D = 1
elseif not user.ready then
showthing = false
D = 0
end
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE); gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE);
gfx.FillColor(255,255,255) gfx.FillColor(255,255,255)
gfx.FontSize(42)
gfx.FontSize(30) gfx.FontSize(30)
gfx.BeginPath(); gfx.BeginPath()
gfx.ImageRect(x, y ,w, h,m_4pb_panels,1,0) gfx.ImageRect(x,y,w,h,m_4pb_panels_bottom,1,0)
gfx.Text(name, x+135, y+51) gfx.BeginPath()
gfx.ImageRect(x,y,w,h,m_4pb_panels_top,1,0)
gfx.Text(name, x+136, y+51.5)
gfx.Text(msg, x+136, y+25.5)
gfx.FontSize(22)
gfx.Text(irText,x+32, y+225)
if showthing == true then if showthing == true then
local jw , jh = gfx.ImageSize(ready_bt); local jw , jh = gfx.ImageSize(ready_bt);
@ -722,7 +718,6 @@ local IR_Handle = function()
end end
function render_lobby(deltaTime) function render_lobby(deltaTime)
local jw , jh = gfx.ImageSize(bg); local jw , jh = gfx.ImageSize(bg);
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(0, 0, desw, desh, bg,1,0); gfx.ImageRect(0, 0, desw, desh, bg,1,0);
@ -747,6 +742,8 @@ end
function render_room_list(deltaTime) function render_room_list(deltaTime)
Background.draw(deltaTime) Background.draw(deltaTime)
draw_rooms(175, resy - 290); draw_rooms(175, resy - 290);
-- Draw cover for rooms out of view -- Draw cover for rooms out of view
@ -771,6 +768,8 @@ function render_room_list(deltaTime)
if not loading then if not loading then
draw_button("Create new room", resx/2, resy-40-buttonHeight, resx*(3/4), new_room); draw_button("Create new room", resx/2, resy-40-buttonHeight, resx*(3/4), new_room);
end end
end end
@ -853,7 +852,7 @@ function render_set_username(deltaTime)
end end
render = function(deltaTime) render = function(deltaTime)
IR_Handle()
Dim.updateResolution() Dim.updateResolution()
Wallpaper.render() Wallpaper.render()
@ -882,12 +881,16 @@ render = function(deltaTime)
elseif screenState == "roomList" then elseif screenState == "roomList" then
render_room_list(deltaTime); render_room_list(deltaTime);
elseif screenState == "passwordScreen" then elseif screenState == "passwordScreen" then
Background.draw(deltaTime)
render_password_screen(deltaTime); render_password_screen(deltaTime);
elseif screenState == "newRoomName" then elseif screenState == "newRoomName" then
Background.draw(deltaTime)
render_new_room_name() render_new_room_name()
elseif screenState == "newRoomPassword" then elseif screenState == "newRoomPassword" then
Background.draw(deltaTime)
render_new_room_password() render_new_room_password()
elseif screenState == "setUsername" then elseif screenState == "setUsername" then
Background.draw(deltaTime)
loading = false; loading = false;
render_set_username() render_set_username()
end end
@ -959,7 +962,7 @@ end
-- Handle button presses to advance the UI -- Handle button presses to advance the UI
button_pressed = function(button) button_pressed = function(button)
if button == game.BUTTON_FXL and game.BUTTON_FXR then if button == game.BUTTON_STA then
if start_game_soon then if start_game_soon then
return return
end end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB