2 class_name DialogicStyleEvent
5 ## Event that allows changing the currently displayed style.
10 ## The name of the style to change to. Can be set on the DialogicNode_Style.
14 ################################################################################
16 ################################################################################
18 func _execute() -> void:
19 dialogic.Styles.change_style(style_name)
20 # we need to wait till the new layout is ready before continuing
21 await dialogic.get_tree().process_frame
25 ################################################################################
27 ################################################################################
30 event_name = "Change Style"
31 set_default_color('Color8')
32 event_category = "Visuals"
33 event_sorting_index = 1
36 ################################################################################
38 ################################################################################
39 func get_shortcode() -> String:
43 func get_shortcode_parameters() -> Dictionary:
45 #param_name : property_info
46 "name" : {"property": "style_name", "default": "", 'suggestions':get_style_suggestions},
50 ################################################################################
51 ## EDITOR REPRESENTATION
52 ################################################################################
54 func build_event_editor() -> void:
55 add_header_edit('style_name', ValueType.DYNAMIC_OPTIONS, {
56 'left_text' :'Use style',
57 'placeholder' : 'Default',
58 'suggestions_func' : get_style_suggestions,
59 'editor_icon' : ["PopupMenu", "EditorIcons"],
63 func get_style_suggestions(_filter := "") -> Dictionary:
64 var styles: Array = ProjectSettings.get_setting('dialogic/layout/style_list', [])
67 suggestions['<Default Style>'] = {'value':'', 'editor_icon':["MenuBar", "EditorIcons"]}
69 var style: DialogicStyle = load(i)
70 suggestions[style.name] = {'value': style.name, 'editor_icon': ["PopupMenu", "EditorIcons"]}