extends Control

@onready var IPAdress_Field = $VBoxContainer/JoinContainer/IPAdress as TextEdit
signal start_game
signal back

func _on_join_button_pressed():
	if not try_connection():
		return
	Network.start_network(false, IPAdress_Field.text)
	start_game.emit()


func try_connection():
	if IPAdress_Field.text.is_empty():
		return false
	return true


func _on_host_button_pressed():
	Network.start_network(true)
	start_game.emit()


func _on_back_button_pressed():
	hide()
	back.emit()
