Example #1
0
        static SizeF PreRenderItem(Graphics graphics, NodeItem item, PointF position)
        {
            var itemSize = (SizeF)item.Measure(graphics);

            item.bounds = new RectangleF(position, itemSize);
            return(itemSize);
        }
Example #2
0
 private NodeItem GetOutputItem(NodeItem A, NodeItem B)
 {
     if (A.ItemType == B.ItemType) throw new ArgumentException("A and B are the same connection type!");
     if (A.ItemType == NodeItemType.Output) return A;
     if (B.ItemType == NodeItemType.Output) return B;
     throw new ArgumentException("No Output type!");
 }
Example #3
0
        public void PinConnected(NodeItem fromConnect, string property)
        {
            Type t = DotaAction.GetType();
            var prop = t.GetProperty(property);

            if (prop == null)
            {
                throw new ArgumentException("Property must be a valid KV property");
            }
            if(fromConnect.Node is VariableNode)
            {
                if (prop.PropertyType == typeof(NumberValue))
                {
                    var vn = fromConnect.Node as VariableNode;
                    var nv = new NumberValue("%" + vn.Variable.Name);

                    prop.SetMethod.Invoke(DotaAction, new object[] { nv });

                }
            }
            if(fromConnect is TargetNodeItem)
            {
                if(prop.PropertyType == typeof(TargetKey))
                {
                    var target = (fromConnect as TargetNodeItem).Target;

                    prop.SetMethod.Invoke(DotaAction, new object[] { target });

                }
            }

        }
Example #4
0
 public void RemoveItem(NodeItem item)
 {
     if (!nodeItems.Contains(item))
     {
         return;
     }
     item.Node = null;
     nodeItems.Remove(item);
 }
Example #5
0
        public VariableNode(BaseActionVariable var)
            : base(var.Name)
        {
            Variable = var;
            HeaderColor = System.Drawing.Brushes.DarkGreen;

            OutputPin = new NumberValueItem("Value", NodeItemType.Output);
            AddItem(OutputPin);
        }
Example #6
0
 public void AddItem(NodeItem item)
 {
     if (nodeItems.Contains(item))
     {
         return;
     }
     if (item.Node != null)
     {
         item.Node.RemoveItem(item);
     }
     nodeItems.Add(item);
     item.Node = this;
 }
Example #7
0
        public void AddItem(NodeItem item)
        {
            if (item.Node != null)
            {
                item.Node.RemoveItem(item);
            }
            item.Node = this;

            if (item.ItemType == NodeItemType.Output)
            {
                OutputItems.Add(item);
            }
            else if (item.ItemType == NodeItemType.Input)
            {
                InputItems.Add(item);
            }
        }
Example #8
0
        public void RemoveItem(NodeItem item)
        {
            if (item.Node != this)
            {
                return;
            }
            item.Node = null;

            if (item.ItemType == NodeItemType.Output)
            {
                OutputItems.Remove(item);
            }
            else if (item.ItemType == NodeItemType.Input)
            {
                InputItems.Remove(item);
            }
        }
Example #9
0
        public void AddItem(NodeItem item, int orderKey = -1)
        {
            if (nodeItems.Contains(item))
            {
                return;
            }

            if (item.Node != null)
            {
                item.Node.RemoveItem(item);
            }

            item.OrderKey = (orderKey >= 0) ? orderKey : currentOrderKey++;
            item.Node     = this;

            nodeItems.Add(item);

            nodeItems.Sort((a, b) => a.OrderKey.CompareTo(b.OrderKey));
        }
Example #10
0
 static void RenderItem(Graphics graphics, SizeF minimumSize, NodeItem item, PointF position)
 {
     item.Render(graphics, minimumSize, position);
 }
Example #11
0
 static SizeF PreRenderItem(Graphics graphics, NodeItem item, PointF position)
 {
     var itemSize = (SizeF)item.Measure(graphics);
     item.bounds = new RectangleF(position, itemSize);
     return itemSize;
 }
Example #12
0
 public NodeItemEventArgs(NodeItem item)
 {
     Item = item;
 }
Example #13
0
 public NodeConnector(NodeItem item, bool enabled)
 {
     Item = item; Enabled = enabled;
 }
Example #14
0
 public NodeOutputConnector(NodeItem item, bool enabled)
     : base(item, enabled)
 {
 }
Example #15
0
        public void AddItem(NodeItem item, int orderKey = -1)
        {
            if (nodeItems.Contains(item))
                return;

            if (item.Node != null)
                item.Node.RemoveItem(item);

            item.OrderKey = (orderKey >= 0) ? orderKey : currentOrderKey++;
            item.Node = this;

            nodeItems.Add(item);

            nodeItems.Sort((a, b) => a.OrderKey.CompareTo(b.OrderKey));
        }
Example #16
0
 static void RenderItem(Graphics graphics, SizeF minimumSize, NodeItem item, PointF position)
 {
     item.Render(graphics, minimumSize, position);
 }
Example #17
0
File: Node.cs Project: Winnak/Graph
 public void AddItem(NodeItem item)
 {
     if (nodeItems.Contains(item))
         return;
     if (item.Node != null)
         item.Node.RemoveItem(item);
     nodeItems.Add(item);
     item.Node = this;
 }
Example #18
0
 public NodeItemEventArgs(NodeItem item)
 {
     Item = item;
 }
Example #19
0
File: Node.cs Project: Winnak/Graph
 public void RemoveItem(NodeItem item)
 {
     if (!nodeItems.Contains(item))
         return;
     item.Node = null;
     nodeItems.Remove(item);
 }
Example #20
0
 public NodeConnection Connect(NodeItem from, NodeItem to)
 {
     return Connect(from.Output, to.Input);
 }
Example #21
0
 public NodeOutputConnector(NodeItem item, bool enabled) : base(item, enabled)
 {
 }
Example #22
0
 public NodeConnector(NodeItem item, bool enabled)
 {
     Item = item; Enabled = enabled;
 }
Example #23
0
 private NodeIOMode getIOMode(NodeItem item)
 {
     bool input = item.Input.Enabled;
     bool output = item.Output.Enabled;
     if (input && output)
         return NodeIOMode.InOut;
     else if (input)
         return NodeIOMode.Input;
     else if (output)
         return NodeIOMode.Output;
     return NodeIOMode.None;
 }