/// <summary>
        /// Gets the next question in the current trivia session
        /// </summary>
        /// <returns>A <c>QuestionModel</c> representing the question</returns>
        public QuestionModel GetNextQuestion()
        {
            // Check if we've run out of questions
            if (currentQuestionIndex + 1 > QuestionSet.QuestionCount)
            {
                OutOfQuestions?.Invoke(this, null);
                return(null);
            }

            // If we have questions, grab a new one
            currentQuestionIndex += 1;
            return(QuestionSet.GetQuestion(currentQuestionIndex));
        }
Пример #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();
        }
Пример #3
0
 /// <summary>
 /// Overidable function called when theres no more questions.
 /// </summary>
 public virtual void OnOutOfQuestions()
 {
     OutOfQuestions?.Invoke(this, null);
 }