@@ -70,6 +70,10 @@ var paused := false:
70
70
71
71
dialogic_resumed .emit ()
72
72
73
+ ## A timeline that will be played when dialog ends.
74
+ ## By default this timeline only contains a clear event.
75
+ var dialog_ending_timeline : DialogicTimeline
76
+
73
77
## Emitted when [member paused] changes to `true`.
74
78
signal dialogic_paused
75
79
## Emitted when [member paused] changes to `false`.
@@ -158,6 +162,9 @@ func _ready() -> void:
158
162
159
163
clear ()
160
164
165
+ dialog_ending_timeline = DialogicTimeline .new ()
166
+ dialog_ending_timeline .from_text ("[clear]" )
167
+
161
168
162
169
#region TIMELINE & EVENT HANDLING
163
170
## ##############################################################################
@@ -242,9 +249,22 @@ func preload_timeline(timeline_resource:Variant) -> Variant:
242
249
243
250
244
251
## Clears and stops the current timeline.
245
- func end_timeline () -> void :
252
+ ## If [param skip_ending] is `true`, the dialog_ending_timeline is not getting played
253
+ func end_timeline (skip_ending := false ) -> void :
254
+ if not skip_ending and dialog_ending_timeline and current_timeline != dialog_ending_timeline :
255
+ start (dialog_ending_timeline )
256
+ return
257
+
246
258
await clear (ClearFlags .TIMELINE_INFO_ONLY )
247
- _on_timeline_ended ()
259
+
260
+ if Styles .has_active_layout_node () and Styles .get_layout_node ().is_inside_tree ():
261
+ match ProjectSettings .get_setting ('dialogic/layout/end_behaviour' , 0 ):
262
+ 0 :
263
+ Styles .get_layout_node ().get_parent ().remove_child (Styles .get_layout_node ())
264
+ Styles .get_layout_node ().queue_free ()
265
+ 1 :
266
+ Styles .get_layout_node ().hide ()
267
+
248
268
timeline_ended .emit ()
249
269
250
270
@@ -368,7 +388,7 @@ func load_full_state(state_info:Dictionary) -> void:
368
388
if current_state_info .get ('current_timeline' , null ):
369
389
start_timeline (current_state_info .current_timeline , current_state_info .get ('current_event_idx' , 0 ))
370
390
else :
371
- end_timeline .call_deferred ()
391
+ end_timeline .call_deferred (true )
372
392
#endregion
373
393
374
394
@@ -413,16 +433,6 @@ func add_subsystem(subsystem_name:String, script_path:String) -> DialogicSubsyst
413
433
#region HELPERS
414
434
## ##############################################################################
415
435
416
- ## This handles the `Layout End Behaviour` setting that can be changed in the Dialogic settings.
417
- func _on_timeline_ended () -> void :
418
- if self .Styles .has_active_layout_node () and self .Styles .get_layout_node ().is_inside_tree ():
419
- match ProjectSettings .get_setting ('dialogic/layout/end_behaviour' , 0 ):
420
- 0 :
421
- self .Styles .get_layout_node ().get_parent ().remove_child (self .Styles .get_layout_node ())
422
- self .Styles .get_layout_node ().queue_free ()
423
- 1 :
424
- @warning_ignore ("unsafe_method_access" )
425
- self .Styles .get_layout_node ().hide ()
426
436
427
437
428
438
func print_debug_moment () -> void :
0 commit comments