cs-os/scripts/ConnectButton.gd

17 lines
396 B
GDScript

extends Button
@onready var button = $"."
@onready var ip_input: TextEdit = $"../IP"
@onready var port_input: TextEdit = $"../Port"
func _ready():
button.text = "Connect"
button.pressed.connect(self._button_pressed)
func _button_pressed():
var ip = ip_input.text
var port = port_input.text
print("Trying to connect to " + ip + ":" + port)
Networking.ConnectToServer(str(ip), int(port))