Пример #1
0
        private void pickName(PlayerDto playerDto)
        {
            var characterName = _drawingRepository.GetCharacterCreationStateArt(PlayerCreationStateEnum.Name);

            _printService.ClearConsole();

            _drawingService.PrintArtCentered(characterName);

            _printService.Print("What do you want your character's name to be?");

            var name = _globalItemsProvider.UpperFirstChar(_printService.ReadInput());

            var newName = _playerRepository.GetPlayer(name);

            if (newName != null)
            {
                _printService.Print("That name is already taken. Pick a new name.");
                Thread.Sleep(2000);
                pickName(playerDto);
            }

            var choiceMade = false;

            while (!choiceMade)
            {
                _printService.Print($"Are you sure you want your character's name to be {name}?  yes | no");

                var choice = _printService.ReadInput();

                if (choice.ToUpper() == "YES")
                {
                    playerDto.Name = name;
                    choiceMade     = true;
                }
                else if (choice.ToUpper() == "NO")
                {
                    pickName(playerDto);
                    choiceMade = true;
                }
                else
                {
                    _printService.Print("You must type in yes or no");
                }
            }
        }