add roomss
This commit is contained in:
@@ -268,4 +268,16 @@ public class ClientGuiController implements ClientListener {
|
|||||||
public void handleActualRoom(String roomName) {
|
public void handleActualRoom(String roomName) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void createRoom() {
|
||||||
|
TextInputDialog dialog = new TextInputDialog();
|
||||||
|
dialog.setTitle("Create a room");
|
||||||
|
dialog.setHeaderText("Enter the name of the room");
|
||||||
|
dialog.setContentText("Room name:");
|
||||||
|
Optional<String> result = dialog.showAndWait();
|
||||||
|
result.ifPresent(name -> {
|
||||||
|
client.SendCreateRoom(name);
|
||||||
|
createChatEnv(name);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class PacketPool {
|
|||||||
private static int MAX_SEND_TRY = 50;
|
private static int MAX_SEND_TRY = 50;
|
||||||
private static long SEND_DELAY = 10;
|
private static long SEND_DELAY = 10;
|
||||||
private static long RETRY_INTERVAL = SEND_DELAY * 2;
|
private static long RETRY_INTERVAL = SEND_DELAY * 2;
|
||||||
private static float PACKET_LOSS_PROBABILITY = 0.1f;
|
private static float PACKET_LOSS_PROBABILITY = 0.0f;
|
||||||
|
|
||||||
private static record ReliablePacketAddress(ReliablePacket packet, InetSocketAddress address) {
|
private static record ReliablePacketAddress(ReliablePacket packet, InetSocketAddress address) {
|
||||||
@Override
|
@Override
|
||||||
@@ -97,7 +97,7 @@ public class PacketPool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void debugPrint(String msg) {
|
private void debugPrint(String msg) {
|
||||||
// System.out.println(msg);
|
System.out.println(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void debugSend(ReliablePacket packet, InetSocketAddress address) {
|
private void debugSend(ReliablePacket packet, InetSocketAddress address) {
|
||||||
|
|||||||
@@ -26,10 +26,17 @@
|
|||||||
</top>
|
</top>
|
||||||
<left>
|
<left>
|
||||||
<ScrollPane prefWidth="200.0" fitToWidth="true">
|
<ScrollPane prefWidth="200.0" fitToWidth="true">
|
||||||
<VBox spacing="10.0" alignment="CENTER" VBox.vgrow="ALWAYS">
|
<BorderPane>
|
||||||
<Label text="Rooms" styleClass="rooms-label"/>
|
<center>
|
||||||
<VBox fx:id="roomList" styleClass="rooms-list" spacing="5.0" VBox.vgrow="ALWAYS" alignment="CENTER"/>
|
<VBox spacing="10.0" alignment="CENTER" VBox.vgrow="ALWAYS">
|
||||||
</VBox>
|
<Label text="Rooms" styleClass="rooms-label"/>
|
||||||
|
<VBox fx:id="roomList" styleClass="rooms-list" spacing="5.0" VBox.vgrow="ALWAYS" alignment="CENTER"/>
|
||||||
|
</VBox>
|
||||||
|
</center>
|
||||||
|
<bottom>
|
||||||
|
<Button text="Create room" onAction="#createRoom" />
|
||||||
|
</bottom>
|
||||||
|
</BorderPane>
|
||||||
</ScrollPane>
|
</ScrollPane>
|
||||||
</left>
|
</left>
|
||||||
<center>
|
<center>
|
||||||
|
|||||||
Reference in New Issue
Block a user