You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
767 B
30 lines
767 B
extends Control
|
|
|
|
var lobby_menu_scene = preload("res://scenes/menu/lobby.tscn")
|
|
|
|
func _ready():
|
|
game.connect("connection_succeeded", self, "_connection_succeeded")
|
|
game.connect("connection_failed", self, "_connection_failed")
|
|
|
|
func _on_join_pressed():
|
|
var ip = get_node("menu/ip").text
|
|
|
|
if not ip.is_valid_ip_address():
|
|
get_node("menu/error").text="Invalid IPv4 address!"
|
|
return
|
|
|
|
var port = get_node("menu/port").text
|
|
game.join_game(ip, int(port))
|
|
|
|
func _connection_succeeded():
|
|
var lobby_menu = lobby_menu_scene.instance()
|
|
get_tree().get_root().add_child(lobby_menu)
|
|
queue_free()
|
|
|
|
func _connection_failed():
|
|
get_node("menu/error").text="Connection failed!"
|
|
|
|
func _on_back_pressed():
|
|
queue_free()
|
|
get_tree().get_root().get_node("server").show()
|
|
|