Add way back to profile selection and abandoning a mission

World map gets a "Changer de profil" button (saves first). During a
mission, a header button asks for confirmation then leaves without
stars or items; attempts already made stay recorded and are saved.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Denis Defolie
2026-10-11 22:26:53 +02:00
parent 65a0cb46f9
commit ebe2dbe3ed
7 changed files with 134 additions and 16 deletions
+24
View File
@@ -29,6 +29,8 @@ var _pending_outcome := ""
@onready var _exercise_container: Control = %ExerciseContainer
@onready var _overlay_container: Control = %OverlayContainer
@onready var _progress_label: Label = %ProgressLabel
@onready var _abandon_button: Button = %AbandonButton
@onready var _abandon_confirm_dialog: ConfirmationDialog = %AbandonConfirmDialog
## Accesseurs reserves aux tests d'integration (scenes/exercises/
@@ -50,6 +52,14 @@ func get_outcomes() -> Array[String]:
func _ready() -> void:
_abandon_button.text = UIText.get_text("exercise_host.abandon_button")
_abandon_button.pressed.connect(_on_abandon_pressed)
_abandon_confirm_dialog.title = UIText.get_text("exercise_host.abandon_confirm_title")
_abandon_confirm_dialog.dialog_text = UIText.get_text("exercise_host.abandon_confirm_message")
_abandon_confirm_dialog.ok_button_text = UIText.get_text("exercise_host.abandon_confirm_yes")
_abandon_confirm_dialog.cancel_button_text = UIText.get_text("exercise_host.abandon_confirm_no")
_abandon_confirm_dialog.confirmed.connect(_on_abandon_confirmed)
_mission = ExerciseEngine.get_mission(GameManager.pending_mission_id)
_rule = ExerciseEngine.get_rule(_mission["rule_id"])
_skill_id = _rule.get("skill", "")
@@ -57,6 +67,20 @@ func _ready() -> void:
_show_rule_panel()
func _on_abandon_pressed() -> void:
_abandon_confirm_dialog.popup_centered()
## Quitter une mission ne rapporte ni etoile ni objet et n'est jamais compte
## comme un echec. Les tentatives deja faites restent enregistrees (ce sont de
## vraies observations d'apprentissage) et sont sauvegardees avant de partir.
func _on_abandon_confirmed() -> void:
ProgressManager.save_now()
GameManager.pending_mission_id = ""
GameManager.last_outcomes = []
GameManager.goto(GameManager.SCENE_WORLD_MAP)
func _show_rule_panel() -> void:
var rule_panel: Control = preload("res://scenes/ui/rule_panel.tscn").instantiate()
_overlay_container.add_child(rule_panel)