示例#1
0
    // Use this for initialization
    public void Start()
    {
        accumulatedHeight = gap;

        for (int i = 0; i < 8; i++)
        {
            strings.Add(i.ToString());

            Rect rect = new Rect(gap, accumulatedHeight, boxWidth, boxHeight);
            accumulatedHeight += gap + boxHeight;

            dragNDrop.CreateDropArea(i.ToString(), null, rect, typeof(String));
            dragNDrop.SetObject(i.ToString(), strings[i]);
        }
    }
示例#2
0
    // Use this for initialization
    public void Start()
    {
        float boxHeight = 100;
        float boxWidth  = 200;

        for (int i = 0; i < 4; i++)
        {
            Rect rect  = new Rect(2 * boxWidth, i * boxHeight, boxWidth, boxHeight);
            Rect rect2 = new Rect(3 * boxWidth, i * boxHeight, boxWidth, boxHeight);
            Rect rect3 = new Rect(4 * boxWidth, i * boxHeight, boxWidth * 2, boxHeight);

            dragNDrop.CreateDropArea("A" + i, null, rect, typeof(A), typeof(C));
            dragNDrop.CreateDropArea("B" + i, null, rect2, typeof(B));
            dragNDrop.CreateDropArea("C" + i, null, rect3, typeof(C), typeof(A));
        }

        dragNDrop.SetObject("A1", a1);
        dragNDrop.SetObject("A2", a2);

        dragNDrop.SetObject("B1", b1);
        dragNDrop.SetObject("B2", b2);

        dragNDrop.SetObject("C1", c1);
        dragNDrop.SetObject("C2", c2);

        objects.Add(a1);
        objects.Add(a2);
        objects.Add(b1);
        objects.Add(b2);
        objects.Add(c1);
        objects.Add(c2);

        Rect rect4 = new Rect(0, 0, 150, 400);
        Rect rect5 = new Rect(10, 10, 130, 180);
        Rect rect6 = new Rect(10, 210, 130, 180);

        dragNDrop.CreateDropArea("D", null, rect4, typeof(String));
        dragNDrop.CreateDropArea("inner1", null, rect5, typeof(String));
        dragNDrop.CreateDropArea("inner2", null, rect6, typeof(String));


        strings.Add(new String("outer".ToCharArray()));
        strings.Add(new String("inner1".ToCharArray()));
        strings.Add(new String("inner1".ToCharArray()));


        //dragNDrop.SetObject("D", strings[0]);
        dragNDrop.SetObject("inner1", strings[1]);
        dragNDrop.SetObject("inner2", strings[2]);
    }
示例#3
0
    // Use this for initialization
    public void Start()
    {
        Rect rect1 = new Rect(0, 0, 150, 400);
        Rect rect4 = new Rect(Screen.width - 150, Screen.height - 400, 150, 400);

        Rect rect2 = new Rect(10, 10, 130, 150);
        Rect rect3 = new Rect(10, 210, 130, 150);

        dragNDrop.CreateDropArea("outer", null, rect1, typeof(String));
        dragNDrop.CreateDropArea("outer2", null, rect4, typeof(String));

        dragNDrop.CreateDropArea("inner1", null, rect2, typeof(String));
        dragNDrop.CreateDropArea("inner2", null, rect3, typeof(String));


        strings.Add(new String("outer".ToCharArray()));
        strings.Add(new String("inner1".ToCharArray()));
        strings.Add(new String("inner2".ToCharArray()));


        dragNDrop.SetObject("outer", strings[0]);
        dragNDrop.SetObject("inner1", strings[1]);
        dragNDrop.SetObject("inner2", strings[2]);
    }