This commit is contained in:
Adrien Ufferte
2025-06-18 16:43:00 +02:00
parent 6be4e67b50
commit ab8efbcbf3
52 changed files with 176 additions and 176 deletions
+7 -7
View File
@@ -2,12 +2,12 @@
extends Node
const _SYMBOLS_TO_STRING: Dictionary[String, String] = {
"#" : "sharp",
"@" : "at",
"*" : "star",
"$" : "usd",
"%" : "pcent",
"§" : "para"
"#": "sharp",
"@": "at",
"*": "star",
"$": "usd",
"%": "pcent",
"§": "para"
}
const BASE_PATH: String = "user://language_resources/"
const TRACING_DATA_FOLDER: String = "tracing_data/"
@@ -80,7 +80,7 @@ func load_additional_word_list() -> String:
return ""
func get_exercice_for_lesson(lesson_nb: int) -> Array[int]:
func get_exercise_for_lesson(lesson_nb: int) -> Array[int]:
var query: String = "Select Exercise1, Exercise2, Exercise3 FROM LessonsExercises
INNER JOIN Lessons ON Lessons.ID = LessonsExercises.LessonID
WHERE LessonNB == " + str(lesson_nb)
+2 -2
View File
@@ -111,11 +111,11 @@ func _log_to_file(message: String) -> void:
log_file.flush()
# Sugar functions
# trace can be used everywhere, in ordre to have a full log of all that is hapenning
# trace can be used everywhere, in order to have a full log of all that is hapenning
func trace(msg: String) -> void: _log_internal(LogLevel.TRACE, msg)
# debug should only be used in a dev environment to track a specific bug.
func debug(msg: String) -> void: _log_internal(LogLevel.DEBUG, msg)
# info can carry important informations that should always be logged but that are not problematic
# info can carry important information(s) that should always be logged but that are not problematic
func info(msg: String) -> void: _log_internal(LogLevel.INFO, msg)
func warn(msg: String) -> void: _log_internal(LogLevel.WARNING, msg)
func error(msg: String) -> void: _log_internal(LogLevel.ERROR, msg)
+2 -2
View File
@@ -1,6 +1,6 @@
extends Node
@onready var music_player : AudioStreamPlayer = $MusicPlayer
@onready var music_player: AudioStreamPlayer = $MusicPlayer
const TRACKS: Array = [
preload("res://assets/music/title.mp3"),
@@ -19,7 +19,7 @@ func _on_music_player_finished() -> void:
music_player.stream_paused = false
music_player.play()
func play(track : Track) -> void:
func play(track: Track) -> void:
music_player.stream = TRACKS[track]
music_player.play()
+1 -1
View File
@@ -5,7 +5,7 @@ signal animation_finished(animation_name: StringName)
@onready var animation_player: AnimationPlayer = $AnimationPlayer
var is_closed : bool = false
var is_closed: bool = false
func open() -> void:
if is_closed:
+6 -8
View File
@@ -38,7 +38,7 @@ func first_login_student() -> void:
func check_email(email: String) -> Dictionary:
loading_rect.show()
await _get_request("checkemail", {"mail" : email})
await _get_request("checkemail", {"mail": email})
return _response()
@@ -99,9 +99,7 @@ func update_student_remediation_data(student_code: int, student_remediation: Use
await _post_json_request("submit_gp_remediation", data)
return _response()
# p_student must have a device key
# it can contain a name, level and age key for parents
# TODO POUR ADD / UPDATE / REMOVE STUDENT : RECUPERER LE TIMESTAMP POUR METTRE A JOUR LE USER
func add_student(p_student: Dictionary) -> Dictionary:
await _post_request("add_student", p_student)
return _response()
@@ -151,7 +149,7 @@ func _create_request_headers(content_type_json: bool = false) -> PackedStringArr
headers.append("Authorization: Bearer " + teacher_settings.token)
if content_type_json:
headers.append("Content-Type: application/json")
Logger.trace("ServerManager Create Header : " + str(headers))
Logger.trace("ServerManager Create Header: " + str(headers))
return headers
@@ -162,9 +160,9 @@ var json: Dictionary = {}
func _response() -> Dictionary:
var res: Dictionary = {
"success" : success,
"code" : code,
"body" : json
"success": success,
"code": code,
"body": json
}
return res
+11 -9
View File
@@ -2,11 +2,11 @@
extends Node
var student: String = "" :
var student: String = "":
set(student_name):
student = student_name
student_progression = null
if student :
if student:
_load_student_progression()
_load_student_remediation()
_load_student_difficulty()
@@ -134,14 +134,14 @@ func login(infos: Dictionary) -> bool:
func safe_load_and_fix_resource(path: String, old_texts: Array[String], new_texts: Array[String]) -> Resource:
if not FileAccess.file_exists(path):
Logger.error(" File not found : " + path)
Logger.error("UserDataManager: File not found: " + path)
return null
var content: String = FileAccess.get_file_as_string(path)
for index: int in old_texts.size():
if content.find(old_texts[index]) != -1:
Logger.info("🔧 Fix resource:" + path)
Logger.info("UserDataManager: Fix resource:" + path)
content = content.replace(old_texts[index], new_texts[index])
var file: FileAccess = FileAccess.open(path, FileAccess.WRITE)
file.store_string(content)
@@ -149,9 +149,11 @@ func safe_load_and_fix_resource(path: String, old_texts: Array[String], new_text
var resource: Resource = ResourceLoader.load(path)
if resource == null:
push_error("❌ Chargement échoué même après correction : " + path)
#TODO REPLACE WITH LOGGER
push_error("UserDataManager: Loading failed after correction: " + path)
else:
print("✅ Chargement réussi :", path)
#TODO REPLACE WITH LOGGER
print("UserDataManager: Loading success: " + path)
return resource
func set_device_id(device: int) -> bool:
@@ -183,7 +185,7 @@ func delete_teacher_data() -> void:
if DirAccess.dir_exists_absolute(get_teacher_folder()):
_delete_dir(get_teacher_folder())
func login_student(code : String) -> bool:
func login_student(code: String) -> bool:
if not _device_settings or not teacher_settings:
return false
@@ -230,7 +232,7 @@ func _save_device_settings() -> void:
Logger.trace("UserDataManager: Saving device settings in " + get_device_settings_path())
ResourceSaver.save(_device_settings, get_device_settings_path())
func set_language(language : String) -> void:
func set_language(language: String) -> void:
if _device_settings:
_device_settings.language = language
_save_device_settings()
@@ -312,7 +314,7 @@ func denormalize_volume(value: float) -> float:
func get_teacher_folder() -> String:
return "user://".path_join(_device_settings.teacher)
func _get_teacher_settings_path(teacher : String) -> String:
func _get_teacher_settings_path(teacher: String) -> String:
return "user://".path_join(teacher).path_join("teacher_settings.tres")
func get_teacher_settings_path() -> String:
+1 -1
View File
@@ -2,7 +2,7 @@
extends Control
class_name ControlBinder
@export var property_name : String
@export var property_name: String
var control: Control
+1 -1
View File
@@ -2,7 +2,7 @@
extends Control
class_name FormBinder
@export var data : Resource
@export var data: Resource
var _control_binder_map: Dictionary[Control, ControlBinder] = {}
+1 -1
View File
@@ -4,7 +4,7 @@ class_name HighlightFX
@onready var animation_player: AnimationPlayer = $AnimationPlayer
var is_playing : bool = false
var is_playing: bool = false
func play() -> void:
is_playing = true
+3 -3
View File
@@ -12,10 +12,10 @@ const TEXTURES: Array[CompressedTexture2D] = [
preload("res://assets/vfx/sand_07.png")
]
@onready var particles : GPUParticles2D = $Particles
@onready var timer : Timer = $Timer
@onready var particles: GPUParticles2D = $Particles
@onready var timer: Timer = $Timer
var is_playing : bool = false
var is_playing: bool = false
func _ready() -> void:
timer.wait_time = particles.lifetime
+1 -1
View File
@@ -1,7 +1,7 @@
extends Resource
class_name LogResource
@export var logs: Dictionary = {} # int : Dictionary {String : Dictionary}
@export var logs: Dictionary = {} # int: Dictionary {String: Dictionary}
func add_log(lesson_nb: int, new_log: Dictionary, time: String) -> void:
+1 -1
View File
@@ -8,7 +8,7 @@ signal swipe(start_position: Vector2, end_position: Vector2)
var current_preview: TextureRect
var start_position: Vector2
func _ready() -> void :
func _ready() -> void:
set_drag_forwarding(
# _get_drag_data
func(at_position: Vector2) -> Dictionary: