Example #1
0
    public void drawSideGrid()
    {
        PVADraw draw = m_OldTrail.getDraw();

        //Debug.Log( "width:" + width + " height:" + height );

        Vector2 min = draw.ScreenToMarker(new Vector2(60, height));
        Vector2 max = draw.ScreenToMarker(new Vector2(width - 30, 0));

        //Debug.Log( "min:" + min.x + " " + min.y );
        //Debug.Log( "max:" + max.x + " " + max.y );

        float y = 0;

        for (int i = 0; i < 5; i++)
        {
            draw.begin();
            draw.setWidth(1);
            draw.setColor(new Color(1, 1, 1, 1));
            draw.moveTo(new Vector2(min.x, y));
            draw.lineTo(new Vector2(max.x, y));
            draw.end();

            //y += 50;
            //y += 25;
            y += 10;
            if (y >= max.y)
            {
                break;
            }
        }
        for (int i = 0; i <= 20; i += 10)
        {
            GameObject obj  = findChild("y" + i + "m");
            Vector2    pos1 = draw.MarkerToScreen(new Vector2(0, (float)i));

            Vector3 pos2 = obj.transform.localPosition;
            pos2.y = -pos1.y;
            obj.transform.localPosition = pos2;
            //Debug.Log( "y" + i + "m = " + pos.y);
        }
        for (int i = 25; i <= 100; i += 25)
        {
            GameObject obj  = findChild("z" + i + "m");
            Vector2    pos1 = draw.MarkerToScreen(new Vector2((float)i, 0));

            Vector3 pos2 = obj.transform.localPosition;
            pos2.x = pos1.x;
            obj.transform.localPosition = pos2;
            //Debug.Log( "z" + i + "m = " + pos.x);
        }
    }
Example #2
0
    public void drawTopGrid()
    {
        PVADraw draw = m_OldTrail.getDraw();

        Vector2 pos1 = draw.ScreenToMarker(new Vector2(0, 0));
        Vector2 pos2 = draw.ScreenToMarker(new Vector2(12, 0));
        float   w1   = pos2.x - pos1.x;

        pos2 = draw.ScreenToMarker(new Vector2(6, 0));
        float w2 = pos2.x - pos1.x;

        Vector2 max = draw.ScreenToMarker(new Vector2(0, 8));

        //Debug.Log( "max:" + max.y );

        draw.begin();
        draw.setWidth(1);
        draw.setColor(new Color(1, 1, 1, 1));
        draw.moveTo(new Vector2(0, 0));
        draw.lineTo(new Vector2(0, max.y));
        draw.end();

        int[] array = new int[] { -25, 25 };
        float z     = 0;

        for (int i = 0; i < 100; i++)
        {
            draw.begin();
            draw.moveTo(new Vector2(-w1, z));
            draw.lineTo(new Vector2(w1, z));
            draw.end();

            int num = array.Length;
            for (int j = 0; j < num; j++)
            {
                float x = (float)array[j];
                draw.begin();
                draw.moveTo(new Vector2(x - w2, z));
                draw.lineTo(new Vector2(x + w2, z));
                draw.end();
            }

            z += 25;
            if (z > max.y)
            {
                break;
            }
        }
    }