コード例 #1
0
 public async void Start(int numberOfQuestions, string difficulty)
 {
     IsRunning = true;
     // Get rid of any answered questions
     hasAnsweredCurrentQuestion.Clear();
     // Get rid of old scores
     scoreKeeper.ResetScores();
     questionSetManager.GetNewQuestionSet(numberOfQuestions, difficulty, questionset => {
         QuestionReady?.Invoke(this, new QuestionEventArgs(questionSetManager.CurrentQuestion));
         StartQuestionTimer();
     });
 }
コード例 #2
0
        private void GetNextQuestion()
        {
            StopQuestionTimer();
            // if there are not more questions, alert any listeners and bail early
            if (questionSetManager.GetNextQuestion() == null)
            {
                OutOfQuestions?.Invoke(this, new GameOverEventArgs(scoreKeeper.Scores));
                return;
            }
            // Remove any skip votes before we show the next question
            hasVotedToSkip.Clear();
            QuestionReady?.Invoke(this, new QuestionEventArgs(questionSetManager.CurrentQuestion));

            //Start a timer to skip the question after a set amount of seconds
            StartQuestionTimer();
        }