-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
13 changed files
with
148 additions
and
16 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
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
26 changes: 26 additions & 0 deletions
26
Runtime/Flow/Models/Nodes/Utilities/FlowNode_ObservableSubscribeT.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,26 @@ | ||
using System; | ||
using Ceres.Annotations; | ||
using R3; | ||
|
||
namespace Ceres.Graph.Flow.Utilities | ||
{ | ||
[Serializable] | ||
[CeresGroup("Utilities/Rx")] | ||
[CeresLabel("Subscribe")] | ||
public class FlowNode_ObservableSubscribeT<T>: FlowNode | ||
{ | ||
[InputPort, HideInGraphEditor] | ||
public CeresPort<Observable<T>> subject; | ||
|
||
[InputPort] | ||
public DelegatePort<EventDelegate<T>> onNext; | ||
|
||
[OutputPort] | ||
public CeresPort<IDisposable> subscription; | ||
|
||
protected override void LocalExecute(ExecutionContext executionContext) | ||
{ | ||
subscription.Value = subject.Value.Subscribe(onNext.Value); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Runtime/Flow/Models/Nodes/Utilities/FlowNode_ObservableSubscribeT.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 1 addition & 2 deletions
3
Runtime/Flow/Models/Nodes/Utilities/Templates/FlowNode_MakeArrayT_Template.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
45 changes: 45 additions & 0 deletions
45
Runtime/Flow/Models/Nodes/Utilities/Templates/FlowNode_ObservableSubscribeT_Template.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,45 @@ | ||
using System; | ||
using Chris; | ||
using R3; | ||
|
||
namespace Ceres.Graph.Flow.Utilities.Templates | ||
{ | ||
public class FlowNode_ObservableSubscribeT_Template: GenericNodeTemplate | ||
{ | ||
public override bool RequirePort() | ||
{ | ||
return true; | ||
} | ||
|
||
public override bool CanFilterPort(Type portValueType) | ||
{ | ||
if (portValueType == null) | ||
{ | ||
return false; | ||
} | ||
|
||
if (!portValueType.IsGenericType) | ||
{ | ||
return false; | ||
} | ||
|
||
return ReflectionUtility.IsInheritedFromGenericDefinition(portValueType, typeof(Observable<>)); | ||
} | ||
|
||
public override Type[] GetGenericArguments(Type portValueType, Type selectArgumentType) | ||
{ | ||
return new[] { selectArgumentType }; | ||
} | ||
|
||
public override Type[] GetAvailableArguments(Type portValueType) | ||
{ | ||
return new[]{ ReflectionUtility.GetGenericArgumentType(portValueType) }; | ||
} | ||
|
||
protected override string GetTargetName(Type[] argumentTypes) | ||
{ | ||
var genericType = typeof(Observable<>).MakeGenericType(argumentTypes[0]); | ||
return CeresNode.GetTargetSubtitle(genericType); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Runtime/Flow/Models/Nodes/Utilities/Templates/FlowNode_ObservableSubscribeT_Template.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...w/Models/Nodes/Utilities/Templates/FlowNode_SoftAssetReferenceTLoadAssetAsync_Template.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
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,40 @@ | ||
using System; | ||
using Ceres.Annotations; | ||
using Ceres.Graph.Flow.Annotations; | ||
using R3; | ||
using R3.Chris; | ||
using UnityEngine; | ||
|
||
namespace Ceres.Graph.Flow.Utilities | ||
{ | ||
/// <summary> | ||
/// Executable function library for R3 | ||
/// </summary> | ||
[CeresGroup("Rx")] | ||
public partial class RxExecutableLibrary: ExecutableFunctionLibrary | ||
{ | ||
[ExecutableFunction(IsScriptMethod = true), CeresLabel("Dispose")] | ||
public static void Flow_IDisposableDispose(IDisposable disposable) | ||
{ | ||
disposable.Dispose(); | ||
} | ||
|
||
[ExecutableFunction(IsScriptMethod = true), CeresLabel("Add to Disposable Unregister")] | ||
public static void Flow_IDisposableAddToIDisposableUnregister(IDisposable disposable, IDisposableUnregister disposableUnregister) | ||
{ | ||
disposable.AddTo(disposableUnregister); | ||
} | ||
|
||
[ExecutableFunction(IsScriptMethod = true), CeresLabel("Add to Component")] | ||
public static void Flow_IDisposableAddToComponent(IDisposable disposable, Component component) | ||
{ | ||
disposable.AddTo(component); | ||
} | ||
|
||
[ExecutableFunction(IsScriptMethod = true), CeresLabel("Add to GameObject")] | ||
public static void Flow_IDisposableAddToGameObject(IDisposable disposable, GameObject gameObject) | ||
{ | ||
disposable.AddTo(gameObject); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.