Esempio n. 1
0
 public void HandleGamePlayingRequests(string argumentOne, ChatUser chatUser, IChatClient chatClient)
 {
     lock (SingleFileLock)
     {
         if (string.IsNullOrWhiteSpace(argumentOne))
         {
             // attempting to start a game
             _hangmanGame.AttemptToStartGame(chatClient, chatUser);
         }
         else if (argumentOne.Length == 1)
         {
             // asking about a letter
             _hangmanGame.AskAboutLetter(chatClient, argumentOne.ToLowerInvariant(), chatUser);
         }
         else
         {
             // guessing the word
             _hangmanGame.GuessWord(chatClient, argumentOne, chatUser);
         }
     }
 }
Esempio n. 2
0
        public override void Process(IChatClient chatClient, CommandReceivedEventArgs eventArgs)
        {
            string   argumentOne = eventArgs?.Arguments?.FirstOrDefault();
            ChatUser chatUser    = eventArgs?.ChatUser;

            lock (SingleFileLock)
            {
                if (string.IsNullOrWhiteSpace(argumentOne))
                {
                    // attempting to start a game
                    _hangmanGame.AttemptToStartGame(chatClient, chatUser);
                }
                else if (argumentOne.Length == 1)
                {
                    // asking about a letter
                    _hangmanGame.AskAboutLetter(chatClient, argumentOne.ToLowerInvariant(), chatUser);
                }
                else
                {
                    // guessing the word
                    _hangmanGame.GuessWord(chatClient, argumentOne, chatUser);
                }
            }
        }