public LogicSlot(AbstractLogicNodeEditor owner, string memberName, string displayName, SlotDirection direction) { Owner = owner; _memberName = memberName; _displayName = displayName; _direction = direction; }
public Slot(SlotDirection direction, SlotKind kind, string name = null, SlotFlags flags = SlotFlags.None, string type = null, string value = null) : this() { Direction = direction; Kind = kind; Name = name; Flags = flags; Type = type; Value = value; }
protected SlotDefinition(SlotDirection direction, SlotKind kind, string name, string type, string value, SlotFlags flags) { Direction = direction; Kind = kind; Name = name; Type = type; Value = value; Flags = flags; }
protected Slot FindSlot(SlotDirection direction, SlotKind kind, SlotFlags flags) { foreach (var slot in Slots) { if (slot.Direction == direction && slot.Kind == kind && (slot.Flags & flags) == flags) { return(slot); } } return(null); }
protected Slot FindSlot(SlotDirection direction, SlotKind kind, string name) { foreach (var slot in Slots) { if (slot.Direction == direction && slot.Kind == kind && slot.Name == name) { return(slot); } } return(null); }
public BooleanSlot(AbstractLogicNodeEditor owner, string memberName, string displayName, SlotDirection direction, string[] labels, Func <Bool4> get, Action <Bool4> set) : base(owner, memberName, displayName, direction) { _labels = labels; _get = get; _set = set; }
public VectorLogicSlot( AbstractLogicNodeEditor owner, string memberName, string displayName, SlotDirection direction, string[] labels, Func <Vector4> get, Action <Vector4> set) : base(owner, memberName, displayName, direction) { _get = get; _set = set; _labels = labels; }
protected virtual void DrawSlot(Control ctrl, Point p, SlotPosition position, SlotDirection direction) { Graphics g = ctrl.CreateGraphics(); UI ui = new UI(); SolidBrush brush = new SolidBrush(ui.SLOT_COLOR); Pen pen = new Pen(brush, 0.5f); Point pN = new Point(0, 0); Point pS = new Point(0, 0); Point pW = new Point(0, 0); Point pE = new Point(0, 0); Point[] points = new Point[3]; if (position.Equals(SlotPosition.Up)) { if (direction == SlotDirection.In) { pN = p; pS = new Point(p.X, p.Y + 5); pW = new Point(p.X - 3, p.Y + 2); pE = new Point(p.X + 3, p.Y + 2); points[0] = pW; points[1] = pE; points[2] = pS; g.DrawLine(pen, pN, pS); } else if (direction == SlotDirection.Out) { pN = new Point(p.X, p.Y + 1); pS = new Point(p.X, p.Y + 5); pW = new Point(p.X - 4, p.Y + 4); pE = new Point(p.X + 4, p.Y + 4); points[0] = pW; points[1] = pE; points[2] = pN; g.DrawLine(pen, pN, pS); } } else if (position.Equals(SlotPosition.Left)) { if (direction == SlotDirection.In) { pW = p; pS = new Point(p.X + 2, p.Y + 3); pN = new Point(p.X + 2, p.Y - 3); pE = new Point(p.X + 5, p.Y); points[0] = pN; points[1] = pE; points[2] = pS; g.DrawLine(pen, pW, pE); } else if (direction == SlotDirection.Out) { pW = new Point(p.X + 1, p.Y); pS = new Point(p.X + 4, p.Y + 3); pN = new Point(p.X + 4, p.Y - 3); pE = new Point(p.X + 5, p.Y); points[0] = pN; points[1] = pS; points[2] = pW; g.DrawLine(pen, pW, pE); } } else if (position.Equals(SlotPosition.Right)) { if (direction == SlotDirection.Out) { pE = new Point(p.X - 1, p.Y); pS = new Point(pE.X - 3, pE.Y + 3); pW = new Point(pE.X - 5, pE.Y); pN = new Point(pE.X - 3, pE.Y - 3); points[0] = pN; points[1] = pE; points[2] = pS; g.DrawLine(pen, pW, pE); } else if (direction == SlotDirection.In) { pE = new Point(p.X - 1, p.Y); pS = new Point(pE.X - 3, pE.Y + 3); pW = new Point(pE.X - 6, pE.Y); pN = new Point(pE.X - 3, pE.Y - 3); points[0] = pN; points[1] = pS; points[2] = pW; g.DrawLine(pen, pW, pE); } } else if (position.Equals(SlotPosition.Down)) { if (direction == SlotDirection.Out) { pS = new Point(p.X, p.Y - 1); pN = new Point(pS.X, pS.Y - 5); pW = new Point(pS.X - 3, pS.Y - 3); pE = new Point(pS.X + 3, pS.Y - 3); points[0] = pW; points[1] = pE; points[2] = pS; g.DrawLine(pen, pN, pS); } else if (direction == SlotDirection.In) { pS = new Point(p.X, p.Y - 1); pN = new Point(pS.X, pS.Y - 6); pW = new Point(pS.X - 3, pS.Y - 2); pE = new Point(pS.X + 3, pS.Y - 2); points[0] = pW; points[1] = pE; points[2] = pN; g.DrawLine(pen, pN, pS); } } g.FillPolygon(brush, points); }
protected override void DrawSlot(Control ctrl, Point p, SlotPosition position, SlotDirection direction) { //Graphics g = ctrl.CreateGraphics(); //SolidBrush brush = new SolidBrush(UI.SLOT_COLOR); //Pen pen = new Pen(brush, 0.5f); Point pN = new Point(0, 0); Point pS = new Point(0, 0); Point pW = new Point(0, 0); Point pE = new Point(0, 0); Point[] points = new Point[3]; // this is the only situation possible for the tee if (position.Equals(SlotPosition.Right)) { if (direction == SlotDirection.Out) { pE = new Point(p.X - 1, p.Y); pS = new Point(pE.X - 3, pE.Y + 3); pW = new Point(pE.X - 11, pE.Y); pN = new Point(pE.X - 3, pE.Y - 3); points[0] = pN; points[1] = pE; points[2] = pS; g.DrawLine(pen, pW, pE); } } else if (position.Equals(SlotPosition.Left)) { if (direction == SlotDirection.In) { pW = p; pS = p; pN = p; pE = new Point(p.X + 5, p.Y); points[0] = pN; points[1] = pE; points[2] = pS; g.DrawLine(pen, pW, pE); } } g.FillPolygon(brush, points); //g.Dispose(); //brush.Dispose(); //pen.Dispose(); }