Пример #1
0
 private void removeRoom(PeerInfo creator)
 {
     foreach (Room room in roomList)
     {
         if (room.getCreator().getID() == creator.getID())
         {
             roomList.Remove(room);
             roomTable.Remove(room.getRoomID());
             return;
         }
     }
 }
Пример #2
0
 private void setNewCreator(PeerInfo oldCreator, PeerInfo newCreator)
 {
     foreach (Room room in roomList)
     {
         if (room.getCreator().getID() == oldCreator.getID())
         {
             room.setCreator(new PeerInfo(newCreator));
             room.getConnectedPeers().Clear();
             room.addPlayer(room.getCreator());
             roomTable[room.getRoomID()] = getHandler(room.getCreator());
             return;
         }
     }
 }
Пример #3
0
 private PeerHandler getHandler(PeerInfo peer)
 {
     foreach (PeerHandler handler in peerList)
     {
         if (handler.info.getID() == peer.getID())
         {
             return handler;
         }
     }
     return new PeerHandler();
 }