diff options
Diffstat (limited to 'client/Archipelago/manager.gd')
-rw-r--r-- | client/Archipelago/manager.gd | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/client/Archipelago/manager.gd b/client/Archipelago/manager.gd index e1c32b9..6b34bdf 100644 --- a/client/Archipelago/manager.gd +++ b/client/Archipelago/manager.gd | |||
@@ -22,6 +22,30 @@ signal connect_status | |||
22 | signal ap_connected | 22 | signal ap_connected |
23 | 23 | ||
24 | 24 | ||
25 | func _init(): | ||
26 | # Read AP settings from file, if there are any | ||
27 | if FileAccess.file_exists("user://ap_settings"): | ||
28 | var file = FileAccess.open("user://ap_settings", FileAccess.READ) | ||
29 | var data = file.get_var(true) | ||
30 | file.close() | ||
31 | |||
32 | if typeof(data) != TYPE_ARRAY: | ||
33 | global._print("AP settings file is corrupted") | ||
34 | data = [] | ||
35 | |||
36 | if data.size() > 0: | ||
37 | ap_server = data[0] | ||
38 | |||
39 | if data.size() > 1: | ||
40 | ap_user = data[1] | ||
41 | |||
42 | if data.size() > 2: | ||
43 | ap_pass = data[2] | ||
44 | |||
45 | if data.size() > 3: | ||
46 | connection_history = data[3] | ||
47 | |||
48 | |||
25 | func _ready(): | 49 | func _ready(): |
26 | client = SCRIPT_client.new() | 50 | client = SCRIPT_client.new() |
27 | client.SCRIPT_uuid = SCRIPT_uuid | 51 | client.SCRIPT_uuid = SCRIPT_uuid |
@@ -35,7 +59,18 @@ func _ready(): | |||
35 | 59 | ||
36 | 60 | ||
37 | func saveSettings(): | 61 | func saveSettings(): |
38 | pass | 62 | # Save the AP settings to disk. |
63 | var path = "user://ap_settings" | ||
64 | var file = FileAccess.open(path, FileAccess.WRITE) | ||
65 | |||
66 | var data = [ | ||
67 | ap_server, | ||
68 | ap_user, | ||
69 | ap_pass, | ||
70 | connection_history, | ||
71 | ] | ||
72 | file.store_var(data, true) | ||
73 | file.close() | ||
39 | 74 | ||
40 | 75 | ||
41 | func saveLocaldata(): | 76 | func saveLocaldata(): |