Exemplo n.º 1
0
        protected override void apply_change()
        {
            hanoilist.Clear();
            int maxsize = firsthanoiwidth + upsize * hanoisize;
            int height  = pillar_top_space + hanoisize * hanoiheight;

            for (int i = 0; i < 3; i++)
            {
                pillars[i].hanoiclear();
                pillars[i].setSize(firsthanoiwidth / 2, height);
                pillars[i].setLocation(sidespace + (betweenspace + maxsize) * i + maxsize / 2,
                                       space_y + (hanoisize * hanoiheight + pillar_top_space) / 2);
            }
            for (int i = hanoisize - 1; i >= 0; i--)
            {
                GraphicHanoi h = new GraphicHanoi(i + 1);
                h.setSize(firsthanoiwidth + upsize * i, hanoiheight);
                hanoilist.Add(h);
                pillars[0].Push(h);
            }
            supp.setLocation(pillars[1].x, space_y + pillar_top_space + hanoisize * hanoiheight + support_height / 2);

            int width = betweenspace * 4 + maxsize * 3;

            supp.setSize(width, support_height);

            form.sizechange(width + 300, height + support_height + 200);
        }
Exemplo n.º 2
0
 void settarget(GraphicHanoi h)
 {
     for (int i = 0; i < 3; i++)
     {
         ms[i].settarget(h);
     }
 }
Exemplo n.º 3
0
        public void move(GraphicPillar to)
        {
            GraphicHanoi h = hanois.Pop();

            settarget(h);
            int    over_y    = (int)draw_y - moveover;
            double target_v1 = over_y - h.y;

            ms[0].v_y = target_v1 / motiontime;

            double target_v2 = to.x - x;

            ms[1].v_x = target_v2 / motiontime;

            double target_v3 = to.targety() - over_y;

            ms[2].v_y = target_v3 / motiontime;
            ms[2].setend(() =>
            {
                to.Push(h);
                end();
            });

            ms[0].start();
        }
Exemplo n.º 4
0
 public void Push(GraphicHanoi h)
 {
     h.setLocation(this.x, targety());
     hanois.Push(h);
 }