story

package
Version: v0.0.0-...-93e07d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Choice

type Choice struct {
	// contains filtered or unexported fields
}

Choice represents a single story node choice

type Node

type Node struct {
	Text    string
	Choices []Choice
}

Node represents a story node

func NewNode

func NewNode(text string, choices []Choice) *Node

NewNode initializes a new Node with the given text and predefined list of choice. You can pass in nil for choices and use the AddChoice method of the story Node to add a single choice

func (*Node) AddChoice

func (s *Node) AddChoice(cmd, description string, nextStory *Node)

AddChoice adds a new choice to the story node choices

func (*Node) ExecuteCmd

func (s *Node) ExecuteCmd(cmd string) *Node

ExecuteCmd executes the input cmd against the list of choices and returns the appropriate next node in the graph

func (*Node) Render

func (s *Node) Render()

Render prints the content of this story node

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL