Пример #1
0
 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);
 }