Esempio n. 1
0
        void OnTimeToGiveAHint(object source, ElapsedEventArgs e)
        {
            string currentHint = mQuizHint.GiveAHint();

            if (CurrentQuizObject.IsImageQuestion())
            {
                CurrentQuizObject.UncoverPartOfImageQuestion();
                ShowStaff(CurrentQuizObject.GetImageQuestion());
            }
            //SendMessage(new IrcCommand(null, "PRIVMSG", new IrcCommandParameter("#sovietmade", false), new IrcCommandParameter(currentHint, true)).ToString() + "\r\n");
            SendMessage(currentHint);
        }
Esempio n. 2
0
        async void OnTimeToAskAQuestion(object source, ElapsedEventArgs e)
        {
            mTimeToGiveAHint.Stop();
            mTimeToAskAQuestion.Stop();
            mTimeTillNextQuestion.Stop();

            //if there is no more items in Q, then the exception will be rised
            if (mQuizList.Count == 0)
            {
                return;
            }

            if (ctsDelay != null)
            {
                ctsDelay.Cancel();
            }
            ctsDelay = new CancellationTokenSource();


            if (mCurrentObject != null && mCurrentObject.IsAnswered() == false)
            {
                string message = String.Format("The answer was: {0}!", mCurrentObject.Answer);
                mCurrentObject.SetAnswered(true);
                SendMessage(message);
                if (mCurrentObject.IsImageQuestion())
                {
                    mCurrentObject.UncoverFullImage();
                    ShowStaff(mCurrentObject.GetImageQuestion());
                }
            }

            CurrentQuizObject = GetQuizObject();

            if (CurrentQuizObject == null)
            {
                InternalInitiationQuizStop();
                return;
            }

            mQuizHint = new QuizHint(CurrentQuizObject.Answer);

            TimeTillNextQuestion = TimeBetweenQuestions / 1000;

            await DelayExecution(ctsDelay.Token);

            if (mCurrentObject == null || cts == null || !quizIsRunning)
            {
                return;
            }
            mTimeToGiveAHint.Start();
            mTimeToAskAQuestion.Start();


            mTimeTillNextQuestion.Start();
            //SendMessage(new IrcCommand(null,"PRIVMSG", new IrcCommandParameter("#sovietmade",false), new IrcCommandParameter(mCurrentQAPair.Item1,true)).ToString() + "\r\n");
            if (!mCurrentObject.IsImageQuestion())
            {
                SendMessage(CurrentQuizObject.Question);
            }

            ShowStaff(CurrentQuizObject.GetImageQuestion());
        }