Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultiPlayerMaze"/> class.
 /// </summary>
 /// <param name="answer">The answer.</param>
 /// <param name="rows">The rows.</param>
 /// <param name="cols">The columns.</param>
 /// <param name="server">The server.</param>
 public MultiPlayerMaze(MultiplayerAnswer answer, int rows, int cols, IServer server)
 {
     this.server            = server;
     this.answer            = answer;
     this.cols              = cols;
     this.rows              = rows;
     this.playerPosition    = new MazePosition(this.answer.You.Start);
     this.opponenetPosition = new MazePosition(this.answer.Other.Start);
     this.hint              = new MazePosition(this.answer.You.Start);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Builds a reply.
        /// </summary>
        /// <param name="name">The name of the maze.</param>
        /// <param name="type">The type of command.</param>
        /// <param name="myMaze">the first client's maze.</param>
        /// <param name="otherMaze">The other client's maze.</param>
        /// <returns>reply string</returns>
        private string BuildReply(string name, int type, GenerateAnswer myMaze, GenerateAnswer otherMaze)
        {
            MultiplayerAnswer ans = new MultiplayerAnswer();

            ans.Name     = name;
            ans.MazeName = name + " maze";
            ans.You      = myMaze;
            ans.Other    = otherMaze;

            return(new Answer().GetJSONAnswer(type, ans));
        }