about summary refs log tree commit diff stats
path: root/Archipelago
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-04-12 15:44:51 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-04-12 15:44:51 -0400
commit563382d459ce18b6df4e5cf9161bc47d942d9276 (patch)
tree5d6ff8725567297d0596c9d457384f9f3c7a5c7f /Archipelago
downloadlingo-archipelago-563382d459ce18b6df4e5cf9161bc47d942d9276.tar.gz
lingo-archipelago-563382d459ce18b6df4e5cf9161bc47d942d9276.tar.bz2
lingo-archipelago-563382d459ce18b6df4e5cf9161bc47d942d9276.zip
Settings screen
Diffstat (limited to 'Archipelago')
-rw-r--r--Archipelago/settings_buttons.gd31
-rw-r--r--Archipelago/settings_screen.gd21
2 files changed, 52 insertions, 0 deletions
diff --git a/Archipelago/settings_buttons.gd b/Archipelago/settings_buttons.gd new file mode 100644 index 0000000..5b4d837 --- /dev/null +++ b/Archipelago/settings_buttons.gd
@@ -0,0 +1,31 @@
1extends Button
2
3
4func _ready():
5 pass
6
7
8func _connect_pressed():
9 # Save the AP settings to disk.
10 var dir = Directory.new()
11 var path = "user://settings"
12 if dir.dir_exists(path):
13 pass
14 else:
15 dir.make_dir(path)
16
17 var file = File.new()
18 file.open("user://settings/archipelago", File.WRITE)
19
20 var data = [
21 self.get_parent().get_node("server_box").text,
22 self.get_parent().get_node("player_box").text,
23 self.get_parent().get_node("password_box").text
24 ]
25
26 file.store_var(data, true)
27 file.close()
28
29
30func _back_pressed():
31 fader._fade_start("main_menu")
diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd new file mode 100644 index 0000000..91f233d --- /dev/null +++ b/Archipelago/settings_screen.gd
@@ -0,0 +1,21 @@
1extends Spatial
2
3
4func _ready():
5 # Undo the load screen removing our cursor
6 get_tree().get_root().set_disable_input(false)
7 Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
8
9 # Read AP settings from file, if there are any
10 var file = File.new()
11 if file.file_exists("user://settings/archipelago"):
12 file.open("user://settings/archipelago", File.READ)
13 var data = file.get_var(true)
14 file.close()
15
16 if data.size() > 0:
17 self.get_node("Panel/server_box").text = data[0]
18 if data.size() > 1:
19 self.get_node("Panel/player_box").text = data[1]
20 if data.size() > 2:
21 self.get_node("Panel/password_box").text = data[2]