You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.2 KiB
73 lines
2.2 KiB
6 months ago
|
@tool
|
||
|
class_name DialogicWaitEvent
|
||
|
extends DialogicEvent
|
||
|
|
||
|
## Event that waits for some time before continuing.
|
||
|
|
||
|
|
||
|
### Settings
|
||
|
|
||
|
## The time in seconds that the event will stop before continuing.
|
||
|
var time: float = 1.0
|
||
|
## If true the text box will be hidden while the event waits.
|
||
|
var hide_text: bool = true
|
||
|
|
||
|
|
||
|
################################################################################
|
||
|
## EXECUTE
|
||
|
################################################################################
|
||
|
|
||
|
func _execute() -> void:
|
||
|
var final_wait_time := time
|
||
|
|
||
|
if dialogic.Inputs.auto_skip.enabled:
|
||
|
var time_per_event: float = dialogic.Inputs.auto_skip.time_per_event
|
||
|
final_wait_time = min(time, time_per_event)
|
||
|
|
||
|
if hide_text and dialogic.has_subsystem("Text"):
|
||
|
dialogic.Text.update_dialog_text('')
|
||
|
dialogic.Text.hide_textbox()
|
||
|
dialogic.current_state = dialogic.States.WAITING
|
||
|
await dialogic.get_tree().create_timer(time, false, DialogicUtil.is_physics_timer()).timeout
|
||
|
dialogic.current_state = dialogic.States.IDLE
|
||
|
|
||
|
finish()
|
||
|
|
||
|
|
||
|
################################################################################
|
||
|
## INITIALIZE
|
||
|
################################################################################
|
||
|
|
||
|
func _init() -> void:
|
||
|
event_name = "Wait"
|
||
|
set_default_color('Color5')
|
||
|
event_category = "Flow"
|
||
|
event_sorting_index = 11
|
||
|
|
||
|
|
||
|
################################################################################
|
||
|
## SAVING/LOADING
|
||
|
################################################################################
|
||
|
|
||
|
func get_shortcode() -> String:
|
||
|
return "wait"
|
||
|
|
||
|
|
||
|
func get_shortcode_parameters() -> Dictionary:
|
||
|
return {
|
||
|
#param_name : property_info
|
||
|
"time" : {"property": "time", "default": 1},
|
||
|
"hide_text" : {"property": "hide_text", "default": true},
|
||
|
}
|
||
|
|
||
|
|
||
|
################################################################################
|
||
|
## EDITOR REPRESENTATION
|
||
|
################################################################################
|
||
|
|
||
|
func build_event_editor():
|
||
|
add_header_edit('time', ValueType.NUMBER, {'left_text':'Wait', 'autofocus':true, 'min':0})
|
||
|
add_header_label('seconds', 'time != 1')
|
||
|
add_header_label('second', 'time == 1')
|
||
|
add_body_edit('hide_text', ValueType.BOOL, {'left_text':'Hide text box:'})
|