]> Untitled Git - wolf-seeking-sheep.git/blob - addons/dialogic/Modules/Choice/ui_choice_end.gd
Adding import files
[wolf-seeking-sheep.git] / addons / dialogic / Modules / Choice / ui_choice_end.gd
1 @tool
2 extends HBoxContainer
3
4 var parent_resource: DialogicChoiceEvent = null
5
6 func refresh() -> void:
7         $AddChoice.icon = get_theme_icon("Add", "EditorIcons")
8
9         if parent_resource is DialogicChoiceEvent:
10                 show()
11                 if len(parent_resource.text) > 12:
12                         $Label.text = "End of choice ("+parent_resource.text.substr(0,12)+"...)"
13                 else:
14                         $Label.text = "End of choice ("+parent_resource.text+")"
15         else:
16                 hide()
17
18
19 func _on_add_choice_pressed() -> void:
20         var timeline := find_parent('VisualEditor')
21         if timeline:
22                 var resource := DialogicChoiceEvent.new()
23                 resource.created_by_button = true
24                 timeline.add_event_undoable(resource, get_parent().get_index()+1)
25                 timeline.indent_events()
26                 timeline.something_changed()
27                 # Prevent focusing on future redos
28                 resource.created_by_button = false