add roomss

This commit is contained in:
Clément
2025-03-13 09:52:25 +01:00
parent 709a92aa4c
commit a4c5d3f67b
3 changed files with 25 additions and 6 deletions

View File

@@ -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);
});
}
} }

View File

@@ -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) {

View File

@@ -26,10 +26,17 @@
</top> </top>
<left> <left>
<ScrollPane prefWidth="200.0" fitToWidth="true"> <ScrollPane prefWidth="200.0" fitToWidth="true">
<BorderPane>
<center>
<VBox spacing="10.0" alignment="CENTER" VBox.vgrow="ALWAYS"> <VBox spacing="10.0" alignment="CENTER" VBox.vgrow="ALWAYS">
<Label text="Rooms" styleClass="rooms-label"/> <Label text="Rooms" styleClass="rooms-label"/>
<VBox fx:id="roomList" styleClass="rooms-list" spacing="5.0" VBox.vgrow="ALWAYS" alignment="CENTER"/> <VBox fx:id="roomList" styleClass="rooms-list" spacing="5.0" VBox.vgrow="ALWAYS" alignment="CENTER"/>
</VBox> </VBox>
</center>
<bottom>
<Button text="Create room" onAction="#createRoom" />
</bottom>
</BorderPane>
</ScrollPane> </ScrollPane>
</left> </left>
<center> <center>