예제 #1
0
파일: Game.cs 프로젝트: bennnym/Myob.Fma
        public int GetUserGameSelection()
        {
            var gameSelection = Console.ReadLine();

            var validInput = UserInputValidation.GameSelectionCheck(gameSelection);

            if (!validInput)
            {
                Console.WriteLine("Please enter a valid number, try again:");
                return(GetUserGameSelection());
            }

            return(int.Parse(gameSelection));
        }
예제 #2
0
파일: Program.cs 프로젝트: bennnym/Myob.Fma
        private static void UserDefinedGame(string gameSelection)
        {
            var validInput = UserInputValidation.GameSelectionCheck(gameSelection);

            if (!validInput)
            {
                Console.WriteLine("Invalid game selection");
            }
            else
            {
                var game       = new Game();
                var gameChoice = game.Start(int.Parse(gameSelection));

                Console.WriteLine(gameChoice.Play());
            }
        }