about summary refs log tree commit diff stats
path: root/Archipelago/settings_screen.gd
blob: 0854a8b7a54a6f565d194c98bbae4b5ff4c02284 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
extends Spatial


func _ready():
	# Undo the load screen removing our cursor
	get_tree().get_root().set_disable_input(false)
	Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)

	# Create the global AP client, if it doesn't already exist.
	if not global.has_node("Archipelago"):
		var apclient = ResourceLoader.load("user://maps/Archipelago/client.gd")
		var apclient_instance = apclient.new()
		apclient_instance.name = "Archipelago"
		global.add_child(apclient_instance)

	global.get_node("Archipelago").connect("client_connected", self, "connectionSuccessful")

	# Populate textboxes with AP settings.
	self.get_node("Panel/server_box").text = global.get_node("Archipelago").ap_server
	self.get_node("Panel/player_box").text = global.get_node("Archipelago").ap_user
	self.get_node("Panel/password_box").text = global.get_node("Archipelago").ap_pass


func connectionSuccessful():
	# Switch to LL1
	Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
	global.map = "level1"
	var _discard = get_tree().change_scene("res://scenes/load_screen.tscn")