Example #1
0
    void Update()
    {
        graph.Add("Horizontal", Input.GetAxis("Horizontal"));
        graph.Add("Vertical", Input.GetAxis("Vertical"));
        graph.Add("HorizontalRaw", Input.GetAxisRaw("Horizontal"));
        graph.Add("VerticalRaw", Input.GetAxisRaw("Vertical"));

        graph.Add("A", Input.GetKey(KeyCode.A) ? 1 : 0);
        graph.Add("D", Input.GetKey(KeyCode.D) ? 1 : 0);
        graph.Add("R", Input.GetKey(KeyCode.RightArrow) ? 1 : 0);
        graph.Add("L", Input.GetKey(KeyCode.LeftArrow) ? 1 : 0);
    }
Example #2
0
        void Start()
        {
            // Supported types: float, Quaternion, Vector3
            DrawGraph.Add("Vec3Test", Vector3.zero)
            // Use System.Linq::ForEach( ... ) to assing group style values
            .ForEach(graph => graph
                     .SetLineWidth(2f)
                     .SetGraphHeight(120f)
                     .SetStepSize(0.25f)
                     .SetLimits(-2f, 2f)
                     );

            DrawGraph.Add("Empty graph test", 0f);

            //Combine two graphs in the same view
            DrawGraph.Get("c1").SetGroup("GroupC");
            DrawGraph.Get("c2").SetGroup("GroupC");
        }
Example #3
0
        void Update()
        {
            if (!updateGraph)
            {
                return;
            }

            // Add values to be drawn in the graph
            // ( seperate graphs, not in a group )
            // Since no settings are assigned, default style
            // values are used for A & B
            DrawGraph.Add("A", Random.value);
            DrawGraph.Add("B", Random.value);

            // Automaticlly create a group for Vector3 and
            // assign each of the x,y,z componenets into the
            // same group
            DrawGraph.Add("Vec3Test", new Vector3(
                              Mathf.Sin(Time.time / 10),
                              Mathf.Tan(1 / Time.time),
                              Mathf.Cos(Time.time / 10)
                              ));

            // c1 & c2 will be drawn in the same group
            DrawGraph.Add("c1", Mathf.Sin(1 / Time.time));

            // If you are feeling particulary lazy, style values
            // can be assined during update
            DrawGraph.Add("Random red", Random.value).SetLengthLimit(250)
            .SetColor(Color.red)
            .SetLineWidth(4f)
            .SetStepSize(2f);

            // Grouped items don't need to be updated in the same place or time
            if (Random.value > 0.7)
            {
                // c1 & c2 will be drawn in the same group
                DrawGraph.Add("c2", Mathf.Tan(1 / Time.time));
            }
        }
Example #4
0
        private void Output_MouseDown(object sender, MouseEventArgs e)
        {
            menuwork = false;
            DrawGraph <int> draw = sender == OutputA ? DrawA : DrawB;

            if (e.Button == MouseButtons.Right)
            {
                SelectedNode = draw.GetNode(e.Location);
                SelectedEdge = draw.GetEdge(e.Location);
                if (SelectedNode != null || SelectedEdge != null)
                {
                    contextMenuStrip.Show((Control)sender, e.Location);
                }
                menuwork = true;
                return;
            }
            if (AddBtn.Checked)
            {
                if (draw.PlaceFree(e.Location))
                {
                    GetValue get = new GetValue();
                    if (get.ShowDialog() == DialogResult.OK)
                    {
                        draw.Add(get.Value, e.Location);
                        UpdatePicter(sender);
                    }
                }
            }
            if (AddEdge.Checked)
            {
                if (SelectedNode == null)
                {
                    SelectedNode = draw.GetNode(e.Location);
                }
                else
                {
                    if (SelectedNode.Head == draw.graph)
                    {
                        Node <NP <int> > T = draw.GetNode(e.Location);
                        if (T != SelectedNode && T != null && T.GetEdge(SelectedNode) == null)
                        {
                            GetValue get = new GetValue();
                            if (get.ShowDialog() == DialogResult.OK)
                            {
                                SelectedNode.AddDualLinkedEdgeTo(T, get.Value);
                            }
                            UpdatePicter(sender);
                        }
                        SelectedNode = null;
                    }
                    else
                    {
                        SelectedNode = draw.GetNode(e.Location);
                    }
                }
            }
            if (ChangeBtn.Checked)
            {
                SelectedNode = draw.GetNode(e.Location);
            }
        }