예제 #1
0
        public char GetUsersNextAction(List <String> options, List <char> validResponses)
        {
            while (true)
            {
                WriteOptions(options);

                char response = reader.ReadInCharacter();

                if (!UserResponse.IsValidResponse(validResponses, response))
                {
                    WriteInvalidResponse();
                }
                else
                {
                    return(response);
                }
            }
        }
예제 #2
0
        public char GetYesOrNoAnswer(string question)
        {
            List <char> validResponses = new List <char>()
            {
                UserResponse.YES, UserResponse.NO
            };

            while (true)
            {
                writer.WriteLine($"{question} ({UserResponse.YES}/{UserResponse.NO})");

                char response = reader.ReadInCharacter();

                if (!UserResponse.IsValidResponse(validResponses, response))
                {
                    WriteInvalidResponse();
                }
                else
                {
                    return(response);
                }
            }
        }