Example #1
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;
                }
            }
        }
Example #2
0
 private void endGameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     panel.setGameOver();
 }