-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All Json Nodes
- Loading branch information
Showing
32 changed files
with
1,469 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using System; | ||
using Elements.Core; | ||
using FrooxEngine; | ||
using FrooxEngine.ProtoFlux; | ||
using ProtoFlux.Core; | ||
using ProtoFlux.Runtimes.Execution; | ||
using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; | ||
using Newtonsoft.Json.Linq; | ||
|
||
|
||
[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] | ||
public class JsonAddToObjectBinding<T> : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode<FrooxEngineContext, JObject> | ||
{ | ||
public readonly SyncRef<INodeObjectOutput<JObject>> Input; | ||
public readonly SyncRef<INodeObjectOutput<string>> Tag; | ||
public readonly SyncRef<INodeObjectOutput<T>> Object; | ||
|
||
public override Type NodeType => typeof(JsonAddToObject<T>); | ||
|
||
public JsonAddToObject<T> TypedNodeInstance { get; private set; } | ||
|
||
public override INode NodeInstance => TypedNodeInstance; | ||
|
||
public override int NodeInputCount => base.NodeInputCount + 3; | ||
|
||
public override N Instantiate<N>() | ||
{ | ||
if (TypedNodeInstance != null) | ||
{ | ||
throw new InvalidOperationException("Node has already been instantiated"); | ||
} | ||
JsonAddToObject<T> jsonAddToObjectInstance = (TypedNodeInstance = new JsonAddToObject<T>()); | ||
return jsonAddToObjectInstance as N; | ||
} | ||
|
||
protected override void AssociateInstanceInternal(INode node) | ||
{ | ||
if (node is JsonAddToObject<T> typedNodeInstance) | ||
{ | ||
TypedNodeInstance = typedNodeInstance; | ||
return; | ||
} | ||
throw new ArgumentException("Node instance is not of type " + typeof(JsonAddToObject<T>)); | ||
} | ||
|
||
public override void ClearInstance() | ||
{ | ||
TypedNodeInstance = null; | ||
} | ||
|
||
protected override ISyncRef GetInputInternal(ref int index) | ||
{ | ||
ISyncRef inputInternal = base.GetInputInternal(ref index); | ||
if (inputInternal != null) | ||
{ | ||
return inputInternal; | ||
} | ||
switch (index) | ||
{ | ||
case 0: | ||
return Input; | ||
case 1: | ||
return Tag; | ||
case 2: | ||
return Object; | ||
default: | ||
index -= 3; | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using System; | ||
using Elements.Core; | ||
using FrooxEngine; | ||
using ProtoFlux.Core; | ||
using ProtoFlux.Runtimes.Execution; | ||
using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; | ||
using Newtonsoft.Json.Linq; | ||
using FrooxEngine.ProtoFlux; | ||
|
||
[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] | ||
public class JsonAppendToArrayBinding<T> : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode<ExecutionContext, JArray> | ||
{ | ||
public readonly SyncRef<INodeObjectOutput<JArray>> Array; | ||
public readonly SyncRef<INodeObjectOutput<T>> Object; | ||
|
||
public override Type NodeType => typeof(JsonAppendToArray<T>); | ||
|
||
public JsonAppendToArray<T> TypedNodeInstance { get; private set; } | ||
|
||
public override INode NodeInstance => TypedNodeInstance; | ||
|
||
public override int NodeInputCount => base.NodeInputCount + 2; | ||
|
||
public override N Instantiate<N>() | ||
{ | ||
if (TypedNodeInstance != null) | ||
{ | ||
throw new InvalidOperationException("Node has already been instantiated"); | ||
} | ||
JsonAppendToArray<T> jsonAppendToArrayInstance = (TypedNodeInstance = new JsonAppendToArray<T>()); | ||
return jsonAppendToArrayInstance as N; | ||
} | ||
|
||
protected override void AssociateInstanceInternal(INode node) | ||
{ | ||
if (node is JsonAppendToArray<T> typedNodeInstance) | ||
{ | ||
TypedNodeInstance = typedNodeInstance; | ||
return; | ||
} | ||
throw new ArgumentException("Node instance is not of type " + typeof(JsonAppendToArray<T>)); | ||
} | ||
|
||
public override void ClearInstance() | ||
{ | ||
TypedNodeInstance = null; | ||
} | ||
|
||
protected override ISyncRef GetInputInternal(ref int index) | ||
{ | ||
ISyncRef inputInternal = base.GetInputInternal(ref index); | ||
if (inputInternal != null) | ||
{ | ||
return inputInternal; | ||
} | ||
switch (index) | ||
{ | ||
case 0: | ||
return Array; | ||
case 1: | ||
return Object; | ||
default: | ||
index -= 2; | ||
return null; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System; | ||
using Elements.Core; | ||
using FrooxEngine; | ||
using ProtoFlux.Core; | ||
using ProtoFlux.Runtimes.Execution; | ||
using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; | ||
using Newtonsoft.Json.Linq; | ||
using FrooxEngine.ProtoFlux; | ||
|
||
[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] | ||
public class JsonCountArrayChildrenBinding : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode<ExecutionContext, int> | ||
{ | ||
public readonly SyncRef<INodeObjectOutput<JArray>> Input; | ||
|
||
public override Type NodeType => typeof(JsonCountArrayChildrenNode); | ||
|
||
public JsonCountArrayChildrenNode TypedNodeInstance { get; private set; } | ||
|
||
public override INode NodeInstance => TypedNodeInstance; | ||
|
||
public override int NodeInputCount => base.NodeInputCount + 1; | ||
|
||
public override N Instantiate<N>() | ||
{ | ||
if (TypedNodeInstance != null) | ||
{ | ||
throw new InvalidOperationException("Node has already been instantiated"); | ||
} | ||
JsonCountArrayChildrenNode jsonCountArrayChildrenInstance = (TypedNodeInstance = new JsonCountArrayChildrenNode()); | ||
return jsonCountArrayChildrenInstance as N; | ||
} | ||
|
||
protected override void AssociateInstanceInternal(INode node) | ||
{ | ||
if (node is JsonCountArrayChildrenNode typedNodeInstance) | ||
{ | ||
TypedNodeInstance = typedNodeInstance; | ||
return; | ||
} | ||
throw new ArgumentException("Node instance is not of type " + typeof(JsonCountArrayChildrenNode)); | ||
} | ||
|
||
public override void ClearInstance() | ||
{ | ||
TypedNodeInstance = null; | ||
} | ||
|
||
protected override ISyncRef GetInputInternal(ref int index) | ||
{ | ||
ISyncRef inputInternal = base.GetInputInternal(ref index); | ||
if (inputInternal != null) | ||
{ | ||
return inputInternal; | ||
} | ||
if (index == 0) | ||
{ | ||
return Input; | ||
} | ||
index -= 1; | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using Elements.Core; | ||
using FrooxEngine; | ||
using ProtoFlux.Core; | ||
using ProtoFlux.Runtimes.Execution; | ||
using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; | ||
using Newtonsoft.Json.Linq; | ||
using FrooxEngine.ProtoFlux; | ||
|
||
|
||
[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] | ||
public class JsonCountObjectChildrenBinding : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode<ExecutionContext, int> | ||
{ | ||
public readonly SyncRef<INodeObjectOutput<JObject>> Input; | ||
|
||
public override Type NodeType => typeof(JsonCountObjectChildrenNode); | ||
|
||
public JsonCountObjectChildrenNode TypedNodeInstance { get; private set; } | ||
|
||
public override INode NodeInstance => TypedNodeInstance; | ||
|
||
public override int NodeInputCount => base.NodeInputCount + 1; | ||
|
||
public override N Instantiate<N>() | ||
{ | ||
if (TypedNodeInstance != null) | ||
{ | ||
throw new InvalidOperationException("Node has already been instantiated"); | ||
} | ||
JsonCountObjectChildrenNode jsonCountObjectChildrenInstance = (TypedNodeInstance = new JsonCountObjectChildrenNode()); | ||
return jsonCountObjectChildrenInstance as N; | ||
} | ||
|
||
protected override void AssociateInstanceInternal(INode node) | ||
{ | ||
if (node is JsonCountObjectChildrenNode typedNodeInstance) | ||
{ | ||
TypedNodeInstance = typedNodeInstance; | ||
return; | ||
} | ||
throw new ArgumentException("Node instance is not of type " + typeof(JsonCountObjectChildrenNode)); | ||
} | ||
|
||
public override void ClearInstance() | ||
{ | ||
TypedNodeInstance = null; | ||
} | ||
|
||
protected override ISyncRef GetInputInternal(ref int index) | ||
{ | ||
ISyncRef inputInternal = base.GetInputInternal(ref index); | ||
if (inputInternal != null) | ||
{ | ||
return inputInternal; | ||
} | ||
if (index == 0) | ||
{ | ||
return Input; | ||
} | ||
index -= 1; | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using Elements.Core; | ||
using FrooxEngine; | ||
using ProtoFlux.Core; | ||
using ProtoFlux.Runtimes.Execution; | ||
using Newtonsoft.Json.Linq; | ||
using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; | ||
|
||
[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] | ||
public class JsonEmptyArrayBinding : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode<ExecutionContext, JArray> | ||
{ | ||
public override Type NodeType => typeof(JsonEmptyArrayNode); | ||
|
||
public JsonEmptyArrayNode TypedNodeInstance { get; private set; } | ||
|
||
public override INode NodeInstance => TypedNodeInstance; | ||
|
||
public override int NodeInputCount => 0; | ||
|
||
public override N Instantiate<N>() | ||
{ | ||
if (TypedNodeInstance != null) | ||
throw new InvalidOperationException("Node has already been instantiated"); | ||
|
||
TypedNodeInstance = new JsonEmptyArrayNode(); | ||
return TypedNodeInstance as N; | ||
} | ||
|
||
protected override void AssociateInstanceInternal(INode node) | ||
{ | ||
if (node is JsonEmptyArrayNode typedNodeInstance) | ||
TypedNodeInstance = typedNodeInstance; | ||
else | ||
throw new ArgumentException("Node instance is not of type " + typeof(JsonEmptyArrayNode)); | ||
} | ||
|
||
public override void ClearInstance() | ||
{ | ||
TypedNodeInstance = null; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using Elements.Core; | ||
using FrooxEngine; | ||
using ProtoFlux.Core; | ||
using ProtoFlux.Runtimes.Execution; | ||
using Newtonsoft.Json.Linq; | ||
using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; | ||
|
||
[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Json" })] | ||
public class JsonEmptyObjectBinding : FrooxEngine.ProtoFlux.Runtimes.Execution.ObjectFunctionNode<ExecutionContext, JObject> | ||
{ | ||
public override Type NodeType => typeof(JsonEmptyObjectNode); | ||
|
||
public JsonEmptyObjectNode TypedNodeInstance { get; private set; } | ||
|
||
public override INode NodeInstance => TypedNodeInstance; | ||
|
||
public override int NodeInputCount => 0; | ||
|
||
public override N Instantiate<N>() | ||
{ | ||
if (TypedNodeInstance != null) | ||
throw new InvalidOperationException("Node has already been instantiated"); | ||
|
||
TypedNodeInstance = new JsonEmptyObjectNode(); | ||
return TypedNodeInstance as N; | ||
} | ||
|
||
protected override void AssociateInstanceInternal(INode node) | ||
{ | ||
if (node is JsonEmptyObjectNode typedNodeInstance) | ||
TypedNodeInstance = typedNodeInstance; | ||
else | ||
throw new ArgumentException("Node instance is not of type " + typeof(JsonEmptyObjectNode)); | ||
} | ||
|
||
public override void ClearInstance() | ||
{ | ||
TypedNodeInstance = null; | ||
} | ||
} | ||
|
Oops, something went wrong.