mirror of
https://github.com/deunix-educ/aventuriers-des-mots.git
synced 2026-10-13 02:11:58 +02:00
493a8617d7
Wires every autoload up to a real UI: boot -> profile select/create -> world map (three mission markers, positioned from data, not hardcoded pixels) -> mission intro (narrative from data/missions/, a new data type with its own schema) -> rule panel -> exercise host -> one of the three exercise type scenes -> feedback panel -> reward screen -> back to the map. exercise_host is the only piece with real orchestration logic: picks exercises via ExerciseEngine (now fully implemented, validating at load like make validate-data does), validates answers through the pure AnswerValidator/DictationAnalyzer, escalates aid over 3 attempts via AttemptFlow, feeds DifficultyManager so adaptive difficulty is actually wired in rather than dead code, and records every attempt through ProgressManager. Every exercise-type scene (multiple_choice, sentence_correction, dictation) only emits its answer by signal, per the architecture invariant. All child-facing text now comes from data/localization/fr.json via UIText, not hardcoded in scripts or scenes. Getting that right required extending SchemaValidator to support "additionalProperties" as a schema (dynamic keys), which also closed a real gap: save.skills was previously unvalidated against SkillState's actual shape. 16 new headless tests, including two integration tests that instance exercise_host.tscn directly and drive it by emitting child-scene signals, stopping short of the final scene transition (which would tear down the test runner's own tree). Everything that needs a screen -- layout at different sizes, touch, virtual keyboard, actual audio playback (no .ogg files exist yet) -- is listed in the new docs/testing/manual-checklist.md instead of claimed as verified. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
72 lines
3.1 KiB
GDScript
72 lines
3.1 KiB
GDScript
class_name ProgressUpdates
|
|
extends RefCounted
|
|
## Fonctions pures qui appliquent une tentative d'exercice ou un debut de
|
|
## seance a une sauvegarde (dictionnaire conforme a save.schema.json), en
|
|
## s'appuyant sur ReviewScheduler et DifficultyManager (scripts/pedagogy/).
|
|
## ProgressManager (autoload) est seul responsable d'appeler ces fonctions et
|
|
## de persister le resultat via SaveManager ; l'ecriture sur disque reste
|
|
## groupee en fin de mission (docs/specs/decisions.md, point 7).
|
|
|
|
|
|
## attempt : {"skill": String, "success": bool, "hint_used": bool,
|
|
## "exercise_type": String}.
|
|
static func record_attempt(save_data: Dictionary, attempt: Dictionary) -> Dictionary:
|
|
var updated: Dictionary = save_data.duplicate(true)
|
|
var skills: Dictionary = updated["skills"]
|
|
var skill_id: String = attempt["skill"]
|
|
var skill_state: Dictionary = (
|
|
skills[skill_id] if skills.has(skill_id) else ReviewScheduler.initial_state()
|
|
)
|
|
var current_session: int = updated["session_count"]
|
|
skills[skill_id] = ReviewScheduler.record_attempt(skill_state, attempt, current_session)
|
|
updated["skills"] = skills
|
|
return updated
|
|
|
|
|
|
## A appeler une fois en debut de seance, avant toute tentative : incremente
|
|
## session_count et bascule en "a_reviser" les competences "acquise" dont le
|
|
## delai de revision est depasse sans nouvelle pratique.
|
|
static func start_session(save_data: Dictionary) -> Dictionary:
|
|
var updated: Dictionary = save_data.duplicate(true)
|
|
updated["session_count"] = int(updated["session_count"]) + 1
|
|
var current_session: int = updated["session_count"]
|
|
|
|
var skills: Dictionary = updated["skills"]
|
|
var updated_skills: Dictionary = {}
|
|
for skill_id: String in skills:
|
|
updated_skills[skill_id] = ReviewScheduler.mark_overdue_as_review(
|
|
skills[skill_id], current_session
|
|
)
|
|
updated["skills"] = updated_skills
|
|
return updated
|
|
|
|
|
|
static func next_difficulty_for_skill(
|
|
save_data: Dictionary, skill_id: String, current_difficulty: int
|
|
) -> int:
|
|
var skills: Dictionary = save_data["skills"]
|
|
if not skills.has(skill_id):
|
|
return current_difficulty
|
|
var recent: Array[bool] = skills[skill_id]["recent_results"]
|
|
return DifficultyManager.next_difficulty(current_difficulty, recent)
|
|
|
|
|
|
static func unlock_region(save_data: Dictionary, region_id: String) -> Dictionary:
|
|
var updated: Dictionary = save_data.duplicate(true)
|
|
var regions: Array = updated["unlocked_regions"]
|
|
if not regions.has(region_id):
|
|
regions.append(region_id)
|
|
updated["unlocked_regions"] = regions
|
|
return updated
|
|
|
|
|
|
## Les recompenses valorisent l'effort et la progression, jamais la vitesse
|
|
## (cahier des charges §2, principe 6) : un nombre fixe d'etoiles par mission
|
|
## terminee, quel que soit le temps pris ou le nombre d'aides utilisees.
|
|
static func add_stars(save_data: Dictionary, amount: int) -> Dictionary:
|
|
var updated: Dictionary = save_data.duplicate(true)
|
|
var rewards: Dictionary = updated["rewards"].duplicate(true)
|
|
rewards["stars"] = int(rewards["stars"]) + amount
|
|
updated["rewards"] = rewards
|
|
return updated
|