//Zapis wyniku private void SaveScore() { if (Board.ScoresTable.Count == 0) { return; } SaveScore saveScore = new SaveScore(); saveScore.ShowDialog(); if (!String.IsNullOrWhiteSpace(saveScore.Nickname)) { Board.ScoresTable.Add(new Player(saveScore.Nickname, board.Score)); } }
//Game Over private void InitGameOver() { FallingTimer.Enabled = false; sound.Stop(); StartStopButton.Text = "Start"; if (Board.ScoresTable.Count > Board.MaxScores) { foreach (var player in Board.ScoresTable) { if (board.Score > player.Wynik || Board.ScoresTable.Count < Board.MaxScores) { SaveScore save = new SaveScore(); save.ShowDialog(); if (!String.IsNullOrWhiteSpace(save.Nickname)) { board.SaveScore(save.Nickname); } break; } } } else { SaveScore save = new SaveScore(); save.ShowDialog(); if (!String.IsNullOrWhiteSpace(save.Nickname)) { board.SaveScore(save.Nickname); } } board = null; g.Clear(Board.BackColor); gNext.Clear(Board.BackColor); GameOverLabel.Visible = true; }