From a4e76bb9ddbe9b8d26b3bdafbd88d06feb4df9f1 Mon Sep 17 00:00:00 2001 From: Adrien Ufferte Date: Thu, 24 Apr 2025 10:00:18 +0200 Subject: [PATCH] Various cleaning --- resources/user/teacher_settings.gd | 10 ++--- sources/menus/brain/brain.tscn | 42 +++++++++---------- .../menus/components/password_visualizer.gd | 1 + sources/minigames/base/base_minigame.gd | 2 - .../base/hear_and_find/syllables_minigame.gd | 4 +- sources/utils/autoloads/user_data_manager.gd | 10 ++--- 6 files changed, 34 insertions(+), 35 deletions(-) diff --git a/resources/user/teacher_settings.gd b/resources/user/teacher_settings.gd index 642e883c..9c3505a6 100644 --- a/resources/user/teacher_settings.gd +++ b/resources/user/teacher_settings.gd @@ -38,12 +38,12 @@ func update_from_dict(dict: Dictionary) -> void: var d_students: Dictionary = dict.students for device: String in d_students.keys(): var device_students: Array[StudentData] = [] - for s: Dictionary in dict.students[device]: + for student_dico: Dictionary in dict.students[device]: var student: = StudentData.new() - student.code = str(s.code) - student.name = s.name - student.age = s.age - student.level = s.level + student.code = student_dico.code + student.name = student_dico.name + student.age = student_dico.age + student.level = student_dico.level device_students.append(student) students[int(device)] = device_students diff --git a/sources/menus/brain/brain.tscn b/sources/menus/brain/brain.tscn index e2928061..71b32fbc 100644 --- a/sources/menus/brain/brain.tscn +++ b/sources/menus/brain/brain.tscn @@ -123,13 +123,13 @@ color = Color(0.00392157, 0, 0.105882, 1) material = SubResource("CanvasItemMaterial_iw28k") position = Vector2(1280, 900) amount = 64 -process_material = SubResource("ParticleProcessMaterial_x00r2") texture = ExtResource("1_poeho") lifetime = 5.0 preprocess = 5.0 randomness = 0.5 visibility_rect = Rect2(-12800, -900, 25600, 1800) local_coords = true +process_material = SubResource("ParticleProcessMaterial_x00r2") [node name="TextureRect" type="TextureRect" parent="ControlBackground"] layout_mode = 0 @@ -258,8 +258,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(59, 56) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton2" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -281,8 +281,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(50, 51.5) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton3" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -304,8 +304,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(59.5, 51) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton4" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -327,8 +327,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(56.5, 59.5) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton5" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -350,8 +350,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(56, 58) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton6" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -373,8 +373,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(59.5, 55.5) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton7" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -396,8 +396,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(56, 49) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton8" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -419,8 +419,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(54.5, 48.5) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton9" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -442,8 +442,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(71, 66) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton10" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -465,8 +465,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(54, 64.5) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton11" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -488,8 +488,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(68, 45.5) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton12" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -511,8 +511,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(57.5, 47.5) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton13" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -534,8 +534,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(51, 64.5) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton14" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -557,8 +557,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(47, 49) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton15" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -580,8 +580,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(53.5, 52.5) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton16" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -603,8 +603,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(82.5, 50) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton17" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -626,8 +626,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(52, 54) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton18" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -649,8 +649,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(60.5, 47.5) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton19" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -672,8 +672,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(46.5, 53) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="GardenButton20" type="TextureButton" parent="GardenButtons"] unique_name_in_owner = true @@ -695,8 +695,8 @@ material = SubResource("CanvasItemMaterial_4xkmy") position = Vector2(59.5, 47) scale = Vector2(0.4, 0.4) emitting = false -process_material = SubResource("ParticleProcessMaterial_4003t") texture = ExtResource("33_bjun2") +process_material = SubResource("ParticleProcessMaterial_4003t") [node name="Kalulu" parent="." instance=ExtResource("35_t3kvk")] visible = false diff --git a/sources/menus/components/password_visualizer.gd b/sources/menus/components/password_visualizer.gd index 7c32a073..ee7d0c70 100644 --- a/sources/menus/components/password_visualizer.gd +++ b/sources/menus/components/password_visualizer.gd @@ -44,6 +44,7 @@ func _draw_password() -> void: var i: = 0 for value in password.split(""): if i >= 3: + push_error("A password cannot be more than 3 characters long") return if value in icons_textures: diff --git a/sources/minigames/base/base_minigame.gd b/sources/minigames/base/base_minigame.gd index c748a66d..2dd7d35c 100644 --- a/sources/minigames/base/base_minigame.gd +++ b/sources/minigames/base/base_minigame.gd @@ -188,7 +188,6 @@ func _notification(what): if not _is_paused: _pause_start = Time.get_ticks_msec() / 1000.0 _is_paused = true - print("⏸️ Pause detected at %.2f" % _pause_start) NOTIFICATION_APPLICATION_FOCUS_IN: if _is_paused: @@ -196,7 +195,6 @@ func _notification(what): var pause_duration = resumed - _pause_start _elapsed_paused += pause_duration _is_paused = false - print("▶️ Resume, pause duration %.2f sec, total pause : %.2f sec" % [pause_duration, _elapsed_paused]) #endregion #region Ending diff --git a/sources/minigames/base/hear_and_find/syllables_minigame.gd b/sources/minigames/base/hear_and_find/syllables_minigame.gd index 54c482dc..9e934a40 100644 --- a/sources/minigames/base/hear_and_find/syllables_minigame.gd +++ b/sources/minigames/base/hear_and_find/syllables_minigame.gd @@ -66,7 +66,7 @@ func _find_stimuli_and_distractions() -> void: else: stimuli.append_array(current_lesson_stimuli) - # We if there are not enough stimuli from current lesson, we want at least half the target number of stimuli + # If there are not enough stimuli from current lesson, we want at least half the target number of stimuli @warning_ignore("integer_division") var minimal_stimuli : int = current_lesson_stimuli_number/2 if stimuli.size() < minimal_stimuli: @@ -95,7 +95,7 @@ func _find_stimuli_and_distractions() -> void: for stimulus: Dictionary in stimuli: var stimulus_distractors: Array[Dictionary] = [] - # Difficulty 1 + # Difficulty 1 # Any previously learned item w/ all letters different for syllable: Dictionary in all_syllables: if syllable.Phoneme != stimulus.Phoneme: diff --git a/sources/utils/autoloads/user_data_manager.gd b/sources/utils/autoloads/user_data_manager.gd index 3fb0207c..7e5c9ddf 100644 --- a/sources/utils/autoloads/user_data_manager.gd +++ b/sources/utils/autoloads/user_data_manager.gd @@ -284,7 +284,7 @@ func _delete_inexistants_students_saves() -> void: # Check if the folder is associated with an existing student var exists: = false for s: StudentData in teacher_settings.students[int(device)]: - if s.code == p_student: + if str(s.code) == p_student: exists = true break # If the code doesn't exists in the configuration, delete the folder @@ -349,11 +349,11 @@ func _on_user_progression_unlocks_changed() -> void: _save_student_progression() -func get_student_progression_for_code(device: int, code: String) -> UserProgression: +func get_student_progression_for_code(device: int, code: int) -> UserProgression: if not teacher_settings or not teacher_settings.students.has(device): return - var student_path: String ="user://".path_join(_device_settings.teacher).path_join(str(device)).path_join(_device_settings.language).path_join(code) + var student_path: String ="user://".path_join(_device_settings.teacher).path_join(str(device)).path_join(_device_settings.language).path_join(str(code)) var progression_path: String = student_path.path_join("progression.tres") var progression: UserProgression @@ -367,8 +367,8 @@ func get_student_progression_for_code(device: int, code: String) -> UserProgress return progression -func save_student_progression_for_code(device: int, code: String, progression: UserProgression) -> void: - var progression_path: String = "user://".path_join(_device_settings.teacher).path_join(str(device)).path_join(_device_settings.language).path_join(code).path_join("progression.tres") +func save_student_progression_for_code(device: int, code: int, progression: UserProgression) -> void: + var progression_path: String = "user://".path_join(_device_settings.teacher).path_join(str(device)).path_join(_device_settings.language).path_join(str(code)).path_join("progression.tres") ResourceSaver.save(progression, progression_path) #endregion