public ConstantReadNode(string serializedValue, string type) : base(NodeType.ConstantRead, UniqueId.NewId())
        {
            Name  = $"Constant - {type}";
            Color = HashColorConverter.GetColor(type);

            OutputPins.Add(new TypeOutputPin(PinId.NewId(NodeId, PinType.Output, 0), serializedValue, type));
        }
        public VariableGetNode(string variable, string type) : base(NodeType.VariableGet, UniqueId.NewId())
        {
            Name  = $"Get Variable - {type}";
            Color = HashColorConverter.GetColor(type);

            OutputPins.Add(new TypeOutputPin(PinId.NewId(NodeId, PinType.Output, 0), variable, type));
        }
        public CExecuteInterfaceFunctionNode(CKlaxScriptInterfaceFunction targetFunction)
        {
            TargetFunctionGuid = targetFunction.Guid;

            Name = targetFunction.Name;

            CExecutionPin inPin = new CExecutionPin("In");

            InExecutionPins.Add(inPin);

            CExecutionPin execPin = new CExecutionPin("Next");

            OutExecutionPins.Add(execPin);

            CInputPin targetInput = new CInputPin("Target", typeof(CEntity));

            InputPins.Add(targetInput);

            foreach (var inputParameter in targetFunction.InputParameters)
            {
                CInputPin input = new CInputPin(inputParameter.Name, inputParameter.Type);
                InputPins.Add(input);
            }

            foreach (var returnParameter in targetFunction.OutputParameters)
            {
                COutputPin output = new COutputPin(returnParameter.Name, returnParameter.Type);
                OutputPins.Add(output);
            }
        }
        public CSelfReferenceNode()
        {
            IsImplicit = true;
            Name       = "Self Reference";

            OutputPins.Add(new COutputPin("Self", typeof(CEntity)));
        }
        public CExecuteCustomFunctionNode(CCustomFunctionGraph functionGraph)
        {
            TargetFunctionGuid = functionGraph.Guid;

            Name = functionGraph.Name;

            CExecutionPin inPin = new CExecutionPin("In");

            InExecutionPins.Add(inPin);

            CExecutionPin execPin = new CExecutionPin("Next");

            OutExecutionPins.Add(execPin);

            foreach (var inputParameter in functionGraph.InputParameters)
            {
                CInputPin input = new CInputPin(inputParameter.Name, inputParameter.Type);
                InputPins.Add(input);
            }

            foreach (var returnParameter in functionGraph.OutputParameters)
            {
                COutputPin output = new COutputPin(returnParameter.Name, returnParameter.Type);
                OutputPins.Add(output);
            }
        }
Exemple #6
0
        /// <summary>
        /// Create a new subnode from a serialized graph
        /// </summary>
        /// <param name="buffer"></param>
        public DaggerSubNode(string name, byte[] buffer)
            : base()
        {
            MemoryStream    ms         = new MemoryStream(buffer);
            BinaryFormatter bformatter = new BinaryFormatter();

            _subNodeGraph = (DaggerGraph)bformatter.Deserialize(ms);
            _subNodeName  = name;
            _subNodeGraph._parentSubNode = this;

            // reflect imported/exported pins to input/output pins
            foreach (DaggerOutputPin pin in _subNodeGraph.ImportedPins)
            {
                DaggerInputPin inpin = new DaggerInputPin();
                inpin.Name     = pin.Name;
                inpin.DataType = pin.DataType;
                InputPins.Add(inpin);
            }
            foreach (DaggerInputPin pin in _subNodeGraph.ExportedPins)
            {
                DaggerOutputPin outpin = new DaggerOutputPin();
                outpin.Name     = pin.Name;
                outpin.DataType = pin.DataType;
                OutputPins.Add(outpin);
            }

            AssociatedUINode = "IDaggerUISubNode";
        }
Exemple #7
0
        public InteractNode() : base(NodeType.Interact, UniqueId.NewId())
        {
            Name  = "Interact";
            Color = 0xFF_32cd32;

            OutputPins.Add(new FlowOutputPin(PinId.NewId(NodeId, PinType.Output, 0), string.Empty));
        }
Exemple #8
0
        protected NodePin <T> AddOutputPin <T>(string name)
        {
            var pin = new NodePin <T>(name, Pins.Count, this);

            RegisterPin(pin);
            OutputPins.Add(pin);
            return(pin);
        }
Exemple #9
0
        protected NodePin <NodePinTypeExecute> AddExecuteOutPin(string name = "Out")
        {
            var pin = new NodePin <NodePinTypeExecute>(name, Pins.Count, this);

            RegisterPin(pin);
            OutputPins.Add(pin);
            return(pin);
        }
        public NpcDialogueNode() : base(NodeType.NpcDialogue, UniqueId.NewId())
        {
            Name  = "NPC Dialogue";
            Color = 0xFF_9370db;

            InputPins.Add(new FlowInputPin(PinId.NewId(NodeId, PinType.Input, 0)));

            OutputPins.Add(new FlowOutputPin(PinId.NewId(NodeId, PinType.Output, 0), string.Empty));
        }
        public TriggerEventNode(string eventName) : base(NodeType.TriggerEvent, UniqueId.NewId())
        {
            Name  = "Trigger Event";
            Color = 0xFF_bdb76b;

            InputPins.Add(new FlowInputPin(PinId.NewId(NodeId, PinType.Input, 0)));

            OutputPins.Add(new FlowOutputPin(PinId.NewId(NodeId, PinType.Output, 0), eventName));
        }
        protected override void OnSourceVariableChanged()
        {
            OutputPins.Clear();

            Name = "Get " + SourceVariable.Name;

            COutputPin output = new COutputPin(SourceVariable.Name, SourceVariable.Type);

            OutputPins.Add(output);
        }
Exemple #13
0
        public VariableSetNode(string variable, string type) : base(NodeType.VariableSet, UniqueId.NewId())
        {
            Name  = $"Set Variable - {type}";
            Color = HashColorConverter.GetColor(type);

            InputPins.Add(new FlowInputPin(PinId.NewId(NodeId, PinType.Input, 0)));
            InputPins.Add(new TypeInputPin(PinId.NewId(NodeId, PinType.Input, 1), variable, type));

            OutputPins.Add(new FlowOutputPin(PinId.NewId(NodeId, PinType.Output, 0), string.Empty));
        }
        public BranchNode() : base(NodeType.Branch, UniqueId.NewId())
        {
            Name  = "Branch";
            Color = 0xFF_ff8c00;

            InputPins.Add(new FlowInputPin(PinId.NewId(NodeId, PinType.Input, 0)));
            InputPins.Add(new TypeInputPin(PinId.NewId(NodeId, PinType.Input, 1), "Condition", "Z"));

            OutputPins.Add(new FlowOutputPin(PinId.NewId(NodeId, PinType.Output, 0), "True"));
            OutputPins.Add(new FlowOutputPin(PinId.NewId(NodeId, PinType.Output, 1), "False"));
        }
        public CComponentVariableNode(CEntityComponent targetComponent)
        {
            IsImplicit = true;

            Name = "Get " + targetComponent.Name;
            ComponentTargetGuid = targetComponent.ComponentGuid;

            COutputPin output = new COutputPin(targetComponent.Name, targetComponent.GetType());

            OutputPins.Add(output);
        }
Exemple #16
0
        public CImplicitCastNode()
        {
            IsImplicit = true;

            COutputPin successOutput = new COutputPin
            {
                Name = "Success",
                Type = typeof(bool)
            };

            OutputPins.Add(successOutput);
        }
        public DaggerTypeConstantNode(Type constantType)
        {
            inpin          = new DaggerInputPin();
            inpin.DataType = constantType;
            inpin.Name     = "Constant Input";
            InputPins.Add(inpin);

            outpin          = new DaggerOutputPin();
            outpin.DataType = constantType;
            OutputPins.Add(outpin);

            AssociatedUINode = typeof(TypeConstantNodeUI);
            DoProcessing    += new ProcessHandler(DaggerTypeConstantNode_DoProcessing);
        }
        protected override void OnSourceVariableChanged()
        {
            OutputPins.Clear();
            InputPins.Clear();

            Name = "Set " + SourceVariable.Name;

            CInputPin input = new CInputPin(SourceVariable.Name, SourceVariable.Type);

            InputPins.Add(input);

            COutputPin output = new COutputPin("NewValue", SourceVariable.Type);

            OutputPins.Add(output);
        }
Exemple #19
0
 public InTerminal()
     : base()
 {
     logic_element = new LogicCircuitSimulator.InTerminal();
     OutputPins.Add(new Visual.Pin(this, PinSide.OUTPUT, 0));
     g_circuit.AddElement(logic_element);
     image_data  = new ConnectableImages.ITERM();
     picture_box = new System.Windows.Forms.PictureBox
     {
         Name     = elements.Count.ToString(),
         Location = new Point(100, 200),
         Size     = new Size(20, 5),
         Image    = image_data.Image
     };
 }
Exemple #20
0
        public void Deserialize(BinaryReader reader)
        {
            Id       = reader.ReadInt32();
            GroupId  = reader.ReadInt32();
            Category = (NodeCategory)reader.ReadInt32();
            Type     = reader.ReadString();
            Name     = reader.ReadString();
            var hasValue = reader.ReadBoolean();

            if (hasValue)
            {
                Value = reader.ReadString();
            }

            var pinsCount = reader.ReadInt32();

            for (var i = 0; i < pinsCount; i++)
            {
                var pin = new Pin();
                pin.Deserialize(reader);
                EnterPins.Add(pin);
            }

            pinsCount = reader.ReadInt32();
            for (var i = 0; i < pinsCount; i++)
            {
                var pin = new PinWithConnection();
                pin.Deserialize(reader);
                InputPins.Add(pin);
            }

            pinsCount = reader.ReadInt32();
            for (var i = 0; i < pinsCount; i++)
            {
                var pin = new PinWithConnection();
                pin.Deserialize(reader);
                ExitPins.Add(pin);
            }

            pinsCount = reader.ReadInt32();
            for (var i = 0; i < pinsCount; i++)
            {
                var pin = new Pin();
                pin.Deserialize(reader);
                OutputPins.Add(pin);
            }
        }
Exemple #21
0
        public CFunctionGraphEntryNode(List <CKlaxVariable> inputParameters)
        {
            AllowDelete = false;
            AllowCopy   = false;

            Name = "Entry";

            CExecutionPin execPin = new CExecutionPin("Next");

            OutExecutionPins.Add(execPin);

            foreach (var inputParameter in inputParameters)
            {
                COutputPin output = new COutputPin(inputParameter.Name, inputParameter.Type);
                OutputPins.Add(output);
            }
        }
Exemple #22
0
        protected NodePin AddPin(string name, Type type, bool isOutput)
        {
            var classType = typeof(NodePin <>).MakeGenericType(type);
            var pin       = Activator.CreateInstance(classType, name, Pins.Count, this) as NodePin;

            RegisterPin(pin);

            if (isOutput)
            {
                OutputPins.Add(pin);
            }
            else
            {
                InputPins.Add(pin);
            }

            return(pin);
        }
        protected override void OnTargetFieldChanged()
        {
            if (TargetField == null)
            {
                throw new NullReferenceException("Target Field cannot be null as this would make the node invalid");
            }
            InputPins.Clear();
            OutputPins.Clear();

            CInputPin targetObjectInput = new CInputPin("Target", TargetField.DeclaringType);

            InputPins.Add(targetObjectInput);

            Name = "Get " + TargetField.Name;

            COutputPin outputPin = new COutputPin(TargetField.Name, TargetField.FieldType);

            OutputPins.Add(outputPin);
        }
        /// <summary>
        /// Deserialization Constructor
        /// </summary>
        /// <param name="info"></param>
        /// <param name="ctxt"></param>
        protected DaggerTypeConstantNode(SerializationInfo info, StreamingContext ctxt)
            : base(info, ctxt)
        {
            if (info == null)
            {
                throw new System.ArgumentNullException("info");
            }

            DataType = (Type)info.GetValue("DataType", typeof(Type));

            inpin = (DaggerInputPin)info.GetValue("InPin", typeof(DaggerInputPin));
            InputPins.Add(inpin);

            outpin = (DaggerOutputPin)info.GetValue("OutPin", typeof(DaggerOutputPin));
            OutputPins.Add(outpin);

            AssociatedUINode = typeof(TypeConstantNodeUI);
            DoProcessing    += new ProcessHandler(DaggerTypeConstantNode_DoProcessing);
        }
 public NodeViewModel(ScriptViewModel script, ScriptNode node)
 {
     Script = script;
     Node   = node;
     _name  = node.Name;
     _value = node.Value;
     foreach (var pin in node.InputPins)
     {
         InputPins.Add(new InputPinViewModel(this, pin));
     }
     foreach (var pin in node.OutputPins)
     {
         OutputPins.Add(new OutputPinViewModel(this, pin));
     }
     foreach (var pin in node.EnterPins)
     {
         EnterPins.Add(new EnterPinViewModel(this, pin));
     }
     foreach (var pin in node.ExitPins)
     {
         ExitPins.Add(new ExitPinViewModel(this, pin));
     }
     MenuItems.Add(new MenuItemViewModel {
         Header = "Copy", Command = CopyThis
     });
     MenuItems.Add(new MenuItemViewModel {
         Header = "Duplicate", Command = DuplicateThis
     });
     MenuItems.Add(new MenuItemViewModel {
         Header = "Cut", Command = CutThis
     });
     MenuItems.Add(new MenuItemViewModel {
         Header = "Delete", Command = DeleteThis
     });
     //MenuItems.Add(new MenuItemViewModel { Header = "-" });
     MenuItems.Add(new MenuItemViewModel {
         Header = "Group", Command = GroupThis
     });
     MenuItems.Add(new MenuItemViewModel {
         Header = "Ungroup", Command = UngroupThis
     });
 }
Exemple #26
0
        /// <summary>
        /// Creates a pin with the specified configuration
        /// </summary>
        /// <param name="pinType">The type of pin (input / output)</param>
        /// <param name="position">The position of the pin, relative to the node bounds</param>
        /// <param name="boundsOffset">The bounds of the pin, relative to the position</param>
        /// <param name="tangent">The tangent of the pin.  Links connected to the pin would come out from this direction</param>
        protected void CreatePin(GraphPinType pinType, Vector2 position, Rect boundsOffset, Vector2 tangent)
        {
            var pin = CreateInstance <GraphPin>();

            pin.PinType      = pinType;
            pin.Node         = this;
            pin.Position     = position;
            pin.BoundsOffset = boundsOffset;
            pin.Tangent      = tangent;
            if (pinType == GraphPinType.Input)
            {
                pin.name = this.name + "_InputPin";
                InputPins.Add(pin);
            }
            else
            {
                pin.name = this.name + "_OutputPin";
                OutputPins.Add(pin);
            }
        }
Exemple #27
0
 public void RebuildNode(List <CKlaxVariable> inputParameters)
 {
     // Adjust the nodes output pins to the new input parameters
     // Note the editor has to take care of adjusting pin connections
     if (inputParameters.Count >= OutputPins.Count)
     {
         for (int i = 0; i < inputParameters.Count; i++)
         {
             CKlaxVariable inputParameter = inputParameters[i];
             if (OutputPins.Count > i)
             {
                 COutputPin pin = OutputPins[i];
                 pin.Name = inputParameter.Name;
                 pin.Type = inputParameter.Type;
             }
             else
             {
                 OutputPins.Add(new COutputPin(inputParameter.Name, inputParameter.Type));
             }
         }
     }
     else
     {
         for (int i = OutputPins.Count - 1; i >= 0; i--)
         {
             if (inputParameters.Count > i)
             {
                 CKlaxVariable inputParameter = inputParameters[i];
                 COutputPin    pin            = OutputPins[i];
                 pin.Name = inputParameter.Name;
                 pin.Type = inputParameter.Type;
             }
             else
             {
                 OutputPins.RemoveAt(i);
             }
         }
     }
     RaiseNodeRebuildEvent();
 }
        public CForEachLoopNode()
        {
            Name = "Foreach Loop";

            CExecutionPin execute = new CExecutionPin()
            {
                Name       = "In",
                TargetNode = null
            };

            InExecutionPins.Add(execute);

            CExecutionPin breakExec = new CExecutionPin()
            {
                Name       = "Break",
                TargetNode = null
            };

            InExecutionPins.Add(breakExec);

            CExecutionPin loop = new CExecutionPin()
            {
                Name       = "Loop",
                TargetNode = null
            };

            OutExecutionPins.Add(loop);
            CExecutionPin done = new CExecutionPin()
            {
                Name       = "Done",
                TargetNode = null
            };

            OutExecutionPins.Add(done);

            InputPins.Add(new CInputPin("List", typeof(IList)));

            OutputPins.Add(new COutputPin("Index", typeof(int)));
            OutputPins.Add(new COutputPin("Element", typeof(object)));
        }
        /// <summary>
        /// Adds gate with coords in work area; 'registers' all its pins to allow selection and connection.
        /// </summary>
        /// <param name="gvmwc"></param>
        public void AddGate(GateViewModelWithCoordinates gvmwc)
        {
            if (gvmwc.gateViewModel.Name == "SOURCE" || gvmwc.gateViewModel.Name == "READER")
            {
                gvmwc.gateViewModel.ShowBottomLabels   = true;
                gvmwc.gateViewModel.NumberLabelVisible = true;
            }

            GateList.Add(gvmwc);

            if (gvmwc.gateViewModel.Name == "SOURCE" || gvmwc.gateViewModel.Name == "READER")
            {
                Renumber();
            }

            foreach (PinViewModel p in gvmwc.gateViewModel.inputPins)
            {
                InputPins.Add(p);
            }

            OutputPins.Add(gvmwc.gateViewModel.outputPin);
        }
Exemple #30
0
        internal void OnDeserializedMethod(StreamingContext ctxt)
        {
            if (_isDeserialized)
            {
                return;
            }

            foreach (DaggerInputPin pin in inputpins)
            {
                InputPins.Add(pin);
            }

            foreach (DaggerOutputPin pin in outputpins)
            {
                OutputPins.Add(pin);
            }

            // associate the subNodeGraph with this subNode
            _subNodeGraph._parentSubNode = this;

            _isDeserialized = true;
        }