18 lines
506 B
GDScript
18 lines
506 B
GDScript
extends Control
|
|
|
|
signal join_lobby(addr: String, port: int)
|
|
|
|
@rpc("reliable", "authority", "call_local")
|
|
func add(addr: String, port: int):
|
|
var lobby_button := preload("res://server/lobby_list_entry.tscn").instantiate()
|
|
lobby_button.address = addr
|
|
lobby_button.port = port
|
|
$Lobbies.add_child(lobby_button, true)
|
|
lobby_button.pressed.connect(emit_join_lobby.bind(addr, port))
|
|
|
|
func emit_join_lobby(addr: String, port: int):
|
|
join_lobby.emit(addr, port)
|
|
|
|
func lobbies():
|
|
return $Lobbies.get_children()
|