Initial commit

This commit is contained in:
2022-01-16 02:55:49 -05:00
commit cf136a2e25
10 changed files with 381 additions and 0 deletions

View File

@ -0,0 +1,38 @@
extends Node
var timeline = STimeline.new("res://addons/simple_dialogue/samples/sample.yaml")
var event : SEvent
export var autoDecide : int = 1
func _process(_delta):
if(Input.is_action_just_pressed("ui_accept")):
# Check for a choice before reading the timeline
# using `STimeline.is_choice()`
if timeline.is_choice():
# You can utilize `STimeline.get_choices()` to return
# an array with all choices as strings in order
# This sample uses the `autoDecide` variable for every
# choice
print("You: ", timeline.get_choices()[autoDecide])
# Use `STimeline.make_choice(int)` to make a choice
# and load that choice's events
timeline.make_choice(autoDecide)
return
# Use `STimeline.read()` to get the next SEvent
# in a dialogue timeline
event = timeline.read()
# The primary properties of a SEvent is
# `name`, `message`, and `portrait`
if event:
print(event.name,": ", event.message)
# When STimeline.read() returns null, the timeline has
# completed and you can exit the dialogue
if event == null:
get_tree().quit()

View File

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/simple_dialouge/samples/minimal/minimal.gd" type="Script" id=1]
[node name="Simple Dialogue Minimal Example" type="Node"]
script = ExtResource( 1 )

View File

@ -0,0 +1,53 @@
apiVersion: 1.0 # `apiVersion` is used just in case of future updates to the schema
kind: timeline # `kind` should be set to timeline for all timeline files
events: # `events` are a list of event objects
# Sample Event Object
- # Two string properties are provided for each locale
# `name` should be the name of the speaker
# `message` should be the words said by the speaker
name:
en_US: Person
message:
en_US: Hello, I say witty dialogue!
# Sample choice
- name:
en_US: Question Asker
message:
en_US: Pick a number between 1-3
# A `choices` block of `choice` objects can be added
# to work as a choice
choices:
- # A choice object contains two properties
# `choice` is a string that works as the display text for the choice
# `events` is a list of all events triggered by this choice
choice:
en_US: 1
events:
- name:
en_US: Question Asker
message:
en_US: You picked '1'
- choice:
en_US: 2
events:
- name:
en_US: Question Asker
message:
en_US: You picked '2'
- choice:
en_US: 3
events:
- name:
en_US: Question Asker
message:
en_US: You picked '3'
# After choice events finish, the timeline returns
# the timeline
- name:
en_US: Person
message:
en_US: Wow! That is a very cool choice!