mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 23:52:35 +00:00
Added prototype multiplayer lobby
This commit is contained in:
@@ -5,11 +5,10 @@ class IMICFPS
|
|||||||
|
|
||||||
link "Single Player" do
|
link "Single Player" do
|
||||||
push_state(LevelSelectMenu)
|
push_state(LevelSelectMenu)
|
||||||
# push_state(LoadingState.new(forward: Game, map_file: GAME_ROOT_PATH + "/maps/test_map.json"))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
link "Multiplayer" do
|
link "Multiplayer" do
|
||||||
push_state(MultiplayerMenu)
|
push_state(MultiplayerLobbyMenu)
|
||||||
end
|
end
|
||||||
|
|
||||||
link "Settings" do
|
link "Settings" do
|
||||||
|
|||||||
82
lib/ui/menus/multiplayer_lobby_menu.rb
Normal file
82
lib/ui/menus/multiplayer_lobby_menu.rb
Normal 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
|
||||||
Reference in New Issue
Block a user