Exemplo n.º 1
0
        /// <summary>
        /// Calls start game method of model and call draw board
        /// method of client.
        /// </summary>
        /// <param name="nameOfGame"> name of game</param>
        /// <param name="rows"> number of rows </param>
        /// <param name="cols"> number of cols </param>
        public void StartGame(string nameOfGame, int rows, int cols)
        {
            ServerModel model = ServerModel.GetInstance();
            // current player
            string clientId = Context.ConnectionId;
            Maze   maze     = model.StartGame(nameOfGame, rows, cols, clientId);

            //calls draw board function in client
            Clients.Client(clientId).drawBoard("myCanvas", maze.ToJSON(),
                                               "playerImg", "exitImg", true);
        }