Adds an info label to the upper panels on the register steps. Moves the language select before the login forms
This commit is contained in:
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -7,7 +7,15 @@ func _ready():
|
||||
var dir = DirAccess.open("res://language_resources")
|
||||
var idx : int = 0
|
||||
for language_locale in dir.get_directories():
|
||||
add_item(TranslationServer.get_locale_name(language_locale), idx)
|
||||
if not language_locale:
|
||||
continue
|
||||
|
||||
var language_locale_name : String = TranslationServer.get_locale_name(language_locale)
|
||||
|
||||
if not language_locale_name:
|
||||
continue
|
||||
|
||||
add_item(language_locale_name, idx)
|
||||
items.append(language_locale)
|
||||
if language_locale == UserDataManager.get_device_settings().language:
|
||||
select(idx)
|
||||
@@ -17,3 +25,7 @@ func _ready():
|
||||
func get_selected_language() -> String:
|
||||
var id = get_selected_id()
|
||||
return items[id]
|
||||
|
||||
|
||||
func _on_item_selected(index):
|
||||
UserDataManager.set_language(items[index])
|
||||
|
||||
@@ -5,7 +5,6 @@ signal logged_in
|
||||
@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
|
||||
@@ -58,7 +57,7 @@ func _on_validate_button_pressed() -> void:
|
||||
return
|
||||
|
||||
# Login
|
||||
if UserDataManager.login(account_type, language_field.get_selected_language(), email_field.text, password_field.text, int(device_id_field.value)):
|
||||
if UserDataManager.login(account_type, email_field.text, password_field.text, int(device_id_field.value)):
|
||||
logged_in.emit()
|
||||
else:
|
||||
login_message.visible = true
|
||||
|
||||
@@ -193,6 +193,22 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 25
|
||||
|
||||
[node name="LanguageContainer" type="VBoxContainer" parent="UserSelection/Form"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="LanguageLabel" type="Label" parent="UserSelection/Form/LanguageContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 70
|
||||
text = "Language"
|
||||
|
||||
[node name="LanguageField" type="OptionButton" parent="UserSelection/Form/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="SignInTeacher" type="Button" parent="UserSelection/Form"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 70
|
||||
@@ -278,22 +294,6 @@ 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
|
||||
@@ -470,6 +470,7 @@ text = "?"
|
||||
vertical_alignment = 1
|
||||
|
||||
[connection signal="pressed" from="Kalulu/PlayButton" to="." method="_on_main_button_pressed"]
|
||||
[connection signal="item_selected" from="UserSelection/Form/LanguageContainer/LanguageField" to="UserSelection/Form/LanguageContainer/LanguageField" method="_on_item_selected"]
|
||||
[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"]
|
||||
|
||||
@@ -6,18 +6,24 @@ signal back(step : Step)
|
||||
signal next(step : Step)
|
||||
|
||||
@onready var question_label : Label = %QuestionLabel
|
||||
@onready var info_label : Label = %InfoLabel
|
||||
@onready var form_validator : FormValidator = %FormValidator
|
||||
@onready var form_binder : FormBinder = %FormBinder
|
||||
@onready var form_container : Control = %FormContainer
|
||||
|
||||
@export var step_name : String
|
||||
@export_multiline var question : String
|
||||
@export_multiline var infos : String
|
||||
@export var data : Resource
|
||||
|
||||
func on_enter() -> void:
|
||||
form_binder.read(data)
|
||||
question_label.text = question
|
||||
|
||||
|
||||
if infos:
|
||||
info_label.text = infos
|
||||
else:
|
||||
info_label.visible = false
|
||||
|
||||
func _on_back() -> bool:
|
||||
return true
|
||||
|
||||
@@ -15,6 +15,7 @@ anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_02ocl")
|
||||
infos = null
|
||||
|
||||
[node name="LeftMargin" type="MarginContainer" parent="."]
|
||||
custom_minimum_size = Vector2(450, 2.08165e-12)
|
||||
@@ -88,16 +89,27 @@ layout_mode = 2
|
||||
theme_override_constants/margin_left = 25
|
||||
theme_override_constants/margin_right = 25
|
||||
|
||||
[node name="QuestionLabel" type="Label" parent="PanelContainer/QuestionContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(1500, 500)
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/QuestionContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="QuestionLabel" type="Label" parent="PanelContainer/QuestionContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(1500, 0)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_font_sizes/font_size = 70
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="InfoLabel" type="Label" parent="PanelContainer/QuestionContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_font_sizes/font_size = 50
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Background" type="TextureRect" parent="."]
|
||||
custom_minimum_size = Vector2(1624, 812)
|
||||
layout_mode = 1
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
device_id = 1
|
||||
step_name = "players"
|
||||
question = "Choose the number of players"
|
||||
infos = "You will be able do modify the players later in the settings"
|
||||
|
||||
[node name="StudentsCountFieldLabel" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer/StudentsCountContainer" index="0"]
|
||||
text = "Players :"
|
||||
|
||||
@@ -22,12 +22,16 @@ func on_enter():
|
||||
if teacher_settings.account_type == TeacherSettings.AccountType.Teacher:
|
||||
education_method.text = "Education method : %s" % TeacherSettings.EducationMethod.keys()[teacher_settings.education_method]
|
||||
education_method.show()
|
||||
|
||||
devices_count.text = "Number of devices : %d" % teacher_settings.students.size()
|
||||
devices_count.show()
|
||||
|
||||
students_count.text = "Number of students : %d" % teacher_settings.get_students_count()
|
||||
students_count.show()
|
||||
else:
|
||||
education_method.hide()
|
||||
|
||||
devices_count.text = "Number of devices : %d" % teacher_settings.students.size()
|
||||
|
||||
students_count.text = "Number of students : %d" % teacher_settings.get_students_count()
|
||||
devices_count.hide()
|
||||
students_count.hide()
|
||||
|
||||
for child in recap_container.get_children(false):
|
||||
child.queue_free()
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
[node name="RecapStep" instance=ExtResource("1_crpog")]
|
||||
script = ExtResource("2_0vlqx")
|
||||
infos = ""
|
||||
|
||||
[node name="ValidateButton" parent="RightMargin/RightContainer" index="0"]
|
||||
text = "Validate"
|
||||
@@ -14,56 +15,56 @@ offset_left = -1024.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 1344.0
|
||||
|
||||
[node name="QuestionLabel" parent="PanelContainer/QuestionContainer" index="0"]
|
||||
[node name="VBoxContainer" parent="PanelContainer/QuestionContainer" index="0"]
|
||||
visible = false
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/QuestionContainer" index="1"]
|
||||
[node name="SummaryContainer" type="VBoxContainer" parent="PanelContainer/QuestionContainer" index="1"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 50
|
||||
|
||||
[node name="Title" type="Label" parent="PanelContainer/QuestionContainer/VBoxContainer" index="0"]
|
||||
[node name="Title" type="Label" parent="PanelContainer/QuestionContainer/SummaryContainer" index="0"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 70
|
||||
text = "Registration summary"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/QuestionContainer/VBoxContainer" index="1"]
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/QuestionContainer/SummaryContainer" index="1"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/QuestionContainer/VBoxContainer/ScrollContainer" index="0"]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/QuestionContainer/SummaryContainer/ScrollContainer" index="0"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 20
|
||||
|
||||
[node name="Email" type="Label" parent="PanelContainer/QuestionContainer/VBoxContainer/ScrollContainer/VBoxContainer" index="0"]
|
||||
[node name="Email" type="Label" parent="PanelContainer/QuestionContainer/SummaryContainer/ScrollContainer/VBoxContainer" index="0"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
|
||||
[node name="AccountType" type="Label" parent="PanelContainer/QuestionContainer/VBoxContainer/ScrollContainer/VBoxContainer" index="1"]
|
||||
[node name="AccountType" type="Label" parent="PanelContainer/QuestionContainer/SummaryContainer/ScrollContainer/VBoxContainer" index="1"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
|
||||
[node name="EducationMethod" type="Label" parent="PanelContainer/QuestionContainer/VBoxContainer/ScrollContainer/VBoxContainer" index="2"]
|
||||
[node name="EducationMethod" type="Label" parent="PanelContainer/QuestionContainer/SummaryContainer/ScrollContainer/VBoxContainer" index="2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
|
||||
[node name="DevicesCount" type="Label" parent="PanelContainer/QuestionContainer/VBoxContainer/ScrollContainer/VBoxContainer" index="3"]
|
||||
[node name="DevicesCount" type="Label" parent="PanelContainer/QuestionContainer/SummaryContainer/ScrollContainer/VBoxContainer" index="3"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
|
||||
[node name="StudentsCount" type="Label" parent="PanelContainer/QuestionContainer/VBoxContainer/ScrollContainer/VBoxContainer" index="4"]
|
||||
[node name="StudentsCount" type="Label" parent="PanelContainer/QuestionContainer/SummaryContainer/ScrollContainer/VBoxContainer" index="4"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
|
||||
[node name="RecapContainer" type="VBoxContainer" parent="PanelContainer/QuestionContainer/VBoxContainer/ScrollContainer/VBoxContainer" index="5"]
|
||||
[node name="RecapContainer" type="VBoxContainer" parent="PanelContainer/QuestionContainer/SummaryContainer/ScrollContainer/VBoxContainer" index="5"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
[node name="DevicesCountStep" instance=ExtResource("1_w3urq")]
|
||||
step_name = "devices"
|
||||
question = "Choose the number of devices"
|
||||
|
||||
[node name="QuestionLabel" parent="PanelContainer/QuestionContainer" index="0"]
|
||||
text = "Choose the number of devices"
|
||||
infos = "You will be able to modify the devices later in the settings"
|
||||
|
||||
[node name="DevicesCountContainer" type="HBoxContainer" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer" index="0"]
|
||||
layout_mode = 2
|
||||
|
||||
@@ -20,9 +20,7 @@ rules = Array[Resource("res://addons/godot-form-validator/rules/validator_rule.g
|
||||
|
||||
[node name="MethodStep" instance=ExtResource("1_ksrhk")]
|
||||
question = "Choose the education method"
|
||||
|
||||
[node name="QuestionLabel" parent="PanelContainer/QuestionContainer" index="0"]
|
||||
text = "Choose the education method"
|
||||
infos = "Choose complete if you also use the paper booklets and games"
|
||||
|
||||
[node name="MethodContainer" type="HBoxContainer" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer" index="0"]
|
||||
layout_mode = 2
|
||||
|
||||
@@ -9,6 +9,7 @@ script = ExtResource("2_susi5")
|
||||
device_id = 0
|
||||
step_name = "students"
|
||||
question = "Choose the number of students on device %d"
|
||||
infos = "You will be able do modify the students for each device later in the settings"
|
||||
|
||||
[node name="StudentsCountContainer" type="HBoxContainer" parent="Background/FormMargin/FormValidator/FormBinder/FormContainer" index="0"]
|
||||
layout_mode = 2
|
||||
|
||||
@@ -5,15 +5,14 @@
|
||||
[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://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="SpriteFrames" uid="uid://dquynn3nx52o" path="res://sources/minigames/jellyfish/red_jellyfish_animations.tres" id="4_g5og8"]
|
||||
[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(538.853, 538.853)
|
||||
custom_minimum_size = Vector2(449.43, 449.43)
|
||||
offset_right = 200.0
|
||||
offset_bottom = 200.0
|
||||
script = ExtResource("1_06uwq")
|
||||
color = 1
|
||||
|
||||
[node name="RightFX" parent="." instance=ExtResource("2_edt4e")]
|
||||
position = Vector2(284, 142.25)
|
||||
@@ -26,10 +25,9 @@ sprites = [NodePath("AnimatedSprite2D")]
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="SpriteControl"]
|
||||
unique_name_in_owner = true
|
||||
scale = Vector2(2.47926, 2.47926)
|
||||
sprite_frames = ExtResource("4_tdfu4")
|
||||
scale = Vector2(1e-05, 1e-05)
|
||||
sprite_frames = ExtResource("4_g5og8")
|
||||
animation = &"idle"
|
||||
frame_progress = 0.520072
|
||||
centered = false
|
||||
|
||||
[node name="PercentMarginContainer" type="Container" parent="."]
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
[node name="JellyfishMinigame" instance=ExtResource("1_hauef")]
|
||||
script = ExtResource("2_gnjlp")
|
||||
lesson_nb = 10
|
||||
difficulty = 4
|
||||
difficulty = 0
|
||||
max_number_of_lives = 5
|
||||
max_progression = 8
|
||||
intro_kalulu_speech = ExtResource("3_6sswr")
|
||||
|
||||
@@ -47,7 +47,7 @@ func register(register_settings : TeacherSettings) -> bool:
|
||||
|
||||
return true
|
||||
|
||||
func login(type : TeacherSettings.AccountType, language : String, teacher : String, password : String, device_id : int) -> bool:
|
||||
func login(type : TeacherSettings.AccountType, teacher : String, password : String, device_id : int) -> bool:
|
||||
if not _device_settings or not teacher or not password or device_id == 0:
|
||||
return false
|
||||
|
||||
@@ -65,8 +65,6 @@ func login(type : TeacherSettings.AccountType, language : String, teacher : Stri
|
||||
teacher_settings = temp_teacher_settings
|
||||
|
||||
# Handles device settings
|
||||
if _device_settings.language != language:
|
||||
_device_settings.language = language
|
||||
_device_settings.teacher = teacher
|
||||
_device_settings.device_id = device_id
|
||||
_save_device_settings()
|
||||
@@ -103,6 +101,12 @@ func login_student(code : String) -> bool:
|
||||
|
||||
# Device settings #
|
||||
|
||||
func set_language(language : String) -> void:
|
||||
print("Setting language")
|
||||
if _device_settings:
|
||||
_device_settings.language = language
|
||||
_save_device_settings()
|
||||
|
||||
func get_device_settings_path() -> String:
|
||||
return "user://device_settings.tres"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user