Ejemplo n.º 1
0
        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);
            }
        }
        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);
            }
        }
Ejemplo n.º 4
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));
        }
        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));
        }
Ejemplo n.º 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";
        }
        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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 10
0
 public Pin ResolveOutputPin(Connection connection)
 {
     if (connection.NodeId != Id)
     {
         throw new InvalidOperationException("Wrong node Uid");
     }
     return(OutputPins.FirstOrDefault(_ => _.Id == connection.PinId));
 }
        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));
        }
Ejemplo n.º 13
0
 protected void RemoveOutputPin(int pinIndex)
 {
     if (pinIndex <= OutputPins.Count && OutputPins.Count > 0)
     {
         NodeEditor.Logger.Log <Node>("Remove output pin.");
         var pin = OutputPins[pinIndex];
         RemovePin(pin);
         OutputPins.Remove(pin);
     }
 }
Ejemplo n.º 14
0
        public void Initialize(NodeData data)
        {
            Name     = data.Name;
            ID       = data.ID;
            Position = data.Position;

            InputPins.Clear();  // TEMP!
            OutputPins.Clear(); // TEMP!
            OnInitialize();
        }
Ejemplo n.º 15
0
        protected override void OnSourceVariableChanged()
        {
            OutputPins.Clear();

            Name = "Get " + SourceVariable.Name;

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

            OutputPins.Add(output);
        }
Ejemplo n.º 16
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));
        }
Ejemplo n.º 17
0
        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);
        }
Ejemplo n.º 19
0
        public CImplicitCastNode()
        {
            IsImplicit = true;

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

            OutputPins.Add(successOutput);
        }
Ejemplo n.º 20
0
        public ComlinkNode(NodeType nodeType, UniqueId id, float x, float y, uint color, string name, IEnumerable <IInputPin> inputPins, IEnumerable <IOutputPin> outputPins,
                           IEnumerable <Connection> connections) : this(nodeType, id)
        {
            X     = x;
            Y     = y;
            Color = color;
            Name  = name;

            InputPins.AddRange(inputPins);
            OutputPins.AddRange(outputPins);
            Connections.AddRange(connections);
        }
Ejemplo n.º 21
0
        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);
        }
Ejemplo n.º 22
0
        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);
        }
Ejemplo n.º 23
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
     };
 }
Ejemplo n.º 24
0
        public SchemeState(Topology.Topology topology)
        {
            Gates = topology.Gates.ToDictionary(x => x, x => new GateState(x, false));
            Nodes = topology.Nodes.ToDictionary(x => x, x => new NodeState(x, false));

            InputPins  = topology.Pins.Where(x => !x.IsOutputPin).ToArray();
            OutputPins = topology.Pins.Where(x => x.IsOutputPin).ToArray();

            PinNodes = topology.Pins.ToDictionary(
                p => p,
                p => (IReadOnlyList <SchemeNode>)topology.Nodes.Where(n => n.Pins.Contains(p)).ToArray());

            InputPinStates            = InputPins.ToDictionary(x => x, x => new PinState(x, false, x.ValuesFunction.Begin(topology.ValuesFunctions)));
            OutputPinStates           = OutputPins.ToDictionary(x => x, x => new PinState(x, false, x.ValuesFunction.Begin(topology.ValuesFunctions)));
            GeneratedOutputPinsStates = OutputPins.ToDictionary(x => x, _ => false);
        }
Ejemplo n.º 25
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);
            }
        }
Ejemplo n.º 26
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);
            }
        }
Ejemplo n.º 27
0
        void RemovePin(NodePin pin)
        {
            Pins.Remove(pin);

            if (pin.IsInput)
            {
                InputPins.Remove(pin);
            }
            else
            {
                OutputPins.Remove(pin);
            }

            PinRemoved.InvokeSafe(pin);
            pin.Connected -= OnPinConnected;
            TriggerChange();
        }
Ejemplo n.º 28
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);
        }
        public ScriptNode Build()
        {
            var node = new ScriptNode();

            node.Type = Type;
            node.Name = Name;
            if (OutputTypes.Any())
            {
                node.Category = NodeCategory.Function;
            }
            else
            {
                node.Category = NodeCategory.Result;
            }
            node.InputPins.AddRange(InputPins.Select(_ => _.Clone()));
            node.OutputPins.AddRange(OutputPins.Select(_ => _.Clone()));
            return(node);
        }
Ejemplo n.º 30
0
        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);
        }