public GameWonEventArgs(Score newScore)
 {
     m_newScore = newScore;
 }
示例#2
0
        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;
            }
        }
示例#3
0
 public void AddScore(Score score)
 {
     List<Score> scores = GetScores().ToList();
     scores.Add(score);
     SaveScores(scores);
 }