mirror of
https://github.com/deunix-educ/aventuriers-des-mots.git
synced 2026-10-13 10:21: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>
60 lines
2.1 KiB
GDScript
60 lines
2.1 KiB
GDScript
extends Control
|
|
## Exercice de correction de phrase : toucher le mot fautif puis le corriger
|
|
## (interaction decidee dans docs/specs/decisions.md, point 3). Scene
|
|
## autonome : emet la reponse par signal, ne touche ni a la sauvegarde ni a
|
|
## la progression.
|
|
|
|
signal answer_submitted(selected_indices: Array, corrections: Dictionary)
|
|
|
|
var _correction_edits: Dictionary = {}
|
|
|
|
@onready var _instruction_label: Label = %InstructionLabel
|
|
@onready var _tokens_box: HFlowContainer = %TokensBox
|
|
@onready var _corrections_box: VBoxContainer = %CorrectionsBox
|
|
@onready var _validate_button: Button = %ValidateButton
|
|
|
|
|
|
func _ready() -> void:
|
|
_validate_button.text = UIText.get_text("exercise_host.validate_button")
|
|
_validate_button.pressed.connect(_on_validate_pressed)
|
|
|
|
|
|
func load_exercise(exercise: Dictionary) -> void:
|
|
_instruction_label.text = exercise["instruction"]
|
|
|
|
for child in _tokens_box.get_children():
|
|
child.queue_free()
|
|
for child in _corrections_box.get_children():
|
|
child.queue_free()
|
|
_correction_edits.clear()
|
|
|
|
var tokens: Array = exercise["tokens"]
|
|
for i in tokens.size():
|
|
var button := Button.new()
|
|
button.text = tokens[i]["text"]
|
|
button.toggle_mode = true
|
|
button.toggled.connect(_on_token_toggled.bind(i))
|
|
_tokens_box.add_child(button)
|
|
|
|
|
|
func _on_token_toggled(pressed: bool, index: int) -> void:
|
|
if pressed:
|
|
if not _correction_edits.has(index):
|
|
var edit := LineEdit.new()
|
|
edit.placeholder_text = UIText.get_text("sentence_correction.correction_placeholder")
|
|
_corrections_box.add_child(edit)
|
|
_correction_edits[index] = edit
|
|
elif _correction_edits.has(index):
|
|
var edit: LineEdit = _correction_edits[index]
|
|
edit.queue_free()
|
|
_correction_edits.erase(index)
|
|
|
|
|
|
func _on_validate_pressed() -> void:
|
|
var selected_indices: Array = []
|
|
var corrections: Dictionary = {}
|
|
for index: int in _correction_edits.keys():
|
|
selected_indices.append(index)
|
|
corrections[index] = (_correction_edits[index] as LineEdit).text.strip_edges()
|
|
answer_submitted.emit(selected_indices, corrections)
|