public override NodeRing Release(CanvasHolder holder, Generators.IDGenerator generator) { if (parent == null) { throw new ArgumentNullException("parent must be set using SetParent() before release!"); } NodeRing generatedNodeRing = new NodeRing(parent, title, color, direction); generator.Add(id, generatedNodeRing); return(generatedNodeRing); }
public override Node Release(CanvasHolder canvasHolder, Generators.IDGenerator generator) { Node generatedNode = new Node(x, y, width); generatedNode.Title = title; foreach (NodeRingHolder nodeRingHolder in canvasHolder.nodeRingHolders) { if (nodeRingHolder.parentId == this.id) { nodeRingHolder.SetParent(generatedNode); NodeRing generatedNodeRing = nodeRingHolder.Release(canvasHolder, generator); generatedNode.AddElement(generatedNodeRing); } } generator.Add(id, generatedNode); return(generatedNode); }
public override Wire Release(CanvasHolder holder, Generators.IDGenerator generator) { try { start = generator.Find(firstRingId).reference.Collider; end = generator.Find(secondRingId).reference.Collider; } catch (NullReferenceException) { throw new Exception("couldn't find (start) or (end) with the stored ids!"); } Wire generatedWire = new Wire(start, end); generatedWire.ReconstructCollider(); ((NodeRing)start.Drawable).Connections.Add(generatedWire); ((NodeRing)end.Drawable).Connections.Add(generatedWire); generator.Add(id, generatedWire); return(generatedWire); }