public static BaseReflectedMethodNode GetMethodNode(MethodInfo targetMethod, ReflectedMethodRegistrationOptions options)
        {
            ParametresDef paramDef;

            if (!ReflectedNodesHelper.InitParams(targetMethod, out paramDef))
            {
                return(null);
            }
#if !NET_STANDARD_2_0 && (UNITY_EDITOR || (!ENABLE_IL2CPP && (UNITY_STANDALONE || UNITY_ANDROID || UNITY_WSA)))
            var jit = new JitMethodNode();
            jit.options = options;
            if (jit.Init(targetMethod, paramDef))
            {
                return(jit);
            }
#endif
            if (OnGetAotReflectedMethodNode != null)
            {
                var eventAot = OnGetAotReflectedMethodNode(targetMethod);
                if (eventAot != null)
                {
                    eventAot.options = options;
                    if (eventAot.Init(targetMethod, paramDef))
                    {
                        return(eventAot);
                    }
                }
            }
            var aot = new PureReflectedMethodNode();
            aot.options = options;
            return(aot.Init(targetMethod, paramDef) ? aot : null);
        }
 public override void RegisterPorts(FlowNode node, ReflectedMethodRegistrationOptions options)
 {
     if (actionCall == null)
     {
         actionCall = Call;
     }
     if (options.callable)
     {
         var output = node.AddFlowOutput(" ");
         node.AddFlowInput(" ", flow =>
         {
             Call();
             output.Call(flow);
         });
     }
     for (int i = 0; i <= delegateParams.Length - 1; i++)
     {
         var param = delegateParams[i];
         var def   = param.paramDef;
         if (def.paramMode == ParamMode.Instance)
         {
             param.RegisterAsInput(node);
             if (options.callable)
             {
                 param.RegisterAsOutput(node);
             }
         }
         else if (def.paramMode == ParamMode.Result)
         {
             param.RegisterAsOutput(node, options.callable ? null : actionCall);
         }
         else
         {
             if (def.paramMode == ParamMode.Ref)
             {
                 param.RegisterAsInput(node);
                 param.RegisterAsOutput(node, options.callable ? null : actionCall);
             }
             else if (def.paramMode == ParamMode.In)
             {
                 param.RegisterAsInput(node);
             }
             else if (def.paramMode == ParamMode.Out)
             {
                 param.RegisterAsOutput(node, options.callable ? null : actionCall);
             }
         }
     }
 }
 public override void RegisterPorts(FlowNode node, ReflectedMethodRegistrationOptions options)
 {
     if (options.callable)
     {
         var output = node.AddFlowOutput(" ");
         node.AddFlowInput(" ", flow =>
         {
             Call();
             output.Call(flow);
         });
     }
     if (instanceDef.paramMode != ParamMode.Undefined)
     {
         instanceInput = node.AddValueInput(instanceDef.portName, instanceDef.paramType, instanceDef.portId);
         if (options.callable)
         {
             node.AddValueOutput(instanceDef.portName, instanceDef.paramType, () => instanceObject, instanceDef.portId);
         }
     }
     if (resultDef.paramMode != ParamMode.Undefined)
     {
         node.AddValueOutput(resultDef.portName, resultDef.portId, resultDef.paramType, () =>
         {
             if (!options.callable)
             {
                 Call();
             }
             return(resultObject);
         });
     }
     for (int i = 0; i <= paramDefinitions.Count - 1; i++)
     {
         var def = paramDefinitions[i];
         if (def.paramMode == ParamMode.Ref)
         {
             RegisterInput(node, def, i);
             RegisterOutput(node, options.callable, def, i);
         }
         else if (def.paramMode == ParamMode.In)
         {
             RegisterInput(node, def, i);
         }
         else if (def.paramMode == ParamMode.Out)
         {
             RegisterOutput(node, options.callable, def, i);
         }
     }
 }
 ///Gather the ports through the wrapper
 protected override void RegisterPorts()
 {
     if (method == null)
     {
         return;
     }
     reflectedMethodNode = ReflectedMethodNode.Create(method);
     if (reflectedMethodNode != null)
     {
         var options = new ReflectedMethodRegistrationOptions();
         options.callable           = callable;
         options.exposeParams       = exposeParams;
         options.exposedParamsCount = exposedParamsCount;
         reflectedMethodNode.RegisterPorts(this, method, options);
     }
 }
Example #5
0
        protected override void RegisterPorts()
        {
            if (constructor == null)
            {
                return;
            }

            var options = new ReflectedMethodRegistrationOptions();

            options.callable           = callable;
            options.exposeParams       = exposeParams;
            options.exposedParamsCount = exposedParamsCount;

            reflectedConstructorNode = BaseReflectedConstructorNode.GetConstructorNode(constructor, options);
            if (reflectedConstructorNode != null)
            {
                reflectedConstructorNode.RegisterPorts(this, options);
            }
        }
        protected override void RegisterPorts()
        {
            if (constructor == null)
            {
                return;
            }

            var options = new ReflectedMethodRegistrationOptions();

            options.callable           = callable;
            options.exposeParams       = exposeParams;
            options.exposedParamsCount = exposedParamsCount;

            reflectedConstructorNode = BaseReflectedConstructorNode.GetConstructorNode(constructor, options);
            if (reflectedConstructorNode != null)
            {
#if UNITY_EDITOR
                //SL--
                customColor = ColorUtils.HexToColor(callable ? "285b7c" : "3a7962");
#endif
                reflectedConstructorNode.RegisterPorts(this, options);
            }
        }
 public abstract void RegisterPorts(FlowNode node, ReflectedMethodRegistrationOptions options);