Skip to content

Support indent as stored property to better create timelines from code#2743

Open
asraeldragon wants to merge 1 commit into
dialogic-godot:mainfrom
asraeldragon:main
Open

Support indent as stored property to better create timelines from code#2743
asraeldragon wants to merge 1 commit into
dialogic-godot:mainfrom
asraeldragon:main

Conversation

@asraeldragon
Copy link
Copy Markdown

This stores the indent level as a property in each event object, supports serialization and deserialization with the indent level. When creating timelines via code something like this is now possible (code may not be correct, I'm using C# in my project so this is based on the example in the docs):

var events : Array = []

var text_event = DialogicTextEvent.new()
text_event.text = "Hey, was this made in code?"
text_event.character = load("res://characters/Emilio.dch")

var ch1 = DialogicChoiceEvent.new()
ch1.text = "Yes"

var sig = DialogicSignalEvent.new()
sig.indent = 1
sig.argument = "yes"

var ch2 = DialogicChoiceEvent.new()
ch2.text = "No"

var end = DialogicEndEvent.new()
end.indent = 1

events = [
  text_event,
  ch1,
  sig,
  ch2,
  end
]

var timeline : DialogicTimeline = DialogicTimeline.new()
timeline.events = events
# if your events are already resources, you need to add this:
timeline.events_processed = true
Dialogic.start(timeline)

This is equivalent to the following string timeline:

emilio: Hey, was this made in code?
- Yes
	[signal arg="yes"]
- No
	[end_timeline]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant