Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MultiPlayerGameController"/> class.
        /// </summary>
        /// <param name="multiPlayerDs">The multi player ds.</param>
        /// <param name="amITheHostClient">if set to <c>true</c> [am i the host client].</param>
        public MultiPlayerGameController(MultiPlayerDS multiPlayerDs, bool amITheHostClient)
        {
            this.multiPlayerDs = multiPlayerDs;
            IamHostClient      = amITheHostClient;

            //dictionary with the possible commands of multiplayer mode:
            commands = new Dictionary <string, ICommand>();
            commands.Add("play", new PlayCommand(multiPlayerDs, model));
            commands.Add("close", new CloseCommand(multiPlayerDs, model));
        }
Esempio n. 2
0
 /// <summary>
 /// Starts a new multi plyer game by set the info for it
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="rows">The rows.</param>
 /// <param name="cols">The cols.</param>
 /// <param name="host">The host.</param>
 /// <returns>MultiPlayerDS.</returns>
 public MultiPlayerDS start(string name, int rows, int cols, TcpClient host)
 {
     if (DictionaryOfMazes.ContainsKey(name))
     {
         var multiPlayerDs = new MultiPlayerDS(host, name, DictionaryOfMazes[name]);
         DictionaryOfMultiPlayerDS.Add(name, multiPlayerDs);
         return(multiPlayerDs);
     }
     else
     {
         var multiPlayerDs = new MultiPlayerDS(host, name, generate(name, rows, cols));
         DictionaryOfMultiPlayerDS.Add(name, multiPlayerDs);
         return(multiPlayerDs);
     }
 }