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)
+30 -16
View File
@@ -11,27 +11,12 @@ grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1")
[node name="HeaderBar" type="MarginContainer" parent="."]
layout_mode = 1
anchor_right = 1.0
offset_bottom = 40.0
grow_horizontal = 2
theme_override_constants/margin_left = 16
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 16
theme_override_constants/margin_bottom = 8
[node name="ProgressLabel" type="Label" parent="HeaderBar"]
unique_name_in_owner = true
layout_mode = 2
horizontal_alignment = 2
[node name="ExerciseContainer" type="Control" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = 40.0
offset_top = 48.0
grow_horizontal = 2
grow_vertical = 2
@@ -44,3 +29,32 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="HeaderBar" type="MarginContainer" parent="."]
layout_mode = 1
anchor_right = 1.0
offset_bottom = 48.0
grow_horizontal = 2
theme_override_constants/margin_left = 16
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 16
theme_override_constants/margin_bottom = 8
[node name="HBox" type="HBoxContainer" parent="HeaderBar"]
layout_mode = 2
[node name="AbandonButton" type="Button" parent="HeaderBar/HBox"]
unique_name_in_owner = true
layout_mode = 2
[node name="Spacer" type="Control" parent="HeaderBar/HBox"]
layout_mode = 2
size_flags_horizontal = 3
[node name="ProgressLabel" type="Label" parent="HeaderBar/HBox"]
unique_name_in_owner = true
layout_mode = 2
horizontal_alignment = 2
[node name="AbandonConfirmDialog" type="ConfirmationDialog" parent="."]
unique_name_in_owner = true