diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-04-17 12:30:18 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-04-17 12:30:18 -0400 |
| commit | ce831897b89974f38fd6f0583e5feac178643a14 (patch) | |
| tree | 205fac55f33de613efc2d4c15dd9e9ecc15febe4 | |
| parent | dbc0e454596ba7e1a8378685c35e37dccd19c964 (diff) | |
| download | lingo-archipelago-ce831897b89974f38fd6f0583e5feac178643a14.tar.gz lingo-archipelago-ce831897b89974f38fd6f0583e5feac178643a14.tar.bz2 lingo-archipelago-ce831897b89974f38fd6f0583e5feac178643a14.zip | |
Add connection history
| -rw-r--r-- | Archipelago/client.gd | 6 | ||||
| -rw-r--r-- | Archipelago/settings_screen.gd | 31 | ||||
| -rw-r--r-- | archipelago.tscn | 25 |
3 files changed, 53 insertions, 9 deletions
| diff --git a/Archipelago/client.gd b/Archipelago/client.gd index f15afe6..489fdb9 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd | |||
| @@ -15,6 +15,7 @@ var ap_pass = "" | |||
| 15 | var confusify_world = false | 15 | var confusify_world = false |
| 16 | var enable_multiplayer = false | 16 | var enable_multiplayer = false |
| 17 | var track_player = false | 17 | var track_player = false |
| 18 | var connection_history = [] | ||
| 18 | 19 | ||
| 19 | const my_version = "2.1.1" | 20 | const my_version = "2.1.1" |
| 20 | const ap_version = {"major": 0, "minor": 4, "build": 5, "class": "Version"} | 21 | const ap_version = {"major": 0, "minor": 4, "build": 5, "class": "Version"} |
| @@ -161,6 +162,8 @@ func _init(): | |||
| 161 | enable_multiplayer = data[5] | 162 | enable_multiplayer = data[5] |
| 162 | if data.size() > 6: | 163 | if data.size() > 6: |
| 163 | track_player = data[6] | 164 | track_player = data[6] |
| 165 | if data.size() > 7: | ||
| 166 | connection_history = data[7] | ||
| 164 | 167 | ||
| 165 | processDatapackages() | 168 | processDatapackages() |
| 166 | 169 | ||
| @@ -485,7 +488,8 @@ func saveSettings(): | |||
| 485 | _datapackages, | 488 | _datapackages, |
| 486 | confusify_world, | 489 | confusify_world, |
| 487 | enable_multiplayer, | 490 | enable_multiplayer, |
| 488 | track_player | 491 | track_player, |
| 492 | connection_history | ||
| 489 | ] | 493 | ] |
| 490 | file.store_var(data, true) | 494 | file.store_var(data, true) |
| 491 | file.close() | 495 | file.close() |
| 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): | |||
| 109 | func connectionSuccessful(): | 122 | func 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 | |||
| 157 | func 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] | ||
| diff --git a/archipelago.tscn b/archipelago.tscn index f0b8ab9..f063af9 100644 --- a/archipelago.tscn +++ b/archipelago.tscn | |||
| @@ -86,9 +86,9 @@ align = 2 | |||
| 86 | 86 | ||
| 87 | [node name="credit5" parent="Panel" instance=ExtResource( 1 )] | 87 | [node name="credit5" parent="Panel" instance=ExtResource( 1 )] |
| 88 | margin_left = 1239.0 | 88 | margin_left = 1239.0 |
| 89 | margin_top = 271.0 | 89 | margin_top = 422.0 |
| 90 | margin_right = 1829.0 | 90 | margin_right = 1829.0 |
| 91 | margin_bottom = 335.0 | 91 | margin_bottom = 486.0 |
| 92 | custom_fonts/font = ExtResource( 2 ) | 92 | custom_fonts/font = ExtResource( 2 ) |
| 93 | custom_styles/normal = SubResource( 1 ) | 93 | custom_styles/normal = SubResource( 1 ) |
| 94 | text = "OPTIONS" | 94 | text = "OPTIONS" |
| @@ -155,9 +155,9 @@ margin_bottom = 58.0 | |||
| 155 | 155 | ||
| 156 | [node name="confusing_box" type="CheckBox" parent="Panel"] | 156 | [node name="confusing_box" type="CheckBox" parent="Panel"] |
| 157 | margin_left = 1227.0 | 157 | margin_left = 1227.0 |
| 158 | margin_top = 351.0 | 158 | margin_top = 502.0 |
| 159 | margin_right = 1832.0 | 159 | margin_right = 1832.0 |
| 160 | margin_bottom = 439.0 | 160 | margin_bottom = 590.0 |
| 161 | custom_fonts/font = ExtResource( 6 ) | 161 | custom_fonts/font = ExtResource( 6 ) |
| 162 | custom_icons/checked = ExtResource( 8 ) | 162 | custom_icons/checked = ExtResource( 8 ) |
| 163 | custom_icons/unchecked = ExtResource( 7 ) | 163 | custom_icons/unchecked = ExtResource( 7 ) |
| @@ -165,9 +165,9 @@ text = "Make world more confusing" | |||
| 165 | 165 | ||
| 166 | [node name="multiplayer_box" type="CheckBox" parent="Panel"] | 166 | [node name="multiplayer_box" type="CheckBox" parent="Panel"] |
| 167 | margin_left = 1227.0 | 167 | margin_left = 1227.0 |
| 168 | margin_top = 461.0 | 168 | margin_top = 612.0 |
| 169 | margin_right = 1832.0 | 169 | margin_right = 1832.0 |
| 170 | margin_bottom = 549.0 | 170 | margin_bottom = 700.0 |
| 171 | custom_fonts/font = ExtResource( 6 ) | 171 | custom_fonts/font = ExtResource( 6 ) |
| 172 | custom_icons/checked = ExtResource( 8 ) | 172 | custom_icons/checked = ExtResource( 8 ) |
| 173 | custom_icons/unchecked = ExtResource( 7 ) | 173 | custom_icons/unchecked = ExtResource( 7 ) |
| @@ -175,13 +175,22 @@ text = "Show other players" | |||
| 175 | 175 | ||
| 176 | [node name="position_box" type="CheckBox" parent="Panel"] | 176 | [node name="position_box" type="CheckBox" parent="Panel"] |
| 177 | margin_left = 1227.0 | 177 | margin_left = 1227.0 |
| 178 | margin_top = 571.0 | 178 | margin_top = 722.0 |
| 179 | margin_right = 1832.0 | 179 | margin_right = 1832.0 |
| 180 | margin_bottom = 654.0 | 180 | margin_bottom = 810.0 |
| 181 | custom_fonts/font = ExtResource( 6 ) | 181 | custom_fonts/font = ExtResource( 6 ) |
| 182 | custom_icons/checked = ExtResource( 8 ) | 182 | custom_icons/checked = ExtResource( 8 ) |
| 183 | custom_icons/unchecked = ExtResource( 7 ) | 183 | custom_icons/unchecked = ExtResource( 7 ) |
| 184 | text = "Send position to tracker" | 184 | text = "Send position to tracker" |
| 185 | 185 | ||
| 186 | [node name="connection_history" type="MenuButton" parent="Panel"] | ||
| 187 | margin_left = 1239.0 | ||
| 188 | margin_top = 276.0 | ||
| 189 | margin_right = 1829.0 | ||
| 190 | margin_bottom = 372.0 | ||
| 191 | custom_fonts/font = ExtResource( 6 ) | ||
| 192 | text = "connection history" | ||
| 193 | flat = false | ||
| 194 | |||
| 186 | [connection signal="pressed" from="Panel/connect_button" to="Panel/connect_button" method="_connect_pressed"] | 195 | [connection signal="pressed" from="Panel/connect_button" to="Panel/connect_button" method="_connect_pressed"] |
| 187 | [connection signal="pressed" from="Panel/quit_button" to="Panel/quit_button" method="_back_pressed"] | 196 | [connection signal="pressed" from="Panel/quit_button" to="Panel/quit_button" method="_back_pressed"] |
