Пример #1
0
        public TaskInfo Execute(string details)
        {
            Mazes.MazeProgram.Multiplayer(details);
            Mazes.IDataClass     data   = Mazes.MazeProgram.GetData();
            JavaScriptSerializer serial = new JavaScriptSerializer();
            string   json    = serial.Serialize(data);
            string   name    = data.GetMazeName();
            bool     isFirst = name.Contains("player1");
            TaskInfo info    = new TaskInfo(json);

            if (isFirst)
            {
                info.Set_Multi_Info((int)MultiplayInfo.First_Request);
            }
            else
            {
                info.Set_Multi_Info((int)MultiplayInfo.Second_Request);
            }
            info.SetMultGame(data.GetName());

            /*bool isFirst = MazeButNot.Multiplayer.IsFirst ();
             * if (isFirst) {
             *      Console.WriteLine ("is first");
             *      info.Set_Multi_Info ((int) MultiplayInfo.First_Request);
             * } else {
             *      Console.WriteLine ("is second");
             *      info.Set_Multi_Info ((int) MultiplayInfo.Second_Request);
             * }
             * info.SetMultGame ("blerrrrf"); // Get name of multiplayer game */
            return(info);
        }
Пример #2
0
        /// <summary>
        /// Executes this command
        /// </summary>
        /// <param name="details">The details of this request from the client -
        /// everything after "generate", "play", etc.</param>
        /// <returns>TaskInfo about the command that was executed</returns>
        public TaskInfo Execute(string details)
        {
            // details is simply the move done by the player
            TaskInfo info = new TaskInfo(details);

            info.Set_Multi_Info((int)MultiplayInfo.Play_Request);
            return(info);
        }
Пример #3
0
        public TaskInfo Execute(string details)
        {
            // details stores the name of the game to close
            TaskInfo info = new TaskInfo("");              // we're not going to print anything for the close command

            info.Set_Multi_Info((int)MultiplayInfo.Close_Request);
            info.SetMultGame(details);
            return(info);
        }
Пример #4
0
        public TaskInfo Execute(string details)
        {
            Mazes.MazeProgram.Close(details); // delete the game in the maze databases
            TaskInfo info = new TaskInfo(""); // we're not going to print anything for the close command

            info.Set_Multi_Info((int)MultiplayInfo.Close_Request);
            info.SetMultGame(details); // details stores the name of the game to close
            return(info);
        }
Пример #5
0
        public TaskInfo Execute(string details)
        {
            Mazes.MazeProgram.Multiplayer(details);
            Mazes.IDataClass     data   = Mazes.MazeProgram.GetData();
            JavaScriptSerializer serial = new JavaScriptSerializer();
            string   json    = serial.Serialize(data);
            string   name    = data.GetMazeName();
            bool     isFirst = name.Contains("player1");
            TaskInfo info    = new TaskInfo(json);

            if (isFirst)
            {
                info.Set_Multi_Info((int)MultiplayInfo.First_Request);
            }
            else
            {
                info.Set_Multi_Info((int)MultiplayInfo.Second_Request);
            }
            info.SetMultGame(data.GetName());
            return(info);
        }