2 class_name DialogicReturnEvent
5 ## Event that will make dialogic jump back to the last jump point.
9 ################################################################################
11 ################################################################################
13 func _execute() -> void:
14 if !dialogic.Jump.is_jump_stack_empty():
15 dialogic.Jump.resume_from_last_jump()
17 dialogic.end_timeline()
20 ################################################################################
22 ################################################################################
26 set_default_color('Color4')
27 event_category = "Flow"
28 event_sorting_index = 5
31 func _get_icon() -> Resource:
32 return load(self.get_script().get_path().get_base_dir().path_join('icon_return.svg'))
35 ################################################################################
37 ################################################################################
38 func to_text() -> String:
42 func from_text(_string:String) -> void:
46 func is_valid_event(string:String) -> bool:
47 if string.strip_edges() == "return":
52 ################################################################################
53 ## EDITOR REPRESENTATION
54 ################################################################################
56 func build_event_editor() -> void:
57 add_header_label('Return')
60 ####################### CODE COMPLETION ########################################
61 ################################################################################
63 func _get_start_code_completion(_CodeCompletionHelper:Node, TextNode:TextEdit) -> void:
64 TextNode.add_code_completion_option(CodeEdit.KIND_PLAIN_TEXT, 'return', 'return\n', event_color.lerp(TextNode.syntax_highlighter.normal_color, 0.3))
67 #################### SYNTAX HIGHLIGHTING #######################################
68 ################################################################################
70 func _get_syntax_highlighting(Highlighter:SyntaxHighlighter, dict:Dictionary, line:String) -> Dictionary:
71 dict[line.find('return')] = {"color":event_color.lerp(Highlighter.normal_color, 0.3)}
72 dict[line.find('return')+6] = {"color":event_color.lerp(Highlighter.normal_color, 0.5)}