Beispiel #1
0
    public static void DrawLineWindows(Vector2 pointA, Vector2 pointB, Color color, float width, bool antiAlias)
    {
        Color     color2 = GUI.color;
        Matrix4x4 matrix = GUI.matrix;

        if (antiAlias)
        {
            width *= (float)3;
        }
        float   num       = Vector3.Angle(pointB - pointA, Vector2.right) * (float)((pointA.y > pointB.y) ? -1 : 1);
        float   magnitude = (pointB - pointA).magnitude;
        Vector3 vector    = new Vector3(pointA.x, pointA.y, (float)0);

        GUI.color  = color;
        GUI.matrix = Drawing_tc1.translationMatrix(vector) * GUI.matrix;
        GUIUtility.ScaleAroundPivot(new Vector2(magnitude, width), new Vector2(-0.5f, (float)0));
        GUI.matrix = Drawing_tc1.translationMatrix(-vector) * GUI.matrix;
        GUIUtility.RotateAroundPivot(num, new Vector2((float)0, (float)0));
        GUI.matrix = Drawing_tc1.translationMatrix(vector + new Vector3(width / (float)2, -magnitude / (float)2) * Mathf.Sin(num * 0.0174532924f)) * GUI.matrix;
        if (!antiAlias)
        {
            GUI.DrawTexture(new Rect((float)0, (float)0, (float)1, (float)1), Drawing_tc1.lineTex);
        }
        else
        {
            GUI.DrawTexture(new Rect((float)0, (float)0, (float)1, (float)1), Drawing_tc1.aaLineTex);
        }
        GUI.matrix = matrix;
        GUI.color  = color2;
    }
Beispiel #2
0
    public static void DrawLineMac(Vector2 pointA, Vector2 pointB, Color color, float width, bool antiAlias)
    {
        Color     color2 = GUI.color;
        Matrix4x4 matrix = GUI.matrix;
        float     num    = width;

        if (antiAlias)
        {
            width *= (float)3;
        }
        float num2      = Vector3.Angle(pointB - pointA, Vector2.right) * (float)((pointA.y > pointB.y) ? -1 : 1);
        float magnitude = (pointB - pointA).magnitude;

        if (magnitude > 0.01f)
        {
            Vector3 vector = new Vector3(pointA.x, pointA.y, (float)0);
            Vector3 b      = new Vector3((pointB.x - pointA.x) * 0.5f, (pointB.y - pointA.y) * 0.5f, (float)0);
            Vector3 b2     = Vector3.zero;
            if (antiAlias)
            {
                b2 = new Vector3(-num * 1.5f * Mathf.Sin(num2 * 0.0174532924f), num * 1.5f * Mathf.Cos(num2 * 0.0174532924f));
            }
            else
            {
                b2 = new Vector3(-num * 0.5f * Mathf.Sin(num2 * 0.0174532924f), num * 0.5f * Mathf.Cos(num2 * 0.0174532924f));
            }
            GUI.color  = color;
            GUI.matrix = Drawing_tc1.translationMatrix(vector) * GUI.matrix;
            GUIUtility.ScaleAroundPivot(new Vector2(magnitude, width), new Vector2(-0.5f, (float)0));
            GUI.matrix = Drawing_tc1.translationMatrix(-vector) * GUI.matrix;
            GUIUtility.RotateAroundPivot(num2, Vector2.zero);
            GUI.matrix = Drawing_tc1.translationMatrix(vector - b2 - b) * GUI.matrix;
            if (antiAlias)
            {
                GUI.DrawTexture(new Rect((float)0, (float)0, (float)1, (float)1), Drawing_tc1.aaLineTex);
            }
            else
            {
                GUI.DrawTexture(new Rect((float)0, (float)0, (float)1, (float)1), Drawing_tc1.lineTex);
            }
        }
        GUI.matrix = matrix;
        GUI.color  = color2;
    }