grounders-slowjam-2024/server/lobby_list.gd

18 lines
506 B
GDScript3
Raw Normal View History

2024-05-25 17:15:59 -06:00
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()