4 var parent_resource: DialogicEvent = null
8 $AddElif.button_up.connect(add_elif)
9 $AddElse.button_up.connect(add_else)
12 func refresh() -> void:
13 if parent_resource is DialogicConditionEvent:
14 # hide add elif and add else button on ELSE event
15 $AddElif.visible = parent_resource.condition_type != DialogicConditionEvent.ConditionTypes.ELSE
16 $AddElse.visible = parent_resource.condition_type != DialogicConditionEvent.ConditionTypes.ELSE
17 $Label.text = "End of "+["IF", "ELIF", "ELSE"][parent_resource.condition_type]+" ("+parent_resource.condition+")"
19 # hide add add else button if followed by ELIF or ELSE event
20 var timeline_editor := find_parent('VisualEditor')
22 var next_event: DialogicEvent = null
23 if timeline_editor.get_block_below(get_parent()):
24 next_event = timeline_editor.get_block_below(get_parent()).resource
25 if next_event is DialogicConditionEvent:
26 if next_event.condition_type != DialogicConditionEvent.ConditionTypes.IF:
28 if parent_resource.condition_type == DialogicConditionEvent.ConditionTypes.ELSE:
29 $Label.text = "End of ELSE"
34 func add_elif() -> void:
35 var timeline := find_parent('VisualEditor')
37 var resource := DialogicConditionEvent.new()
38 resource.condition_type = DialogicConditionEvent.ConditionTypes.ELIF
39 timeline.add_event_undoable(resource, get_parent().get_index()+1)
40 timeline.indent_events()
41 timeline.something_changed()
44 func add_else() -> void:
45 var timeline := find_parent('VisualEditor')
47 var resource := DialogicConditionEvent.new()
48 resource.condition_type = DialogicConditionEvent.ConditionTypes.ELSE
49 timeline.add_event_undoable(resource, get_parent().get_index()+1)
50 timeline.indent_events()
51 timeline.something_changed()