Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/lounge/LoungeSceneViewController.java
This commit is contained in:
Seraina 2022-05-13 12:40:36 +02:00
commit d71da4cf0c
9 changed files with 21 additions and 91 deletions

View File

@ -374,10 +374,6 @@ public class Client {
case GuiParameters.VoteIsOver:
chatApp.getGameController().clearAllNoiseDisplay();
break;
case GuiParameters.listOfPLayers:
updateListOfClients(data);
//TODO
break;
case GuiParameters.getMembersInLobby:
updateLobbyMembers(data);
break;
@ -398,9 +394,6 @@ public class Client {
case GuiParameters.newLobbyCreated:
makeNewLobby(data);
break;
case GuiParameters.newPlayerOnServer:
addNewPlayerToGui(data);
break;
case GuiParameters.updateHighScore:
chatApp.getLoungeSceneViewController().addHighScore(data);
break;
@ -428,11 +421,6 @@ public class Client {
LOGGER.debug("Made it into removeLobbyFromGui()");
}
private void addNewPlayerToGui(String data) {
loungeSceneViewController.addClientToList(data);
LOGGER.debug("addNewPlayerToGui() seems to have finished");
}
private void makeNewLobby(String data) {
String[] params = data.split(":");
loungeSceneViewController.newLobby(params[0], params[1]);
@ -463,14 +451,6 @@ public class Client {
//TODO
}
private void updateListOfClients(String data) {
String[] arr = data.split(":");
ObservableList<SimpleStringProperty> list = new SimpleListProperty<>();
int n = arr.length;
for (int i = 0; i < n; i = i + 1) {
loungeSceneViewController.addClientToList(arr[i]);
}
}
/**
* Starts a new thread, thad adds a message to notificationText in the gameController, waits 3

View File

@ -69,10 +69,6 @@ public class LoungeSceneViewController implements Initializable {
@FXML
private SplitPane chatSplitPane;
@FXML
private AnchorPane chatAnchorPane;
@FXML
private AnchorPane otherNotificationAnchorPane;
@FXML
public Button highScoreButton;
@FXML
private Button leaveLobbyButton;
@ -87,8 +83,6 @@ public class LoungeSceneViewController implements Initializable {
@FXML
public ListView<LobbyListItem> LobbyListView;
@FXML
public ListView<ClientListItem> ClientListView;
@FXML
private Button ChangeNameButton;
@FXML
private Button LeaveServerButton;
@ -100,7 +94,6 @@ public class LoungeSceneViewController implements Initializable {
private ToolBar NTtBToolBar;
public static ListView<LobbyListItem> lListView;
public static ListView<ClientListItem> cListView;
public static ClientModel client;
private static ChatApp chatApp;
@ -153,10 +146,7 @@ public class LoungeSceneViewController implements Initializable {
newGameButton.setOnAction(event -> newGame());
LobbyListView.setVisible(true);
lListView = LobbyListView;
cListView = ClientListView;
LOGGER.debug("Lobby in initialize" + LobbyListView);
ClientListView.setVisible(true);
ClientListView.setItems(clients);
addChatView();
addBackgroundDay();
LOGGER.debug("cApp = " + cApp);
@ -395,7 +385,7 @@ public class LoungeSceneViewController implements Initializable {
@Override
public void run() {
try {
chatAnchorPane.getChildren().add(chatApp.chat);
ChatArea.getChildren().add(chatApp.chat);
} catch (Exception e) {
LOGGER.debug("Not yet initialized: chatAnchorPane");
}
@ -513,45 +503,6 @@ public class LoungeSceneViewController implements Initializable {
client.getClient().sendMsgToServer(Protocol.clientQuitRequest);
}
/**
* Used to add a new player to the list of players. "NPLOS" {@link ch.unibas.dmi.dbis.cs108.multiplayer.helpers.GuiParameters}
*
* @param s the information corresponding to to the client in String from
*/
public void addClientToList(String s) {
ClientListItem cl = new ClientListItem(s);
ClientListView = cListView;
Platform.runLater(new Runnable() {
@Override
public void run() {
clients.add(cl);
LOGGER.debug("in addClientToList() in run()");
LOGGER.debug(cl.toString() + " in run()");
}
});
}
/**
* Sould remove a client of a certain name from the ListView
*
* @param name the name of the client to be removed
*/
public void removeClientFromList(String name) {
Iterator<ClientListItem> it = clients.iterator();
while (it.hasNext()) {
String uid = it.next().getName();
if (uid.equals(name)) {
it.remove();
break;
}
}
}
public void removeClientFromLobby(String s) {
//todo
}
/**
* Sends the create New Lobby Protocol message
*/

View File

@ -44,7 +44,7 @@
<RowConstraints minHeight="10.0" percentHeight="90.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="56.0" prefWidth="125.0" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
<AnchorPane fx:id="sendButtonAnchor" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="56.0" prefWidth="125.0" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
<children>
<Button fx:id="sendButton" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="56.0" prefWidth="178.0" text="Send" textOverrun="CENTER_WORD_ELLIPSIS" wrapText="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<font>
@ -55,7 +55,7 @@
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</GridPane.margin>
</AnchorPane>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="92.0" prefWidth="85.0" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
<AnchorPane fx:id="whisperAnchor" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="92.0" prefWidth="85.0" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
<children>
<TextField fx:id="whisperTargetSelectField" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="56.0" prefWidth="488.0" promptText="whisper..." AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
@ -63,7 +63,7 @@
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</GridPane.margin>
</AnchorPane>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="92.0" prefWidth="366.0" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
<AnchorPane fx:id="chatinputAnchor" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="92.0" prefWidth="366.0" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
<children>
<TextField fx:id="chatMsgField" layoutX="-420.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="56.0" prefWidth="1372.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 947 KiB

After

Width:  |  Height:  |  Size: 137 KiB

View File

@ -35,31 +35,30 @@
</AnchorPane>
</center>
<bottom>
<AnchorPane fx:id="ChatArea" pickOnBounds="false" BorderPane.alignment="CENTER">
<AnchorPane fx:id="ChatArea" pickOnBounds="false" prefHeight="83.0" prefWidth="578.0" BorderPane.alignment="CENTER">
<children>
<SplitPane fx:id="chatSplitPane" dividerPositions="0.46467817896389324" minHeight="50.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<SplitPane fx:id="chatSplitPane" disable="true" dividerPositions="0.5" layoutY="-34.0" minHeight="50.0" prefHeight="46.0" prefWidth="578.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
<AnchorPane fx:id="chatAnchorPane" minHeight="0.0" minWidth="0.0" />
<AnchorPane fx:id="otherNotificationAnchorPane" minHeight="0.0" minWidth="0.0">
<children>
<Label text="High Score:" />
<TextFlow fx:id="highScore" layoutY="18.0" prefHeight="30.0" prefWidth="99.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="239.0" AnchorPane.topAnchor="18.0" />
<Label layoutX="120.0" text="Lobbies:" />
<TextFlow fx:id="lobbyPrint" layoutX="120.0" layoutY="18.0" />
<Line endX="-6.5" endY="-24.0" layoutX="120.0" layoutY="24.0" startX="-6.5" startY="48.5" AnchorPane.bottomAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
</items>
</SplitPane>
<AnchorPane fx:id="ChatArea" prefHeight="200.0" prefWidth="200.0" />
<AnchorPane prefHeight="200.0" prefWidth="200.0" />
</items></SplitPane>
</children>
</AnchorPane>
</bottom>
<left>
<ListView fx:id="ClientListView" pickOnBounds="false" BorderPane.alignment="CENTER" />
</left>
<right>
<ListView fx:id="LobbyListView" pickOnBounds="false" BorderPane.alignment="CENTER" />
</right>
<left>
<AnchorPane prefHeight="316.0" prefWidth="181.0" BorderPane.alignment="CENTER">
<children>
<Label layoutX="59.0" layoutY="200.0" text="High Score:" />
<TextFlow fx:id="highScore" layoutX="62.0" layoutY="232.0" prefHeight="167.0" prefWidth="181.0" AnchorPane.bottomAnchor="1.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="232.0" />
<Label layoutX="67.0" layoutY="6.0" text="Players:" />
<TextFlow fx:id="lobbyPrint" layoutX="5.0" layoutY="23.0" prefHeight="178.0" prefWidth="171.0" />
<Line endX="72.5" layoutX="91.0" layoutY="201.0" startX="-79.5" />
</children>
</AnchorPane>
</left>
</BorderPane>
<AnchorPane fx:id="gameDisplayAnchorPane" maxHeight="843.75" maxWidth="1500.0" pickOnBounds="false" />
</children>