Ejemplo n.º 1
0
 public void TestAsk()
 {
     m_player.ClearBuffer();
     m_player.QuestionData = null;
     m_game.SendCommand("ask");
     Assert.AreEqual("Some text", m_player.Buffer(1));
     Assert.AreEqual(2, m_player.BufferLength, "Expected nothing else in the output buffer after question is asked");
     Assert.AreEqual("question text", m_player.QuestionData);
     m_game.SetQuestionResponse(true);
     Assert.AreEqual("response yes", m_player.Buffer(2));
 }
Ejemplo n.º 2
0
        public void ShowQuestion(string caption)
        {
            ClearBuffer();
            OutputText(caption + "<br/>Y/N:");
            string response;

            do
            {
                response = Console.ReadKey().KeyChar.ToString().ToUpper();
            } while (response != "Y" && response != "N");
            Console.WriteLine();

            Thread newThread = new Thread(() =>
            {
                m_game.SetQuestionResponse(response == "Y");
                ClearBuffer();
            });

            newThread.Start();
        }