Esempio n. 1
0
 public RemotePlayer(string connectionID, int ID)
 {
     _connectionID              = connectionID;
     _playerShape               = new ShapeModel();
     _playerShape.Left          = 0;
     _playerShape.Top           = 0;
     _playerShape.LastUpdatedBy = connectionID;
     _ID             = ID;
     _playerShape.id = ID;
 }
Esempio n. 2
0
 public Broadcaster()
 {
     // Save our hub context so we can easily use it
     // to send to its connected clients
     _hubContext      = GlobalHost.ConnectionManager.GetHubContext <MoveShapeHub>();
     _model           = new ShapeModel();
     _modelUpdated    = false;
     connectedPlayers = new Dictionary <string, RemotePlayer>();
     // Start the broadcast loop
     _broadcastLoop = new Timer(
         Broadcast,
         null,
         BroadcastInterval,
         BroadcastInterval);
 }
Esempio n. 3
0
 public void UpdateShape(ShapeModel clientModel)
 {
     updatedmodels.Add(clientModel);
     _modelUpdated = true;
 }
Esempio n. 4
0
 public void UpdateModel(ShapeModel clientModel)
 {
     clientModel.LastUpdatedBy = Context.ConnectionId;
     // Update the shape model within our broadcaster
     _broadcaster.UpdateShape(clientModel);
 }