예제 #1
0
        public ScaledRadialNode(JObject data, Guid[] executeIn, Guid[] executeOut, Guid[] dataIn, Guid[] dataOut)
            : base(ScaledRadialNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conOutX = new ConnectorViewModel("X", typeof(NodeDataNumeric), dataOut[0]);
            conOutY = new ConnectorViewModel("Y", typeof(NodeDataNumeric), dataOut[1]);
            conInX = new ConnectorViewModel("X", typeof(NodeDataNumeric), dataIn[0]);
            conInY = new ConnectorViewModel("Y", typeof(NodeDataNumeric), dataIn[1]);
            conInMin = new ConnectorViewModel("Min", typeof(NodeDataNumeric), dataIn[2]);
            conInMax = new ConnectorViewModel("Max", typeof(NodeDataNumeric), dataIn[3]);

            this.OutputConnectors.Add(conOutX);
            this.OutputConnectors.Add(conOutY);
            this.InputConnectors.Add(conInX);
            this.InputConnectors.Add(conInY);
            this.InputConnectors.Add(conInMin);
            this.InputConnectors.Add(conInMax);

            // Set Name
            Name = (string)data["name"];

            // State Values
            Min = (int)data["min"];
            Max = (int)data["max"];

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #2
0
        public XInputControllerAnalogNode()
            : base(XInputControllerAnalogNodeFactory.TYPESTRING)
        {
            // Prepare Execution Connection
            conExecuted = new ExecutionConnectorViewModel();
            conExecute = new ExecutionConnectorViewModel();

            this.InputExecutionConnectors.Add(conExecuted);
            this.OutputExecutionConnectors.Add(conExecute);

            // Prepare Connections
            conLeftThumbX   = new ConnectorViewModel("LeftThumbX", typeof(NodeDataNumeric));
            conLeftThumbY   = new ConnectorViewModel("LeftThumbY", typeof(NodeDataNumeric));
            conLeftTrigger  = new ConnectorViewModel("LeftTrigger", typeof(NodeDataNumeric));
            conRightThumbX  = new ConnectorViewModel("RightThumbX", typeof(NodeDataNumeric));
            conRightThumbY  = new ConnectorViewModel("RightThumbY", typeof(NodeDataNumeric));
            conRightTrigger = new ConnectorViewModel("RightTrigger", typeof(NodeDataNumeric));
            //conButtons = new ConnectorViewModel("Buttons", typeof(NodeDataXInputButtons));

            this.OutputConnectors.Add(conLeftThumbX);
            this.OutputConnectors.Add(conLeftThumbY);
            this.OutputConnectors.Add(conLeftTrigger);
            this.OutputConnectors.Add(conRightThumbX);
            this.OutputConnectors.Add(conRightThumbY);
            this.OutputConnectors.Add(conRightTrigger);
            //this.OutputConnectors.Add(conButtons);

            // State Values
            currentUser = UserIndex.One;
            controller = new SharpDX.XInput.Controller(currentUser);

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #3
0
        // Fresh constructor
        public EmoteSetVariableNode()
            : base(EmoteSetVariableNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conExecute = new ExecutionConnectorViewModel();
            inputValue = new ConnectorViewModel("Value", typeof(NodeDataNumeric));
            inputFrameCount = new ConnectorViewModel("FrameCount", typeof(NodeDataNumeric));
            inputEasing = new ConnectorViewModel("Easing", typeof(NodeDataNumeric));

            this.InputExecutionConnectors.Add(conExecute);
            this.InputConnectors.Add(inputValue);
            this.InputConnectors.Add(inputFrameCount);
            this.InputConnectors.Add(inputEasing);

            // State Values
            value = 0f;
            frameCount = 0.1f;
            easing = 0.9f;
            varName = string.Empty;

            // Create Dialog
            dlgEdit = new PropertyDialog();

            // Get Character Context
            charContext = CharacterContext.GetCharacterContext();
        }
예제 #4
0
        public ScaledRadialNode()
            : base(ScaledRadialNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conOutX = new ConnectorViewModel("X", typeof(NodeDataNumeric));
            conOutY = new ConnectorViewModel("Y", typeof(NodeDataNumeric));
            conInX = new ConnectorViewModel("X", typeof(NodeDataNumeric));
            conInY = new ConnectorViewModel("Y", typeof(NodeDataNumeric));
            conInMin = new ConnectorViewModel("Min", typeof(NodeDataNumeric));
            conInMax = new ConnectorViewModel("Max", typeof(NodeDataNumeric));

            this.OutputConnectors.Add(conOutX);
            this.OutputConnectors.Add(conOutY);
            this.InputConnectors.Add(conInX);
            this.InputConnectors.Add(conInY);
            this.InputConnectors.Add(conInMin);
            this.InputConnectors.Add(conInMax);

            // State Values
            Min = 0;
            Max = 1;

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #5
0
 public ConsoleOutNode()
     : base(ConsoleOutNodeFactory.TYPESTRING)
 {
     this.InputExecutionConnectors.Add(new ExecutionConnectorViewModel());
     inputText = new ConnectorViewModel("Text", typeof(INodeData));
     this.InputConnectors.Add(inputText);
 }
예제 #6
0
        public ConsoleOutNode(JObject data, Guid[] executeIn, Guid[] executeOut, Guid[] dataIn, Guid[] dataOut)
        {
            this.InputExecutionConnectors.Add(new ExecutionConnectorViewModel(executeIn[0]));
            inputText = new ConnectorViewModel("Text", typeof(INodeData), dataIn[0]);
            this.InputConnectors.Add(inputText);

            // Set Name
            Name = (string)data["name"];
        }
예제 #7
0
파일: Data.cs 프로젝트: Nielk1/NekoPuppet
        //public override string Note { get { } }
        public DataRoutingNode()
            : base(DataRoutingNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conOut = new ConnectorViewModel("In", typeof(NodeDataNumeric));
            conInput = new ConnectorViewModel("Out", typeof(NodeDataNumeric));

            this.OutputConnectors.Add(conOut);
            this.InputConnectors.Add(conInput);
        }
예제 #8
0
파일: Data.cs 프로젝트: Nielk1/NekoPuppet
        public DataRoutingNode(JObject data, Guid[] executeIn, Guid[] executeOut, Guid[] dataIn, Guid[] dataOut)
            : base(DataRoutingNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conOut = new ConnectorViewModel("In", typeof(NodeDataNumeric), dataOut[0]);
            conInput = new ConnectorViewModel("Out", typeof(NodeDataNumeric), dataIn[0]);

            this.OutputConnectors.Add(conOut);
            this.InputConnectors.Add(conInput);

            // Set Name
            //Name = (string)data["name"];
        }
예제 #9
0
        public GetVariableNode()
            : base(GetVariableNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conOut = new ConnectorViewModel("Value", typeof(INodeData));

            this.OutputConnectors.Add(conOut);

            // State Values
            VarName = null;

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #10
0
        public MathNumericConstantNode()
            : base(MathNumericConstantNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conOut = new ConnectorViewModel("Value", typeof(NodeDataNumeric));

            this.OutputConnectors.Add(conOut);

            // State Values
            CastToType = CastType.Double;
            Value = 0d;

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #11
0
        //public override string Note { get { } }
        public XInputConstantsNode()
            : base(XInputConstantsNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conLeftThumbDeadZone = new ConnectorViewModel("LeftThumbDeadZone", typeof(NodeDataNumeric));
            conRightThumbDeadZone = new ConnectorViewModel("RightThumbDeadZone", typeof(NodeDataNumeric));
            conTriggerThreshold = new ConnectorViewModel("TriggerThreshold", typeof(NodeDataNumeric));

            this.OutputConnectors.Add(conLeftThumbDeadZone);
            this.OutputConnectors.Add(conRightThumbDeadZone);
            this.OutputConnectors.Add(conTriggerThreshold);

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #12
0
        public XInputControllerDigitalNode()
            : base(XInputControllerDigitalNodeFactory.TYPESTRING)
        {
            // Prepare Execution Connection
            conExecuted = new ExecutionConnectorViewModel();
            conExecute = new ExecutionConnectorViewModel();

            this.InputExecutionConnectors.Add(conExecuted);
            this.OutputExecutionConnectors.Add(conExecute);

            // Prepare Connections
            conDPadUp = new ConnectorViewModel("DPadUp", typeof(NodeDataBoolean));
            conDPadDown = new ConnectorViewModel("DPadDown", typeof(NodeDataBoolean));
            conDPadLeft = new ConnectorViewModel("DPadLeft", typeof(NodeDataBoolean));
            conDPadRight = new ConnectorViewModel("DPadRight", typeof(NodeDataBoolean));
            conStart = new ConnectorViewModel("Start", typeof(NodeDataBoolean));
            conBack = new ConnectorViewModel("Back", typeof(NodeDataBoolean));
            conLeftThumb = new ConnectorViewModel("LeftThumb", typeof(NodeDataBoolean));
            conRightThumb = new ConnectorViewModel("RightThumb", typeof(NodeDataBoolean));
            conLeftShoulder = new ConnectorViewModel("LeftShoulder", typeof(NodeDataBoolean));
            conRightShoulder = new ConnectorViewModel("RightShoulder", typeof(NodeDataBoolean));
            conA = new ConnectorViewModel("A", typeof(NodeDataBoolean));
            conB = new ConnectorViewModel("B", typeof(NodeDataBoolean));
            conX = new ConnectorViewModel("X", typeof(NodeDataBoolean));
            conY = new ConnectorViewModel("Y", typeof(NodeDataBoolean));

            this.OutputConnectors.Add(conDPadUp);
            this.OutputConnectors.Add(conDPadDown);
            this.OutputConnectors.Add(conDPadLeft);
            this.OutputConnectors.Add(conDPadRight);
            this.OutputConnectors.Add(conStart);
            this.OutputConnectors.Add(conBack);
            this.OutputConnectors.Add(conLeftThumb);
            this.OutputConnectors.Add(conRightThumb);
            this.OutputConnectors.Add(conLeftShoulder);
            this.OutputConnectors.Add(conRightShoulder);
            this.OutputConnectors.Add(conA);
            this.OutputConnectors.Add(conB);
            this.OutputConnectors.Add(conX);
            this.OutputConnectors.Add(conY);

            // State Values
            currentUser = UserIndex.One;
            controller = new SharpDX.XInput.Controller(currentUser);

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #13
0
        //public override string Note { get { } }
        public MathMultiplyNode()
            : base(MathMultiplyNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conOut = new ConnectorViewModel("Product", typeof(NodeDataNumeric));
            conInput = new ConnectorViewModel("Multi-Input", typeof(NodeDataNumeric));

            this.OutputConnectors.Add(conOut);
            this.InputConnectors.Add(conInput);

            // State Values
            CastToType = CastType.Double;

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #14
0
        public GetVariableNode(JObject data, Guid[] executeIn, Guid[] executeOut, Guid[] dataIn, Guid[] dataOut)
            : base(GetVariableNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conOut = new ConnectorViewModel("Value", typeof(NodeDataNumeric), dataOut[0]);

            this.OutputConnectors.Add(conOut);

            // Set Name
            Name = (string)data["name"];

            // State Values
            VarName = (string)data["varname"];

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #15
0
        public XInputConstantsNode(JObject data, Guid[] executeIn, Guid[] executeOut, Guid[] dataIn, Guid[] dataOut)
            : base(XInputConstantsNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conLeftThumbDeadZone = new ConnectorViewModel("LeftThumbDeadZone", typeof(NodeDataNumeric), dataOut[0]);
            conRightThumbDeadZone = new ConnectorViewModel("RightThumbDeadZone", typeof(NodeDataNumeric), dataOut[1]);
            conTriggerThreshold = new ConnectorViewModel("TriggerThreshold", typeof(NodeDataNumeric), dataOut[2]);

            this.OutputConnectors.Add(conLeftThumbDeadZone);
            this.OutputConnectors.Add(conRightThumbDeadZone);
            this.OutputConnectors.Add(conTriggerThreshold);

            // Set Name
            Name = (string)data["name"];

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #16
0
        public MathNumericConstantNode(JObject data, Guid[] executeIn, Guid[] executeOut, Guid[] dataIn, Guid[] dataOut)
            : base(MathNumericConstantNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conOut = new ConnectorViewModel("Value", typeof(NodeDataNumeric), dataOut[0]);

            this.OutputConnectors.Add(conOut);

            // Set Name
            Name = (string)data["name"];

            // State Values
            if (!Enum.TryParse<CastType>((string)data["CastToType"], out CastToType)) CastToType = CastType.Double;
            Value = (Double)data["value"];

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #17
0
        public ValueBufferNode()
            : base(ValueBufferNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conExecute = new ExecutionConnectorViewModel();
            conIn = new ConnectorViewModel("Set", typeof(INodeData));
            conOut = new ConnectorViewModel("Value", typeof(INodeData));

            this.InputExecutionConnectors.Add(conExecute);
            this.InputConnectors.Add(conIn);
            this.OutputConnectors.Add(conOut);

            // State Values
            Value = null;

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #18
0
파일: Fork.cs 프로젝트: Nielk1/NekoPuppet
        public ForkNode()
            : base(ForkNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conExecuteIn = new ExecutionConnectorViewModel();
            conExecuteOut = new ExecutionConnectorViewModel();
            conIn = new ConnectorViewModel("Set", typeof(NodeDataBoolean));

            this.InputExecutionConnectors.Add(conExecuteIn);
            this.OutputExecutionConnectors.Add(conExecuteOut);
            this.InputConnectors.Add(conIn);

            // State Values
            Value = null;

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #19
0
파일: Fork.cs 프로젝트: Nielk1/NekoPuppet
        public ForkNode(JObject data, Guid[] executeIn, Guid[] executeOut, Guid[] dataIn, Guid[] dataOut)
            : base(ForkNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conExecuteIn = new ExecutionConnectorViewModel(executeIn[0]);
            conExecuteOut = new ExecutionConnectorViewModel(executeOut[0]);
            conIn = new ConnectorViewModel("Set", typeof(NodeDataBoolean), dataIn[0]);

            this.InputExecutionConnectors.Add(conExecuteIn);
            this.OutputExecutionConnectors.Add(conExecuteOut);
            this.InputConnectors.Add(conIn);

            // Set Name
            Name = (string)data["name"];

            // State Values
            //Value = (Double)data["value"]; // no way to serilize generic values yet

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #20
0
        // Load Data Constructor
        public EmoteSetVariableNode(JObject data, Guid[] executeIn, Guid[] executeOut, Guid[] dataIn, Guid[] dataOut)
        {
            // Prepare Connections
            conExecute = new ExecutionConnectorViewModel(executeIn[0]);
            inputValue = new ConnectorViewModel("Value", typeof(NodeDataNumeric), dataIn[0]);
            if (dataIn.Length > 1) // allow loading older node graph saves
            {
                inputFrameCount = new ConnectorViewModel("FrameCount", typeof(NodeDataNumeric), dataIn[1]);
                inputEasing = new ConnectorViewModel("Easing", typeof(NodeDataNumeric), dataIn[2]);
            }
            else
            {
                inputFrameCount = new ConnectorViewModel("FrameCount", typeof(NodeDataNumeric));
                inputEasing = new ConnectorViewModel("Easing", typeof(NodeDataNumeric));
            }

            this.InputExecutionConnectors.Add(conExecute);
            this.InputConnectors.Add(inputValue);
            this.InputConnectors.Add(inputFrameCount);
            this.InputConnectors.Add(inputEasing);

            // Set Name
            Name = (string)data["name"];

            // State Values
            value = (float)data["value"];
            frameCount = (float)data["frameCount"];
            easing = (float)data["easing"];
            varName = (string)data["varName"];

            // Create Dialog
            dlgEdit = new PropertyDialog();

            // Get Character Context
            charContext = CharacterContext.GetCharacterContext();
        }
예제 #21
0
        /// <summary>
        /// Called to query the application for feedback while the user is dragging the connection.
        /// </summary>
        public void QueryConnnectionFeedback(ConnectorViewModel draggedOutConnector, ConnectorViewModel draggedOverConnector, out object feedbackIndicator, out bool connectionOk)
        {
            if (draggedOutConnector == draggedOverConnector)
            {
                //
                // Can't connect to self!
                // Provide feedback to indicate that this connection is not valid!
                //
                feedbackIndicator = new ConnectionBadIndicator();
                connectionOk = false;
            }
            else
            {
                var sourceConnector = draggedOutConnector;
                var destConnector = draggedOverConnector;

                //
                // Only allow connections from output connector to input connector (ie each
                // connector must have a different type).
                // Also only allocation from one node to another, never one node back to the same node.
                //
                connectionOk = sourceConnector.ParentNode != destConnector.ParentNode &&
                                 sourceConnector.Type != destConnector.Type;

                if (connectionOk)
                {
                    //
                    // Yay, this is a valid connection!
                    // Provide feedback to indicate that this connection is ok!
                    //
                    feedbackIndicator = new ConnectionOkIndicator();
                }
                else
                {
                    //
                    // Connectors with the same connector type (eg input & input, or output & output)
                    // can't be connected.
                    // Only connectors with separate connector type (eg input & output).
                    // Provide feedback to indicate that this connection is not valid!
                    //
                    feedbackIndicator = new ConnectionBadIndicator();
                }
            }
        }
예제 #22
0
        /// <summary>
        /// Retrieve a connection between the two connectors.
        /// Returns null if there is no connection between the connectors.
        /// </summary>
        public ConnectionViewModel FindConnection(ConnectorViewModel connector1, ConnectorViewModel connector2)
        {
            Trace.Assert(connector1.Type != connector2.Type);

            //
            // Figure out which one is the source connector and which one is the
            // destination connector based on their connector types.
            //
            var sourceConnector = connector1.Type == ConnectorType.Output ? connector1 : connector2;
            var destConnector = connector1.Type == ConnectorType.Output ? connector2 : connector1;

            //
            // Now we can just iterate attached connections of the source
            // and see if it each one is attached to the destination connector.
            //

            foreach (var connection in sourceConnector.AttachedConnections)
            {
                if (connection.DestConnector == destConnector)
                {
                    //
                    // Found a connection that is outgoing from the source connector
                    // and incoming to the destination connector.
                    //
                    return connection;
                }
            }

            return null;
        }
예제 #23
0
        /// <summary>
        /// Called when the user has started to drag out a connector, thus creating a new connection.
        /// </summary>
        public ConnectionViewModel ConnectionDragStarted(ConnectorViewModel draggedOutConnector, Point curDragPoint)
        {
            //
            // Create a new connection to add to the view-model.
            //
            var connection = new ConnectionViewModel();

            if (draggedOutConnector.Type == ConnectorType.Output)
            {
                //
                // The user is dragging out a source connector (an output) and will connect it to a destination connector (an input).
                //
                connection.SourceConnector = draggedOutConnector;
                connection.DestConnectorHotspot = curDragPoint;
            }
            else
            {
                //
                // The user is dragging out a destination connector (an input) and will connect it to a source connector (an output).
                //
                connection.DestConnector = draggedOutConnector;
                connection.SourceConnectorHotspot = curDragPoint;
            }

            //
            // Add the new connection to the view-model.
            //
            this.Network.Connections.Add(connection);

            return connection;
        }
예제 #24
0
        /// <summary>
        /// Called when the user has finished dragging out the new connection.
        /// </summary>
        public void ConnectionDragCompleted(ConnectionViewModel newConnection, ConnectorViewModel connectorDraggedOut, ConnectorViewModel connectorDraggedOver)
        {
            if (connectorDraggedOver == null)
            {
                //
                // The connection was unsuccessful.
                // Maybe the user dragged it out and dropped it in empty space.
                //
                this.Network.Connections.Remove(newConnection);
                return;
            }

            //
            // Only allow connections from output connector to input connector (ie each
            // connector must have a different type).
            // Also only allocation from one node to another, never one node back to the same node.
            //
            bool connectionOk = connectorDraggedOut.ParentNode != connectorDraggedOver.ParentNode &&
                                connectorDraggedOut.Type != connectorDraggedOver.Type;

            if (!connectionOk)
            {
                //
                // Connections between connectors that have the same type,
                // eg input -> input or output -> output, are not allowed,
                // Remove the connection.
                //
                this.Network.Connections.Remove(newConnection);
                return;
            }

            //
            // The user has dragged the connection on top of another valid connector.
            //

            //
            // Remove any existing connection between the same two connectors.
            //
            var existingConnection = FindConnection(connectorDraggedOut, connectorDraggedOver);
            if (existingConnection != null)
            {
                this.Network.Connections.Remove(existingConnection);
            }

            //
            // Finalize the connection by attaching it to the connector
            // that the user dragged the mouse over.
            //
            if (newConnection.DestConnector == null)
            {
                newConnection.DestConnector = connectorDraggedOver;
            }
            else
            {
                newConnection.SourceConnector = connectorDraggedOver;
            }
        }
예제 #25
0
파일: Fork.cs 프로젝트: Nielk1/NekoPuppet
 public override object GetValue(ConnectorViewModel connector, object context)
 {
     return null;
 }
예제 #26
0
        public override object GetValue(ConnectorViewModel connector, object context)
        {
            if (conInput.IsConnected)
            {
                Cache cache;
                double retVal;
                if (context == null || !DataCache.TryGetValue(context, out cache))
                {
                    if (conInput.AttachedConnections.Count > 0)
                    {
                        retVal = 1;
                        conInput.AttachedConnections.Select(connection =>
                        {
                            object tmp = connection.SourceConnector.ParentNode.GetValue(connection.SourceConnector, context);
                            try { if (typeof(NodeDataNumeric).IsAssignableFrom(tmp.GetType())) return ((NodeDataNumeric)tmp).GetDouble(); } catch { }
                            return 0d;
                        }).ToList().ForEach(valItem =>
                        {
                            retVal *= valItem;
                        });
                    }
                    else
                    {
                        retVal = 0;
                    }
                    DataCache.Add(context, new Cache() { value = retVal });
                }
                else
                {
                    retVal = cache.value;
                }

                switch (CastToType)
                {
                    //case CastType.SByte:
                    //    return (SByte)retVal;
                    //case CastType.Int16:
                    //    return (Int16)retVal;
                    //case CastType.Int32:
                    //    return (Int32)retVal;
                    //case CastType.Int64:
                    //    return (Int64)retVal;
                    //case CastType.Byte:
                    //    return (Byte)retVal;
                    //case CastType.UInt16:
                    //    return (UInt16)retVal;
                    //case CastType.UInt32:
                    //    return (UInt32)retVal;
                    //case CastType.UInt64:
                    //    return (UInt64)retVal;
                    case CastType.Double:
                        return NodeDataNumeric.FromDouble(retVal);
                        //case CastType.Single:
                        //    return (Single)retVal;
                        //case CastType.Decimal:
                        //    return (Decimal)retVal;

                        //case CastType.IConvertable:
                        //    return enumeration.Sum(dr => dr);
                }
                return NodeDataNumeric.MakeZero();
            }
            return NodeDataNumeric.MakeZero();
        }
예제 #27
0
 public abstract object GetValue(ConnectorViewModel connector, object context);
예제 #28
0
        public XInputControllerDigitalNode(JObject data, Guid[] executeIn, Guid[] executeOut, Guid[] dataIn, Guid[] dataOut)
            : base(XInputControllerDigitalNodeFactory.TYPESTRING)
        {
            // Prepare Execution Connection
            conExecuted = new ExecutionConnectorViewModel(executeIn[0]);
            conExecute = new ExecutionConnectorViewModel(executeOut[0]);

            this.InputExecutionConnectors.Add(conExecuted);
            this.OutputExecutionConnectors.Add(conExecute);

            // Prepare Connections
            conDPadUp = new ConnectorViewModel("DPadUp", typeof(NodeDataBoolean), dataOut[0]);
            conDPadDown = new ConnectorViewModel("DPadDown", typeof(NodeDataBoolean), dataOut[1]);
            conDPadLeft = new ConnectorViewModel("DPadLeft", typeof(NodeDataBoolean), dataOut[2]);
            conDPadRight = new ConnectorViewModel("DPadRight", typeof(NodeDataBoolean), dataOut[3]);
            conStart = new ConnectorViewModel("Start", typeof(NodeDataBoolean), dataOut[4]);
            conBack = new ConnectorViewModel("Back", typeof(NodeDataBoolean), dataOut[5]);
            conLeftThumb = new ConnectorViewModel("LeftThumb", typeof(NodeDataBoolean), dataOut[6]);
            conRightThumb = new ConnectorViewModel("RightThumb", typeof(NodeDataBoolean), dataOut[7]);
            conLeftShoulder = new ConnectorViewModel("LeftShoulder", typeof(NodeDataBoolean), dataOut[8]);
            conRightShoulder = new ConnectorViewModel("RightShoulder", typeof(NodeDataBoolean), dataOut[9]);
            conA = new ConnectorViewModel("A", typeof(NodeDataBoolean), dataOut[10]);
            conB = new ConnectorViewModel("B", typeof(NodeDataBoolean), dataOut[11]);
            conX = new ConnectorViewModel("X", typeof(NodeDataBoolean), dataOut[12]);
            conY = new ConnectorViewModel("Y", typeof(NodeDataBoolean), dataOut[13]);

            this.OutputConnectors.Add(conDPadUp);
            this.OutputConnectors.Add(conDPadDown);
            this.OutputConnectors.Add(conDPadLeft);
            this.OutputConnectors.Add(conDPadRight);
            this.OutputConnectors.Add(conStart);
            this.OutputConnectors.Add(conBack);
            this.OutputConnectors.Add(conLeftThumb);
            this.OutputConnectors.Add(conRightThumb);
            this.OutputConnectors.Add(conLeftShoulder);
            this.OutputConnectors.Add(conRightShoulder);
            this.OutputConnectors.Add(conA);
            this.OutputConnectors.Add(conB);
            this.OutputConnectors.Add(conX);
            this.OutputConnectors.Add(conY);

            // Set Name
            Name = (string)data["name"];

            // State Values
            if (!Enum.TryParse<UserIndex>((string)data["currentUser"], out currentUser)) currentUser = UserIndex.One;
            controller = new SharpDX.XInput.Controller(currentUser);

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #29
0
        public override object GetValue(ConnectorViewModel connector, object context)
        {
            switch (CastToType)
            {
                //case CastType.SByte:
                //    return (SByte)retVal;
                //case CastType.Int16:
                //    return (Int16)retVal;
                //case CastType.Int32:
                //    return (Int32)retVal;
                //case CastType.Int64:
                //    return (Int64)retVal;
                //case CastType.Byte:
                //    return (Byte)retVal;
                //case CastType.UInt16:
                //    return (UInt16)retVal;
                //case CastType.UInt32:
                //    return (UInt32)retVal;
                //case CastType.UInt64:
                //    return (UInt64)retVal;
                case CastType.Double:
                    return NodeDataNumeric.FromDouble(Value);
                    //case CastType.Single:
                    //    return (Single)retVal;
                    //case CastType.Decimal:
                    //    return (Decimal)retVal;

                    //case CastType.IConvertable:
                    //    return enumeration.Sum(dr => dr);
            }
            return NodeDataNumeric.MakeZero();
        }
예제 #30
0
 public override object GetValue(ConnectorViewModel connector, object context)
 {
     if (controller.IsConnected && cState.HasValue)
     {
         if (conDPadUp == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.DPadUp));
         if (conDPadDown == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.DPadDown));
         if (conDPadLeft == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.DPadLeft));
         if (conDPadRight == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.DPadRight));
         if (conStart == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.Start));
         if (conBack == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.Back));
         if (conLeftThumb == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.LeftThumb));
         if (conRightThumb == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.RightThumb));
         if (conLeftShoulder == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.LeftShoulder));
         if (conRightShoulder == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.RightShoulder));
         if (conA == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.A));
         if (conB == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.B));
         if (conX == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.X));
         if (conY == connector)
             return NodeDataBoolean.FromBoolean(cState.Value.Gamepad.Buttons.HasFlag(GamepadButtonFlags.Y));
     }
     return null;
 }