public JObject Join(string gameName) { MultiPlayerModel model = MultiPlayerModel.GetInstance(); string clientID = Context.ConnectionId; string mazeAsString = model.Join(gameName, clientID); Maze maze = Maze.FromJSON(mazeAsString); string otherPlayerID = model.GetOtherPlayerID(clientID); JObject obj = JObject.Parse(maze.ToJSON()); //TODO: Call to function to draw the mazes on other player client(by notify to otherPlayerID ). Clients.Client(clientID).drawMazes(obj); Clients.Client(otherPlayerID).drawMazes(obj); return(obj); }
public void Play(string direction, int oldRow, int oldCol) { MultiPlayerModel model = MultiPlayerModel.GetInstance(); string clientID = Context.ConnectionId; string otherPlayerID = model.GetOtherPlayerID(clientID); //TODO: Call to function to draw this move on the other client canvas. if (direction == "won") { Clients.Client(otherPlayerID).otherWon(); } else { Clients.Client(otherPlayerID).otherMoving(direction, oldRow, oldCol); } }