コード例 #1
0
        public Setup AskForAmountOfPlayers()
        {
            var reponse = _playerInterface.Ask(PlayerInterfaceQuestions.AskAmountOfPlayers);
            int amount;

            if (
                !Int32.TryParse(reponse, out amount) ||
                amount < 1 ||
                amount > 6
                )
            {
                _playerInterface.Tell(PlayerInterfaceQuestions.MustEnterAValidNumber);

                return(AskForAmountOfPlayers());
            }
            else
            {
                _amountOfPlayers = amount;
            }

            return(this);
        }
コード例 #2
0
        public Setup AskForAmountOfPlayers()
        {
            // Console.WriteLine("How many players will be playing the game?");
            // var response = Console.ReadLine();
            var reponse = _playerInterface.Ask(PlayerInterfaceQuestions.AskAmountOfPlayers);
            int amount;

            if (
                !Int32.TryParse(reponse, out amount) ||
                amount < 1 ||
                amount > 6
                )
            {
                _playerInterface.Tell(PlayerInterfaceQuestions.MustEnterAValidNumber);

                return(AskForAmountOfPlayers());
            }
            else
            {
                _amountOfPlayers = amount;
            }

            return(this);
        }