コード例 #1
0
ファイル: CheckManager.cs プロジェクト: klimentt/Hangman-6
 /// <summary>
 /// Initialize a new instance of the HangmanSix.CheckManager class
 /// </summary>
 /// <param name="player"></param>
 public CheckManager(Player player)
 {
     this.Player = player;
     this.CommandManager = new CommandManager();
     this.HasHelpUsed = false;
     this.UsedLetters = new HashSet<char>();
 }
コード例 #2
0
ファイル: GameEngine.cs プロジェクト: klimentt/Hangman-6
 public GameEngine(Player player, IConsole consoleWrapper)
 {
     this.Player = player;
     this.ConsoleWrapper = consoleWrapper;
     this.ChoiceStrategy = new ChoiceRandom();
     this.PathToSecretWordsDirectory = PathToSecretWordsDatabase;
 }
コード例 #3
0
ファイル: ScoreBoard.cs プロジェクト: klimentt/Hangman-6
 public void AddScore(Player player)
 {
     this.TopScores.Add(player.Name, player.AttemptsToGuess);
     ExtractSpecificTopScores();
 }
コード例 #4
0
ファイル: ScoreBoard.cs プロジェクト: klimentt/Hangman-6
        public void Update(Player player)
        {
            this.Load();
            if (this.TopScores.Count < NumberOfTopScores || player.AttemptsToGuess < this.TopScores.Values.Last())
            {
                while (true)
                {
                    UIMessages.EnterPlayerNameMessage();
                    player.Name = this.ConsoleWrapper.ReadLine();

                    if (player.Name == string.Empty)
                    {
                        throw new ArgumentException("The player's name cannot be an empty strig!");
                    }
                    else if (this.TopScores.ContainsKey(player.Name))
                    {
                        throw new ArgumentException("Existing name!");
                    }

                    break;
                }

                this.AddScore(player);
                this.Save();
            }
        }