aboutsummaryrefslogtreecommitdiff
path: root/client/menu
diff options
context:
space:
mode:
Diffstat (limited to 'client/menu')
-rw-r--r--client/menu/popup.gd31
-rw-r--r--client/menu/popup.tscn (renamed from client/menu/warning_popup.tscn)23
-rw-r--r--client/menu/rating/rating.tscn2
-rw-r--r--client/menu/setup.gd7
-rw-r--r--client/menu/warning_popup.gd8
5 files changed, 46 insertions, 25 deletions
diff --git a/client/menu/popup.gd b/client/menu/popup.gd
new file mode 100644
index 00000000..5b3a60ac
--- /dev/null
+++ b/client/menu/popup.gd
@@ -0,0 +1,31 @@
+# Hurry Curry! - a game about cooking
+# Copyright 2024 nokoe
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+extends Menu
+class_name MenuPopup
+
+@onready var message := $CenterContainer/Panel/MarginContainer/VBoxContainer/Message
+@onready var button_container := $CenterContainer/Panel/MarginContainer/VBoxContainer/HBoxContainer
+
+class Data:
+ var buttons: Array[Button]
+ var text: String
+
+func _ready():
+ var setup: Data = self.data
+ for i in setup.buttons:
+ button_container.add_child(i)
+ i.pressed.connect(exit)
+ message.text = setup.text
diff --git a/client/menu/warning_popup.tscn b/client/menu/popup.tscn
index 4fd2fbba..85db4897 100644
--- a/client/menu/warning_popup.tscn
+++ b/client/menu/popup.tscn
@@ -1,18 +1,18 @@
-[gd_scene load_steps=4 format=3 uid="uid://0v2olkwpm150"]
+[gd_scene load_steps=4 format=3 uid="uid://lwtym0pbc17g"]
-[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_yk5xc"]
-[ext_resource type="Script" path="res://menu/warning_popup.gd" id="2_2vobb"]
-[ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://menu/theme/dark_blur_material.tres" id="3_5wavk"]
+[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_m0d0r"]
+[ext_resource type="Script" path="res://menu/popup.gd" id="2_1h10j"]
+[ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://menu/theme/dark_blur_material.tres" id="3_iouvy"]
-[node name="WarningPopup" type="Control"]
+[node name="Popup" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
-theme = ExtResource("1_yk5xc")
-script = ExtResource("2_2vobb")
+theme = ExtResource("1_m0d0r")
+script = ExtResource("2_1h10j")
support_anim = false
[node name="CenterContainer" type="CenterContainer" parent="."]
@@ -24,7 +24,7 @@ grow_horizontal = 2
grow_vertical = 2
[node name="Panel" type="PanelContainer" parent="CenterContainer"]
-material = ExtResource("3_5wavk")
+material = ExtResource("3_iouvy")
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/Panel"]
@@ -42,10 +42,3 @@ horizontal_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/Panel/MarginContainer/VBoxContainer"]
layout_mode = 2
alignment = 1
-
-[node name="Accept" type="Button" parent="CenterContainer/Panel/MarginContainer/VBoxContainer/HBoxContainer"]
-layout_mode = 2
-theme_override_font_sizes/font_size = 16
-text = "Accept"
-
-[connection signal="pressed" from="CenterContainer/Panel/MarginContainer/VBoxContainer/HBoxContainer/Accept" to="." method="_on_accept_pressed"]
diff --git a/client/menu/rating/rating.tscn b/client/menu/rating/rating.tscn
index 69edba88..780cf261 100644
--- a/client/menu/rating/rating.tscn
+++ b/client/menu/rating/rating.tscn
@@ -120,7 +120,7 @@ alignment = 1
[node name="Close" type="Button" parent="MarginContainer/PanelContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
-text = "c.menu.rating.accept"
+text = "c.menu.accept"
[node name="StarTimer" type="Timer" parent="."]
wait_time = 0.5
diff --git a/client/menu/setup.gd b/client/menu/setup.gd
index fbf0bfce..580902da 100644
--- a/client/menu/setup.gd
+++ b/client/menu/setup.gd
@@ -60,7 +60,12 @@ func check():
func _on_sign_pressed():
if check() != null: # TODO show error message
- await submenu("res://menu/warning_popup.tscn", check())
+ var data := MenuPopup.Data.new()
+ data.text = check()
+ var accept_button := Button.new()
+ accept_button.text = tr("c.menu.accept")
+ data.buttons = [accept_button]
+ await submenu("res://menu/popup.tscn", data)
return
sign_button.disabled = true
diff --git a/client/menu/warning_popup.gd b/client/menu/warning_popup.gd
deleted file mode 100644
index fd23a30a..00000000
--- a/client/menu/warning_popup.gd
+++ /dev/null
@@ -1,8 +0,0 @@
-extends Menu
-class_name WarningPopup
-
-func _ready():
- $CenterContainer/Panel/MarginContainer/VBoxContainer/Message.text = self.data
-
-func _on_accept_pressed():
- exit()