2 class_name DialogicWaitEvent
5 ## Event that waits for some time before continuing.
10 ## The time in seconds that the event will stop before continuing.
12 ## If true the text box will be hidden while the event waits.
14 ## If true the wait can be skipped with user input
15 var skippable := false
19 ################################################################################
21 ################################################################################
23 func _execute() -> void:
24 var final_wait_time := time
26 if dialogic.Inputs.auto_skip.enabled:
27 var time_per_event: float = dialogic.Inputs.auto_skip.time_per_event
28 final_wait_time = min(time, time_per_event)
30 dialogic.current_state = dialogic.States.WAITING
32 if hide_text and dialogic.has_subsystem("Text"):
33 dialogic.Text.update_dialog_text('', true)
34 dialogic.Text.hide_textbox()
36 _tween = dialogic.get_tree().create_tween()
37 if DialogicUtil.is_physics_timer():
38 _tween.set_process_mode(Tween.TWEEN_PROCESS_PHYSICS)
39 _tween.tween_callback(_on_finish).set_delay(final_wait_time)
42 dialogic.Inputs.dialogic_action.connect(_on_finish)
45 func _on_finish() -> void:
46 if is_instance_valid(_tween):
50 dialogic.Inputs.dialogic_action.disconnect(_on_finish)
52 if dialogic.Animations.is_animating():
53 dialogic.Animations.stop_animation()
54 dialogic.current_state = dialogic.States.IDLE
59 ################################################################################
61 ################################################################################
65 set_default_color('Color5')
66 event_category = "Flow"
67 event_sorting_index = 11
70 ################################################################################
72 ################################################################################
74 func get_shortcode() -> String:
78 func get_shortcode_parameters() -> Dictionary:
80 #param_name : property_info
81 "time" : {"property": "time", "default": 1},
82 "hide_text" : {"property": "hide_text", "default": true},
83 "skippable" : {"property": "skippable", "default": false},
87 ################################################################################
88 ## EDITOR REPRESENTATION
89 ################################################################################
91 func build_event_editor() -> void:
92 add_header_edit('time', ValueType.NUMBER, {'left_text':'Wait', 'autofocus':true, 'min':0.1})
93 add_header_label('seconds', 'time != 1')
94 add_header_label('second', 'time == 1')
95 add_body_edit('hide_text', ValueType.BOOL, {'left_text':'Hide text box:'})
96 add_body_edit('skippable', ValueType.BOOL, {'left_text':'Skippable:'})