public GameWonEventArgs(Score newScore) { m_newScore = newScore; }
public void ButtonClicked(int button) { if (!ButtonsCanBeClicked) { return; } if (tapDanceWatch.IsRunning) { tappedButtons.Add(button); if (tappedButtons.Count.Equals(generatedPattern.Length)) { tapDanceWatch.Stop(); if (CheckPattern(tappedButtons.ToArray())) { var score = new Score(tapDanceWatch.Elapsed.TotalSeconds, DateTime.Now); PlayerWon(this, new GameWonEventArgs(score)); GameState = GameState.PlayerWon; } else { PlayerLost(this, new EventArgs()); GameState = GameState.PlayerWrongCombination; } } } else { if (countdownTimer.IsEnabled) { countdownTimer.Stop(); } PlayerTooFast(this, new EventArgs()); GameState = GameState.PlayerTooFast; } }
public void AddScore(Score score) { List<Score> scores = GetScores().ToList(); scores.Add(score); SaveScores(scores); }