Class Node
Represents a kind of node inside a NodeScript
Inherited Members
Namespace: Artemis.Core
Assembly: Artemis.Core.dll
Syntax
public abstract class Node : BreakableModel, INode, IBreakableModel
Constructors
Node()
Creates a new instance of the Node class with an empty name and description
Declaration
protected Node()
Node(string, string)
Creates a new instance of the Node class with the provided name and description
Declaration
protected Node(string name, string description)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| string | description |
Properties
BrokenDisplayName
Gets the display name of this breakable model
Declaration
public override string BrokenDisplayName { get; }
Property Value
| Type | Description |
|---|---|
| string |
Overrides
Description
Gets the description of the node
Declaration
public string Description { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
HelpUrl
Gets or sets the help URL of the node
Declaration
public string HelpUrl { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Id
Gets or sets the ID of the node.
Declaration
public Guid Id { get; set; }
Property Value
| Type | Description |
|---|---|
| Guid |
IsDefaultNode
Gets a boolean indicating whether the node is a default node that connot be removed
Declaration
public virtual bool IsDefaultNode { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsExitNode
Gets a boolean indicating whether the node is the exit node of the script
Declaration
public virtual bool IsExitNode { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Name
Gets the name of the node
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
PinCollections
Gets a read-only collection of the pin collections on this node
Declaration
public IReadOnlyCollection<IPinCollection> PinCollections { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyCollection<IPinCollection> |
Pins
Gets a read-only collection of the pins on this node
Declaration
public IReadOnlyCollection<IPin> Pins { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyCollection<IPin> |
X
Gets or sets the X-position of the node
Declaration
public double X { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
Y
Gets or sets the Y-position of the node
Declaration
public double Y { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
Methods
AddPin(Pin)
Adds an existing pin to the Pins collection.
Declaration
public void AddPin(Pin pin)
Parameters
| Type | Name | Description |
|---|---|---|
| Pin | pin | The pin to add |
CreateInputPin(Type, string)
Creates a new input pin and adds it to the Pins collection
Declaration
public InputPin CreateInputPin(Type type, string name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type of value the pin will hold |
| string | name | The name of the pin |
Returns
| Type | Description |
|---|---|
| InputPin | The newly created pin |
CreateInputPinCollection(Type, string, int)
Creates a new input pin collection and adds it to the PinCollections collection
Declaration
public InputPinCollection CreateInputPinCollection(Type type, string name = "", int initialCount = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type of value the pins of this collection will hold |
| string | name | The name of the pin collection |
| int | initialCount | The amount of pins to initially add to the collection |
Returns
| Type | Description |
|---|---|
| InputPinCollection | The resulting input pin collection |
CreateInputPinCollection<T>(string, int)
Creates a new input pin collection and adds it to the PinCollections collection
Declaration
public InputPinCollection<T> CreateInputPinCollection<T>(string name = "", int initialCount = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the pin collection |
| int | initialCount | The amount of pins to initially add to the collection |
Returns
| Type | Description |
|---|---|
| InputPinCollection<T> | The resulting input pin collection |
Type Parameters
| Name | Description |
|---|---|
| T | The type of value the pins of this collection will hold |
CreateInputPin<T>(string)
Creates a new input pin and adds it to the Pins collection
Declaration
public InputPin<T> CreateInputPin<T>(string name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the pin |
Returns
| Type | Description |
|---|---|
| InputPin<T> | The newly created pin |
Type Parameters
| Name | Description |
|---|---|
| T | The type of value the pin will hold |
CreateOrAddInputPin(Type, string)
Creates or adds an input pin to the node using a bucket. The bucket might grow a bit over time as the user edits the node but pins won't get lost, enabling undo/redo in the editor.
Declaration
public InputPin CreateOrAddInputPin(Type valueType, string displayName)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | valueType | |
| string | displayName |
Returns
| Type | Description |
|---|---|
| InputPin |
CreateOrAddOutputPin(Type, string)
Creates or adds an output pin to the node using a bucket. The bucket might grow a bit over time as the user edits the node but pins won't get lost, enabling undo/redo in the editor.
Declaration
public OutputPin CreateOrAddOutputPin(Type valueType, string displayName)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | valueType | |
| string | displayName |
Returns
| Type | Description |
|---|---|
| OutputPin |
CreateOutputPin(Type, string)
Creates a new output pin and adds it to the Pins collection
Declaration
public OutputPin CreateOutputPin(Type type, string name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type of value the pin will hold |
| string | name | The name of the pin |
Returns
| Type | Description |
|---|---|
| OutputPin | The newly created pin |
CreateOutputPinCollection<T>(string, int)
Creates a new output pin collection and adds it to the PinCollections collection
Declaration
public OutputPinCollection<T> CreateOutputPinCollection<T>(string name = "", int initialCount = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the pin collection |
| int | initialCount | The amount of pins to initially add to the collection |
Returns
| Type | Description |
|---|---|
| OutputPinCollection<T> | The resulting output pin collection |
Type Parameters
| Name | Description |
|---|---|
| T | The type of value the pins of this collection will hold |
CreateOutputPin<T>(string)
Creates a new output pin and adds it to the Pins collection
Declaration
public OutputPin<T> CreateOutputPin<T>(string name = "")
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the pin |
Returns
| Type | Description |
|---|---|
| OutputPin<T> | The newly created pin |
Type Parameters
| Name | Description |
|---|---|
| T | The type of value the pin will hold |
DeserializeStorage(string)
Deserializes the Artemis.Storage object and sets it
Declaration
public virtual void DeserializeStorage(string serialized)
Parameters
| Type | Name | Description |
|---|---|---|
| string | serialized | The serialized object |
Evaluate()
Evaluates the value of the output pins of this node
Declaration
public abstract void Evaluate()
Initialize(INodeScript)
Called when the node was loaded from storage or newly created, at this point pin connections aren't reestablished yet.
Declaration
public virtual void Initialize(INodeScript script)
Parameters
| Type | Name | Description |
|---|---|---|
| INodeScript | script | The script the node is contained in |
RemovePin(Pin)
Removes the provided pin from the node and it's Pins collection
Declaration
public bool RemovePin(Pin pin)
Parameters
| Type | Name | Description |
|---|---|---|
| Pin | pin | The pin to remove |
Returns
| Type | Description |
|---|---|
| bool |
RemovePinCollection(PinCollection)
Removes the provided pinCollection from the node and it's PinCollections
collection
Declaration
public bool RemovePinCollection(PinCollection pinCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| PinCollection | pinCollection | The pin collection to remove |
Returns
| Type | Description |
|---|---|
| bool |
Reset()
Resets the node causing all pins to re-evaluate the next time TryEvaluate() is called
Declaration
public virtual void Reset()
SerializeStorage()
Serializes the Artemis.Storage object into a string
Declaration
public virtual string SerializeStorage()
Returns
| Type | Description |
|---|---|
| string | The serialized object |
TryEvaluate()
Attempts to evaluate the value of the output pins of this node
Declaration
public void TryEvaluate()
TryInitialize(INodeScript)
Attempts to initialize the node.
Declaration
public void TryInitialize(INodeScript script)
Parameters
| Type | Name | Description |
|---|---|---|
| INodeScript | script | The script the node is contained in |
Events
PinAdded
Occurs when a pin was added to the node
Declaration
public event EventHandler<SingleValueEventArgs<IPin>>? PinAdded
Event Type
| Type | Description |
|---|---|
| EventHandler<SingleValueEventArgs<IPin>> |
PinCollectionAdded
Occurs when a pin collection was added to the node
Declaration
public event EventHandler<SingleValueEventArgs<IPinCollection>>? PinCollectionAdded
Event Type
| Type | Description |
|---|---|
| EventHandler<SingleValueEventArgs<IPinCollection>> |
PinCollectionRemoved
Occurs when a pin was removed from the node
Declaration
public event EventHandler<SingleValueEventArgs<IPinCollection>>? PinCollectionRemoved
Event Type
| Type | Description |
|---|---|
| EventHandler<SingleValueEventArgs<IPinCollection>> |
PinRemoved
Occurs when a pin was removed from the node
Declaration
public event EventHandler<SingleValueEventArgs<IPin>>? PinRemoved
Event Type
| Type | Description |
|---|---|
| EventHandler<SingleValueEventArgs<IPin>> |
Resetting
Called when the node resets
Declaration
public event EventHandler? Resetting
Event Type
| Type | Description |
|---|---|
| EventHandler |