All pages
Powered by GitBook
1 of 38

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

PlayerVisibleContentElement

Class in

Inherits from System.Object

An abstract class that represents some content that is shown to the player.

This class is used, rather than the runtime classes Yarn.Line or Yarn.OptionSet, because when the program is being analysed, no values for any substitutions are available. Instead, these classes represent the data that is available offline.

public abstract class PlayerVisibleContentElement

Summary

Remarks

BasicBlock

Name

Property in

Gets a descriptive name for the block.

If this block begins at a labelled instruction, the name will be [NodeName].[LabelName] . Otherwise, it will be [NodeName].[FirstInstructionIndex] .

Block

Enumeration Member in

DirectJump

Enumeration Member in

The Destination is reached beacuse of an explicit instruction to go to this block.

Descendants

Property in

Gets all descendants (that is, destinations, and destinations of those destinations, and so on), recursively.

Cycles are detected and avoided.

ToString()

Method in

DescendantsWithPlayerVisibleContent

Property in

Gets all descendants (that is, destinations, and destinations of those destinations, and so on) that have any player-visible content, recursively.

Cycles are detected and avoided.

CommandText

Field in

The text of the command.

CommandElement

Class in

Inherits from

A command that will be executed.

Name
Description

Condition

Property in

The condition that causes this destination to be reached.

public string Name
{
            get; }

Summary

Remarks

BasicBlock
Block

Summary

DestinationType
DirectJump

Summary

Condition
public IEnumerable<BasicBlock> Descendants
{
            get; }

Summary

Remarks

BasicBlock
public override string ToString();

Summary

BasicBlock
public IEnumerable<BasicBlock> DescendantsWithPlayerVisibleContent
{
            get; }

Summary

Remarks

BasicBlock
public string CommandText;

Summary

CommandElement
public class CommandElement : PlayerVisibleContentElement

CommandText

The text of the command.

Summary

Fields

BasicBlock
PlayerVisibleContentElement
public Condition Condition { get; set; }

Summary

Destination

Fallthrough

Enumeration Member in Condition

Summary

The Destination is reached because the preceding BasicBlock reached the end of its execution, and the Destination's target is the block immediately following.

Fallthrough

Block

Property in Destination

Summary

The block that this destination refers to.

public BasicBlock Block { get; set; }

Remarks

This value is only valid when Type is Block .

Option

Enumeration Member in Condition

Summary

The Destination is reached because the player made an in-game choice to go to it.

Option

FirstInstructionIndex

Property in BasicBlock

Summary

Gets the index of the first instruction of the node that this block is in.

public int FirstInstructionIndex { get; set; }

Node

Enumeration Member in DestinationType

Summary

Node

PlayerVisibleContent

Property in BasicBlock

Summary

Gets the collection of player-visible content that will be delivered when this block is run.

public IEnumerable<PlayerVisibleContentElement> PlayerVisibleContent
{
            get; }

Remarks

Player-visible content means lines, options and commands. When this block is run, the entire contents of this collection will be displayed to the player, in the same order as they appear in this collection.

If this collection is empty, then the block contains no visible content. This is the case for blocks that only contain logic, and do not contain any lines, options or commands.

To tell the difference between the different kinds of content, use the is operator to check the type of each item:

NodeName

Property in Destination

Summary

The name of the node that this destination refers to.

public string NodeName { get; set; }

Remarks

This value is only valid when Type is Node .

LineID

Field in Option

Summary

The string table ID that will be shown to the player.

public string LineID;

LineID

Field in LineElement

Summary

The string table ID of the line that will be shown to the player.

public string LineID;

Type

Property in Destination

Summary

Gets the Destination's type - whether the destination is a block, or a node.

public DestinationType Type { get; set; }

Instructions

Property in BasicBlock

Summary

Gets the Instructions that form this block.

public IEnumerable<Instruction> Instructions { get; set; };

Destination

Field in Option

Summary

The destination that will be run if this option is selected by the player.

public string Destination;

Remarks

This will be the name of a label, or the name of a node.

ExpressionIsFalse

Enumeration Member in Condition

Summary

The Destination is reached because an expression evaluated to false.

ExpressionIsFalse
foreach (var item in block.PlayerVisibleContent) { if (item is
LineElement line) { // Do something with line } }

AddDestination(string,Condition)

Method in BasicBlock

Summary

Adds a new destination to this block, that points to a node.

public void AddDestination(string nodeName, Condition condition)

Parameters

Name
Description

string nodeName

The name of the destination node.

condition

OptionsElement

Class in BasicBlock

Inherits from PlayerVisibleContentElement

Summary

A collection of options that should be shown to the player.

public class OptionsElement : PlayerVisibleContentElement

Fields

Name
Description

The collection of options that will be delivered to the player.

Structs

Name
Description

Option

Struct in OptionsElement

Inherits from System.ValueType

Summary

Represents a single option that may be presented to the player.

public struct Option

Fields

Name
Description

Destination

Struct in

Inherits from System.ValueType

A destination represents a or node that may be run, following the execution of a .

Destination objects represent links between blocks, or between blocks and nodes.

Name
Description

LineElement

Class in

Inherits from

A line of dialogue that should be shown to the player.

Name
Description

The condition under which descendant will be run.

Yarn.Compiler.BasicBlock.Condition

Option

Represents a single option that may be presented to the player.

Options

The destination that will be run if this option is selected by the player.

LineID

The string table ID that will be shown to the player.

Destination
public class LineElement : PlayerVisibleContentElement

LineID

The string table ID of the line that will be shown to the player.

Summary

Fields

BasicBlock
PlayerVisibleContentElement

The type of a Destination.

Name
Description

The block that this destination refers to.

The condition that causes this destination to be reached.

public struct Destination

Summary

Remarks

Enums

BasicBlock
BasicBlock
BasicBlock

Properties

The name of the node that this destination refers to.

Gets the Destination's type - whether the destination is a block, or a node.

DestinationType
Block
Condition
NodeName

LabelName

Property in

Gets the name of the label that this block begins at, or null if this basic block does not begin at a labelled instruction.

Options

Field in

The collection of options that will be delivered to the player.

Type
public string LabelName { get; set; }

Summary

BasicBlock
public IEnumerable<Option> Options;

Summary

OptionsElement

Destinations

Property in

Gets the destinations of this block - that is, blocks or nodes that may run immediately after this block.

  • : A destination represents a or node that may be run, following the execution of a .

public IEnumerable<Destination> Destinations { get };

Summary

See Also

BasicBlock
Destination
BasicBlock
BasicBlock

AddDestination(BasicBlock,Condition)

Method in BasicBlock

Summary

Adds a new destination to this block, that points to another block.

public void AddDestination(BasicBlock descendant, Condition condition)

Parameters

Name
Description

descendant

The new descendant node.

condition

The condition under which descendant will be run.

Yarn.Compiler.BasicBlock
Yarn.Compiler.BasicBlock.Condition

Ancestors

Property in

Get the ancestors of this block - that is, blocks that may run immediately before this block.

public IEnumerable<BasicBlock> Ancestors { get };

Summary

BasicBlock

DestinationType

Enum in Destination

Inherits from System.Enum

Summary

The type of a Destination.

public enum DestinationType
{
    Node,
    Block
}

Members

Name
Description

Block
Node

NodeName

Property in

Gets the name of the node that this block is in.

public string NodeName { get; set; }

Summary

BasicBlock

BasicBlock

Class in Yarn.Compiler

Inherits from System.Object

Summary

A basic block is a run of instructions inside a Node. Basic blocks group instructions up into segments such that execution only ever begins at the start of a block (that is, a program never jumps into the middle of a block), and execution only ever leaves at the end of a block.

public class BasicBlock

Classes

Name
Description
Name
Description
Name
Description
Name
Description
Name
Description

A command that will be executed.

A line of dialogue that should be shown to the player.

A collection of options that should be shown to the player.

An abstract class that represents some content that is shown to the player.

The conditions under which a may be reached at the end of a BasicBlock.

Adds a new destination to this block, that points to a node.

Adds a new destination to this block, that points to another block.

Get the ancestors of this block - that is, blocks that may run immediately before this block.

Gets all descendants (that is, destinations, and destinations of those destinations, and so on), recursively.

A destination represents a or node that may be run, following the execution of a .

Enums

Methods

Properties

Structs

Gets all descendants (that is, destinations, and destinations of those destinations, and so on) that have any player-visible content, recursively.

Gets the destinations of this block - that is, blocks or nodes that may run immediately after this block.

Gets the index of the first instruction of the node that this block is in.

Gets the Instructions that form this block.

Gets the name of the label that this block begins at, or null if this basic block does not begin at a labelled instruction.

Gets a descriptive name for the block.

Gets the name of the node that this block is in.

Gets the collection of player-visible content that will be delivered when this block is run.

CommandElement
LineElement
OptionsElement
PlayerVisibleContentElement
Condition
Destination
AddDestination(string,Condition)
AddDestination(BasicBlock,Condition)
ToString()
Ancestors
Descendants
DescendantsWithPlayerVisibleContent
Destination
BasicBlock
BasicBlock
Destinations
FirstInstructionIndex
Instructions
LabelName
Name
NodeName
PlayerVisibleContent

Condition

Enum in BasicBlock

Inherits from System.Enum

Summary

The conditions under which a Destination may be reached at the end of a BasicBlock.

public enum Condition
{
    Fallthrough,
    DirectJump,
    ExpressionIsTrue,
    ExpressionIsFalse,
    Option
}

Members

Name
Description

The Destination is reached beacuse of an explicit instruction to go to this block.

The Destination is reached because an expression evaluated to false.

The Destination is reached because an expression evaluated to true.

The Destination is reached because the preceding BasicBlock reached the end of its execution, and the Destination's target is the block immediately following.

The Destination is reached because the player made an in-game choice to go to it.

DirectJump
ExpressionIsFalse
ExpressionIsTrue
Fallthrough
Option

ExpressionIsTrue

Enumeration Member in

The Destination is reached because an expression evaluated to true.

ExpressionIsTrue

Summary

Condition