CR: Dialog-Zeilen per confirm/interact bis zur naechsten Auswahl skippen
- confirm (Enter/A) und interact (E) ueberspringen laufende Zeilen, Zeile fuer Zeile bis zur naechsten Antwortauswahl; funktioniert auch in nicht abbrechbaren Dialogen, ohne den Abbruch-Schutz auszuhebeln - Hinweiszeile der Chatbox zeigt die Weiter-Taste, Abbruch nur wo erlaubt - Headless verifiziert (6 Checks) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
77c905de62
commit
84a437825b
3 changed files with 43 additions and 13 deletions
|
|
@ -41,6 +41,7 @@ var _speakers: Dictionary = {}
|
|||
var _speaker_names: Dictionary = {}
|
||||
var _is_effect_pass := true
|
||||
var _is_abort_requested := false
|
||||
var _is_skip_requested := false
|
||||
var _has_applied_effects := false
|
||||
var _abort_lines: Array = [DEFAULT_ABORT_LINE]
|
||||
var _box: CanvasLayer
|
||||
|
|
@ -61,6 +62,7 @@ func start_dialogue(dialogue_path: String, speakers: Dictionary) -> void:
|
|||
_speaker_names = data.get("speakers", {})
|
||||
_is_effect_pass = not GameState.has_completed_dialogue(dialogue_id)
|
||||
_is_abort_requested = false
|
||||
_is_skip_requested = false
|
||||
_has_applied_effects = false
|
||||
_abort_lines = data.get("abort_lines", [])
|
||||
if _abort_lines.is_empty():
|
||||
|
|
@ -71,13 +73,21 @@ func start_dialogue(dialogue_path: String, speakers: Dictionary) -> void:
|
|||
_run_dialogue(data)
|
||||
|
||||
|
||||
## Merkt einen Abbruch-Wunsch (cancel) während laufender Dialog-Zeilen
|
||||
## vor; offene Antwortauswahlen behandelt die Dialog-Box selbst.
|
||||
## Merkt Abbruch- (cancel/dialogue_abort) und Skip-Wünsche
|
||||
## (confirm/interact) während laufender Dialog-Zeilen vor; offene
|
||||
## Antwortauswahlen behandelt die Dialog-Box selbst. Skippen springt
|
||||
## Zeile für Zeile bis zur nächsten Auswahl und funktioniert auch in
|
||||
## nicht abbrechbaren Dialogen.
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if not is_dialogue_active or not is_abort_allowed:
|
||||
if not is_dialogue_active:
|
||||
return
|
||||
if _box != null and _box.has_open_options():
|
||||
return
|
||||
if event.is_action_pressed("confirm") or event.is_action_pressed("interact"):
|
||||
_is_skip_requested = true
|
||||
return
|
||||
if not is_abort_allowed:
|
||||
return
|
||||
if event.is_action_pressed("cancel") or event.is_action_pressed("dialogue_abort"):
|
||||
_is_abort_requested = true
|
||||
|
||||
|
|
@ -136,17 +146,20 @@ func _play_line(node: Dictionary) -> String:
|
|||
|
||||
|
||||
## Wartet das Ende einer Zeile ab (Sprechblasen-Dauer oder Fallback-Timer)
|
||||
## und bricht früh ab, sobald ein Dialog-Abbruch angefordert wurde.
|
||||
## und bricht früh ab, sobald ein Dialog-Abbruch oder ein Zeilen-Skip
|
||||
## (confirm/interact) angefordert wurde.
|
||||
func _wait_for_line(bubble: Node) -> void:
|
||||
_is_skip_requested = false
|
||||
if bubble != null:
|
||||
while bubble.visible and not _is_abort_requested:
|
||||
while bubble.visible and not _is_abort_requested and not _is_skip_requested:
|
||||
await get_tree().process_frame
|
||||
if _is_abort_requested:
|
||||
if _is_abort_requested or _is_skip_requested:
|
||||
bubble.hide_bubble()
|
||||
return
|
||||
var timer := get_tree().create_timer(FALLBACK_LINE_SECONDS)
|
||||
while timer.time_left > 0.0 and not _is_abort_requested:
|
||||
await get_tree().process_frame
|
||||
else:
|
||||
var timer := get_tree().create_timer(FALLBACK_LINE_SECONDS)
|
||||
while timer.time_left > 0.0 and not _is_abort_requested and not _is_skip_requested:
|
||||
await get_tree().process_frame
|
||||
_is_skip_requested = false
|
||||
|
||||
|
||||
## Zeigt eine Zeile mit Antwortoptionen in Box (mit Auswahl) und
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue