Beispiel #1
0
 private void DrawNodeConnections(Rect container)
 {
     GUI.depth = -150;
     foreach (var n in Program.Nodes)
     {
         foreach (var c in n.Outputs)
         {
             if (c.Value.Connected)
             {
                 if (connections.ContainsKey(c.Value))
                 {
                     foreach (var c2 in c.Value.Connections)
                     {
                         if (connections.ContainsKey(c2))
                         {
                             Vector2 a = connections[c.Value];
                             Vector2 b = connections[c2];
                             GUILine.DrawLine(GUIUtility.ScreenToGUIPoint(a), GUIUtility.ScreenToGUIPoint(b), ConnectionColor(c.Value), 2, true);
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
    private void PaintLine()
    {
        Color color   = Color.black;//黑色的线
        int   start_x = (int)paintline[0].x;
        int   start_y = (int)paintline[0].y;
        int   end_x   = (int)paintline[1].x;
        int   end_y   = (int)paintline[1].y;

        GUILine.DrawSegment(palette, start_x, start_y, end_x, end_y, color, 3);
    }
Beispiel #3
0
    void drawLine(Vector2 begin, Vector2 end)
    {
        var point1 = cam.ViewportToScreenPoint(new Vector2 {
            x = begin.x, y = 1 - begin.y
        });
        var point2 = cam.ViewportToScreenPoint(new Vector2 {
            x = end.x, y = 1 - end.y
        });

        GUILine.draw(point1, point2, Color.red);
    }
Beispiel #4
0
 public override void Draw()
 {
     GUI.depth = 150;
     if (draggedConnection != null && dragInfo != GUIController.mousePos)
     {
         GUILine.DrawLine(GUIUtility.ScreenToGUIPoint(dragInfo), GUIUtility.ScreenToGUIPoint(GUIController.mousePos), Color.red, 2, true);
     }
     if (Program != null)
     {
         DrawNodes(new Rect(toolbarWidth + 20, GUIController.ElSize, WinRect.width - (toolbarWidth + GUIController.ElSize + 20), WinRect.height - GUIController.ElSize * 2));
     }
     DrawNodeToolbar();
 }
Beispiel #5
0
    void drawDiagonal()
    {
        var point1 = cam.ViewportToScreenPoint(Vector2.zero);
        var point2 = cam.ViewportToScreenPoint(new Vector2 {
            x = 1
        });
        var point3 = cam.ViewportToScreenPoint(new Vector2 {
            y = 1
        });
        var point4 = cam.ViewportToScreenPoint(Vector2.one);

        GUILine.draw(point1, point4, Color.red);
        GUILine.draw(point2, point3, Color.red);
    }
Beispiel #6
0
    void draw(Rect rect)
    {
        var point1 = cam.ViewportToScreenPoint(new Vector2 {
            x = rect.xMin, y = 1 - rect.yMin
        });
        var point2 = cam.ViewportToScreenPoint(new Vector2 {
            x = rect.xMin, y = 1 - rect.yMax
        });
        var point3 = cam.ViewportToScreenPoint(new Vector2 {
            x = rect.xMax, y = 1 - rect.yMax
        });
        var point4 = cam.ViewportToScreenPoint(new Vector2 {
            x = rect.xMax, y = 1 - rect.yMin
        });

        GUILine.draw(point1, point2);
        GUILine.draw(point2, point3);
        GUILine.draw(point3, point4);
        GUILine.draw(point4, point1);
        GUILine.draw(point4, point1);
    }
Beispiel #7
0
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         if (newline.startPt == Vector2.zero)
         {
             newline.startPt = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
         }
         else
         {
             newline.endPt = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
         }
     }
     else if (Input.GetMouseButtonUp(0))
     {
         if (newline.endPt != Vector2.zero)
         {
             //Debug.Log(newline.startPt.ToString() + " " + newline.endPt.ToString());
             lines.Add(newline);
             newline = new GUILine();
         }
     }
 }
Beispiel #8
0
 void addGUILine(GUILine line)
 {
     lines.Add (line);
 }
Beispiel #9
0
    void Update()
    {
        if (Input.GetMouseButtonDown (0)) {
            newline = new GUILine ();
            newline.startPt = new Vector2 (Input.mousePosition.x, Input.mousePosition.y);
            mouseDown = true;
        }
        if (Input.GetMouseButtonUp (0)) {
            mouseDown = false;
            mouseUp = true;
        }
        if (Input.GetMouseButtonUp (1)) {
            if (lines.Count != 0)
                lines.RemoveAt (lines.Count - 1);
        }
        if (Input.GetKeyDown (KeyCode.LeftShift) || Input.GetKeyDown (KeyCode.RightShift)) {
            shift = true;
        }
        if (Input.GetKeyUp (KeyCode.LeftShift) || Input.GetKeyUp (KeyCode.RightShift)) {
            shift = false;
        }

        if (Input.GetKey (KeyCode.KeypadEnter) || Input.GetKey ("enter")) {

        }
    }
Beispiel #10
0
 void setLinePoints(GUILine line)
 {
     line.startPt = setPoint (line.startPt);
     line.endPt = setPoint (line.endPt);
     length = (line.startPt - line.endPt).magnitude;
 }
Beispiel #11
0
    void OnGUI()
    {
        RobotMotion motionss = GameObject.Find("MyMotion").GetComponent <RobotMotion>();

        //if(GUILayout.Button("go"))
        //{
        //    float[] actual = motionss.CurrentAngle_All();
        //    Vector3 StartPoint = motionss.IKA.SolutionOfKinematics(actual);
        //    Quaternion Posture = motionss.IKA.SolutionOfKinematics_posture(actual);
        //    float[] theory = motionss.IKA.AcceptInterPointPosture(StartPoint, Posture, actual);
        //    for (int i = 0; i < 6; i++)
        //    {
        //        Debug.Log("第"+i+"轴的转动角度:"+theory[i]);
        //        if (Mathf.Abs(actual[i] - theory[i])>0.5)
        //        {
        //            Debug.Log("机械臂运动学逆解出现错误!!" + "实际角度:" + actual[i] + ",理论角度:" + theory[i]+".");
        //        }
        //    }
        //}
        if (GUILayout.Button("camera"))
        {
            Camerascript cameras = GameObject.Find("CameraFree").GetComponent <Camerascript>();
            cameras.SwitchCamera();
        }
        //if (GUILayout.Button("add scene"))
        //{
        //    GSKDATA.Scene_NO++;
        //}
        if (GUILayout.Button("部件提示功能"))
        {
            FuncPara.componentTips = !FuncPara.componentTips;
        }

        //if (GUILayout.Button("姿态检测"))
        //{
        //    float[] actual = motionss.CurrentAngle_All();
        //    Quaternion Posture = motionss.IKA.SolutionOfKinematics_posture(actual);
        //    Quaternion Posture2 = GameObject.Find("Shape13").GetComponent<Transform>().rotation;
        //    Debug.Log("理论姿态" + Posture.ToString("0.000"));
        //    Debug.Log("实际姿态" + Posture2.ToString("0.000"));
        //}

        if (GUILayout.Button("IO面板"))
        {
            GameObject.Find("MyButton").GetComponent <ButtonRespond>().ShowIOPanel();
        }

        if (GUILayout.Button("示教器面板"))
        {
            GameObject.Find("MyButton").GetComponent <ButtonRespond>().ShowPanel();
        }

        if (GUILayout.Button("返回零点"))
        {
            GameObject.Find("MyMotion").GetComponent <RobotMotion>().ReturnToZero();
        }

        if (GUILayout.Button("视角还原"))
        {
            GameObject.Find("CameraFree").GetComponent <Camerascript>().CameraPosition();
        }

        if (GUILayout.Button("清空画板"))
        {
            GUILine.TextureInitial(paletter1);
        }
        if (GUILayout.Button("画画"))
        {
            GSKDATA.Painting = true;
        }
        if (GUILayout.Button("案例一"))
        {
            GSKDATA.Painting = true;
        }
        if (GUILayout.Button("案例二"))
        {
            GSKDATA.Painting = true;
        }
        if (GUILayout.Button("方向"))
        {
            Transform tooldir  = GameObject.Find("Circle0571").GetComponent <Transform>();
            Transform tooldir2 = GameObject.Find("qt208").GetComponent <Transform>();
            Debug.Log(tooldir.forward.ToString("0.00"));
            Debug.Log(tooldir2.forward.ToString("0.00"));
        }
        if (GUILayout.Button("光晕"))
        {
            GameObject.Find("qt208").AddComponent <FlashingController>();
        }
        if (GUILayout.Button("GuidPath"))
        {
            GameObject.Find("CameraFree").GetComponent <Camerascript>().SetPathGuid();
        }
        if (GUILayout.Button("教学"))
        {
        }
        if (GUILayout.Button("练习"))
        {
        }
    }
Beispiel #12
0
 //清空画板
 public void ClearPanel()
 {
     GUILine.TextureInitial(palette);//清空画板
 }