diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-04-12 15:44:51 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-04-12 15:44:51 -0400 |
| commit | 563382d459ce18b6df4e5cf9161bc47d942d9276 (patch) | |
| tree | 5d6ff8725567297d0596c9d457384f9f3c7a5c7f | |
| download | lingo-archipelago-563382d459ce18b6df4e5cf9161bc47d942d9276.tar.gz lingo-archipelago-563382d459ce18b6df4e5cf9161bc47d942d9276.tar.bz2 lingo-archipelago-563382d459ce18b6df4e5cf9161bc47d942d9276.zip | |
Settings screen
| -rw-r--r-- | Archipelago/settings_buttons.gd | 31 | ||||
| -rw-r--r-- | Archipelago/settings_screen.gd | 21 | ||||
| -rw-r--r-- | archipelago.tscn | 133 |
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 @@ | |||
| 1 | extends Button | ||
| 2 | |||
| 3 | |||
| 4 | func _ready(): | ||
| 5 | pass | ||
| 6 | |||
| 7 | |||
| 8 | func _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 | |||
| 30 | func _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 @@ | |||
| 1 | extends Spatial | ||
| 2 | |||
| 3 | |||
| 4 | func _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] | ||
| 11 | bg_color = Color( 0, 0, 0, 0 ) | ||
| 12 | |||
| 13 | [sub_resource type="StyleBoxFlat" id=2] | ||
| 14 | bg_color = Color( 1, 1, 1, 1 ) | ||
| 15 | border_width_left = 1 | ||
| 16 | border_width_top = 1 | ||
| 17 | border_width_right = 1 | ||
| 18 | border_width_bottom = 1 | ||
| 19 | border_color = Color( 1, 1, 0, 1 ) | ||
| 20 | border_blend = true | ||
| 21 | corner_radius_top_left = 3 | ||
| 22 | corner_radius_top_right = 3 | ||
| 23 | corner_radius_bottom_right = 3 | ||
| 24 | corner_radius_bottom_left = 3 | ||
| 25 | expand_margin_left = 5.0 | ||
| 26 | expand_margin_right = 5.0 | ||
| 27 | expand_margin_top = 5.0 | ||
| 28 | expand_margin_bottom = 5.0 | ||
| 29 | |||
| 30 | [node name="settings_screen" type="Spatial"] | ||
| 31 | script = ExtResource( 5 ) | ||
| 32 | |||
| 33 | [node name="Panel" type="Panel" parent="."] | ||
| 34 | margin_right = 1920.0 | ||
| 35 | margin_bottom = 1080.0 | ||
| 36 | |||
| 37 | [node name="title" parent="Panel" instance=ExtResource( 1 )] | ||
| 38 | margin_left = 0.0 | ||
| 39 | margin_top = 75.0 | ||
| 40 | margin_right = 1920.0 | ||
| 41 | margin_bottom = 225.0 | ||
| 42 | custom_fonts/font = ExtResource( 2 ) | ||
| 43 | text = "ARCHIPELAGO" | ||
| 44 | valign = 1 | ||
| 45 | |||
| 46 | [node name="credit" parent="Panel" instance=ExtResource( 1 )] | ||
| 47 | visible = false | ||
| 48 | margin_left = 1278.0 | ||
| 49 | margin_top = 974.0 | ||
| 50 | margin_right = 1868.0 | ||
| 51 | margin_bottom = 1034.0 | ||
| 52 | custom_fonts/font = ExtResource( 2 ) | ||
| 53 | text = "Brenton Wildes" | ||
| 54 | |||
| 55 | [node name="connect_button" parent="Panel" instance=ExtResource( 3 )] | ||
| 56 | margin_left = 255.0 | ||
| 57 | margin_top = 875.0 | ||
| 58 | margin_right = 891.0 | ||
| 59 | margin_bottom = 1025.0 | ||
| 60 | custom_colors/font_color_hover = Color( 1, 0.501961, 0, 1 ) | ||
| 61 | custom_fonts/font = ExtResource( 2 ) | ||
| 62 | text = "CONNECT" | ||
| 63 | script = ExtResource( 4 ) | ||
| 64 | |||
| 65 | [node name="quit_button" parent="Panel" instance=ExtResource( 3 )] | ||
| 66 | margin_left = 1102.0 | ||
| 67 | margin_top = 875.0 | ||
| 68 | margin_right = 1738.0 | ||
| 69 | margin_bottom = 1025.0 | ||
| 70 | custom_colors/font_color_hover = Color( 1, 0, 0, 1 ) | ||
| 71 | custom_fonts/font = ExtResource( 2 ) | ||
| 72 | text = "BACK" | ||
| 73 | script = ExtResource( 4 ) | ||
| 74 | |||
| 75 | [node name="credit2" parent="Panel" instance=ExtResource( 1 )] | ||
| 76 | margin_left = 267.0 | ||
| 77 | margin_top = 347.0 | ||
| 78 | margin_right = 857.0 | ||
| 79 | margin_bottom = 411.0 | ||
| 80 | custom_fonts/font = ExtResource( 2 ) | ||
| 81 | custom_styles/normal = SubResource( 1 ) | ||
| 82 | text = "SERVER" | ||
| 83 | |||
| 84 | [node name="credit3" parent="Panel" instance=ExtResource( 1 )] | ||
| 85 | margin_left = 263.0 | ||
| 86 | margin_top = 515.0 | ||
| 87 | margin_right = 853.0 | ||
| 88 | margin_bottom = 579.0 | ||
| 89 | custom_fonts/font = ExtResource( 2 ) | ||
| 90 | custom_styles/normal = SubResource( 1 ) | ||
| 91 | text = "PLAYER" | ||
| 92 | |||
| 93 | [node name="credit4" parent="Panel" instance=ExtResource( 1 )] | ||
| 94 | margin_left = 199.0 | ||
| 95 | margin_top = 691.0 | ||
| 96 | margin_right = 789.0 | ||
| 97 | margin_bottom = 755.0 | ||
| 98 | custom_fonts/font = ExtResource( 2 ) | ||
| 99 | custom_styles/normal = SubResource( 1 ) | ||
| 100 | text = "PASSWORD" | ||
| 101 | |||
| 102 | [node name="server_box" type="LineEdit" parent="Panel"] | ||
| 103 | margin_left = 682.0 | ||
| 104 | margin_top = 295.0 | ||
| 105 | margin_right = 1324.0 | ||
| 106 | margin_bottom = 445.0 | ||
| 107 | custom_colors/selection_color = Color( 0.482353, 0, 0, 1 ) | ||
| 108 | custom_colors/font_color = Color( 0, 0, 0, 1 ) | ||
| 109 | custom_styles/focus = SubResource( 2 ) | ||
| 110 | align = 1 | ||
| 111 | |||
| 112 | [node name="player_box" type="LineEdit" parent="Panel"] | ||
| 113 | margin_left = 682.0 | ||
| 114 | margin_top = 477.0 | ||
| 115 | margin_right = 1324.0 | ||
| 116 | margin_bottom = 627.0 | ||
| 117 | custom_colors/selection_color = Color( 0.482353, 0, 0, 1 ) | ||
| 118 | custom_colors/font_color = Color( 0, 0, 0, 1 ) | ||
| 119 | custom_styles/focus = SubResource( 2 ) | ||
| 120 | align = 1 | ||
| 121 | |||
| 122 | [node name="password_box" type="LineEdit" parent="Panel"] | ||
| 123 | margin_left = 682.0 | ||
| 124 | margin_top = 659.0 | ||
| 125 | margin_right = 1324.0 | ||
| 126 | margin_bottom = 809.0 | ||
| 127 | custom_colors/selection_color = Color( 0.482353, 0, 0, 1 ) | ||
| 128 | custom_colors/font_color = Color( 0, 0, 0, 1 ) | ||
| 129 | custom_styles/focus = SubResource( 2 ) | ||
| 130 | align = 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"] | ||
