Пример #1
0
        public override void Respond(InterfaceHandler _interface)
        {
            List <string> First = new List <string> {
                ReplyMessage, "Would a joke cheer you up?", "Press Y for Yes and N for No"
            }; _interface.WriteTo(First);
            Random rand = new Random();

            TellJoke(rand, _interface);
            List <string> Final = new List <string> {
                "That's a no to a joke.", FarewellMessage
            };

            _interface.WriteTo(Final);
            _interface.Exit();
        }
Пример #2
0
        //Basic function for compiling messages to send to console,
        // need virtual keyword for polymorphism
        public virtual void Respond(InterfaceHandler _interface)
        {
            List <string> message = new List <string> {
                ReplyMessage, FarewellMessage
            };

            _interface.WriteTo(message);
            _interface.Exit();
        }
Пример #3
0
        public void TellJoke(Random _rand, InterfaceHandler _interface)
        {
            char input = _interface.GetResponse();

            if (input == 'Y' || input == 'y')
            {
                List <string> Joke = GetJoke(_rand);
                Joke.Add("Would you like to hear another joke?");
                _interface.WriteTo(Joke);
                TellJoke(_rand, _interface);
            }
        }