Example #1
0
 // game interface:
 public gameController(Panel v)
 {
     view = v;
     lineNo = rowNo * v.Height / v.Width;
     bw = v.Width / rowNo;
     bh = v.Height / lineNo;
     map = new List<int[]>();
     now = new block(rowNo / 2 - 2, 0);
     for (int i = 0; i < lineNo; ++i)
         map.Add(new int[rowNo]);
     initMap();
     wait = new block(rowNo / 2 - 2, 0);
 }
 // game interface:
 public gameController(Panel v)
 {
     view   = v;
     lineNo = rowNo * v.Height / v.Width;
     bw     = v.Width / rowNo;
     bh     = v.Height / lineNo;
     map    = new List <int[]>();
     now    = new block(rowNo / 2 - 2, 0);
     for (int i = 0; i < lineNo; ++i)
     {
         map.Add(new int[rowNo]);
     }
     initMap();
     wait = new block(rowNo / 2 - 2, 0);
 }
        public void transpose()
        {
            block temp = new block(now.curx, now.cury);

            temp.colorblock = now.colorblock;
            for (int i = 0; i < block.size; ++i)
            {
                for (int j = block.size - 1; j >= 0; --j)
                {
                    temp.matblock[j, i] = now.matblock[i, block.size - 1 - j];
                }
            }
            if (temp.curx >= 0 && temp.curx + block.size <= rowNo &&
                test(temp.curx, temp.cury, temp.matblock))
            {
                now = temp;
                Invalidateblock();
            }
        }
 public void startnext()
 {
     now  = wait;
     wait = new block(rowNo / 2 - 2, 0);
 }
Example #5
0
 public void transpose()
 {
     block temp = new block(now.curx, now.cury);
     temp.colorblock = now.colorblock;
     for (int i = 0; i < block.size; ++i)
         for (int j = block.size-1; j >= 0; --j)
             temp.matblock[j, i] =  now.matblock[i, block.size-1 - j];
     if (temp.curx >=0 && temp.curx+block.size <= rowNo
         && test(temp.curx, temp.cury, temp.matblock))
     {
         now = temp;
         Invalidateblock();
     }
 }
Example #6
0
 public void startnext()
 {
     now = wait;
     wait = new block(rowNo / 2 - 2, 0);
 }