/// <summary> remove last value input pin</summary> public virtual void RemovePin() { if (multiplePins && valInPins.Count > 2) { ValueInputPin pin = valInPins[valInPins.Count - 1]; valInPins.Remove(pin); RemoveConnection(pin); Resize(); } }
/// <summary> If choice node, removes last choice from the control. /// minimum of 3 value inputs </summary> public override void RemovePin() { if (multiplePins && valInPins.Count > 2) { ValueInputPin iP = valInPins[valInPins.Count - 1]; valInPins.Remove(iP); RemoveConnection(iP); ExecOutputPin oP = execOutPins[execOutPins.Count - 1]; execOutPins.Remove(oP); RemoveConnection(oP); Resize(); } }
/// <summary> /// Build pins for node /// </summary> /// <param name="title"></param> public void Construct(OpType type, VarType nT, int inCount) { base.SetName(GetTitle(type)); op = type; // set description switch (type) { case OpType.Add: description = "Adds all input nodes. Unconnected nodes are not applied from the top. " + "If nothing is connected, the default value is 0."; name = "Addition Function"; splashText = "+"; break; case OpType.Subtract: description = "Subtracts all input nodes from the first connected input from the top. " + "If nothing is connected, the default value is 0."; name = "Subtraction Function"; splashText = "-"; break; case OpType.Multiply: description = "Multiplies all input nodes to the first connected input from the top. " + "If nothing is connected, the default value is 0."; name = "Multiplication Function"; splashText = "X"; break; case OpType.Divide: description = "Divides the first connected input by all succeeding input. If nothing is connected, " + "the default value is 0. Avoids dividing by 0"; name = "Division Function"; splashText = "/"; break; case OpType.Abs: description = "Calculates the absolute value of the input node. Defaults to 0 if nothing is connected."; name = "Absolute Value Function"; splashText = "ABS"; break; case OpType.SQRT: description = "Calculates the square root of the input node. Defaults to 0 if nothing is connected."; name = "Squareroot Function"; splashText = "SQRT"; break; case OpType.Not: description = "Logically negates input node. Defaults to false if nothing is connected."; name = "Logical Negation"; splashText = "NOT"; break; case OpType.And: description = "Performs AND on each subsequent connected input node. Defaults to false if nothing is connected."; name = "Boolean AND Function"; splashText = "AND"; break; case OpType.Or: description = "Performs OR on each subsequent connected input node. Defaults to false if nothing is connected."; name = "Boolean OR Function"; splashText = "OR"; break; case OpType.Xor: description = "Performs XOR on each subsequent connected input node. Defaults to false if nothing is connected."; name = "Boolean XOR Function"; splashText = "XOR"; break; case OpType.POW: description = "Calculates the first value to the power of the second. Second value defaults to 2 if not connected." + " First value defaults to 0. If nothing is connected, the default output is 0."; name = "Power Function"; splashText = "^"; break; case OpType.EqualTo: description = "Compares equality between values."; name = "Equal To"; break; case OpType.GreaterThan: description = "Compares if first value is greater than the second."; name = "Greater Than"; break; case OpType.GreaterOrEqual: description = "Compares if first value is greater than or equal to the second.."; name = "Greater Than or Equal To"; break; case OpType.LessThan: description = "Compares if first value is less than the second."; name = "Less Than"; break; case OpType.LessOrEqual: description = "Compares if first value is less than or equal to the second."; name = "Less Than or Equal To"; break; } // create pins; switch (type) { case OpType.Add: case OpType.Subtract: case OpType.Multiply: case OpType.Divide: for (int i = 0; i < inCount; i++) { ValueInputPin p = new ValueInputPin(this, nT); valInPins.Add(p); } valOutPins.Add(new ValueOutputPin(this, nT)); multiplePins = true; break; case OpType.Abs: case OpType.SQRT: valInPins.Add(new ValueInputPin(this, nT)); valOutPins.Add(new ValueOutputPin(this, nT)); break; case OpType.POW: valInPins.Add(new ValueInputPin(this, nT)); valInPins.Add(new ValueInputPin(this, nT)); valOutPins.Add(new ValueOutputPin(this, nT)); break; case OpType.Not: valInPins.Add(new ValueInputPin(this, VarType.Bool)); valOutPins.Add(new ValueOutputPin(this, VarType.Bool)); break; case OpType.And: case OpType.Or: case OpType.Xor: for (int i = 0; i < inCount; i++) { valInPins.Add(new ValueInputPin(this, VarType.Bool)); } valOutPins.Add(new ValueOutputPin(this, VarType.Bool)); multiplePins = true; break; case OpType.EqualTo: case OpType.GreaterThan: case OpType.GreaterOrEqual: case OpType.LessThan: case OpType.LessOrEqual: valInPins.Add(new ValueInputPin(this, nT)); valInPins.Add(new ValueInputPin(this, nT)); valOutPins.Add(new ValueOutputPin(this, VarType.Bool)); break; } if (multiplePins) { description += " Maximum pins allowed is 16."; } Resize(); }