multi changes only create room when 0 online bug!

This commit is contained in:
RealFD 2022-05-07 18:54:28 +02:00
parent f6e29603d3
commit e22fab8e2d
2 changed files with 47 additions and 1204 deletions

File diff suppressed because it is too large Load Diff

View File

@ -34,11 +34,12 @@ local bg = gfx.CreateSkinImage("multi/lobby/bg.png", 1);
local bg_graid1 = gfx.CreateSkinImage("multi/lobby/gradient_bottom.png", 1);
local bg_graid2 = gfx.CreateSkinImage("multi/lobby/gradient_top.png", 1);
local idolAnimation = gfx.LoadSkinAnimation('crew/anim/'..creww, 1 / 30, 0, true);
local idle = "/idle"
local idolAnimation = gfx.LoadSkinAnimation('crew/anim/'..creww..idle, 1 / 30, 0, true);
local idolAnimTransitionScale = 0;
local resX,resY = game.GetResolution()
local desw,desh = game.GetResolution()
local rightPanelX = 283;
local rightPanelY = 1187;
@ -67,7 +68,7 @@ local infPanelY = 1590
local mposx = 0;
local mposy = 0;
local hovered = nil;
local buttonWidth = resX*(3/4);
local buttonWidth = desw*(3/4);
local buttonHeight = 75;
local buttonBorder = 2;
local portrait
@ -76,7 +77,7 @@ local jacket_size;
local BAR_ALPHA = 191;
local HEADER_HEIGHT = 100
local resx, resy = game.GetResolution()
local desw, desh = game.GetResolution()
local desw = 1080
local desh = 1920
local scale;
@ -429,8 +430,9 @@ mouse_clipped = function(x,y,w,h)
return mposx > x and mposy > y and mposx < x+w and mposy < y+h;
end;
-- look into this when people are online
draw_room = function(name, x, y, selected, hoverindex)
local buttonWidth = resx*(3/4);
local buttonWidth = desw/2;
local rx = x - (buttonWidth / 2);
local ty = y - (buttonHeight / 2);
local roomButtonBorder = buttonBorder;
@ -440,7 +442,7 @@ draw_room = function(name, x, y, selected, hoverindex)
gfx.FillColor(0,255,0);
roomButtonBorder = 4;
end
if mouse_clipped(rx,ty, buttonWidth, buttonHeight) then
if mouse_clipped(rx,ty-75, buttonWidth, buttonHeight/2) then
hovered = hoverindex;
gfx.FillColor(255,128,0);
end
@ -465,10 +467,10 @@ draw_button = function(name, x, y, buttonWidth, hoverindex)
end
draw_button_color = function(name, x, y, buttonWidth, hoverindex,img)
local rx = x/buttonWidth;
local ty = y-20;
local rx = x;
local ty = y - buttonHeight;
gfx.BeginPath();
gfx.ImageRect(rx,ty,buttonWidth/1.5,buttonHeight*2,img,1,0)
gfx.ImageRect(rx,ty,buttonWidth,buttonHeight,img,1,0)
if mouse_clipped(rx,ty, buttonWidth/1.5, buttonHeight*2) then
hovered = hoverindex;
end
@ -558,17 +560,17 @@ function render_loading()
gfx.Save()
gfx.ResetTransform()
gfx.BeginPath()
gfx.MoveTo(resx, resy)
gfx.LineTo(resx - 350, resy)
gfx.LineTo(resx - 300, resy - 50)
gfx.LineTo(resx, resy - 50)
gfx.MoveTo(desw, desh)
gfx.LineTo(desw - 350, desh)
gfx.LineTo(desw - 300, desh - 50)
gfx.LineTo(desw, desh - 50)
gfx.ClosePath()
gfx.FillColor(33,33,33)
gfx.Fill()
gfx.FillColor(255,255,255)
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT, gfx.TEXT_ALIGN_BOTTOM)
gfx.FontSize(70)
gfx.Text("LOADING...", resx - 20, resy - 3)
gfx.Text("LOADING...", desw - 20, desh - 3)
gfx.Restore()
end
@ -670,7 +672,7 @@ function draw_rooms(y, h)
if room.password then
status = status..' <P>'
end
draw_room(room.name .. ': '.. status, resx / 2, ypos, i == selected_room_index, function()
draw_room(room.name .. ': '.. status, desw/2, ypos, i == selected_room_index, function()
join_room(room)
end)
end
@ -684,7 +686,7 @@ change_selected_room = function(off)
return;
end
local h = resy - 290;
local h = desh - 290;
local num_rooms_visible = math.floor(h / (buttonHeight + 10))
@ -744,29 +746,29 @@ function render_room_list(deltaTime)
Background.draw(deltaTime)
draw_rooms(175, resy - 290);
draw_rooms(175, desh - 290);
-- Draw cover for rooms out of view
gfx.BeginPath()
gfx.FillColor(20, 20, 20)
gfx.Rect(0, 0, resx, 145)
gfx.Rect(0, resy-170, resx, 170)
gfx.Rect(0, 0, desw, 145)
gfx.Rect(0, desh-170, desw, 170)
gfx.Fill()
gfx.BeginPath()
gfx.FillColor(60, 60, 60)
gfx.Rect(0, 145, resx, 2)
gfx.Rect(0, resy-170-2, resx, 2)
gfx.Rect(0, 145, desw, 2)
gfx.Rect(0, desh-170-2, desw, 2)
gfx.Fill()
gfx.FillColor(255,255,255)
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
gfx.FontSize(70)
gfx.Text("Multiplayer Rooms", resx/2, 100)
gfx.Text("- - - - - - - - - - - Multiplayer Rooms - - - - - - - - - - -", desw/2, 100)
if not loading then
draw_button("Create new room", resx/2, resy-40-buttonHeight, resx*(3/4), new_room);
draw_button("Create new room", desw/2, desh-40-buttonHeight, desw*(3/4), new_room);
end
@ -778,40 +780,40 @@ function render_password_screen(deltaTime)
gfx.FillColor(255,255,255)
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
gfx.FontSize(70)
gfx.Text("Joining "..selected_room.name.."...", resx/2, resy/4)
gfx.Text("Joining "..selected_room.name.."...", desw/2, desh/4)
gfx.FillColor(50,50,50)
gfx.BeginPath()
gfx.Rect(0, resy/2-10, resx, 40)
gfx.Rect(0, desh/2-10, desw, 40)
gfx.Fill();
gfx.FillColor(255,255,255)
gfx.Text("Please enter room password:", resx/2, resy/2-40)
gfx.Text(string.rep("*",#textInput.text), resx/2, resy/2+40)
gfx.Text("Please enter room password:", desw/2, desh/2-40)
gfx.Text(string.rep("*",#textInput.text), desw/2, desh/2+40)
if passwordError then
gfx.FillColor(255,50,50)
gfx.FontSize(60 + math.floor(passwordErrorOffset*20))
gfx.Text("Invalid password", resx/2, resy/2+80)
gfx.Text("Invalid password", desw/2, desh/2+80)
end
draw_button("Join", resx/2, resy*3/4, resx/2, mpScreen.JoinWithPassword);
draw_button("Join", desw/2, desh*3/4, desw/2, mpScreen.JoinWithPassword);
end
function render_new_room_password(delta_time)
gfx.FillColor(255,255,255)
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
gfx.FontSize(70)
gfx.Text("Create New Room", resx/2, resy/4)
gfx.Text("Create New Room", desw/2, desh/4)
gfx.FillColor(50,50,50)
gfx.BeginPath()
gfx.Rect(0, resy/2-10, resx, 40)
gfx.Rect(0, desh/2-10, desw, 40)
gfx.Fill();
gfx.FillColor(255,255,255)
gfx.Text("Enter room password:", resx/2, resy/2-40)
gfx.Text(string.rep("*",#textInput.text), resx/2, resy/2+40)
draw_button("Create Room", resx/2, resy*3/4, resx/2, mpScreen.NewRoomStep);
gfx.Text("Enter room password:", desw/2, desh/2-40)
gfx.Text(string.rep("*",#textInput.text), desw/2, desh/2+40)
draw_button("Create Room", desw/2, desh*3/4, desw/2, mpScreen.NewRoomStep);
end
--here
function render_new_room_name(deltaTime)
@ -820,31 +822,31 @@ function render_new_room_name(deltaTime)
gfx.FillColor(255,255,255)
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
gfx.FontSize(70)
gfx.Text("Create New Room", resx/2, resy/4)
gfx.Text("Create New Room", desw/2, desh/4)
gfx.Rect(0, resy/2-10, resx, 60)
gfx.Rect(0, desh/2-10, desw, 60)
gfx.Text("Please enter room name:", resx/2, resy/2-40)
gfx.Text(textInput.text, resx/2, resy/2+40)
draw_button("Next", resx/2, resy*3/4, resx/2, mpScreen.NewRoomStep);
gfx.Text("Please enter room name:", desw/2, desh/2-40)
gfx.Text(textInput.text, desw/2, desh/2+40)
draw_button("Next", desw/2, desh*3/4, desw/2, mpScreen.NewRoomStep);
end
function render_set_username(deltaTime)
gfx.FillColor(255,255,255)
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
gfx.FontSize(70)
gfx.Text("First things first...", resx/2, resy/4)
gfx.Text("First things first...", desw/2, desh/4)
gfx.FillColor(50,50,50)
gfx.BeginPath()
gfx.Rect(0, resy/2-10, resx, 60)
gfx.Rect(0, desh/2-10, desw, 60)
gfx.Fill();
gfx.FillColor(255,255,255)
gfx.Text("Enter a display name:", resx/2, resy/2-40)
gfx.Text(textInput.text, resx/2, resy/2+40)
draw_button("Join Multiplayer", resx/2, resy*3/4, resx/2, function()
gfx.Text("Enter a display name:", desw/2, desh/2-40)
gfx.Text(textInput.text, desw/2, desh/2+40)
draw_button("Join Multiplayer", desw/2, desh*3/4, desw/2, function()
loading = true;
mpScreen.SaveUsername()
end);
@ -858,7 +860,7 @@ render = function(deltaTime)
Dim.transformToScreenSpace()
buttonWidth = resx*(3/4);
buttonWidth = desw*(3/4);
mposx,mposy = game.GetMousePos();
Sound.stopMusic();