예제 #1
0
        public void UpdateVisualisation(byte envStatus, GameManagerState GameState,
                                        MoreOrLess.InternalState internalState, int accessCode, Question _currentQuestion,
                                        AnswerParameters _currentAnswer, int nScore,
                                        int nTotalGameSecs, int nRemainingSecs, int nRemainingQuestionSecs)
        {
            VisualisationData vd = new VisualisationData();

            vd.EnvironmentStatus = envStatus;
            vd.GameState         = GameState.ToString();
            vd.GameStateInt      = (int)GameState;
            vd.InternalState     = internalState.ToString();
            vd.InternalStateInt  = (int)internalState;
            vd.AccessCode        = accessCode;

            if (_currentQuestion != null)
            {
                vd.currentQuestion = _currentQuestion;
            }

            if (_currentAnswer != null)
            {
                vd.currentQuestionMin = _currentAnswer.GetMin();
                vd.currentQuestionMax = _currentAnswer.GetMax();
                vd.currentAnswerLo    = _currentAnswer.GetLo();
                vd.currentAnswerHi    = _currentAnswer.GetHi();
                vd.PotentialScore     = _currentAnswer.GetPotentialPoints();
            }

            vd.Score                 = nScore;
            vd.TotalGameSecs         = nTotalGameSecs;
            vd.RemainingSecs         = nRemainingSecs;
            vd.RemainingQuestionSecs = nRemainingQuestionSecs;

            WriteToVizServer(vd);

            if (m_bUseFileSystem)
            {
                if (!IsClientReceiving() || IsVisFileAlreadyPresent())
                {
                    _vdPending = vd;
                    _dogPendingUpdate.Reset();
                    return;
                }

                WriteToVizFile(vd);
            }
        }
예제 #2
0
        private void FetchQuestion()
        {
            SetInternalState(InternalState.FetchQuestion);
            _currentQuestion = _questionSource.GetQuestion();
            _currentAnswer   = new AnswerParameters();
            _currentAnswer.SetOriginalRange(_currentQuestion.Answer, _currentQuestion.RangeLo, _currentQuestion.RangeHi);

            Console.WriteLine("");
            Console.WriteLine("");
            Console.WriteLine("");
            Console.WriteLine("------------------------------------------------------------------");
            Console.WriteLine("New Question      -    remaining time(s): " + GetRemainingGameTimeSec());
            Console.WriteLine("------------");

            _dogAcceptAnswerTimeout.Reset();
            DisplayOutput();
            SetInternalState(InternalState.DisplayQuestion);
        }