Exemple #1
0
        public void MakePoints()
        {
            if (this.data is NodeFuncData)
            {
                NodeFuncData data = this.data as NodeFuncData;

                List <Type> methodParameters = new List <Type>();
                foreach (var point in data.parameters)
                {
                    methodParameters.Add(NodeGUIUtility.GetType(point));
                }

                if (data.nodeType == NodeType.Constructor)
                {
                    ConstructorInfo method     = NodeGUIUtility.GetType(data.funcClassType).GetConstructor(methodParameters.ToArray());
                    ParameterInfo[] parameters = method.GetParameters();

                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Return, data.funcClassType, "instance"));

                    int index = 1;

                    foreach (var parameter in parameters)
                    {
                        AddPoint(new NodePointData(index++, data.GUID, ConnectionPointType.Parameter, parameter.ParameterType.FullName, parameter.Name));
                    }
                }
                else
                {
                    Type            classType  = NodeGUIUtility.GetType(data.funcClassType);
                    MethodInfo      method     = classType.GetMethod(data.methodName, methodParameters.ToArray());
                    ParameterInfo[] parameters = method.GetParameters();

                    int index = 1;

                    if (method.ReturnParameter.ParameterType == typeof(void))
                    {
                        AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.In, typeof(void).FullName, "Logic", null));
                        AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                        data.nodeType = NodeType.Logic;
                    }
                    else
                    {
                        AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Return, method.ReturnParameter.ParameterType.FullName, method.ReturnParameter.Name));
                        data.nodeType = NodeType.Func;
                    }

                    if (!method.IsStatic)
                    {
                        AddPoint(new NodePointData(index++, data.GUID, ConnectionPointType.Parameter, data.funcClassType, "This"));
                    }

                    foreach (var parameter in parameters)
                    {
                        AddPoint(new NodePointData(index++, data.GUID, ConnectionPointType.Parameter, parameter.ParameterType.FullName, parameter.Name));
                    }

                    if (data.methodName.Contains("get_") || data.methodName.Contains("set_"))
                    {
                        data.nodeType = NodeType.Property;
                    }
                }
            }
            else
            {
                if (data.nodeType == NodeType.Condition)
                {
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.In, typeof(void).FullName, "Logic", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Parameter, typeof(bool).FullName, "Condition"));
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                }
                else if (data.nodeType == NodeType.For)
                {
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.In, typeof(void).FullName, "Logic", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Parameter, typeof(int).FullName, "LoofCount"));
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                }
                else if (data.nodeType == NodeType.Event)
                {
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Return, typeof(Character).FullName, "Owner", null));
                }
                else if (data.nodeType == NodeType.TimeLine)
                {
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Return, typeof(Character).FullName, "Owner", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Parameter, typeof(float).FullName, "Time"));
                }
            }
        }
Exemple #2
0
        public void MakePoints()
        {
            if (this.data is NodeFuncData)
            {
                NodeFuncData data = this.data as NodeFuncData;

                MethodInfo      method     = Type.GetType(data.funcClassType).GetMethod(data.methodName);
                ParameterInfo[] parameters = method.GetParameters();

                int index = 1;

                if (method.ReturnParameter.ParameterType == typeof(void))
                {
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.In, typeof(void).FullName, "Logic", null));
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                    data.nodeType = NodeType.Logic;
                }
                else
                {
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Return, method.ReturnParameter.ParameterType.FullName, method.ReturnParameter.Name));
                    data.nodeType = NodeType.Func;
                }

                if (!method.IsStatic)
                {
                    AddPoint(new NodePointData(index++, data.GUID, ConnectionPointType.Parameter, data.funcClassType, "Owner"));
                }

                foreach (var parameter in parameters)
                {
                    AddPoint(new NodePointData(index++, data.GUID, ConnectionPointType.Parameter, parameter.ParameterType.FullName, parameter.Name));
                }
            }
            else
            {
                if (data.nodeType == NodeType.Condition)
                {
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.In, typeof(void).FullName, "Logic", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Parameter, typeof(bool).FullName, "Condition"));
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                }
                else if (data.nodeType == NodeType.For)
                {
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.In, typeof(void).FullName, "Logic", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Parameter, typeof(int).FullName, "LoofCount"));
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                }
                else if (data.nodeType == NodeType.Event)
                {
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Return, typeof(Character).FullName, "Owner", null));
                }
                else if (data.nodeType == NodeType.TimeLine)
                {
                    AddPoint(new NodePointData(0, data.GUID, ConnectionPointType.Out, typeof(void).FullName, "Logic", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Return, typeof(Character).FullName, "Owner", null));
                    AddPoint(new NodePointData(1, data.GUID, ConnectionPointType.Parameter, typeof(float).FullName, "Time"));
                }
            }
        }