public Node(Menu menu, Vector2 position, GUISkin skin) { this.menu = menu; height = 50 + (menu.transitionButtons.Length - 1) * 25; rect = new Rect(position.x, position.y, width, height); inPoint = new ConnectionPoint(ConnectionPointType.In, skin); for (int i = 0; i < menu.transitionButtons.Length; i++) { ConnectionPoint outP = new ConnectionPoint(ConnectionPointType.Out, skin); outPoint.Add(outP); } style = defaultNodeStyle = skin.box; selectedNodeStyle = skin.customStyles[0]; this.skin = skin; styleShadow = skin.customStyles[1]; }
public void Draw() { if (!menu) { OnClickRemoveNode(); return; } height = 50 + (menu.transitionButtons.Length - 1) * 25; rect.height = height; //Color shadowCol = new Color(0, 0, 0, 0.06f); //for (int i = 0; i < 3; i++){ // Draw a shadow Rect rectshadow = rect; rectshadow.x += 4; rectshadow.y += 4; GUI.Box(rectshadow, "", styleShadow); //} GUI.Box(rect, menu.name, style); inPoint.Draw(this, 0); if (menu.transitionButtons.Length > outPoint.Count) { for (int i = outPoint.Count - 1; i < menu.transitionButtons.Length; i++) { ConnectionPoint outP = new ConnectionPoint(ConnectionPointType.Out, skin); outPoint.Add(outP); } } else if (menu.transitionButtons.Length < outPoint.Count) { for (int i = outPoint.Count - 1; i > menu.transitionButtons.Length - 1; i--) { // ConnectionPoint outP = new ConnectionPoint( ConnectionPointType.Out, skin); outPoint.RemoveAt(i); } } for (int i = 0; i < outPoint.Count; i++) { outPoint[i].Draw(this, i); } }
private Node GetNode(ConnectionPoint point) { if (!menudesign) { return(null); } foreach (var item in menudesign.nodes) { if (item.inPoint == point) { return(item); } foreach (var item2 in item.outPoint) { if (item2 == point) { return(item); } } } return(null); }
private void ClearConnectionSelection() { selectedInPoint = null; selectedOutPoint = null; }