コード例 #1
0
        private void InitGameOver()
        {
            fallingTimer.Enabled = false;

            if (TetrisBoard.ScoresTable.Count > 0)
            {
                foreach (var player in TetrisBoard.ScoresTable)
                {
                    if (board.Score > player.Score || TetrisBoard.ScoresTable.Count < TetrisBoard.MaxScores)
                    {
                        SaveScoreForm saveScoreForm = new SaveScoreForm();
                        saveScoreForm.ShowDialog();
                        if (!String.IsNullOrWhiteSpace(saveScoreForm.PlayerName))
                        {
                            board.SaveScore(saveScoreForm.PlayerName);
                        }
                        break;
                    }
                }
            }
            else
            {
                SaveScoreForm saveScoreForm = new SaveScoreForm();
                saveScoreForm.ShowDialog();
                if (!String.IsNullOrWhiteSpace(saveScoreForm.PlayerName))
                {
                    board.SaveScore(saveScoreForm.PlayerName);
                }
            }

            board = null;
            g.Clear(TetrisBoard.BackColor);
            gNext.Clear(TetrisBoard.BackColor);
            MessageBox.Show("Game Over!");
        }