Beispiel #1
0
    private void AddNode(bool input = false)
    {
        IONode NewNode = (IONode)Node.Instance();

        NewNode.SetPosition(-(new Vector2(1550, 1080) / 2) * Global.Camera.Zoom +
                            Global.Camera.Offset + MousePos * Global.Camera.Zoom);
        NewNode.Input = input;
        Global.Nodes.AddChild(NewNode);
    }
Beispiel #2
0
    private void AutoSort()
    {
        Vector2 FirstPosition = new Vector2(100000, 100000);
        int     Input         = 0;
        int     Output        = 0;
        Vector2 IODistance    = new Vector2(100, 60);

        for (int ChildIndex = 0; ChildIndex < Global.SelectedNodes.Count; ChildIndex++)
        {
            IONode Child = Global.SelectedNodes[ChildIndex];
            if (FirstPosition == new Vector2(100000, 100000))
            {
                FirstPosition = Child.GetPosition();
            }
            Child.SetPosition(Child.Input ? new Vector2(FirstPosition.x, FirstPosition.y + IODistance.y * Input)
                              : new Vector2(FirstPosition.x + IODistance.x, FirstPosition.y + IODistance.y * Output));
            Input  += Convert.ToInt16(Child.Input);
            Output += Convert.ToInt16(!Child.Input);
        }
    }