Class Node
Represents a kind of node inside a NodeScript
public abstract class Node : BreakableModel, INode, IBreakableModel, IPluginFeatureDependent
- Inheritance
-
objectCorePropertyChangedNode
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
Node()
Creates a new instance of the Node class with an empty name and description
protected Node()
Node(string, string)
Creates a new instance of the Node class with the provided name and description
protected Node(string name, string description)
Parameters
Properties
BrokenDisplayName
Gets the display name of this breakable model
public override string BrokenDisplayName { get; }
Property Value
Description
Gets the description of the node
public string Description { get; set; }
Property Value
HelpUrl
Gets or sets the help URL of the node
public string HelpUrl { get; set; }
Property Value
Id
Gets or sets the ID of the node.
public Guid Id { get; set; }
Property Value
IsDefaultNode
Gets a boolean indicating whether the node is a default node that connot be removed
public virtual bool IsDefaultNode { get; }
Property Value
IsExitNode
Gets a boolean indicating whether the node is the exit node of the script
public virtual bool IsExitNode { get; }
Property Value
IsLoading
Gets a boolean indicating whether the node is currently loading, use this to disable pin type changes etc.
public bool IsLoading { get; set; }
Property Value
Name
Gets the name of the node
public string Name { get; set; }
Property Value
NodeData
Gets or sets the node data with information about this node
public NodeData? NodeData { get; set; }
Property Value
PinCollections
Gets a read-only collection of the pin collections on this node
public IReadOnlyCollection<IPinCollection> PinCollections { get; }
Property Value
Pins
Gets a read-only collection of the pins on this node
public IReadOnlyCollection<IPin> Pins { get; }
Property Value
X
Gets or sets the X-position of the node
public double X { get; set; }
Property Value
Y
Gets or sets the Y-position of the node
public double Y { get; set; }
Property Value
Methods
AddPin(Pin)
Adds an existing pin to the Pins collection.
public void AddPin(Pin pin)
Parameters
pinPinThe pin to add
CreateInputPin(Type, string)
Creates a new input pin and adds it to the Pins collection
public InputPin CreateInputPin(Type type, string name = "")
Parameters
Returns
- InputPin
The newly created pin
CreateInputPinCollection(Type, string, int)
Creates a new input pin collection and adds it to the PinCollections collection
public InputPinCollection CreateInputPinCollection(Type type, string name = "", int initialCount = 1)
Parameters
typeTypeThe type of value the pins of this collection will hold
namestringThe name of the pin collection
initialCountintThe amount of pins to initially add to the collection
Returns
- InputPinCollection
The resulting input pin collection
CreateInputPinCollection<T>(string, int)
Creates a new input pin collection and adds it to the PinCollections collection
public InputPinCollection<T> CreateInputPinCollection<T>(string name = "", int initialCount = 1)
Parameters
namestringThe name of the pin collection
initialCountintThe amount of pins to initially add to the collection
Returns
- InputPinCollection<T>
The resulting input pin collection
Type Parameters
TThe 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
public InputPin<T> CreateInputPin<T>(string name = "")
Parameters
namestringThe name of the pin
Returns
- InputPin<T>
The newly created pin
Type Parameters
TThe 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.
public InputPin CreateOrAddInputPin(Type valueType, string displayName)
Parameters
Returns
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.
public OutputPin CreateOrAddOutputPin(Type valueType, string displayName)
Parameters
Returns
CreateOutputPin(Type, string)
Creates a new output pin and adds it to the Pins collection
public OutputPin CreateOutputPin(Type type, string name = "")
Parameters
Returns
- OutputPin
The newly created pin
CreateOutputPinCollection<T>(string, int)
Creates a new output pin collection and adds it to the PinCollections collection
public OutputPinCollection<T> CreateOutputPinCollection<T>(string name = "", int initialCount = 1)
Parameters
namestringThe name of the pin collection
initialCountintThe amount of pins to initially add to the collection
Returns
- OutputPinCollection<T>
The resulting output pin collection
Type Parameters
TThe 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
public OutputPin<T> CreateOutputPin<T>(string name = "")
Parameters
namestringThe name of the pin
Returns
- OutputPin<T>
The newly created pin
Type Parameters
TThe type of value the pin will hold
DeserializeStorage(string)
Deserializes the Artemis.Storage object and sets it
public virtual void DeserializeStorage(string serialized)
Parameters
serializedstringThe serialized object
Evaluate()
Evaluates the value of the output pins of this node
public abstract void Evaluate()
GetFeatureDependencies()
Gets the plugin features this class depends on, may contain the same plugin feature twice if depending on it in multiple ways.
public virtual IEnumerable<PluginFeature> GetFeatureDependencies()
Returns
- IEnumerable<PluginFeature>
A List<T> of PluginFeature this class depends on.
Initialize(INodeScript)
Called when the node was loaded from storage or newly created, at this point pin connections aren't reestablished yet.
public virtual void Initialize(INodeScript script)
Parameters
scriptINodeScriptThe script the node is contained in
RemovePin(Pin)
Removes the provided pin from the node and it's Pins collection
public bool RemovePin(Pin pin)
Parameters
pinPinThe pin to remove
Returns
RemovePinCollection(PinCollection)
Removes the provided pinCollection from the node and it's PinCollections
collection
public bool RemovePinCollection(PinCollection pinCollection)
Parameters
pinCollectionPinCollectionThe pin collection to remove
Returns
Reset()
Resets the node causing all pins to re-evaluate the next time TryEvaluate() is called
public virtual void Reset()
SerializeStorage()
Serializes the Artemis.Storage object into a string
public virtual string SerializeStorage()
Returns
- string
The serialized object
TryEvaluate()
Attempts to evaluate the value of the output pins of this node
public void TryEvaluate()
TryInitialize(INodeScript)
Attempts to initialize the node.
public void TryInitialize(INodeScript script)
Parameters
scriptINodeScriptThe script the node is contained in
Events
PinAdded
Occurs when a pin was added to the node
public event EventHandler<SingleValueEventArgs<IPin>>? PinAdded
Event Type
PinCollectionAdded
Occurs when a pin collection was added to the node
public event EventHandler<SingleValueEventArgs<IPinCollection>>? PinCollectionAdded
Event Type
PinCollectionRemoved
Occurs when a pin was removed from the node
public event EventHandler<SingleValueEventArgs<IPinCollection>>? PinCollectionRemoved
Event Type
PinRemoved
Occurs when a pin was removed from the node
public event EventHandler<SingleValueEventArgs<IPin>>? PinRemoved
Event Type
Resetting
Called when the node resets
public event EventHandler? Resetting