-
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.
- Loading branch information
1 parent
a39f384
commit a33a54f
Showing
23 changed files
with
227 additions
and
113 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
34 changes: 34 additions & 0 deletions
34
ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs
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,34 @@ | ||
using System; | ||
using System.Linq; | ||
using Newtonsoft.Json.Linq; | ||
using ProtoFlux.Core; | ||
using ProtoFlux.Runtimes.Execution; | ||
using Elements.Core; | ||
using FrooxEngine; | ||
using FrooxEngine.ProtoFlux; | ||
using Obsidian.Elements; | ||
|
||
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; | ||
|
||
[NodeName("Add To Object")] | ||
[NodeCategory("Obsidian/Json")] | ||
[GenericTypes(typeof(string), typeof(Uri), typeof(IJsonToken), typeof(JsonObject), typeof(JsonArray))] | ||
public class JsonAddObjectToObjectNode<T> : ObjectFunctionNode<FrooxEngineContext, JsonObject> where T : class | ||
{ | ||
public readonly ObjectInput<JsonObject> Input; | ||
public readonly ObjectInput<string> Tag; | ||
public readonly ObjectInput<T> Object; | ||
|
||
public static bool IsValidGenericType => JsonTypeHelper.ValidObjectSetTypes.Contains(typeof(T)); | ||
|
||
protected override JsonObject Compute(FrooxEngineContext context) | ||
{ | ||
var input = Input.Evaluate(context); | ||
if (input == null) return null; | ||
|
||
var tag = Tag.Evaluate(context); | ||
var obj = Object.Evaluate(context); | ||
|
||
return string.IsNullOrEmpty(tag) ? input : input.Add(tag, obj); | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs
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,28 @@ | ||
using System; | ||
using System.Linq; | ||
using Newtonsoft.Json.Linq; | ||
using ProtoFlux.Core; | ||
using ProtoFlux.Runtimes.Execution; | ||
using FrooxEngine; | ||
using Elements.Core; | ||
using FrooxEngine.ProtoFlux; | ||
using Obsidian.Elements; | ||
|
||
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; | ||
|
||
[NodeName("Append To Array")] | ||
[NodeCategory("Obsidian/Json")] | ||
[GenericTypes(typeof(string), typeof(Uri), typeof(IJsonToken), typeof(JsonObject), typeof(JsonArray))] | ||
public class JsonAppendObjectToArrayNode<T> : ObjectFunctionNode<FrooxEngineContext, JsonArray> where T : class | ||
{ | ||
public readonly ObjectInput<JsonArray> Array; | ||
public readonly ObjectInput<T> Object; | ||
|
||
public static bool IsValidGenericType => JsonTypeHelper.ValidObjectSetTypes.Contains(typeof(T)); | ||
protected override JsonArray Compute(FrooxEngineContext context) | ||
{ | ||
var array = Array.Evaluate(context); | ||
var obj = Object.Evaluate(context); | ||
return array?.Append(obj); | ||
} | ||
} |
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
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
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
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,14 @@ | ||
using FrooxEngine.ProtoFlux; | ||
using Newtonsoft.Json.Linq; | ||
using Obsidian.Elements; | ||
using ProtoFlux.Core; | ||
using ProtoFlux.Runtimes.Execution; | ||
|
||
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; | ||
|
||
[NodeName("Empty JsonArray")] | ||
[NodeCategory("Obsidian/Json")] | ||
public class JsonEmptyArrayNode : ObjectFunctionNode<FrooxEngineContext, JsonArray> | ||
{ | ||
protected override JsonArray Compute(FrooxEngineContext context) => new(new JArray()); | ||
} |
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
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
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
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
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
33 changes: 33 additions & 0 deletions
33
ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs
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,33 @@ | ||
using System; | ||
using System.Linq; | ||
using Newtonsoft.Json.Linq; | ||
using ProtoFlux.Core; | ||
using ProtoFlux.Runtimes.Execution; | ||
using Elements.Core; | ||
using FrooxEngine; | ||
using FrooxEngine.ProtoFlux; | ||
using Obsidian.Elements; | ||
|
||
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; | ||
|
||
[NodeName("Insert To Array")] | ||
[NodeCategory("Obsidian/Json")] | ||
[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
typeof(long), typeof(ulong), typeof(float), typeof(double))] | ||
public class JsonInsertObjectToArrayNode<T> : ObjectFunctionNode<FrooxEngineContext, JsonArray> | ||
{ | ||
public readonly ObjectInput<JsonArray> Array; | ||
public readonly ObjectInput<T> Object; | ||
public readonly ObjectInput<int> Index; | ||
public static bool IsValidGenericType => JsonTypeHelper.ValidObjectSetTypes.Contains(typeof(T)); | ||
protected override JsonArray Compute(FrooxEngineContext context) | ||
{ | ||
var array = Array.Evaluate(context); | ||
var obj = Object.Evaluate(context); | ||
var index = Index.Evaluate(context); | ||
if (array == null || index < 0 || index > array.Count) | ||
return null; | ||
|
||
return array.Insert(index, obj); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs
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,32 @@ | ||
using System; | ||
using System.Linq; | ||
using Newtonsoft.Json.Linq; | ||
using ProtoFlux.Core; | ||
using ProtoFlux.Runtimes.Execution; | ||
using Elements.Core; | ||
using FrooxEngine; | ||
using FrooxEngine.ProtoFlux; | ||
using Obsidian.Elements; | ||
|
||
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; | ||
|
||
[NodeName("Insert To Array")] | ||
[NodeCategory("Obsidian/Json")] | ||
[GenericTypes(typeof(string), typeof(Uri), typeof(IJsonToken), typeof(JsonObject), typeof(JsonArray))] | ||
public class JsonInsertValueToArrayNode<T> : ObjectFunctionNode<FrooxEngineContext, JsonArray> | ||
This comment has been minimized.
Sorry, something went wrong. |
||
{ | ||
public readonly ObjectInput<JsonArray> Array; | ||
public readonly ObjectInput<T> Object; | ||
public readonly ValueInput<int> Index; | ||
public static bool IsValidGenericType => JsonTypeHelper.ValidValueTypes.Contains(typeof(T)); | ||
protected override JsonArray Compute(FrooxEngineContext context) | ||
{ | ||
var array = Array.Evaluate(context); | ||
var obj = Object.Evaluate(context); | ||
var index = Index.Evaluate(context); | ||
if (array == null || index < 0 || index > array.Count) | ||
return null; | ||
|
||
return array.Insert(index, obj); | ||
} | ||
} |
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
Oops, something went wrong.
Wrong generic types?