Fixes last step of registration. Fixes password visualizer. Changes the opening curtain to an autoload

This commit is contained in:
Dylan Sarrazyn
2024-02-22 15:33:58 +01:00
parent 1b4fe08f62
commit e5eac1a683
18 changed files with 219 additions and 175 deletions
+46
View File
@@ -0,0 +1,46 @@
extends Control
class_name AdultCheck
const symbols_names = {
"1" : "star",
"2" : "bar",
"3" : "circle",
"4" : "plus",
"5" : "square",
"6" : "triangle",
}
@export var last_scene : String
@export var next_scene : String
@onready var code_keyboard : CodeKeyboard = %CodeKeyboard
@onready var password_label : Label = %PasswordLabel
var base_password_label_text : String
var password : String = ""
func _ready():
base_password_label_text = password_label.text
_reset_password()
OpeningCurtain.open()
func _reset_password():
password = TeacherSettings.available_codes.pick_random()
var password_array = password.split("")
password_label.text = base_password_label_text % [symbols_names[password_array[0]], symbols_names[password[1]], symbols_names[password[2]]]
func _on_back_button_pressed():
get_tree().change_scene_to_file(last_scene)
func _on_code_keyboard_password_entered(entered_password):
if password != entered_password:
code_keyboard.reset_password()
_reset_password()
return
await OpeningCurtain.close()
get_tree().change_scene_to_file(next_scene)
@@ -0,0 +1,99 @@
[gd_scene load_steps=8 format=3 uid="uid://b75gufapo12p7"]
[ext_resource type="PackedScene" uid="uid://djduptonofbh4" path="res://sources/menus/components/code_keyboard.tscn" id="1_2c1xf"]
[ext_resource type="Script" path="res://sources/menus/adult_check/adult_check.gd" id="1_wqrmw"]
[ext_resource type="Texture2D" uid="uid://wtx3wqs0l4si" path="res://assets/minigames/minigame_ui/graphic/button_back_up.png" id="2_tyffq"]
[ext_resource type="PackedScene" uid="uid://wdjp1sv55q4f" path="res://sources/menus/components/night_sky/night_sky.tscn" id="2_whxas"]
[ext_resource type="PackedScene" uid="uid://dxc82xcl7jncd" path="res://sources/menus/main/plants/palm.tscn" id="3_pni2u"]
[ext_resource type="Texture2D" uid="uid://cbhip35yyqneg" path="res://assets/minigames/minigame_ui/graphic/button_back_down.png" id="3_ui1cy"]
[ext_resource type="Texture2D" uid="uid://tcapan0mj64o" path="res://assets/minigames/minigame_ui/graphic/button_back_disabled.png" id="4_cnq3y"]
[node name="AdultCheck" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_wqrmw")
[node name="Background" parent="." instance=ExtResource("2_whxas")]
layout_mode = 1
[node name="Palm" parent="Background" instance=ExtResource("3_pni2u")]
position = Vector2(1280, 1792)
scale = Vector2(2.5, 2.5)
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.19375
anchor_top = 0.102222
anchor_right = 0.807031
anchor_bottom = 0.391111
grow_horizontal = 2
grow_vertical = 2
theme_type_variation = &"PanelKalulu"
[node name="LabelContainer" type="MarginContainer" parent="PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 25
theme_override_constants/margin_right = 25
[node name="PasswordLabel" type="Label" parent="PanelContainer/LabelContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(1500, 500)
layout_mode = 2
size_flags_vertical = 1
theme_override_font_sizes/font_size = 70
text = "Please confirm you are an adult !
Press the %s, %s and %s"
horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 2
[node name="CodeKeyboard" parent="." instance=ExtResource("1_2c1xf")]
unique_name_in_owner = true
anchors_preset = 0
anchor_right = 0.0
anchor_bottom = 0.0
offset_right = 2560.0
offset_bottom = 1800.0
grow_horizontal = 1
grow_vertical = 0
[node name="PasswordVisualizer" parent="CodeKeyboard" index="0"]
offset_left = -376.0
offset_top = -164.0
offset_right = 376.0
offset_bottom = 56.0
key_size = 200
[node name="InterfaceLeft" type="MarginContainer" parent="."]
custom_minimum_size = Vector2(450, 0)
layout_mode = 1
anchors_preset = 9
anchor_bottom = 1.0
offset_right = 450.0
grow_vertical = 2
theme_override_constants/margin_left = 50
theme_override_constants/margin_top = 50
theme_override_constants/margin_right = 50
theme_override_constants/margin_bottom = 50
[node name="Container" type="VBoxContainer" parent="InterfaceLeft"]
layout_mode = 2
[node name="BackButton" type="TextureButton" parent="InterfaceLeft/Container"]
layout_mode = 2
size_flags_vertical = 3
size_flags_stretch_ratio = 4.0
texture_normal = ExtResource("2_tyffq")
texture_pressed = ExtResource("3_ui1cy")
texture_disabled = ExtResource("4_cnq3y")
stretch_mode = 4
[connection signal="password_entered" from="CodeKeyboard" to="." method="_on_code_keyboard_password_entered"]
[connection signal="pressed" from="InterfaceLeft/Container/BackButton" to="." method="_on_back_button_pressed"]
[editable path="CodeKeyboard"]
+4
View File
@@ -19,6 +19,8 @@ func _ready():
device_number_label.show()
device_number_label.text += str(UserDataManager.get_device_settings().device_id)
await OpeningCurtain.open()
await kalulu.play_kalulu_speech(Database.get_audio_stream_for_path(help_speech_path))
music_player.play()
@@ -26,6 +28,7 @@ func _ready():
func _on_code_keyboard_password_entered(password):
if UserDataManager.login_student(password):
await kalulu.play_kalulu_speech(Database.get_audio_stream_for_path(right_password_speech_path))
await OpeningCurtain.close()
get_tree().change_scene_to_file(next_scene_path)
else:
await kalulu.play_kalulu_speech(Database.get_audio_stream_for_path(wrong_password_speech_path))
@@ -50,4 +53,5 @@ func _on_teacher_button_button_up():
func _on_teacher_timer_timeout():
await OpeningCurtain.close()
get_tree().change_scene_to_file(teacher_scene_path)
+11 -2
View File
@@ -1,5 +1,6 @@
extends Control
const adult_check_scene_path := "res://sources/menus/adult_check/adult_check.tscn"
const next_scene_path := "res://sources/menus/login/login.tscn"
const register_scene_path := "res://sources/menus/register/register.tscn"
@@ -17,11 +18,12 @@ func _ready():
version_label.text = ProjectSettings.get_setting("application/config/version")
teacher_label.text = UserDataManager.get_device_settings().teacher
device_id_label.text = str(UserDataManager.get_device_settings().device_id)
OpeningCurtain.open()
func _on_main_button_pressed():
if UserDataManager.get_device_settings().teacher:
get_tree().change_scene_to_file(next_scene_path)
_on_login_in()
else:
kalulu.hide()
kalulu.stop_speech()
@@ -49,7 +51,14 @@ func _on_sign_in_parent_pressed():
func _on_register_pressed():
get_tree().change_scene_to_file(register_scene_path)
await OpeningCurtain.close()
var adult_check_scene : AdultCheck = load(adult_check_scene_path).instantiate()
adult_check_scene.last_scene = get_tree().current_scene.scene_file_path
adult_check_scene.next_scene = register_scene_path
get_tree().get_root().get_child(get_tree().get_root().get_child_count() -1).queue_free()
get_tree().get_root().add_child(adult_check_scene)
func _on_login_in():
+7 -1
View File
@@ -1,22 +1,28 @@
extends Control
func _ready():
OpeningCurtain.open()
func _on_monkeys_button_pressed() -> void:
await OpeningCurtain.close()
get_tree().change_scene_to_file("res://sources/minigames/monkeys/monkeys_minigame.tscn")
func _on_crabs_button_pressed() -> void:
await OpeningCurtain.close()
get_tree().change_scene_to_file("res://sources/minigames/crabs/crabs_minigame.tscn")
func _on_parakeets_button_pressed() -> void:
await OpeningCurtain.close()
get_tree().change_scene_to_file("res://sources/minigames/parakeets/parakeets_minigame.tscn")
func _on_frog_button_pressed() -> void:
await OpeningCurtain.close()
get_tree().change_scene_to_file("res://sources/minigames/frog/frog_minigame.tscn")
func _on_jellyfish_button_pressed() -> void:
await OpeningCurtain.close()
get_tree().change_scene_to_file("res://sources/minigames/jellyfish/jellyfish_minigame.tscn")
+5 -45
View File
@@ -2,14 +2,6 @@ extends Control
const main_menu_path := "res://sources/menus/main/main_menu.tscn"
const next_scene_path := "res://sources/menus/settings/teacher_settings.tscn"
const symbols_names = {
"1" : "star",
"2" : "bar",
"3" : "circle",
"4" : "plus",
"5" : "square",
"6" : "triangle",
}
@onready var teacher_steps : Array[PackedScene] = [
preload("res://sources/menus/register/steps/teacher/method_step.tscn"),
@@ -27,22 +19,18 @@ const symbols_names = {
@onready var students_step : PackedScene = preload("res://sources/menus/register/steps/teacher/students_count_step.tscn")
@onready var player_step : PackedScene = preload("res://sources/menus/register/steps/parent/player_step.tscn")
var base_password_label_text : String
var password : String = ""
var current_steps : Array[Step]
@onready var opening_curtain := %OpeningCurtain
#@onready var opening_curtain : OpeningCurtain = %OpeningCurtain
@onready var register_data := TeacherSettings.new()
@onready var progress_bar := %ProgressBar
@onready var adult_check := %AdultCheck
@onready var code_keyboard : CodeKeyboard = %CodeKeyboard
@onready var password_label : Label = %PasswordLabel
@onready var steps := %Steps
func _ready():
base_password_label_text = password_label.text
_reset_password()
opening_curtain.play("open")
current_steps = [account_type_step.instantiate()]
_go_to_step(progress_bar.value)
OpeningCurtain.open()
func _go_to_step(step_index: int):
@@ -68,30 +56,6 @@ func _go_to_step(step_index: int):
progress_bar.set_value_with_tween(step_index)
func _reset_password():
password = TeacherSettings.available_codes.pick_random()
var password_array = password.split("")
password_label.text = base_password_label_text % [symbols_names[password_array[0]], symbols_names[password[1]], symbols_names[password[2]]]
func _on_code_keyboard_password_entered(code):
if password != code:
code_keyboard.reset_password()
_reset_password()
return
opening_curtain.play("close")
await opening_curtain.animation_finished
adult_check.hide()
progress_bar.show()
current_steps = [account_type_step.instantiate()]
_go_to_step(progress_bar.value)
opening_curtain.play("open")
func _on_step_back(_step : Step):
if progress_bar.value == 0:
get_tree().change_scene_to_file(main_menu_path)
@@ -155,7 +119,3 @@ func _remove_future_steps():
# Resize the array to remove unwanted steps
current_steps.resize(progress_bar.value + 1)
func _on_back_button_pressed():
get_tree().change_scene_to_file(main_menu_path)
+1 -91
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=3 uid="uid://b7cfjs2iipagq"]
[gd_scene load_steps=9 format=3 uid="uid://b7cfjs2iipagq"]
[ext_resource type="Script" path="res://sources/menus/register/register.gd" id="1_jsnxc"]
[ext_resource type="PackedScene" uid="uid://cp27bjh6v5bkj" path="res://sources/minigames/base/opening_curtain.tscn" id="2_kfcp0"]
@@ -7,11 +7,7 @@
[ext_resource type="PackedScene" uid="uid://nwur175781jf" path="res://sources/menus/main/plants/large_flower.tscn" id="5_23tyx"]
[ext_resource type="PackedScene" uid="uid://dqtclljq6bvtg" path="res://sources/menus/main/plants/bush.tscn" id="6_i6t6f"]
[ext_resource type="PackedScene" uid="uid://dp4182l80ntvn" path="res://sources/menus/main/plants/flower.tscn" id="7_iqya7"]
[ext_resource type="Texture2D" uid="uid://wtx3wqs0l4si" path="res://assets/minigames/minigame_ui/graphic/button_back_up.png" id="7_ky0kq"]
[ext_resource type="PackedScene" uid="uid://djduptonofbh4" path="res://sources/menus/components/code_keyboard.tscn" id="7_pghbe"]
[ext_resource type="Texture2D" uid="uid://cbhip35yyqneg" path="res://assets/minigames/minigame_ui/graphic/button_back_down.png" id="8_bj4xm"]
[ext_resource type="Script" path="res://sources/menus/register/ProgressBar.gd" id="8_h8kqu"]
[ext_resource type="Texture2D" uid="uid://tcapan0mj64o" path="res://assets/minigames/minigame_ui/graphic/button_back_disabled.png" id="9_yv3y4"]
[node name="RegisterScreen" type="Control"]
layout_mode = 3
@@ -55,7 +51,6 @@ theme_override_constants/margin_bottom = 50
[node name="ProgressBar" type="ProgressBar" parent="ProgressBarContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_vertical = 1
max_value = 10.0
@@ -72,88 +67,3 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_use_anchors_ = true
[node name="AdultCheck" type="Control" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="PanelContainer" type="PanelContainer" parent="AdultCheck"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.19375
anchor_top = 0.102222
anchor_right = 0.807031
anchor_bottom = 0.391111
grow_horizontal = 2
grow_vertical = 2
theme_type_variation = &"PanelKalulu"
metadata/_edit_use_anchors_ = true
[node name="LabelContainer" type="MarginContainer" parent="AdultCheck/PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 25
theme_override_constants/margin_right = 25
[node name="PasswordLabel" type="Label" parent="AdultCheck/PanelContainer/LabelContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(1500, 500)
layout_mode = 2
size_flags_vertical = 1
theme_override_font_sizes/font_size = 70
text = "Please confirm you are an adult !
Press the %s, %s and %s"
horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 2
[node name="CodeKeyboard" parent="AdultCheck" instance=ExtResource("7_pghbe")]
unique_name_in_owner = true
layout_mode = 2
anchors_preset = 0
anchor_right = 0.0
anchor_bottom = 0.0
offset_right = 2560.0
offset_bottom = 1800.0
grow_vertical = 0
metadata/_edit_use_anchors_ = true
[node name="PasswordVisualizer" parent="AdultCheck/CodeKeyboard" index="0"]
offset_left = -376.0
offset_top = -164.0
offset_right = 376.0
offset_bottom = 56.0
key_size = 200
[node name="InterfaceLeft" type="MarginContainer" parent="AdultCheck"]
custom_minimum_size = Vector2(450, 0)
layout_mode = 1
anchors_preset = 9
anchor_bottom = 1.0
offset_right = 450.0
grow_vertical = 2
theme_override_constants/margin_left = 50
theme_override_constants/margin_top = 50
theme_override_constants/margin_right = 50
theme_override_constants/margin_bottom = 50
[node name="Container" type="VBoxContainer" parent="AdultCheck/InterfaceLeft"]
layout_mode = 2
[node name="BackButton" type="TextureButton" parent="AdultCheck/InterfaceLeft/Container"]
layout_mode = 2
size_flags_vertical = 3
size_flags_stretch_ratio = 4.0
texture_normal = ExtResource("7_ky0kq")
texture_pressed = ExtResource("8_bj4xm")
texture_disabled = ExtResource("9_yv3y4")
stretch_mode = 4
[connection signal="password_entered" from="AdultCheck/CodeKeyboard" to="." method="_on_code_keyboard_password_entered"]
[connection signal="pressed" from="AdultCheck/InterfaceLeft/Container/BackButton" to="." method="_on_back_button_pressed"]
[editable path="AdultCheck/CodeKeyboard"]
@@ -10,6 +10,8 @@ const device_recap_scene : PackedScene = preload("res://sources/menus/register/s
@onready var students_count : Label = %StudentsCount
func on_enter():
super.on_enter()
var teacher_settings = data as TeacherSettings
if not teacher_settings:
return
+3 -1
View File
@@ -7,7 +7,7 @@
custom_minimum_size = Vector2(822, 500)
layout_mode = 3
anchors_preset = 0
offset_right = 500.0
offset_right = 822.0
offset_bottom = 500.0
size_flags_horizontal = 3
script = ExtResource("1_teefe")
@@ -48,6 +48,8 @@ vertical_alignment = 1
[node name="PasswordVisualizer" parent="StudentContainer/MarginContainer/VBoxContainer" instance=ExtResource("1_7chbh")]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
password = "123"
[node name="DetailsButton" type="TextureButton" parent="StudentContainer"]
layout_mode = 2
+4 -1
View File
@@ -8,7 +8,8 @@ const device_tab_scene : PackedScene = preload("res://sources/menus/settings/dev
@onready var devices_tab_container : TabContainer = %DevicesTabContainer
func _ready():
_refresh_devices_tabs()
await _refresh_devices_tabs()
OpeningCurtain.open()
func _refresh_devices_tabs() -> void:
@@ -28,10 +29,12 @@ func _refresh_devices_tabs() -> void:
func _on_back_button_pressed():
await OpeningCurtain.close()
get_tree().change_scene_to_file(login_menu_path)
func _on_logout_button_pressed():
await OpeningCurtain.close()
UserDataManager.logout()
get_tree().change_scene_to_file(main_menu_path)
+3 -7
View File
@@ -22,7 +22,6 @@ class_name Minigame
@export var lose_kalulu_speech: AudioStream = preload("res://language_resources/fr/minigames/kalulu/kalulu_lose_minigame_all.mp3")
@onready var minigame_ui: = $MinigameUI
@onready var opening_curtain: = $OpeningCurtain
@onready var audio_player: = $AudioStreamPlayer
@onready var fireworks: = $Fireworks
@@ -109,8 +108,7 @@ func _find_stimuli_and_distractions() -> void:
# Open the curtains and Kalulu explains
func _curtains_and_kalulu() -> void:
opening_curtain.play("open")
await opening_curtain.animation_finished
await OpeningCurtain.open()
minigame_ui.play_kalulu_speech(intro_kalulu_speech)
await minigame_ui.kalulu_speech_ended
@@ -125,8 +123,7 @@ func _start() -> void:
func _reset() -> void:
opening_curtain.play("close")
await opening_curtain.animation_finished
await OpeningCurtain.close()
get_tree().paused = false
get_tree().reload_current_scene()
@@ -190,8 +187,7 @@ func _log_new_response(response: Dictionary, current_stimulus: Dictionary) -> vo
func _go_back_to_the_garden() -> void:
opening_curtain.play("close")
await opening_curtain.animation_finished
await OpeningCurtain.close()
_save_logs()
+1 -4
View File
@@ -1,8 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://8awe4usnucyv"]
[gd_scene load_steps=4 format=3 uid="uid://8awe4usnucyv"]
[ext_resource type="Script" path="res://sources/minigames/base/base_minigame.gd" id="1_jdfsm"]
[ext_resource type="PackedScene" uid="uid://weree6bnlt6f" path="res://sources/minigames/base/minigame_ui.tscn" id="2_a3tib"]
[ext_resource type="PackedScene" path="res://sources/minigames/base/opening_curtain.tscn" id="3_p5ryr"]
[ext_resource type="PackedScene" uid="uid://d1gkvqxe1n8o8" path="res://sources/utils/fx/fireworks.tscn" id="4_yekwo"]
[node name="BaseMinigame" type="Control"]
@@ -20,8 +19,6 @@ bus = &"Effects"
[node name="MinigameUI" parent="." instance=ExtResource("2_a3tib")]
[node name="OpeningCurtain" parent="." instance=ExtResource("3_p5ryr")]
[node name="GameRoot" type="Control" parent="."]
process_mode = 1
layout_mode = 1
+13 -2
View File
@@ -5,9 +5,20 @@ signal animation_finished(animation_name: StringName)
@onready var animation_player: = $AnimationPlayer
var is_closed : bool = false
func play(animation_name: String) -> void:
animation_player.play(animation_name)
func open() -> void:
if is_closed:
is_closed = false
animation_player.play("open")
await animation_player.animation_finished
func close() -> void:
if not is_closed:
is_closed = true
animation_player.play("close")
await animation_player.animation_finished
func _on_animation_player_animation_finished(animation_name: StringName) -> void:
+6 -7
View File
@@ -2,14 +2,14 @@
[ext_resource type="Script" path="res://sources/utils/sprite_control.gd" id="1_1b85n"]
[ext_resource type="Script" path="res://sources/minigames/jellyfish/jellyfish.gd" id="1_06uwq"]
[ext_resource type="SpriteFrames" uid="uid://dkemftb4jdxvs" path="res://sources/minigames/jellyfish/green_jellyfish_animations.tres" id="2_afbbq"]
[ext_resource type="PackedScene" uid="uid://cn2rw06pltyiu" path="res://sources/utils/fx/right.tscn" id="2_edt4e"]
[ext_resource type="Script" path="res://sources/utils/percent_margin_container.gd" id="3_vllju"]
[ext_resource type="PackedScene" uid="uid://c6klih3h3ws6f" path="res://sources/utils/auto_size_label.tscn" id="4_26xiq"]
[ext_resource type="PackedScene" uid="uid://bgio7muqck2bu" path="res://sources/utils/auto_size_label.tscn" id="4_26xiq"]
[ext_resource type="SpriteFrames" uid="uid://dkemftb4jdxvs" path="res://sources/minigames/jellyfish/green_jellyfish_animations.tres" id="4_tdfu4"]
[ext_resource type="PackedScene" uid="uid://dlmbxcgiv8tpr" path="res://sources/utils/fx/wrong.tscn" id="6_w1tlu"]
[node name="Jellyfish" type="MarginContainer"]
custom_minimum_size = Vector2(569.954, 569.954)
custom_minimum_size = Vector2(538.853, 538.853)
offset_right = 200.0
offset_bottom = 200.0
script = ExtResource("1_06uwq")
@@ -26,10 +26,10 @@ sprites = [NodePath("AnimatedSprite2D")]
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="SpriteControl"]
unique_name_in_owner = true
scale = Vector2(2.62212, 2.62212)
sprite_frames = ExtResource("2_afbbq")
scale = Vector2(2.47926, 2.47926)
sprite_frames = ExtResource("4_tdfu4")
animation = &"idle"
frame_progress = 0.241534
frame_progress = 0.520072
centered = false
[node name="PercentMarginContainer" type="Container" parent="."]
@@ -52,7 +52,6 @@ text = "A"
[node name="WrongFX" parent="." instance=ExtResource("6_w1tlu")]
position = Vector2(284, 142.25)
scale = Vector2(1, 1)
[connection signal="gui_input" from="." to="." method="_on_gui_input"]
+1 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=2 format=3 uid="uid://c6klih3h3ws6f"]
[gd_scene load_steps=2 format=3 uid="uid://bgio7muqck2bu"]
[ext_resource type="Script" path="res://sources/utils/auto_size_label.gd" id="1_j2tjj"]
-1
View File
@@ -33,7 +33,6 @@ func read(resource : Resource) -> void:
if binder.property_name in data:
var property_value = data.get(binder.property_name)
binder.set_value(property_value)
#push_warning("Property typing and control doesn't match for property '" + binder.property_name + "' (" + str(property_value) + ") and " + str(binder.control))
else:
push_warning("Property " + binder.property_name + " not found in " + data.get_class())