2 class_name DialogicEndBranchEvent
5 ## Event that indicates the end of a condition or choice (or custom branch).
6 ## In text this is not stored (only as a change in indentation).
10 ################################################################################
12 func _execute() -> void:
13 dialogic.current_event_idx = find_next_index()-1
17 func find_next_index() -> int:
18 var idx: int = dialogic.current_event_idx
23 var event: DialogicEvent = dialogic.current_timeline.get_event(idx)
26 if event is DialogicEndBranchEvent:
29 elif event.can_contain_events and not event.should_execute_this_branch():
37 func find_opening_index(at_index:int) -> int:
38 var idx: int = at_index
43 var event: DialogicEvent = dialogic.current_timeline.get_event(idx)
46 if event is DialogicEndBranchEvent:
48 elif event.can_contain_events:
57 ################################################################################
60 event_name = "End Branch"
61 disable_editor_button = true
65 #region SAVING/LOADING
66 ################################################################################
68 ## NOTE: This event is very special. It is rarely stored at all, as it is usually
69 ## just a placeholder for removing an indentation level.
70 ## When copying events however, some representation of this is necessary. That's why this is half-implemented.
71 func to_text() -> String:
72 return "<<END BRANCH>>"
75 func from_text(_string:String) -> void:
79 func is_valid_event(string:String) -> bool:
80 if string.strip_edges().begins_with("<<END BRANCH>>"):