mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-17 22:33:47 +00:00
Updated dialogic
This commit is contained in:
parent
1d11462073
commit
cbb82512ee
483 changed files with 5743 additions and 2177 deletions
|
|
@ -14,43 +14,42 @@ func _execute() -> void:
|
|||
finish()
|
||||
|
||||
|
||||
## Returns the index of the first event that
|
||||
## - is on the same "indentation"
|
||||
## - is not a branching event (unless it is a branch starter)
|
||||
func find_next_index() -> int:
|
||||
var idx: int = dialogic.current_event_idx
|
||||
|
||||
var ignore: int = 1
|
||||
while true:
|
||||
idx += 1
|
||||
var event: DialogicEvent = dialogic.current_timeline.get_event(idx)
|
||||
if not event:
|
||||
return idx
|
||||
if event is DialogicEndBranchEvent:
|
||||
if ignore > 1:
|
||||
ignore -= 1
|
||||
elif event.can_contain_events and not event.should_execute_this_branch():
|
||||
ignore += 1
|
||||
elif ignore <= 1:
|
||||
return idx
|
||||
|
||||
if event.can_contain_events:
|
||||
if event._is_branch_starter():
|
||||
break
|
||||
else:
|
||||
idx = event.get_end_branch_index()
|
||||
break
|
||||
else:
|
||||
break
|
||||
|
||||
return idx
|
||||
|
||||
|
||||
func find_opening_index(at_index:int) -> int:
|
||||
var idx: int = at_index
|
||||
|
||||
var ignore: int = 1
|
||||
func get_opening_index() -> int:
|
||||
var index: int = dialogic.current_timeline_events.find(self)
|
||||
while true:
|
||||
idx -= 1
|
||||
var event: DialogicEvent = dialogic.current_timeline.get_event(idx)
|
||||
if not event:
|
||||
return idx
|
||||
index -= 1
|
||||
if index < 0:
|
||||
break
|
||||
var event: DialogicEvent = dialogic.current_timeline_events[index]
|
||||
if event is DialogicEndBranchEvent:
|
||||
ignore += 1
|
||||
index = event.get_opening_index()
|
||||
elif event.can_contain_events:
|
||||
ignore -= 1
|
||||
if ignore == 0:
|
||||
return idx
|
||||
return index
|
||||
return 0
|
||||
|
||||
return idx
|
||||
#endregion
|
||||
|
||||
#region INITIALIZE
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://u1fgjw2pmu7f
|
||||
uid://3wq6lhrhifgj
|
||||
|
|
|
|||
|
|
@ -23,5 +23,5 @@ func _get_text_effects() -> Array[Dictionary]:
|
|||
|
||||
func _get_text_modifiers() -> Array[Dictionary]:
|
||||
return [
|
||||
{'subsystem':'Expressions', 'method':"modifier_condition", 'command':'if', 'mode':-1},
|
||||
{'subsystem':'Expressions', 'method':"modifier_condition", 'command':'if', 'mode':-1, "order":20},
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://v3bsjawf3iff
|
||||
uid://hdi17v8hqb0p
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://ds2fsl72rli0o
|
||||
uid://drgk63svehoum
|
||||
|
|
|
|||
|
|
@ -55,13 +55,21 @@ func execute_condition(condition:String) -> bool:
|
|||
return false
|
||||
|
||||
|
||||
var condition_modifier_regex := RegEx.create_from_string(r"(?(DEFINE)(?<nobraces>([^{}]|\{(?P>nobraces)\})*))\[if *(?<condition>\{(?P>nobraces)\})(?<truetext>(\\\]|\\\/|[^\]\/])*)(\/(?<falsetext>(\\\]|[^\]])*))?\]")
|
||||
var condition_modifier_regex := RegEx.create_from_string(r"(?(DEFINE)(?<nobraces>([^{}]|\{(?P>nobraces)\})*))\[if *(?<condition>(\{(?P>nobraces)\}|true\b|false\b))(?<truetext>(\\\]|\\\/|[^\]\/])*)(\/(?<falsetext>(\\\]|[^\]])*))?\]")
|
||||
func modifier_condition(text:String) -> String:
|
||||
for find in condition_modifier_regex.search_all(text):
|
||||
var insert := ""
|
||||
if execute_condition(find.get_string("condition")):
|
||||
text = text.replace(find.get_string(), find.get_string("truetext").strip_edges())
|
||||
insert = find.get_string("truetext")
|
||||
else:
|
||||
text = text.replace(find.get_string(), find.get_string("falsetext").strip_edges())
|
||||
insert = find.get_string("falsetext")
|
||||
|
||||
# Avoid double spaces at the insert position if the insert is empty.
|
||||
if not insert.strip_edges() and " "+find.get_string()+" " in text:
|
||||
text = text.replace(find.get_string()+" ", insert.strip_edges())
|
||||
else:
|
||||
text = text.replace(find.get_string(), insert.strip_edges())
|
||||
|
||||
return text
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://bavk51trmafsh
|
||||
uid://cn3846afxgeux
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ func handle_node_gui_input(event:InputEvent) -> void:
|
|||
|
||||
|
||||
func is_input_blocked() -> bool:
|
||||
return input_block_timer.time_left > 0.0
|
||||
return input_block_timer.time_left > 0.0 and not auto_skip.enabled
|
||||
|
||||
|
||||
func block_input(time:=0.1) -> void:
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://8rbn1lo8jefn
|
||||
uid://crdsvy044intj
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue