Exemple #1
0
        void DrawLine(Vector3 a, Vector3 b, Color color) // 接口
        {
            a = Camera.main.WorldToViewportPoint(a);
            b = Camera.main.WorldToViewportPoint(b);

            DrawLines.DoDrawLines(color, new Vector2[] { a, b }, new int[] { 0, 1 }, Matrix4x4.identity);
        }
Exemple #2
0
        void DrawLineScreen(Vector2 a, Vector2 b, Color color)
        {
            Matrix4x4 m          = Matrix4x4.identity;
            var       screenSize = new Vector2(Screen.width, Screen.height);

            a /= screenSize;
            b /= screenSize;
            DrawLines.DoDrawLines(color, new Vector2[] { a, b }, new int[] { 0, 1 }, m);
        }
Exemple #3
0
        void DrawRect(Vector2 p, Vector2 size, Color color, Matrix4x4 m)
        {
            size /= UI.scaler.referenceResolution; // to N
            var lt = p - size * 0.5f;

            lt.y += size.y; // 左上和左下坐标的转换
            var lb = p - size * 0.5f;
            var rb = p + size * 0.5f;

            rb.y -= size.y; // 其实也没必要,本来这么想但如果注释顺序就错了
            var rt = p + size * 0.5f;

            DrawLines.DrawQuads(color, new Vector2[] { lt, lb, rb, rt }, m);
        }