about summary refs log tree commit diff stats
path: root/Archipelago
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-04-20 22:48:41 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-04-20 22:48:41 -0400
commit86a87b882be20825af21bd09225aaa35ca793777 (patch)
treee88b673021c26170b27c069995c29828f58d7648 /Archipelago
parenta297dd6d094466214d746c84a66fe70a0bed97d5 (diff)
downloadlingo-archipelago-86a87b882be20825af21bd09225aaa35ca793777.tar.gz
lingo-archipelago-86a87b882be20825af21bd09225aaa35ca793777.tar.bz2
lingo-archipelago-86a87b882be20825af21bd09225aaa35ca793777.zip
Disable connect button while connecting
Pressing back now also halts the connection.
Diffstat (limited to 'Archipelago')
-rw-r--r--Archipelago/client.gd13
-rw-r--r--Archipelago/settings_buttons.gd5
-rw-r--r--Archipelago/settings_screen.gd2
3 files changed, 19 insertions, 1 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index a6a78e2..bb6d0a2 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -124,6 +124,11 @@ func _connected(_proto = ""):
124 global._print("Connected!") 124 global._print("Connected!")
125 125
126 126
127func disconnect_from_ap():
128 _initiated_disconnect = true
129 _client.disconnect_from_host()
130
131
127func _on_data(): 132func _on_data():
128 var packet = _client.get_peer(1).get_packet() 133 var packet = _client.get_peer(1).get_packet()
129 global._print("Got data from server: " + packet.get_string_from_utf8()) 134 global._print("Got data from server: " + packet.get_string_from_utf8())
@@ -388,7 +393,13 @@ func connectToServer():
388 var url = "ws://" + ap_server 393 var url = "ws://" + ap_server
389 var err = _client.connect_to_url(url) 394 var err = _client.connect_to_url(url)
390 if err != OK: 395 if err != OK:
391 emit_signal("could_not_connect", "Could not connect to Archipelago. Error code: %d." % err) 396 emit_signal(
397 "could_not_connect",
398 (
399 "Could not connect to Archipelago. Check that your server and port are correct. See the error log for more information. Error code: %d."
400 % err
401 )
402 )
392 global._print("Could not connect to AP: " + err) 403 global._print("Could not connect to AP: " + err)
393 return 404 return
394 _should_process = true 405 _should_process = true
diff --git a/Archipelago/settings_buttons.gd b/Archipelago/settings_buttons.gd index 735f944..0050504 100644 --- a/Archipelago/settings_buttons.gd +++ b/Archipelago/settings_buttons.gd
@@ -6,6 +6,8 @@ func _ready():
6 6
7 7
8func _connect_pressed(): 8func _connect_pressed():
9 self.disabled = true
10
9 var apclient = global.get_node("Archipelago") 11 var apclient = global.get_node("Archipelago")
10 apclient.ap_server = self.get_parent().get_node("server_box").text 12 apclient.ap_server = self.get_parent().get_node("server_box").text
11 apclient.ap_user = self.get_parent().get_node("player_box").text 13 apclient.ap_user = self.get_parent().get_node("player_box").text
@@ -16,4 +18,7 @@ func _connect_pressed():
16 18
17 19
18func _back_pressed(): 20func _back_pressed():
21 var apclient = global.get_node("Archipelago")
22 apclient.disconnect_from_ap()
23
19 fader._fade_start("main_menu") 24 fader._fade_start("main_menu")
diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd index 0eb68cf..b74617b 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd
@@ -66,6 +66,8 @@ func connectionSuccessful():
66 66
67 67
68func connectionUnsuccessful(error_message): 68func connectionUnsuccessful(error_message):
69 self.get_node("Panel/connect_button").disabled = false
70
69 var popup = self.get_node("Panel/AcceptDialog") 71 var popup = self.get_node("Panel/AcceptDialog")
70 popup.window_title = "Could not connect to Archipelago" 72 popup.window_title = "Could not connect to Archipelago"
71 popup.dialog_text = error_message 73 popup.dialog_text = error_message