예제 #1
0
 public override bool Equals(object other)
 {
     if (typeof(INodeDataBoolean).IsAssignableFrom(other.GetType()))
     {
         INodeDataBoolean objTmp = (INodeDataBoolean)other;
         return(objTmp.GetBool() == this.GetBool());
     }
     return(false);
 }
예제 #2
0
        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();
        }
예제 #3
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();
        }
예제 #4
0
        public override void Execute(object context)
        {
            if (conIn.IsConnected)
            {
                object newContext = new object(); // new exuction node, new execution context
                Value = conIn.AttachedConnections.Select(connection =>
                {
                    try
                    {
                        object tmp = connection.SourceConnector.ParentNode.GetValue(connection.SourceConnector, context);
                        if (typeof(INodeDataBoolean).IsAssignableFrom(tmp.GetType()))
                        {
                            return((INodeDataBoolean)tmp);
                        }
                        return(null);
                    }
                    catch
                    {
                        return(null);
                    }
                }).Where(val => val != null).FirstOrDefault();
            }
            else
            {
                Value = null;
            }
            OnPropertyChanged("Note");

            if (Value != null && Value.GetBool())
            {
                foreach (ExecutionConnectionViewModel con in this.AttachedExecutionConnections)
                {
                    if (con.SourceConnector != null &&
                        con.SourceConnector.ParentNode == this &&
                        con.DestConnector != null &&
                        con.DestConnector.ParentNode != null)
                    {
                        con.DestConnector.ParentNode.Execute(new object());
                    }
                }
            }
        }
예제 #5
0
 public int CompareTo(object obj)
 {
     if (typeof(INodeDataBoolean).IsAssignableFrom(obj.GetType()))
     {
         INodeDataBoolean objTmp = (INodeDataBoolean)obj;
         if (objTmp.GetBool() == this.GetBool())
         {
             return(0);
         }
         if (objTmp.GetBool())
         {
             return(-1);
         }
         if (this.GetBool())
         {
             return(1);
         }
     }
     throw new ArgumentException("Could not compare values");
 }
예제 #6
0
파일: Fork.cs 프로젝트: Nielk1/NekoPuppet
        public override void Execute(object context)
        {
            if (conIn.IsConnected)
            {
                object newContext = new object(); // new exuction node, new execution context
                Value = conIn.AttachedConnections.Select(connection =>
                {
                    try
                    {
                        object tmp = connection.SourceConnector.ParentNode.GetValue(connection.SourceConnector, context);
                        if (typeof(INodeDataBoolean).IsAssignableFrom(tmp.GetType())) return (INodeDataBoolean)tmp;
                        return null;
                    }
                    catch
                    {
                        return null;
                    }
                }).Where(val => val != null).FirstOrDefault();
            }
            else
            {
                Value = null;
            }
            OnPropertyChanged("Note");

            if(Value != null && Value.GetBool())
            foreach (ExecutionConnectionViewModel con in this.AttachedExecutionConnections)
            {
                if (con.SourceConnector != null &&
                    con.SourceConnector.ParentNode == this &&
                    con.DestConnector != null &&
                    con.DestConnector.ParentNode != null)
                {
                    con.DestConnector.ParentNode.Execute(new object());
                }
            }
        }