Ejemplo n.º 1
0
        public void timer_Tick(object Sender, EventArgs e)
        {
            count++;

            if (panel.pieces[point.X, point.Y].color >= 0)
            {
                panel.pieces[point.X, point.Y].Visible = false;
            }
            else
            {
                panel.pieces[point.X, point.Y].setHint();
            }

            point = (Point)list[count];
            panel.pieces[point.X, point.Y].Image   = ClippingImage.bitmapPiece[0, color - 1];
            panel.pieces[point.X, point.Y].Visible = true;

            if (count == list.Count - 1)
            {
                timer.Stop();
                panel.gameShape.matrix[point.X, point.Y] = color;
                panel.pieces[point.X, point.Y].color     = color;
                ArrayList arr = Algorithms.checkLines(panel.gameShape.matrix, point.X, point.Y);
                if (arr == null)
                {
                    panel.appearenceThread = new AppearenceThread(panel, panel.gameShape.matrix);
                }
                else
                {
                    panel.destructionThread = new DestructionThread(panel, arr);
                }
            }
        }
Ejemplo n.º 2
0
        void timer_Tick(object sender, EventArgs e)
        {
            for (int i = 0; i < len; i++)
            {
                panel.pieces[p[i].X, p[i].Y].setAppearenceAt(count);
            }
            count++;

            if (count == SkinConstants.BallAppearence.Length)
            {
                this.Stop();
                for (int i = 0; i < len; i++)
                {
                    panel.gameShape.matrix[p[i].X, p[i].Y] = -panel.gameShape.matrix[p[i].X, p[i].Y];
                    panel.pieces[p[i].X, p[i].Y].color     = -panel.pieces[p[i].X, p[i].Y].color;
                    panel.pieces[p[i].X, p[i].Y].setNormal();
                }

                ArrayList arr = new ArrayList();
                for (int i = 0; i < len; i++)
                {
                    ArrayList a = Algorithms.checkLines(panel.gameShape.matrix, p[i].X, p[i].Y);
                    if (a != null)
                    {
                        arr = Algorithms.merge(arr, a);
                    }
                }
                if (arr.Count > 0)
                {
                    panel.destructionThread = new DestructionThread(panel, arr);
                    Algorithms.addNextColor(panel.gameShape.matrix);
                    panel.repaintNextColor(panel.gameShape.matrix);
                    panel.repaintPieces(panel.gameShape.matrix);
                }
                else if (Algorithms.countEmpty(panel.gameShape.matrix) < 3)
                {
                    panel.setGameOver();
                    panel.isLocking = false;
                }
                else
                {
                    Algorithms.addNextColor(panel.gameShape.matrix);
                    panel.repaintNextColor(panel.gameShape.matrix);
                    panel.repaintPieces(panel.gameShape.matrix);
                    panel.isLocking = false;
                }
            }
        }