Adds adult checks on register screen. Revamps the code keyboard.

This commit is contained in:
Dylan Sarrazyn
2024-02-20 16:12:19 +01:00
parent 20ac86acc2
commit d894e912d1
22 changed files with 1288 additions and 333 deletions
-23
View File
@@ -1,23 +0,0 @@
extends Control
signal button_pressed
@onready var buttons: GridContainer = %Buttons
@onready var sound_player := $ButtonSoundPlayer
func _ready():
for button in buttons.get_children(false):
button.pressed.connect(_on_button_pressed.bind(button))
func _on_button_pressed(button : TextureButton):
sound_player.play()
button.set_modulate(Color(0.5,0.5,0.5))
button.set_disabled(true)
emit_signal("button_pressed", button.name)
func reset_buttons():
for button in buttons.get_children(false):
button.set_modulate(Color(1,1,1))
button.set_disabled(false)
+64
View File
@@ -0,0 +1,64 @@
extends Control
class_name CodeKeyboard
signal button_pressed(key : String, password : Array[String])
signal password_entered(password : String)
const button_sound := preload("res://assets/menus/login/ui_play_button.mp3")
@onready var password_visualizer : PasswordVisualizer = %PasswordVisualizer
@onready var buttons: GridContainer = %Buttons
@onready var sound_player := $ButtonSoundPlayer
var password : Array[String] = []
func _ready():
for button in buttons.get_children(false):
button.pressed.connect(_on_button_pressed.bind(button))
func _on_button_pressed(button : TextureButton):
if password.size() == 3:
return
# Gets the pressed key
var key : String = button.name
password.append(key)
# Sound effect
sound_player.play()
# Disables button
button.set_modulate(Color(0.5,0.5,0.5))
button.set_disabled(true)
# Updates the visualizer
password_visualizer.password = "".join(password)
# Emit the key pressed signal
button_pressed.emit(key, password)
# Emit the password entered signal
if password.size() == 3:
var code = ""
for char_ in password:
code += char_
password_entered.emit(code)
func get_password() -> Array[String]:
return password
func get_password_as_string() -> String:
return "".join(password)
func reset_password():
password = []
for button in buttons.get_children(false):
button.set_modulate(Color(1,1,1))
button.set_disabled(false)
password_visualizer.password = ""
@@ -1,6 +1,6 @@
[gd_scene load_steps=16 format=3 uid="uid://djduptonofbh4"]
[gd_scene load_steps=17 format=3 uid="uid://djduptonofbh4"]
[ext_resource type="Script" path="res://sources/menus/code_keyboard.gd" id="1_4kb0k"]
[ext_resource type="Script" path="res://sources/menus/components/code_keyboard.gd" id="1_4kb0k"]
[ext_resource type="Texture2D" uid="uid://d3rhl050u0ahl" path="res://assets/menus/login/password_background.png" id="1_qy2tt"]
[ext_resource type="Texture2D" uid="uid://de8087qre3hqd" path="res://assets/menus/login/button_symbol01_up.png" id="2_lewtn"]
[ext_resource type="Texture2D" uid="uid://ce2dk2so7yo85" path="res://assets/menus/login/button_symbol01_down.png" id="3_6vmwg"]
@@ -15,6 +15,7 @@
[ext_resource type="Texture2D" uid="uid://eg5jrfombxb8" path="res://assets/menus/login/button_symbol06_up.png" id="12_3eke6"]
[ext_resource type="Texture2D" uid="uid://dce53jiyk6gy6" path="res://assets/menus/login/button_symbol06_down.png" id="13_mhbsr"]
[ext_resource type="AudioStream" uid="uid://dlsgs8uralt8n" path="res://assets/menus/login/ui_play_button.mp3" id="15_tcy0b"]
[ext_resource type="PackedScene" uid="uid://c5ey1jk06asiq" path="res://sources/menus/components/password_visualizer.tscn" id="17_gt2pl"]
[node name="CodeKeyboard" type="Control"]
layout_mode = 3
@@ -25,6 +26,23 @@ grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_4kb0k")
[node name="PasswordVisualizer" parent="." instance=ExtResource("17_gt2pl")]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -706.0
offset_top = -572.0
offset_right = 706.0
offset_bottom = -132.0
grow_horizontal = 2
grow_vertical = 2
key_size = 420
metadata/_edit_use_anchors_ = true
[node name="Keyboard" type="TextureRect" parent="."]
custom_minimum_size = Vector2(1624, 812)
layout_mode = 1
@@ -0,0 +1,51 @@
@tool
extends HBoxContainer
class_name PasswordVisualizer
const icons_textures = {
"1" : preload("res://assets/menus/login/symbol01.png"),
"2" : preload("res://assets/menus/login/symbol02.png"),
"3" : preload("res://assets/menus/login/symbol03.png"),
"4" : preload("res://assets/menus/login/symbol04.png"),
"5" : preload("res://assets/menus/login/symbol05.png"),
"6" : preload("res://assets/menus/login/symbol06.png")
}
@export var key_size : int = 200:
set(value):
key_size = value
for icon in icons:
icon.custom_minimum_size.x = key_size
icon.custom_minimum_size.y = key_size
@export var password : String:
set(value):
password = value
_draw_password()
@onready var icons : Array[TextureRect]
func _ready():
_draw_password()
for icon in icons:
icon.custom_minimum_size.x = key_size
icon.custom_minimum_size.y = key_size
func _draw_password():
if not icons:
icons = [%Icon1, %Icon2, %Icon3]
for icon in icons:
icon.texture = null
if not password:
return
var i = 0
for value in password.split(""):
if i >= 3:
return
if value in icons_textures:
icons[i].texture = icons_textures[value]
i += 1
@@ -0,0 +1,49 @@
[gd_scene load_steps=3 format=3 uid="uid://c5ey1jk06asiq"]
[ext_resource type="Theme" uid="uid://dqjvrt5nrtwn1" path="res://resources/themes/kalulu_theme.tres" id="1_0hqng"]
[ext_resource type="Script" path="res://sources/menus/components/password_visualizer.gd" id="1_mxw25"]
[node name="PasswordVisualizer" type="HBoxContainer"]
offset_right = 668.0
offset_bottom = 220.0
theme_override_constants/separation = 46
script = ExtResource("1_mxw25")
[node name="Panel1" type="PanelContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_0hqng")
metadata/_edit_use_anchors_ = true
[node name="Icon1" type="TextureRect" parent="Panel1"]
unique_name_in_owner = true
custom_minimum_size = Vector2(200, 200)
layout_mode = 2
expand_mode = 2
stretch_mode = 4
[node name="Panel2" type="PanelContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_0hqng")
metadata/_edit_use_anchors_ = true
[node name="Icon2" type="TextureRect" parent="Panel2"]
unique_name_in_owner = true
custom_minimum_size = Vector2(200, 200)
layout_mode = 2
expand_mode = 2
stretch_mode = 4
[node name="Panel3" type="PanelContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_0hqng")
metadata/_edit_use_anchors_ = true
[node name="Icon3" type="TextureRect" parent="Panel3"]
unique_name_in_owner = true
custom_minimum_size = Vector2(200, 200)
layout_mode = 2
expand_mode = 2
stretch_mode = 4
+8 -46
View File
@@ -1,34 +1,21 @@
extends Control
const teacher_password : String = "42"
const back_scene_path: = "res://sources/menus/main/main_menu.tscn"
const next_scene_path: = "res://sources/menus/minigame_selection.tscn"
const teacher_scene_path: = "res://sources/menus/teacher/teacher_settings.tscn"
const icons_textures = [
preload("res://assets/menus/login/symbol01.png"),
preload("res://assets/menus/login/symbol02.png"),
preload("res://assets/menus/login/symbol03.png"),
preload("res://assets/menus/login/symbol04.png"),
preload("res://assets/menus/login/symbol05.png"),
preload("res://assets/menus/login/symbol06.png")
]
const button_sound := preload("res://assets/menus/login/ui_play_button.mp3")
const help_speech_path : String = "main_menu/audio/login_screen_help_code.mp3"
const wrong_password_speech_path : String = "main_menu/audio/login_screen_feedback_wrong_password.mp3"
const right_password_speech_path : String = "main_menu/audio/login_screen_feedback_right_password.mp3"
@onready var kalulu: Control = $Kalulu
@onready var music_player : AudioStreamPlayer = $MusicStreamPlayer
@onready var device_number_label := $DeviceNumber
@onready var icons := [%Icon1, %Icon2, %Icon3]
@onready var keyboard := $CodeKeyboard
@onready var keyboard : CodeKeyboard = $CodeKeyboard
@onready var teacher_timer : Timer = $InterfaceRight/TeacherButton/TeacherTimer
var password : Array = []
func _ready():
if UserDataManager.teacher_settings.account_type == TeacherSettings.AccountType.Teacher:
if UserDataManager.teacher_settings and UserDataManager.teacher_settings.account_type == TeacherSettings.AccountType.Teacher:
device_number_label.show()
device_number_label.text += str(UserDataManager.get_device_settings().device_id)
@@ -36,39 +23,13 @@ func _ready():
music_player.play()
func _reset_password():
password = []
keyboard.reset_buttons()
for icon in icons:
icon.texture = null
func _on_code_keyboard_button_pressed(key : String):
var index : int = key.to_int()
password.append(key)
var password_size = password.size()
icons[password_size-1].texture = icons_textures[index-1]
if password_size == 3:
_check_password()
func _check_password():
var code = ""
for char_ in password:
code += char_
if UserDataManager.login_student(code):
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))
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))
_reset_password()
keyboard.reset_password()
func _on_back_button_pressed():
@@ -80,7 +41,8 @@ func _on_kalulu_button_pressed():
func _on_teacher_button_button_down():
teacher_timer.start()
if keyboard.get_password_as_string() == teacher_password:
teacher_timer.start()
func _on_teacher_button_button_up():
+3 -57
View File
@@ -1,13 +1,12 @@
[gd_scene load_steps=16 format=3 uid="uid://2wab3q35ssta"]
[gd_scene load_steps=15 format=3 uid="uid://2wab3q35ssta"]
[ext_resource type="Script" path="res://sources/menus/login/login.gd" id="1_spyuf"]
[ext_resource type="PackedScene" uid="uid://wdjp1sv55q4f" path="res://sources/menus/night_sky/night_sky.tscn" id="3_0my6t"]
[ext_resource type="PackedScene" uid="uid://blos4rn53qkwg" path="res://sources/minigames/base/kalulu.tscn" id="3_5b1v0"]
[ext_resource type="PackedScene" uid="uid://dxc82xcl7jncd" path="res://sources/menus/main/plants/palm.tscn" id="3_yrwu8"]
[ext_resource type="Texture2D" uid="uid://wtx3wqs0l4si" path="res://assets/minigames/minigame_ui/graphic/button_back_up.png" id="4_3vuah"]
[ext_resource type="Theme" uid="uid://dqjvrt5nrtwn1" path="res://resources/themes/kalulu_theme.tres" id="5_j0bnd"]
[ext_resource type="Texture2D" uid="uid://cbhip35yyqneg" path="res://assets/minigames/minigame_ui/graphic/button_back_down.png" id="5_vd33f"]
[ext_resource type="PackedScene" uid="uid://djduptonofbh4" path="res://sources/menus/code_keyboard.tscn" id="5_xwrca"]
[ext_resource type="PackedScene" uid="uid://djduptonofbh4" path="res://sources/menus/components/code_keyboard.tscn" id="5_xwrca"]
[ext_resource type="Texture2D" uid="uid://tcapan0mj64o" path="res://assets/minigames/minigame_ui/graphic/button_back_disabled.png" id="6_0dhup"]
[ext_resource type="Texture2D" uid="uid://iw84x6mx8h2g" path="res://assets/minigames/minigame_ui/graphic/button_kalulu_up.png" id="7_2wdoi"]
[ext_resource type="Texture2D" uid="uid://ub1dnysbojn8" path="res://assets/minigames/minigame_ui/graphic/button_kalulu_down.png" id="8_nxlxw"]
@@ -46,59 +45,6 @@ grow_horizontal = 2
theme_override_font_sizes/font_size = 70
text = "DEVICE n°"
[node name="Icons" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -676.0
offset_top = -565.0
offset_right = 676.0
offset_bottom = -145.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 46
[node name="Panel1" type="PanelContainer" parent="Icons"]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("5_j0bnd")
metadata/_edit_use_anchors_ = true
[node name="Icon1" type="TextureRect" parent="Icons/Panel1"]
unique_name_in_owner = true
custom_minimum_size = Vector2(420, 420)
layout_mode = 2
stretch_mode = 4
[node name="Panel2" type="PanelContainer" parent="Icons"]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("5_j0bnd")
metadata/_edit_use_anchors_ = true
[node name="Icon2" type="TextureRect" parent="Icons/Panel2"]
unique_name_in_owner = true
custom_minimum_size = Vector2(420, 420)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="Panel3" type="PanelContainer" parent="Icons"]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("5_j0bnd")
metadata/_edit_use_anchors_ = true
[node name="Icon3" type="TextureRect" parent="Icons/Panel3"]
unique_name_in_owner = true
custom_minimum_size = Vector2(420, 420)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="CodeKeyboard" parent="." instance=ExtResource("5_xwrca")]
layout_mode = 1
@@ -166,7 +112,7 @@ layout_mode = 1
[node name="MusicStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource("24_4xfja")
[connection signal="button_pressed" from="CodeKeyboard" to="." method="_on_code_keyboard_button_pressed"]
[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"]
[connection signal="pressed" from="InterfaceLeft/Container/KaluluButton" to="." method="_on_kalulu_button_pressed"]
[connection signal="button_down" from="InterfaceRight/TeacherButton" to="." method="_on_teacher_button_button_down"]
+3
View File
@@ -21,6 +21,9 @@ func _process(delta):
if not visible:
return
if not sprite.is_playing():
sprite.play("Tc_Idle1")
if not isSpeaking:
elapsedTime += delta
if elapsedTime > 20:
+51 -13
View File
@@ -2,25 +2,63 @@ extends Control
signal logged_in
@onready var language_field : OptionButton = $Form/LanguageField
@onready var email_field : LineEdit = $Form/EmailField
@onready var password_field : LineEdit = $Form/PasswordField
@onready var device_id_field : SpinBox = $Form/DeviceIDField
@onready var teacher_label : Label = %TeacherLabel
@onready var parent_label : Label = %ParentLabel
@onready var validator : FormValidator = %LoginFormValidator
@onready var language_field : OptionButton = %LanguageField
@onready var email_field : LineEdit = %EmailField
@onready var password_field : LineEdit = %PasswordField
@onready var device_id_container : VBoxContainer = %DeviceIDContainer
@onready var device_id_field : SpinBox = %DeviceIDField
@onready var login_message : Label = %LoginError
var account_type: TeacherSettings.AccountType
func _ready():
email_field.text_changed.connect(_hide_login_error)
password_field.text_changed.connect(_hide_login_error)
device_id_field.value_changed.connect(_hide_login_error)
func show_form(is_teacher : bool):
self.show()
if is_teacher:
device_id_container.show()
account_type = TeacherSettings.AccountType.Teacher
teacher_label.show()
parent_label.hide()
else:
device_id_field.value = 1
device_id_container.hide()
account_type = TeacherSettings.AccountType.Parent
teacher_label.hide()
parent_label.show()
func _hide_login_error(_value):
if login_message.visible:
login_message.hide()
func _on_login_form_validator_control_validated(control, passed, messages):
var label = find_child(control.name + "Error", true, false) as Label
if not label:
return
if passed:
label.hide()
else:
label.text = ". ".join(messages)
label.show()
@onready var field_missing_message : Label = $Form/FieldMissingError
@onready var login_message : Label = $Form/LoginError
func _on_validate_button_pressed() -> void:
# Check if all the values are given
if not email_field.text or not password_field.text or not device_id_field.value:
field_missing_message.visible = true
# Validator
if not validator.validate():
return
# TODO Check login and password
# Login
if UserDataManager.login(language_field.get_selected_language(), email_field.text, password_field.text, int(device_id_field.value)):
if UserDataManager.login(account_type, language_field.get_selected_language(), email_field.text, password_field.text, int(device_id_field.value)):
logged_in.emit()
else:
login_message.visible = true
+20 -10
View File
@@ -9,7 +9,8 @@ const register_scene_path := "res://sources/menus/register/register.tscn"
@onready var kalulu : Control = $Kalulu
@onready var user_selection : Control = $UserSelection
@onready var login : Control = $Login
@onready var login_form : Control = %LoginForm
@onready var interface_left : MarginContainer = %InterfaceLeft
func _ready():
@@ -25,22 +26,31 @@ func _on_main_button_pressed():
kalulu.hide()
kalulu.stop_speech()
user_selection.show()
interface_left.show()
func _on_back_button_pressed():
login_form.hide()
user_selection.hide()
kalulu.show()
interface_left.hide()
func _on_sign_in_teacher_pressed():
user_selection.hide()
login.show()
kalulu.hide()
login_form.show_form(true)
func _on_back_button_pressed():
login.hide()
kalulu.show()
kalulu.start_speech()
func _on_login_in():
get_tree().change_scene_to_file(next_scene_path)
func _on_sign_in_parent_pressed():
user_selection.hide()
kalulu.hide()
login_form.show_form(false)
func _on_register_pressed():
get_tree().change_scene_to_file(register_scene_path)
func _on_login_in():
get_tree().change_scene_to_file(next_scene_path)
+225 -149
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=3 uid="uid://6v3nachs7j71"]
[gd_scene load_steps=31 format=3 uid="uid://6v3nachs7j71"]
[ext_resource type="Script" path="res://sources/menus/main/main_menu.gd" id="1_0r1ij"]
[ext_resource type="PackedScene" uid="uid://wdjp1sv55q4f" path="res://sources/menus/night_sky/night_sky.tscn" id="1_afd4d"]
@@ -11,14 +11,55 @@
[ext_resource type="Script" path="res://sources/menus/main/kalulu.gd" id="8_cxg8l"]
[ext_resource type="PackedScene" uid="uid://dnuny6200v5b0" path="res://sources/kalulu.tscn" id="10_icqmp"]
[ext_resource type="Script" path="res://sources/menus/main/login.gd" id="12_6bu7q"]
[ext_resource type="Texture2D" uid="uid://bsojx7tmm435x" path="res://assets/minigames/minigame_ui/graphic/button_next_up.png" id="12_km7h0"]
[ext_resource type="Texture2D" uid="uid://wtx3wqs0l4si" path="res://assets/minigames/minigame_ui/graphic/button_back_up.png" id="13_j3nb7"]
[ext_resource type="Texture2D" uid="uid://brrxuaco0l85j" path="res://assets/minigames/minigame_ui/graphic/button_next_down.png" id="13_oqjai"]
[ext_resource type="Script" path="res://sources/menus/main/language_field.gd" id="13_rs3hd"]
[ext_resource type="Texture2D" uid="uid://cbhip35yyqneg" path="res://assets/minigames/minigame_ui/graphic/button_back_down.png" id="14_3lr3g"]
[ext_resource type="Texture2D" uid="uid://bsmq426v8148w" path="res://assets/minigames/minigame_ui/graphic/button_next_disabled.png" id="14_11c6x"]
[ext_resource type="Script" path="res://addons/godot-form-validator/form_validator.gd" id="15_e88oj"]
[ext_resource type="Theme" uid="uid://dqjvrt5nrtwn1" path="res://resources/themes/kalulu_theme.tres" id="15_pcmnw"]
[ext_resource type="Theme" uid="uid://cd7ftmo5x4c2r" path="res://resources/themes/kalulu_theme_big.tres" id="16_bq28s"]
[ext_resource type="Script" path="res://addons/godot-form-validator/control_validator.gd" id="18_iunlb"]
[ext_resource type="Script" path="res://addons/godot-form-validator/rules/required_rule.gd" id="19_o524c"]
[ext_resource type="Script" path="res://addons/godot-form-validator/validators/range_validator.gd" id="20_6xsd1"]
[ext_resource type="Script" path="res://addons/godot-form-validator/rules/email_rule.gd" id="20_jk8lq"]
[ext_resource type="Texture2D" uid="uid://bbip3wpyidt1q" path="res://assets/menus/main/play_button_mask.png" id="20_oqrk5"]
[ext_resource type="Script" path="res://addons/godot-form-validator/validators/line_edit_validator.gd" id="21_1bl4i"]
[sub_resource type="Resource" id="Resource_mh75v"]
script = ExtResource("19_o524c")
fail_message = "A value is required."
[sub_resource type="Resource" id="Resource_owox8"]
script = ExtResource("20_6xsd1")
validation_order = 1
validation_method = 1
skip_validation = false
rules = Array[Resource("res://addons/godot-form-validator/rules/validator_rule.gd")]([SubResource("Resource_mh75v")])
[sub_resource type="Resource" id="Resource_j516d"]
script = ExtResource("19_o524c")
fail_message = "A value is required."
[sub_resource type="Resource" id="Resource_ayewh"]
script = ExtResource("20_jk8lq")
fail_message = "Value must be a valid email address."
[sub_resource type="Resource" id="Resource_hxkvx"]
script = ExtResource("21_1bl4i")
validation_order = 1
validation_method = 1
skip_validation = false
rules = Array[Resource("res://addons/godot-form-validator/rules/validator_rule.gd")]([SubResource("Resource_j516d"), SubResource("Resource_ayewh")])
[sub_resource type="Resource" id="Resource_b08p8"]
script = ExtResource("19_o524c")
fail_message = "A value is required."
[sub_resource type="Resource" id="Resource_k2y4u"]
script = ExtResource("21_1bl4i")
validation_order = 1
validation_method = 1
skip_validation = false
rules = Array[Resource("res://addons/godot-form-validator/rules/validator_rule.gd")]([SubResource("Resource_b08p8")])
[node name="MainMenu" type="Control"]
layout_mode = 3
@@ -136,54 +177,44 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Form" type="Control" parent="UserSelection"]
[node name="Form" type="VBoxContainer" parent="UserSelection"]
custom_minimum_size = Vector2(850, 300)
layout_mode = 1
anchor_left = 0.333984
anchor_top = 0.416667
anchor_right = 0.666016
anchor_bottom = 0.583333
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -425.0
offset_top = -160.0
offset_right = 425.0
offset_bottom = 160.0
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_use_anchors_ = true
theme_override_constants/separation = 25
[node name="SignInTeacher" type="Button" parent="UserSelection/Form"]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 0.168
grow_horizontal = 2
layout_mode = 2
theme_override_font_sizes/font_size = 70
text = "Sign-in teacher account
"
metadata/_edit_use_anchors_ = true
[node name="SignInParent" type="Button" parent="UserSelection/Form"]
layout_mode = 1
anchors_preset = -1
anchor_top = 0.416
anchor_right = 1.0
anchor_bottom = 0.584
grow_horizontal = 2
grow_vertical = 2
layout_mode = 2
theme_override_font_sizes/font_size = 70
text = "Sign-in parent account
"
metadata/_edit_use_anchors_ = true
[node name="Register" type="Button" parent="UserSelection/Form"]
layout_mode = 1
anchors_preset = -1
anchor_top = 0.832
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 0
layout_mode = 2
theme_override_font_sizes/font_size = 70
text = "Create an account"
metadata/_edit_use_anchors_ = true
[node name="Login" type="Control" parent="."]
[node name="LoginForm" type="Control" parent="."]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 15
@@ -193,7 +224,163 @@ grow_horizontal = 2
grow_vertical = 2
script = ExtResource("12_6bu7q")
[node name="InterfaceLeft" type="MarginContainer" parent="Login"]
[node name="TeacherLabel" type="Label" parent="LoginForm"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_top = 168.0
offset_bottom = 286.0
grow_horizontal = 2
theme_override_font_sizes/font_size = 90
text = "Teacher login"
horizontal_alignment = 1
vertical_alignment = 1
[node name="ParentLabel" type="Label" parent="LoginForm"]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_top = 168.0
offset_bottom = 286.0
grow_horizontal = 2
theme_override_font_sizes/font_size = 90
text = "Parent login"
horizontal_alignment = 1
vertical_alignment = 1
[node name="LoginFormValidator" type="Control" parent="LoginForm"]
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
script = ExtResource("15_e88oj")
[node name="FormContainer" type="VBoxContainer" parent="LoginForm/LoginFormValidator"]
custom_minimum_size = Vector2(1000, 0)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -500.0
offset_top = -406.0
offset_right = 500.0
offset_bottom = 406.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 25
alignment = 1
[node name="LanguageContainer" type="VBoxContainer" parent="LoginForm/LoginFormValidator/FormContainer"]
layout_mode = 2
theme_override_constants/separation = 0
[node name="LanguageLabel" type="Label" parent="LoginForm/LoginFormValidator/FormContainer/LanguageContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 70
text = "Language"
[node name="LanguageField" type="OptionButton" parent="LoginForm/LoginFormValidator/FormContainer/LanguageContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_type_variation = &"Combobox"
theme_override_font_sizes/font_size = 70
script = ExtResource("13_rs3hd")
[node name="DeviceIDContainer" type="VBoxContainer" parent="LoginForm/LoginFormValidator/FormContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_constants/separation = 0
[node name="DeviceIDLabel" type="Label" parent="LoginForm/LoginFormValidator/FormContainer/DeviceIDContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 70
text = "Device number"
[node name="DeviceIDField" type="SpinBox" parent="LoginForm/LoginFormValidator/FormContainer/DeviceIDContainer"]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("16_bq28s")
min_value = 1.0
max_value = 6.0
value = 1.0
rounded = true
metadata/_edit_use_anchors_ = true
[node name="DeviceIDValidator" type="Node" parent="LoginForm/LoginFormValidator/FormContainer/DeviceIDContainer/DeviceIDField"]
script = ExtResource("18_iunlb")
validator = SubResource("Resource_owox8")
[node name="DeviceIDFieldError" type="Label" parent="LoginForm/LoginFormValidator/FormContainer/DeviceIDContainer"]
visible = false
layout_mode = 2
[node name="EmailContainer" type="VBoxContainer" parent="LoginForm/LoginFormValidator/FormContainer"]
layout_mode = 2
theme_override_constants/separation = 0
[node name="EmailLabel" type="Label" parent="LoginForm/LoginFormValidator/FormContainer/EmailContainer"]
layout_mode = 2
theme = ExtResource("15_pcmnw")
theme_override_font_sizes/font_size = 70
text = "Login"
[node name="EmailField" type="LineEdit" parent="LoginForm/LoginFormValidator/FormContainer/EmailContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_type_variation = &"1"
theme_override_font_sizes/font_size = 70
placeholder_text = "Email"
[node name="EmailValidator" type="Node" parent="LoginForm/LoginFormValidator/FormContainer/EmailContainer/EmailField"]
script = ExtResource("18_iunlb")
validator = SubResource("Resource_hxkvx")
[node name="EmailFieldError" type="Label" parent="LoginForm/LoginFormValidator/FormContainer/EmailContainer"]
visible = false
layout_mode = 2
[node name="PasswordContainer" type="VBoxContainer" parent="LoginForm/LoginFormValidator/FormContainer"]
layout_mode = 2
theme_override_constants/separation = 0
[node name="PasswordField" type="LineEdit" parent="LoginForm/LoginFormValidator/FormContainer/PasswordContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 70
placeholder_text = "Password"
secret = true
[node name="PasswordValidator" type="Node" parent="LoginForm/LoginFormValidator/FormContainer/PasswordContainer/PasswordField"]
script = ExtResource("18_iunlb")
validator = SubResource("Resource_k2y4u")
[node name="PasswordFieldError" type="Label" parent="LoginForm/LoginFormValidator/FormContainer/PasswordContainer"]
visible = false
layout_mode = 2
[node name="ValidateButton" type="Button" parent="LoginForm/LoginFormValidator/FormContainer"]
layout_mode = 2
size_flags_vertical = 8
theme_override_font_sizes/font_size = 70
text = "Log in"
[node name="LoginError" type="Label" parent="LoginForm/LoginFormValidator/FormContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "Invalid username or password"
[node name="InterfaceLeft" type="MarginContainer" parent="."]
unique_name_in_owner = true
visible = false
custom_minimum_size = Vector2(450, 0)
layout_mode = 1
anchors_preset = 9
@@ -205,129 +392,16 @@ theme_override_constants/margin_top = 50
theme_override_constants/margin_right = 50
theme_override_constants/margin_bottom = 50
[node name="Container" type="VBoxContainer" parent="Login/InterfaceLeft"]
[node name="Container" type="VBoxContainer" parent="InterfaceLeft"]
layout_mode = 2
[node name="BackButton" type="TextureButton" parent="Login/InterfaceLeft/Container"]
[node name="BackButton" type="TextureButton" parent="InterfaceLeft/Container"]
layout_mode = 2
size_flags_vertical = 3
texture_normal = ExtResource("13_j3nb7")
texture_pressed = ExtResource("14_3lr3g")
stretch_mode = 4
[node name="Form" type="Control" parent="Login"]
custom_minimum_size = Vector2(1350, 620)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -675.0
offset_top = -310.0
offset_right = 675.0
offset_bottom = 310.0
grow_horizontal = 2
grow_vertical = 2
[node name="EmailField" type="LineEdit" parent="Login/Form"]
layout_mode = 1
offset_top = 80.0
offset_right = 800.0
offset_bottom = 193.0
theme_type_variation = &"1"
theme_override_font_sizes/font_size = 70
placeholder_text = "Email"
[node name="Label" type="Label" parent="Login/Form/EmailField"]
layout_mode = 0
offset_top = -80.0
offset_right = 412.0
theme = ExtResource("15_pcmnw")
theme_override_font_sizes/font_size = 70
text = "Login"
[node name="PasswordField" type="LineEdit" parent="Login/Form"]
layout_mode = 1
offset_top = 223.0
offset_right = 800.0
offset_bottom = 336.0
theme_override_font_sizes/font_size = 70
placeholder_text = "Password"
secret = true
[node name="DeviceIDField" type="SpinBox" parent="Login/Form"]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -400.0
offset_top = 80.0
offset_bottom = 193.0
grow_horizontal = 0
theme = ExtResource("15_pcmnw")
min_value = 1.0
max_value = 6.0
value = 1.0
rounded = true
[node name="Label" type="Label" parent="Login/Form/DeviceIDField"]
layout_mode = 1
offset_top = -80.0
offset_right = 412.0
theme_override_font_sizes/font_size = 70
text = "Tablet number"
[node name="LanguageField" type="OptionButton" parent="Login/Form"]
layout_mode = 0
offset_top = 356.0
offset_right = 800.0
offset_bottom = 469.0
theme_override_font_sizes/font_size = 70
script = ExtResource("13_rs3hd")
[node name="ValidateButton" type="TextureButton" parent="Login/Form"]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -321.0
offset_top = -310.0
offset_right = -181.0
offset_bottom = -170.0
grow_horizontal = 0
grow_vertical = 0
scale = Vector2(2, 2)
texture_normal = ExtResource("12_km7h0")
texture_pressed = ExtResource("13_oqjai")
texture_disabled = ExtResource("14_11c6x")
[node name="FieldMissingError" type="Label" parent="Login/Form"]
visible = false
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -76.0
grow_horizontal = 2
grow_vertical = 0
text = "Please fill all the fields"
[node name="LoginError" type="Label" parent="Login/Form"]
visible = false
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -76.0
grow_horizontal = 2
grow_vertical = 0
text = "Invalid username or password"
[node name="Informations" type="Control" parent="."]
layout_mode = 1
anchors_preset = 2
@@ -397,7 +471,9 @@ vertical_alignment = 1
[connection signal="pressed" from="Kalulu/PlayButton" to="." method="_on_main_button_pressed"]
[connection signal="pressed" from="UserSelection/Form/SignInTeacher" to="." method="_on_sign_in_teacher_pressed"]
[connection signal="pressed" from="UserSelection/Form/SignInParent" to="." method="_on_sign_in_parent_pressed"]
[connection signal="pressed" from="UserSelection/Form/Register" to="." method="_on_register_pressed"]
[connection signal="logged_in" from="Login" to="." method="_on_login_in"]
[connection signal="pressed" from="Login/InterfaceLeft/Container/BackButton" to="." method="_on_back_button_pressed"]
[connection signal="pressed" from="Login/Form/ValidateButton" to="Login" method="_on_validate_button_pressed"]
[connection signal="logged_in" from="LoginForm" to="." method="_on_login_in"]
[connection signal="control_validated" from="LoginForm/LoginFormValidator" to="LoginForm" method="_on_login_form_validator_control_validated"]
[connection signal="pressed" from="LoginForm/LoginFormValidator/FormContainer/ValidateButton" to="LoginForm" method="_on_validate_button_pressed"]
[connection signal="pressed" from="InterfaceLeft/Container/BackButton" to="." method="_on_back_button_pressed"]
+47 -6
View File
@@ -1,7 +1,15 @@
extends Control
const main_menu_path := "res://sources/menus/main/main_menu.tscn"
const login_menu_path := "res://sources/menus/login/login.tscn"
const next_scene_path := "res://sources/menus/teacher/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"),
@@ -16,17 +24,22 @@ const login_menu_path := "res://sources/menus/login/login.tscn"
@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 kalulu := %Kalulu
@onready var opening_curtain := %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():
kalulu.play("Tc_Idle1")
current_steps = [account_type_step.instantiate()]
_go_to_step(progress_bar.value)
base_password_label_text = password_label.text
_reset_password()
opening_curtain.play("open")
func _go_to_step(step_index: int):
@@ -51,6 +64,30 @@ 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)
@@ -98,7 +135,7 @@ func _on_step_completed(step : Step):
if progress_bar.value == current_steps.size()-1:
if UserDataManager.register(register_data):
get_tree().change_scene_to_file(login_menu_path)
get_tree().change_scene_to_file(next_scene_path)
else:
print("Impossible to register")
else:
@@ -112,3 +149,7 @@ 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)
+107 -7
View File
@@ -1,10 +1,17 @@
[gd_scene load_steps=8 format=3 uid="uid://b7cfjs2iipagq"]
[gd_scene load_steps=15 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"]
[ext_resource type="PackedScene" uid="uid://wdjp1sv55q4f" path="res://sources/menus/night_sky/night_sky.tscn" id="2_tirf6"]
[ext_resource type="PackedScene" uid="uid://dxc82xcl7jncd" path="res://sources/menus/main/plants/palm.tscn" id="3_25mko"]
[ext_resource type="PackedScene" uid="uid://dnuny6200v5b0" path="res://sources/kalulu.tscn" id="4_tnnid"]
[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"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0rcyk"]
border_width_left = 3
@@ -26,17 +33,25 @@ grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_jsnxc")
[node name="OpeningCurtain" parent="." instance=ExtResource("2_kfcp0")]
unique_name_in_owner = true
[node name="NightSky" parent="." instance=ExtResource("2_tirf6")]
layout_mode = 1
[node name="Palm" parent="." instance=ExtResource("3_25mko")]
[node name="LargeFlower" parent="NightSky" instance=ExtResource("5_23tyx")]
position = Vector2(2064, 1794)
scale = Vector2(2, 2)
[node name="Bush" parent="NightSky" instance=ExtResource("6_i6t6f")]
position = Vector2(2224, 1824)
[node name="Palm" parent="NightSky" instance=ExtResource("3_25mko")]
position = Vector2(1280, 1800)
scale = Vector2(2, 2)
[node name="Kalulu" parent="." instance=ExtResource("4_tnnid")]
unique_name_in_owner = true
position = Vector2(256, 1320)
animation = &"Tc_Idle1"
[node name="Flower" parent="NightSky" instance=ExtResource("7_iqya7")]
position = Vector2(304, 1800)
[node name="ProgressBarContainer" type="MarginContainer" parent="."]
layout_mode = 1
@@ -51,6 +66,7 @@ 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
theme_override_colors/font_color = Color(0, 0, 0, 0)
@@ -71,3 +87,87 @@ 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
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"]
@@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=3 uid="uid://dc4eaxcunpmke"]
[gd_scene load_steps=16 format=3 uid="uid://dc4eaxcunpmke"]
[ext_resource type="PackedScene" uid="uid://bxd3i06rqpxf0" path="res://sources/menus/register/steps/base_step.tscn" id="1_ggdon"]
[ext_resource type="Script" path="res://addons/godot-form-validator/control_validator.gd" id="2_6d1eh"]
@@ -8,6 +8,7 @@
[ext_resource type="Script" path="res://addons/godot-form-validator/rules/length_rule.gd" id="6_qcc6t"]
[ext_resource type="Script" path="res://addons/godot-form-validator/rules/alpha_rule.gd" id="7_0a041"]
[ext_resource type="Script" path="res://addons/godot-form-validator/validators/line_edit_validator.gd" id="7_22xb4"]
[ext_resource type="Theme" uid="uid://cd7ftmo5x4c2r" path="res://resources/themes/kalulu_theme_big.tres" id="9_x0cdr"]
[sub_resource type="Resource" id="Resource_kw8sn"]
script = ExtResource("3_pj58p")
@@ -99,6 +100,7 @@ property_name = "name"
[node name="AgeField" type="SpinBox" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer" index="2"]
layout_mode = 2
theme = ExtResource("9_x0cdr")
min_value = 1.0
value = 1.0
@@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=3 uid="uid://do5e7c1oxkn5g"]
[gd_scene load_steps=4 format=3 uid="uid://do5e7c1oxkn5g"]
[ext_resource type="PackedScene" uid="uid://bxd3i06rqpxf0" path="res://sources/menus/register/steps/base_step.tscn" id="1_w3urq"]
[ext_resource type="Script" path="res://sources/utils/binder/control_binder.gd" id="2_asuou"]
[ext_resource type="Theme" uid="uid://cd7ftmo5x4c2r" path="res://resources/themes/kalulu_theme_big.tres" id="2_ux74f"]
[node name="DevicesCountStep" instance=ExtResource("1_w3urq")]
step_name = "devices"
@@ -12,6 +13,7 @@ text = "Choose the number of devices"
[node name="DevicesCountField" type="SpinBox" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer" index="0"]
layout_mode = 2
theme = ExtResource("2_ux74f")
min_value = 1.0
max_value = 90.0
value = 1.0
@@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=3 uid="uid://cyhoa68y1yyyg"]
[gd_scene load_steps=4 format=3 uid="uid://cyhoa68y1yyyg"]
[ext_resource type="PackedScene" uid="uid://bxd3i06rqpxf0" path="res://sources/menus/register/steps/base_step.tscn" id="1_par6r"]
[ext_resource type="Script" path="res://sources/menus/register/steps/teacher/students_count_step.gd" id="2_susi5"]
[ext_resource type="Theme" uid="uid://cd7ftmo5x4c2r" path="res://resources/themes/kalulu_theme_big.tres" id="3_pacdw"]
[node name="StudentsCountStep" instance=ExtResource("1_par6r")]
script = ExtResource("2_susi5")
@@ -12,6 +13,7 @@ question = "Choose the number of students on device %d"
[node name="StudentsCountField" type="SpinBox" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer" index="0"]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("3_pacdw")
min_value = 1.0
max_value = 90.0
value = 1.0
+2 -1
View File
@@ -9,7 +9,8 @@ func _on_back_button_pressed():
func _on_button_pressed():
print(UserDataManager.teacher_settings.students)
if UserDataManager.teacher_settings:
print(UserDataManager.teacher_settings.students)
func _on_logout_button_pressed():
+372 -12
View File
@@ -1,10 +1,11 @@
[gd_scene load_steps=6 format=3 uid="uid://ci7ueo06f24k3"]
[gd_scene load_steps=7 format=3 uid="uid://ci7ueo06f24k3"]
[ext_resource type="Script" path="res://sources/menus/teacher/teacher_settings.gd" id="1_ojivk"]
[ext_resource type="PackedScene" uid="uid://wdjp1sv55q4f" path="res://sources/menus/night_sky/night_sky.tscn" id="1_v06h8"]
[ext_resource type="Texture2D" uid="uid://wtx3wqs0l4si" path="res://assets/minigames/minigame_ui/graphic/button_back_up.png" id="3_hvu1i"]
[ext_resource type="Texture2D" uid="uid://cbhip35yyqneg" path="res://assets/minigames/minigame_ui/graphic/button_back_down.png" id="4_045cm"]
[ext_resource type="Texture2D" uid="uid://tcapan0mj64o" path="res://assets/minigames/minigame_ui/graphic/button_back_disabled.png" id="5_e3piv"]
[ext_resource type="PackedScene" uid="uid://c5ey1jk06asiq" path="res://sources/menus/components/password_visualizer.tscn" id="6_lywux"]
[node name="TeacherSettings" type="Control"]
layout_mode = 3
@@ -42,31 +43,390 @@ texture_pressed = ExtResource("4_045cm")
texture_disabled = ExtResource("5_e3piv")
stretch_mode = 4
[node name="LogoutButton" type="Button" parent="InterfaceLeft/Container"]
layout_mode = 2
theme_override_font_sizes/font_size = 70
text = "Logout"
[node name="VBoxContainer" type="VBoxContainer" parent="."]
custom_minimum_size = Vector2(2112, 1800)
layout_mode = 1
anchors_preset = 11
anchor_left = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -632.0
grow_horizontal = 0
grow_vertical = 2
[node name="TabContainer" type="TabContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/outline_size = 0
theme_override_font_sizes/font_size = 70
[node name="Device 1" type="TabBar" parent="VBoxContainer/TabContainer"]
layout_mode = 2
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer/TabContainer/Device 1"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/margin_left = 100
theme_override_constants/margin_top = 100
theme_override_constants/margin_right = 100
theme_override_constants/margin_bottom = 100
[node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/h_separation = 25
theme_override_constants/v_separation = 25
columns = 2
[node name="Control" type="Control" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(0, 500)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="StudentContainer" type="PanelContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -146.5
offset_top = -24.0
offset_right = 146.5
offset_bottom = 24.0
offset_left = -411.0
offset_top = -180.0
offset_right = 411.0
offset_bottom = 180.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 50
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control/StudentContainer"]
layout_mode = 2
theme_override_constants/margin_left = 25
theme_override_constants/margin_top = 25
theme_override_constants/margin_right = 25
theme_override_constants/margin_bottom = 25
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control/StudentContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control/StudentContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 50
text = "Student 1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="PasswordVisualizer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control/StudentContainer/MarginContainer/VBoxContainer" instance=ExtResource("6_lywux")]
layout_mode = 2
password = "123"
[node name="Control2" type="Control" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(0, 500)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="StudentContainer" type="PanelContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control2"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -411.0
offset_top = -180.0
offset_right = 411.0
offset_bottom = 180.0
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control2/StudentContainer"]
layout_mode = 2
theme_override_constants/margin_left = 25
theme_override_constants/margin_top = 25
theme_override_constants/margin_right = 25
theme_override_constants/margin_bottom = 25
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control2/StudentContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control2/StudentContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 50
text = "Student 1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="PasswordVisualizer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control2/StudentContainer/MarginContainer/VBoxContainer" instance=ExtResource("6_lywux")]
layout_mode = 2
password = "123"
[node name="Control3" type="Control" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(0, 500)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="StudentContainer" type="PanelContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control3"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -411.0
offset_top = -180.0
offset_right = 411.0
offset_bottom = 180.0
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control3/StudentContainer"]
layout_mode = 2
theme_override_constants/margin_left = 25
theme_override_constants/margin_top = 25
theme_override_constants/margin_right = 25
theme_override_constants/margin_bottom = 25
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control3/StudentContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control3/StudentContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 50
text = "Student 1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="PasswordVisualizer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control3/StudentContainer/MarginContainer/VBoxContainer" instance=ExtResource("6_lywux")]
layout_mode = 2
password = "123"
[node name="Control4" type="Control" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(0, 500)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="StudentContainer" type="PanelContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control4"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -411.0
offset_top = -180.0
offset_right = 411.0
offset_bottom = 180.0
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control4/StudentContainer"]
layout_mode = 2
theme_override_constants/margin_left = 25
theme_override_constants/margin_top = 25
theme_override_constants/margin_right = 25
theme_override_constants/margin_bottom = 25
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control4/StudentContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control4/StudentContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 50
text = "Student 1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="PasswordVisualizer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control4/StudentContainer/MarginContainer/VBoxContainer" instance=ExtResource("6_lywux")]
layout_mode = 2
password = "123"
[node name="Control5" type="Control" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(0, 500)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="StudentContainer" type="PanelContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control5"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -411.0
offset_top = -180.0
offset_right = 411.0
offset_bottom = 180.0
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control5/StudentContainer"]
layout_mode = 2
theme_override_constants/margin_left = 25
theme_override_constants/margin_top = 25
theme_override_constants/margin_right = 25
theme_override_constants/margin_bottom = 25
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control5/StudentContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control5/StudentContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 50
text = "Student 1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="PasswordVisualizer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control5/StudentContainer/MarginContainer/VBoxContainer" instance=ExtResource("6_lywux")]
layout_mode = 2
password = "123"
[node name="Control6" type="Control" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(0, 500)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="StudentContainer" type="PanelContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control6"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -411.0
offset_top = -180.0
offset_right = 411.0
offset_bottom = 180.0
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control6/StudentContainer"]
layout_mode = 2
theme_override_constants/margin_left = 25
theme_override_constants/margin_top = 25
theme_override_constants/margin_right = 25
theme_override_constants/margin_bottom = 25
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control6/StudentContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control6/StudentContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 50
text = "Student 1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="PasswordVisualizer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control6/StudentContainer/MarginContainer/VBoxContainer" instance=ExtResource("6_lywux")]
layout_mode = 2
password = "123"
[node name="Control7" type="Control" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(0, 500)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="StudentContainer" type="PanelContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control7"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -411.0
offset_top = -180.0
offset_right = 411.0
offset_bottom = 180.0
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control7/StudentContainer"]
layout_mode = 2
theme_override_constants/margin_left = 25
theme_override_constants/margin_top = 25
theme_override_constants/margin_right = 25
theme_override_constants/margin_bottom = 25
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control7/StudentContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control7/StudentContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 50
text = "Student 1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="PasswordVisualizer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control7/StudentContainer/MarginContainer/VBoxContainer" instance=ExtResource("6_lywux")]
layout_mode = 2
password = "123"
[node name="Control8" type="Control" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(0, 500)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="StudentContainer" type="PanelContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control8"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -411.0
offset_top = -180.0
offset_right = 411.0
offset_bottom = 180.0
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control8/StudentContainer"]
layout_mode = 2
theme_override_constants/margin_left = 25
theme_override_constants/margin_top = 25
theme_override_constants/margin_right = 25
theme_override_constants/margin_bottom = 25
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control8/StudentContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control8/StudentContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 50
text = "Student 1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="PasswordVisualizer" parent="VBoxContainer/TabContainer/Device 1/ScrollContainer/MarginContainer/GridContainer/Control8/StudentContainer/MarginContainer/VBoxContainer" instance=ExtResource("6_lywux")]
layout_mode = 2
password = "123"
[node name="PrintButton" type="Button" parent="VBoxContainer"]
visible = false
layout_mode = 2
theme_override_font_sizes/font_size = 70
text = "Print teacher settings"
[node name="LogoutButton" type="Button" parent="VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 70
text = "Logout"
[connection signal="pressed" from="InterfaceLeft/Container/BackButton" to="." method="_on_back_button_pressed"]
[connection signal="pressed" from="InterfaceLeft/Container/LogoutButton" to="." method="_on_logout_button_pressed"]
[connection signal="pressed" from="VBoxContainer/PrintButton" to="." method="_on_button_pressed"]
[connection signal="pressed" from="VBoxContainer/LogoutButton" to="." method="_on_logout_button_pressed"]
+1 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3]
[gd_scene load_steps=7 format=3 uid="uid://cp27bjh6v5bkj"]
[ext_resource type="Script" path="res://sources/minigames/base/opening_curtain.gd" id="1_xih0r"]
[ext_resource type="Texture2D" uid="uid://4u85b8th4uuv" path="res://assets/minigames/minigame_ui/graphic/curtain/bush.png" id="1_yhjvv"]
+2 -2
View File
@@ -47,7 +47,7 @@ func register(register_settings : TeacherSettings) -> bool:
return true
func login(language : String, teacher : String, password : String, device_id : int) -> bool:
func login(type : TeacherSettings.AccountType, language : String, teacher : String, password : String, device_id : int) -> bool:
if not _device_settings or not teacher or not password or device_id == 0:
return false
@@ -58,7 +58,7 @@ func login(language : String, teacher : String, password : String, device_id : i
var temp_teacher_settings = load(path) as TeacherSettings
if not temp_teacher_settings or temp_teacher_settings.password != password or device_id not in temp_teacher_settings.students.keys():
if not temp_teacher_settings or temp_teacher_settings.password != password or temp_teacher_settings.account_type != type or device_id not in temp_teacher_settings.students.keys():
return false
# Handles teacher settings