about summary refs log tree commit diff stats
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
downloadlingo-archipelago-563382d459ce18b6df4e5cf9161bc47d942d9276.tar.gz
lingo-archipelago-563382d459ce18b6df4e5cf9161bc47d942d9276.tar.bz2
lingo-archipelago-563382d459ce18b6df4e5cf9161bc47d942d9276.zip
Settings screen
-rw-r--r--Archipelago/settings_buttons.gd31
-rw-r--r--Archipelago/settings_screen.gd21
-rw-r--r--archipelago.tscn133
3 files changed, 185 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]
diff --git a/archipelago.tscn b/archipelago.tscn new file mode 100644 index 0000000..def9ce4 --- /dev/null +++ b/archipelago.tscn
@@ -0,0 +1,133 @@
1[gd_scene load_steps=9 format=2]
2
3[ext_resource path="res://nodes/label.tscn" type="PackedScene" id=1]
4[ext_resource path="res://fonts/Lingo.tres" type="DynamicFont" id=2]
5[ext_resource path="res://nodes/button.tscn" type="PackedScene" id=3]
6[ext_resource path="user://maps/Archipelago/settings_buttons.gd" type="Script" id=4]
7[ext_resource path="user://maps/Archipelago/settings_screen.gd" type="Script" id=5]
8[ext_resource path="res://fonts/Lingo35.tres" type="DynamicFont" id=6]
9
10[sub_resource type="StyleBoxFlat" id=1]
11bg_color = Color( 0, 0, 0, 0 )
12
13[sub_resource type="StyleBoxFlat" id=2]
14bg_color = Color( 1, 1, 1, 1 )
15border_width_left = 1
16border_width_top = 1
17border_width_right = 1
18border_width_bottom = 1
19border_color = Color( 1, 1, 0, 1 )
20border_blend = true
21corner_radius_top_left = 3
22corner_radius_top_right = 3
23corner_radius_bottom_right = 3
24corner_radius_bottom_left = 3
25expand_margin_left = 5.0
26expand_margin_right = 5.0
27expand_margin_top = 5.0
28expand_margin_bottom = 5.0
29
30[node name="settings_screen" type="Spatial"]
31script = ExtResource( 5 )
32
33[node name="Panel" type="Panel" parent="."]
34margin_right = 1920.0
35margin_bottom = 1080.0
36
37[node name="title" parent="Panel" instance=ExtResource( 1 )]
38margin_left = 0.0
39margin_top = 75.0
40margin_right = 1920.0
41margin_bottom = 225.0
42custom_fonts/font = ExtResource( 2 )
43text = "ARCHIPELAGO"
44valign = 1
45
46[node name="credit" parent="Panel" instance=ExtResource( 1 )]
47visible = false
48margin_left = 1278.0
49margin_top = 974.0
50margin_right = 1868.0
51margin_bottom = 1034.0
52custom_fonts/font = ExtResource( 2 )
53text = "Brenton Wildes"
54
55[node name="connect_button" parent="Panel" instance=ExtResource( 3 )]
56margin_left = 255.0
57margin_top = 875.0
58margin_right = 891.0
59margin_bottom = 1025.0
60custom_colors/font_color_hover = Color( 1, 0.501961, 0, 1 )
61custom_fonts/font = ExtResource( 2 )
62text = "CONNECT"
63script = ExtResource( 4 )
64
65[node name="quit_button" parent="Panel" instance=ExtResource( 3 )]
66margin_left = 1102.0
67margin_top = 875.0
68margin_right = 1738.0
69margin_bottom = 1025.0
70custom_colors/font_color_hover = Color( 1, 0, 0, 1 )
71custom_fonts/font = ExtResource( 2 )
72text = "BACK"
73script = ExtResource( 4 )
74
75[node name="credit2" parent="Panel" instance=ExtResource( 1 )]
76margin_left = 267.0
77margin_top = 347.0
78margin_right = 857.0
79margin_bottom = 411.0
80custom_fonts/font = ExtResource( 2 )
81custom_styles/normal = SubResource( 1 )
82text = "SERVER"
83
84[node name="credit3" parent="Panel" instance=ExtResource( 1 )]
85margin_left = 263.0
86margin_top = 515.0
87margin_right = 853.0
88margin_bottom = 579.0
89custom_fonts/font = ExtResource( 2 )
90custom_styles/normal = SubResource( 1 )
91text = "PLAYER"
92
93[node name="credit4" parent="Panel" instance=ExtResource( 1 )]
94margin_left = 199.0
95margin_top = 691.0
96margin_right = 789.0
97margin_bottom = 755.0
98custom_fonts/font = ExtResource( 2 )
99custom_styles/normal = SubResource( 1 )
100text = "PASSWORD"
101
102[node name="server_box" type="LineEdit" parent="Panel"]
103margin_left = 682.0
104margin_top = 295.0
105margin_right = 1324.0
106margin_bottom = 445.0
107custom_colors/selection_color = Color( 0.482353, 0, 0, 1 )
108custom_colors/font_color = Color( 0, 0, 0, 1 )
109custom_styles/focus = SubResource( 2 )
110align = 1
111
112[node name="player_box" type="LineEdit" parent="Panel"]
113margin_left = 682.0
114margin_top = 477.0
115margin_right = 1324.0
116margin_bottom = 627.0
117custom_colors/selection_color = Color( 0.482353, 0, 0, 1 )
118custom_colors/font_color = Color( 0, 0, 0, 1 )
119custom_styles/focus = SubResource( 2 )
120align = 1
121
122[node name="password_box" type="LineEdit" parent="Panel"]
123margin_left = 682.0
124margin_top = 659.0
125margin_right = 1324.0
126margin_bottom = 809.0
127custom_colors/selection_color = Color( 0.482353, 0, 0, 1 )
128custom_colors/font_color = Color( 0, 0, 0, 1 )
129custom_styles/focus = SubResource( 2 )
130align = 1
131
132[connection signal="pressed" from="Panel/connect_button" to="Panel/connect_button" method="_connect_pressed"]
133[connection signal="pressed" from="Panel/quit_button" to="Panel/quit_button" method="_back_pressed"]