private void removeRoom(PeerInfo creator) { foreach (Room room in roomList) { if (room.getCreator().getID() == creator.getID()) { roomList.Remove(room); roomTable.Remove(room.getRoomID()); return; } } }
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; } } }
private PeerHandler getHandler(PeerInfo peer) { foreach (PeerHandler handler in peerList) { if (handler.info.getID() == peer.getID()) { return handler; } } return new PeerHandler(); }