示例#1
0
 /// <summary>
 /// executes a multiplayer play command
 /// </summary>
 /// <param name="args">arguments of the command</param>
 /// <param name="client">to give the command</param>
 /// <returns>the Status</returns>
 public Status Execute(string[] args, TcpClient client)
 {
     // checks if there is a connection with the server
     if (messageRec.IsMultiActive)
     {
         string message = String.Join(" ", args);
         messageRec.SendMessage(message);
         return(Status.Play);
     }
     Console.WriteLine("Game is not on");
     return(Status.Disconnect);
 }
示例#2
0
 /// <summary>
 /// executes the close command
 /// </summary>
 /// <param name="args">arguments of the command</param>
 /// <param name="client">to give the command</param>
 /// <returns></returns>
 public Status Execute(string[] args, TcpClient client)
 {
     // if the connection is active
     if (messageRec.IsMultiActive)
     {
         string message = String.Join(" ", args);
         // send and receive a message
         messageRec.SendMessage(message);
         return(Status.Close);
     }
     Console.WriteLine("Can't close a game without playing");
     return(Status.Disconnect);
 }
示例#3
0
 /// <summary>
 /// executes the close command
 /// </summary>
 /// <param name="args">arguments of the command</param>
 /// <param name="client">to give the command</param>
 /// <returns></returns>
 public Status Execute(string[] args, TcpClient client)
 {
     if (messageRec.IsMultiActive)
     {
         string message = String.Join(" ", args);
         // send and receive a message
         messageRec.SendMessage(message);
         Statues stat = Statues.FromJson(messageRec.GetMassage());
         Console.WriteLine(stat.Message);
         return(stat.Stat);
     }
     Console.WriteLine("Can't close a game without playing");
     return(Status.Disconnect);
 }