ActionGraphclass
Represents an async method as a directed graph. Control will enter through an "event" node, which can route signals through a network of other nodes that perform actions. Use `Facepunch.ActionGraphs.ActionGraph.CreateEmpty(Facepunch.ActionGraphs.NodeLibrary)` to create a completely blank graph, or `Facepunch.ActionGraphs.ActionGraph.CreateDelegate`(Facepunch.ActionGraphs.NodeLibrary)` to create a graph that handles an event matching the signature of a particular delegate.
Methods39
Showing 39 methods
public void AddRequiredNodes()
void—public Facepunch.ActionGraphs.Variable AddVariable(string name, System.Type type, object defaultValue = null)
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
| type | Type | — |
| defaultValue = null | object | — |
public System.Linq.Expressions.LambdaExpression BuildExpression()
Builds a `System.Linq.Expressions.LambdaExpression` that implements this graph.
LambdaExpression—public bool CanCreateSubGraph(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes)
| Parameter | Type | Description |
|---|---|---|
| nodes | IEnumerable<Node> | — |
bool—public void ClearChanges()
Don't increment `Facepunch.ActionGraphs.ActionGraph.ChangeId` during next validation.
void—public static Facepunch.ActionGraphs.ActionGraph CreateEmpty(Facepunch.ActionGraphs.NodeLibrary nodeLibrary)
Creates a completely blank action graph. This won't be invokable until an event node is added.
| Parameter | Type | Description |
|---|---|---|
| nodeLibrary | NodeLibrary | Source of node definitions for the new action graph. |
public System.Threading.Tasks.Task`1<System.Nullable`1<Facepunch.ActionGraphs.CreateSubGraphResult>> CreateSubGraphAsync(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes, System.Text.Json.JsonSerializerOptions jsonOptions, Facepunch.ActionGraphs.CreateSubGraphNodeDelegate createSubGraphNode)
| Parameter | Type | Description |
|---|---|---|
| nodes | IEnumerable<Node> | — |
| jsonOptions | JsonSerializerOptions | — |
| createSubGraphNode | CreateSubGraphNodeDelegate | — |
public void Deserialize(string json, System.Type delegateType, System.Text.Json.JsonSerializerOptions options = null)
Restore a previously serialized graph from JSON in this instance.
| Parameter | Type | Description |
|---|---|---|
| json | string | Serialized action graph. |
| delegateType | Type | Optional delegate type, must match the one used when serializing. |
| options = null | JsonSerializerOptions | Optional serializer options. |
void—public System.Collections.Generic.IReadOnlyDictionary`2<string,object> Evaluate(System.Collections.Generic.IReadOnlyDictionary`2<string,object> inputs = null)
| Parameter | Type | Description |
|---|---|---|
| inputs = null | IReadOnlyDictionary<string,object> | — |
IReadOnlyDictionary<string,object>—public System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.IActionGraphDelegate> GetDelegates()
Gets all known `Facepunch.ActionGraphs.IActionGraphDelegate`s created from this graph.
public Facepunch.ActionGraphs.Link InsertLink(Facepunch.ActionGraphs.Node.Input target, Facepunch.ActionGraphs.ILinkSource source, int index)
| Parameter | Type | Description |
|---|---|---|
| target | Input | — |
| source | ILinkSource | — |
| index | int | — |
public System.Threading.Tasks.Task`1<System.Collections.Generic.IReadOnlyDictionary`2<string,object>> InvokeAsync(System.Collections.Generic.IReadOnlyDictionary`2<string,object> inputs = null, System.Collections.Generic.IReadOnlyDictionary`2<string,Facepunch.ActionGraphs.Compilation.OutputDelegate> outputs = null)
| Parameter | Type | Description |
|---|---|---|
| inputs = null | IReadOnlyDictionary<string,object> | — |
| outputs = null | IReadOnlyDictionary<string,OutputDelegate> | — |
Task<IReadOnlyDictionary<string,object>>—public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushCache(Facepunch.ActionGraphs.IActionGraphCache value, bool writeReferences)
| Parameter | Type | Description |
|---|---|---|
| value | IActionGraphCache | — |
| writeReferences | bool | — |
public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushGuidMap(System.Collections.Generic.IReadOnlyDictionary`2<System.Guid,System.Guid> value)
| Parameter | Type | Description |
|---|---|---|
| value | IReadOnlyDictionary<Guid,Guid> | — |
public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushMakeGuidsUnique(bool value)
| Parameter | Type | Description |
|---|---|---|
| value | bool | — |
public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushSerializationOptions(Facepunch.ActionGraphs.SerializationOptions options)
| Parameter | Type | Description |
|---|---|---|
| options | SerializationOptions | — |
public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushSourceLocation(Facepunch.ActionGraphs.ISourceLocation value)
| Parameter | Type | Description |
|---|---|---|
| value | ISourceLocation | — |
public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushTarget(Facepunch.ActionGraphs.InputDefinition value)
| Parameter | Type | Description |
|---|---|---|
| value | InputDefinition | — |
public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushWriteCacheReferences(bool value)
| Parameter | Type | Description |
|---|---|---|
| value | bool | — |
public void RemoveLink(Facepunch.ActionGraphs.Link link)
| Parameter | Type | Description |
|---|---|---|
| link | Link | — |
void—public void RemoveNode(Facepunch.ActionGraphs.Node node)
Remove a node from this action graph. Any links into or out of the node will also be removed.
| Parameter | Type | Description |
|---|---|---|
| node | Node | Node to remove. |
void—public void RemoveUnusedChildNodes()
void—public void RemoveVariable(Facepunch.ActionGraphs.Variable variable)
| Parameter | Type | Description |
|---|---|---|
| variable | Variable | — |
void—public string Serialize(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes, System.Text.Json.JsonSerializerOptions options)
| Parameter | Type | Description |
|---|---|---|
| nodes | IEnumerable<Node> | — |
| options | JsonSerializerOptions | — |
string—public System.Text.Json.Nodes.JsonNode SerializeToNode(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes, System.Text.Json.JsonSerializerOptions options)
| Parameter | Type | Description |
|---|---|---|
| nodes | IEnumerable<Node> | — |
| options | JsonSerializerOptions | — |
JsonNode—public System.Collections.Generic.IReadOnlyList`1<Facepunch.ActionGraphs.Link> SetLinks(Facepunch.ActionGraphs.Node.Input target, System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.ILinkSource> sources)
| Parameter | Type | Description |
|---|---|---|
| target | Input | — |
| sources | IEnumerable<ILinkSource> | — |
public void Validate(bool force = False)
| Parameter | Type | Description |
|---|---|---|
| force = False | bool | — |
void—No results match this filter.
Properties25
Showing 25 properties
public string Facepunch.ActionGraphs.ActionGraph.Category { get; set; }
string—public int Facepunch.ActionGraphs.ActionGraph.ChangeId { get; set; }
Increments each time this graph re-validates after a change.
int—public string Facepunch.ActionGraphs.ActionGraph.Description { get; set; }
string—public Facepunch.ActionGraphs.DisplayInfo Facepunch.ActionGraphs.ActionGraph.DisplayInfo { get; set; }
public System.Guid Facepunch.ActionGraphs.ActionGraph.Guid { get; set; }
Guid—public string Facepunch.ActionGraphs.ActionGraph.Icon { get; set; }
string—public Facepunch.ActionGraphs.Node Facepunch.ActionGraphs.ActionGraph.InputNode { get; set; }
Entry point of the graph.
public System.Collections.Generic.IReadOnlyDictionary`2<string,Facepunch.ActionGraphs.InputDefinition> Facepunch.ActionGraphs.ActionGraph.Inputs { get; set; }
public Facepunch.ActionGraphs.NodeKind Facepunch.ActionGraphs.ActionGraph.Kind { get; set; }
public System.Collections.Generic.IReadOnlySet`1<Facepunch.ActionGraphs.Link> Facepunch.ActionGraphs.ActionGraph.Links { get; set; }
Set of links added between nodes in this action graph.
public System.Collections.Generic.IReadOnlyCollection`1<Facepunch.ActionGraphs.ValidationMessage> Facepunch.ActionGraphs.ActionGraph.Messages { get; set; }
public virtual sealed Facepunch.ActionGraphs.NodeLibrary Facepunch.ActionGraphs.ActionGraph.NodeLibrary { get; set; }
Library of node definitions available for use by this action graph.
public System.Collections.Generic.IReadOnlyDictionary`2<int,Facepunch.ActionGraphs.Node> Facepunch.ActionGraphs.ActionGraph.Nodes { get; set; }
Set of nodes added to this action graph.
public System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> Facepunch.ActionGraphs.ActionGraph.OutputNodes { get; set; }
Nodes that emit return values or output signals from this graph to the caller.
public System.Collections.Generic.IReadOnlyDictionary`2<string,Facepunch.ActionGraphs.OutputDefinition> Facepunch.ActionGraphs.ActionGraph.Outputs { get; set; }
public Facepunch.ActionGraphs.Node Facepunch.ActionGraphs.ActionGraph.PrimaryOutputNode { get; set; }
Primary output of the graph.
public static Facepunch.ActionGraphs.SerializationOptions Facepunch.ActionGraphs.ActionGraph.SerializationOptions { get; set; }
public Facepunch.ActionGraphs.ISourceLocation Facepunch.ActionGraphs.ActionGraph.SourceLocation { get; set; }
Identifies where this instance was deserialized from.
public virtual sealed string Facepunch.ActionGraphs.ActionGraph.StackTraceIdentifier { get; set; }
string—public string[] Facepunch.ActionGraphs.ActionGraph.Tags { get; set; }
string[]—public Facepunch.ActionGraphs.InputDefinition Facepunch.ActionGraphs.ActionGraph.TargetDefinition { get; set; }
The definition of the graph input that represents the target of the graph.
public Facepunch.ActionGraphs.Node.Output Facepunch.ActionGraphs.ActionGraph.TargetOutput { get; set; }
The output of the graph's entry node that represents the target of the graph.
public string Facepunch.ActionGraphs.ActionGraph.Title { get; set; }
string—public System.Text.Json.Nodes.JsonObject Facepunch.ActionGraphs.ActionGraph.UserData { get; set; }
Arbitrary named values stored in this action graph, which will be included during serialization. Values must be serializable to JSON.
JsonObject—public System.Collections.Generic.IReadOnlyDictionary`2<string,Facepunch.ActionGraphs.Variable> Facepunch.ActionGraphs.ActionGraph.Variables { get; set; }
Set of variables added to this action graph.
No results match this filter.