Added prototype multiplayer lobby

This commit is contained in:
2020-05-16 08:11:29 -05:00
parent 94c3dea7b9
commit bac0311263
2 changed files with 83 additions and 2 deletions

View File

@@ -5,11 +5,10 @@ class IMICFPS
link "Single Player" do
push_state(LevelSelectMenu)
# push_state(LoadingState.new(forward: Game, map_file: GAME_ROOT_PATH + "/maps/test_map.json"))
end
link "Multiplayer" do
push_state(MultiplayerMenu)
push_state(MultiplayerLobbyMenu)
end
link "Settings" do

View File

@@ -0,0 +1,82 @@
class IMICFPS
class MultiplayerLobbyMenu < Menu
def setup
@sample_games = [
{
host: "Host",
game_type: "Type",
map: "Map",
players: "Players",
ping: "Ping",
source: "Source"
},
{
host: "localhost:54637",
game_type: "C&C",
map: "Test Map",
players: "0/16",
ping: 48,
source: "LAN"
},
{
host: "gameserver1.example.com:5637",
game_type: "C&C",
map: "Islands Test Map",
players: "14/64",
ping: 123,
source: "Internet"
}
]
label "Multiplayer Lobby", text_size: 100
flow width: 1.0, height: 1.0 do
stack width: 0.25 do
button "Host Game", width: 1.0
button "Direct Connect", width: 1.0
button "Back", width: 1.0 do
pop_state
end
end
stack width: 0.5, height: 1.0 do
stack width: 1.0, height: 0.75, border_color: 0xffffffff, border_thickness: 1 do
@sample_games.each_with_index do |game, i|
text_size = 18
flow width: 1.0 do
background i.even? ? 0x55000000 : 0x55ff5500
flow width: 0.1 do
label game[:game_type], text_size: text_size
end
flow width: 0.3 do
label game[:host], text_size: text_size
end
flow width: 0.3 do
label game[:map], text_size: text_size
end
flow width: 0.1 do
label game[:players], text_size: text_size
end
flow width: 0.1 do
label game[:ping], text_size: text_size
end
flow width: 0.1 do
label game[:source], text_size: text_size
end
end
end
end
flow width: 1.0, height: 0.25 do
label "Name"
name = edit_line "", margin_right: 20
button "Join", width: 0.25 do
pp name.value
end
end
end
end
end
end
end