public override Node Create(Vector2 pos) { //GUITestNode node = CreateInstance<GUITestNode>(); var sIn = new SocketIn(); sIn.ID = 0; sIn.Create(this, new TypeData(new FloatType()));// Inputs.Add(sIn); sIn = new SocketIn(); sIn.ID = 1; sIn.Create(this, new TypeData(new Vector3Type()));//, new TypeData(new FloatType()) Inputs.Add(sIn); var sOut = new SocketOut(); sOut.ID = 2; sOut.Create(this, new TypeData(new FloatType()));//, new TypeData(new FloatType()) Outputs.Add(sOut); sOut = new SocketOut(); sOut.ID = 3; sOut.Create(this, new TypeData(new Vector3Type()));//, new TypeData(new FloatType()) Outputs.Add(sOut); rect = new Rect(pos.x, pos.y, 155, (Inputs.Count + Outputs.Count) * GUIx.I.socketStyle.fixedHeight + 20 + 24); return this; }
public NodeChar(Point location) { StartNode = true; Location = location; _outputChar = new SocketOut(typeof(char), "Output char", this); Name = "Sample Char"; NodeType = this.GetType().ToString().Split('.').Last(); Description = "This node provides sample char: \"" + DefaultOutputValue + "\"."; BaseColor = Color.FromArgb(CommonStates.NodeColorAlpha, 31, 36, 42); HeaderColor = Color.FromArgb(62, 88, 140); FooterHeight = 25; Sockets.Add(_outputChar); }
public NodeLogicOutput(Point location) { StartNode = true; Location = location; _outputH = new SocketOut(typeof(bool), "Output H", this); _outputL = new SocketOut(typeof(bool), "Output L", this); Name = "Logic Output"; NodeType = this.GetType().ToString().Split('.').Last(); Description = "This node provides logic state H or L."; BaseColor = Color.FromArgb(CommonStates.NodeColorAlpha, 31, 36, 42); HeaderColor = Color.FromArgb(66, 74, 84); Sockets.Add(_outputH); Sockets.Add(_outputL); }
// main constructor public MathNumNode(Point location) { StartNode = true; Location = location; _output = new SocketOut(typeof(double), "Number out", this); Name = "Number Generator"; NodeType = GetType().ToString().Split('.').Last(); Description = "This node generates integer."; BaseColor = Color.FromArgb(CommonStates.NodeColorAlpha, 31, 36, 42); HeaderColor = Color.FromArgb(62, 88, 140); FooterHeight = 25f; _output.UpdateValue(DefaultOutputValue); Sockets.Add(_output); }
// main constructor public MathAvgNode(Point location) { Location = location; _numberHub = new SocketIn(typeof(double), "Numbers", this, true); _result = new SocketOut(typeof(double), "Result", this); Name = "Number Average"; NodeType = GetType().ToString().Split('.').Last(); Description = "This node calculates the average of the numbers on the input."; BaseColor = Color.FromArgb(CommonStates.NodeColorAlpha, 31, 36, 42); HeaderColor = Color.FromArgb(62, 88, 140); _result.UpdateValue(0d); Sockets.Add(_numberHub); Sockets.Add(_result); }
public void Connect(SocketOut from, SocketIn to) { Wire wire = null; try { wire = new Wire(from, to); to.Connect(wire); from.Connect(wire); _connections.Add(wire); wire.Flow(); } catch (Exception e) { wire?.Disconnect(); Console.WriteLine(e); } ValidateConnections(); }
public NodeLogicOscillator(Point location) { StartNode = true; Location = location; _output = new SocketOut(typeof(bool), "Output", this); Name = "Logic Output"; NodeType = GetType().ToString().Split('.').Last(); Description = "DON'T USE THIS ONE. Takes focus from property grid."; BaseColor = Color.FromArgb(CommonStates.NodeColorAlpha, 31, 36, 42); HeaderColor = Color.FromArgb(66, 74, 84); FooterHeight = 20; _timer.Interval = 1000; _timer.Enabled = false; _timer.Tick += ((sender, args) => Time()); Sockets.Add(_output); }
// main constructor public MathSumNode(Point location) { Location = location; _numberA = new SocketIn(typeof(double), "Number A", this, false); _numberB = new SocketIn(typeof(double), "Number B", this, false); _resultOut = new SocketOut(typeof(double), "Result", this); Name = "Sample Node"; NodeType = GetType().ToString().Split('.').Last(); Description = "This node encodes string on input with XOR function."; BaseColor = Color.FromArgb(CommonStates.NodeColorAlpha, 31, 36, 42); HeaderColor = Color.FromArgb(62, 88, 140); _resultOut.UpdateValue(0d); Sockets.Add(_numberA); Sockets.Add(_numberB); Sockets.Add(_resultOut); }
public NodeStringXOR(Point location) { Location = location; _inputString = new SocketIn(typeof(string), "Input string", this, false); _inputKey = new SocketIn(typeof(char), "Input key", this, false); _inputEnabled = new SocketIn(typeof(bool), "Input enabled", this, false); _outputString = new SocketOut(typeof(string), "Output string", this); Name = "String XOR"; NodeType = GetType().ToString().Split('.').Last(); Description = "This node encodes string on input with XOR function."; BaseColor = Color.FromArgb(CommonStates.NodeColorAlpha, 31, 36, 42); HeaderColor = Color.FromArgb(61, 115, 99); _outputString.UpdateValue(DefaultOutputValue); Sockets.Add(_inputString); Sockets.Add(_inputKey); Sockets.Add(_inputEnabled); Sockets.Add(_outputString); }
public static bool IsDoubleConnection(SocketIn inSocket, SocketOut outSocket) { for (int i = 0; i < inSocket.connections.Count; i++) { if (inSocket.connections[i].startSocket == outSocket) return true; } return false; }