Exemple #1
0
 private void statisticsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     statistics = new HighScores(game.GetSettings());
     statistics.ShowDialog();
 }
Exemple #2
0
        /*
         * Left Click - uncovers a cell, lays new minefield if it's the first cell uncovered
         */
        public void Uncover(Cell C)
        {
            List <Cell> surrounding;

            //if its the first cell uncovered in a new game, lay a new field with this
            //cell safe
            if (Newgame)
            {
                LayMineField(C);
                timerinator.Start();
            }

            // if it's not flagged, and still up, check for mine
            if (C.CellState == CellState.UP && !C.Flagged)
            {
                C.CellState = CellState.DOWN;

                if (C.HasBomb)
                {
                    timerinator.Stop();
                    faceinator.state = GraphicsLibrary.DEAD;
                    C.tripped        = true;
                    GameOver         = true;
                }
                else
                {
                    if (C.TouchesCount == 0)
                    {
                        surrounding = GetSurrounding(minefield.getField(), C);
                        foreach (Cell c in surrounding)
                        {
                            Uncover(c);
                        }
                    }

                    uncovered++;

                    //check for winner
                    if (uncovered == ToUncover)
                    {
                        GameOver = true;
                        timerinator.Stop();
                        faceinator.state = GraphicsLibrary.COOL;

                        if (gameMode != GameModes.ADVANCED)
                        {
                            form.Refresh();
                            if (timerinator.getTime() < settings.GetScore(gameMode).Time)
                            {
                                // get name
                                NameForm nameForm = new NameForm();
                                nameForm.ShowDialog();
                                string name = nameForm.PlayerName;
                                settings.SetScore(gameMode, timerinator.getTime(), name);
                                var hs = new HighScores(settings);
                                hs.ShowDialog();
                            }
                        }
                    }
                }
            }
        }