about summary refs log tree commit diff stats
path: root/Archipelago/settings_screen.gd
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-04-17 12:30:18 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-04-17 12:30:18 -0400
commitce831897b89974f38fd6f0583e5feac178643a14 (patch)
tree205fac55f33de613efc2d4c15dd9e9ecc15febe4 /Archipelago/settings_screen.gd
parentdbc0e454596ba7e1a8378685c35e37dccd19c964 (diff)
downloadlingo-archipelago-ce831897b89974f38fd6f0583e5feac178643a14.tar.gz
lingo-archipelago-ce831897b89974f38fd6f0583e5feac178643a14.tar.bz2
lingo-archipelago-ce831897b89974f38fd6f0583e5feac178643a14.zip
Add connection history
Diffstat (limited to 'Archipelago/settings_screen.gd')
-rw-r--r--Archipelago/settings_screen.gd31
1 files changed, 31 insertions, 0 deletions
diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd index de64214..453e3bf 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd
@@ -67,6 +67,19 @@ func _ready():
67 self.get_node("Panel/multiplayer_box").pressed = apclient.enable_multiplayer 67 self.get_node("Panel/multiplayer_box").pressed = apclient.enable_multiplayer
68 self.get_node("Panel/position_box").pressed = apclient.track_player 68 self.get_node("Panel/position_box").pressed = apclient.track_player
69 69
70 var history_box = get_node("Panel/connection_history")
71 if apclient.connection_history.empty():
72 history_box.disabled = true
73 else:
74 history_box.disabled = false
75
76 var i = 0
77 for details in apclient.connection_history:
78 history_box.get_popup().add_item("%s (%s)" % [details[1], details[0]], i)
79 i += 1
80
81 history_box.get_popup().connect("id_pressed", self, "historySelected")
82
70 # Show client version. 83 # Show client version.
71 self.get_node("Panel/title").text = "ARCHIPELAGO (%s)" % apclient.my_version 84 self.get_node("Panel/title").text = "ARCHIPELAGO (%s)" % apclient.my_version
72 85
@@ -109,6 +122,15 @@ func connectionStatus(message):
109func connectionSuccessful(): 122func connectionSuccessful():
110 var apclient = global.get_node("Archipelago") 123 var apclient = global.get_node("Archipelago")
111 124
125 # Save connection details
126 var connection_details = [apclient.ap_server, apclient.ap_user, apclient.ap_pass]
127 if apclient.connection_history.has(connection_details):
128 apclient.connection_history.erase(connection_details)
129 apclient.connection_history.push_front(connection_details)
130 if apclient.connection_history.size() > 10:
131 apclient.connection_history.resize(10)
132 apclient.saveSettings()
133
112 # Switch to LL1 134 # Switch to LL1
113 Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) 135 Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
114 global.save_file = apclient.getSaveFileName() 136 global.save_file = apclient.getSaveFileName()
@@ -130,3 +152,12 @@ func connectionUnsuccessful(error_message):
130 popup.popup_exclusive = true 152 popup.popup_exclusive = true
131 popup.get_ok().visible = true 153 popup.get_ok().visible = true
132 popup.popup_centered() 154 popup.popup_centered()
155
156
157func historySelected(index):
158 var apclient = global.get_node("Archipelago")
159 var details = apclient.connection_history[index]
160
161 self.get_node("Panel/server_box").text = details[0]
162 self.get_node("Panel/player_box").text = details[1]
163 self.get_node("Panel/password_box").text = details[2]