Merge remote-tracking branch 'origin/Application' into Application
# Conflicts: # src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/lounge/LoungeSceneViewController.java
This commit is contained in:
commit
b58c371b7b
@ -31,9 +31,11 @@ public class ServerGameInfoHandler {
|
||||
switch (msg) {
|
||||
case ClientGameInfoHandler.ghostVoteRequest:
|
||||
msg = Protocol.serverRequestsGhostVote + "$" + passenger.getPosition() + "$";
|
||||
passenger.getClientHandler().sendMsgToClient(Protocol.printToClientConsole + "$" + ClientGameInfoHandler.ghostVoteRequest);
|
||||
break;
|
||||
case ClientGameInfoHandler.humanVoteRequest:
|
||||
msg = Protocol.serverRequestsHumanVote + "$" + passenger.getPosition() + "$";
|
||||
passenger.getClientHandler().sendMsgToClient(Protocol.printToClientConsole + "$" + ClientGameInfoHandler.humanVoteRequest);
|
||||
break;
|
||||
default:
|
||||
if(!msg.contains("$")) {
|
||||
|
||||
@ -129,7 +129,6 @@ public class ChatApp extends Application {
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
this.setcModel(clientModel);
|
||||
this.setGameC(gameController);
|
||||
|
||||
gameC.setClient(cModel);
|
||||
gameC.setGameStateModel(GameController.getGameStateModel());
|
||||
try {
|
||||
|
||||
@ -9,22 +9,27 @@ import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.application.Application;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.collections.ObservableMap;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListCell;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.SplitPane;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.TitledPane;
|
||||
import javafx.scene.control.ToolBar;
|
||||
@ -42,6 +47,13 @@ public class LoungeSceneViewController implements Initializable {
|
||||
public static final Logger LOGGER = LogManager.getLogger(LoungeSceneViewController.class);
|
||||
public static final BudaLogConfig l = new BudaLogConfig(LOGGER);
|
||||
|
||||
@FXML
|
||||
private SplitPane chatSplitPane;
|
||||
@FXML
|
||||
private AnchorPane chatAnchorPane;
|
||||
@FXML
|
||||
private AnchorPane otherNotificationAnchorPane;
|
||||
|
||||
@FXML
|
||||
private Button leaveLobbyButton;
|
||||
@FXML
|
||||
@ -61,8 +73,6 @@ public class LoungeSceneViewController implements Initializable {
|
||||
@FXML
|
||||
private AnchorPane ChatArea;
|
||||
@FXML
|
||||
private HBox ChatAreaHBox;
|
||||
@FXML
|
||||
private BorderPane LoungeSceneBorderPane;
|
||||
@FXML
|
||||
private ToolBar NTtBToolBar;
|
||||
@ -104,6 +114,10 @@ public class LoungeSceneViewController implements Initializable {
|
||||
ChangeNameButton.setOnAction(event -> changeName());
|
||||
LeaveServerButton.setOnAction(event -> leaveServer());
|
||||
newGameButton.setOnAction(event -> newGame());
|
||||
LobbyListView.setVisible(true);
|
||||
ClientListView.setVisible(true);
|
||||
ClientListView.setItems(clients);
|
||||
addChatView();
|
||||
|
||||
ClientListView.setItems(clients);
|
||||
ClientListView.setCellFactory(param -> {
|
||||
@ -278,8 +292,8 @@ public class LoungeSceneViewController implements Initializable {
|
||||
LobbyListView.setVisible(true);
|
||||
}
|
||||
|
||||
public void addGameView(){
|
||||
Platform.runLater(new Runnable(){
|
||||
public void addGameView() {
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@ -293,7 +307,7 @@ public class LoungeSceneViewController implements Initializable {
|
||||
});
|
||||
}
|
||||
|
||||
public void removeGameView(){
|
||||
public void removeGameView() {
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -308,6 +322,27 @@ public class LoungeSceneViewController implements Initializable {
|
||||
});
|
||||
}
|
||||
|
||||
public void addChatView() {
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
chatAnchorPane.getChildren().add(chatApp.chat);
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("Not yet initialized: chatAnchorPane");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateClientListView(ObservableList<SimpleStringProperty> names) {
|
||||
ObservableList<ClientListItem> clientsLeft = ClientListView.getItems();
|
||||
clientsLeft.removeAll(names);
|
||||
this.ClientListView.setItems(names);
|
||||
for (ClientListItem gone : clientsLeft) {
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds players to a lobby
|
||||
@ -366,6 +401,7 @@ public class LoungeSceneViewController implements Initializable {
|
||||
|
||||
public void leaveLobby() {
|
||||
client.getClient().sendMsgToServer(Protocol.leaveLobby);
|
||||
removeGameView();
|
||||
}
|
||||
|
||||
public void leaveServer() {
|
||||
@ -427,12 +463,5 @@ public class LoungeSceneViewController implements Initializable {
|
||||
public static void setClient(ClientModel client) {
|
||||
LoungeSceneViewController.client = client;
|
||||
}
|
||||
|
||||
public HBox getChatAreaHBox() {
|
||||
return ChatAreaHBox;
|
||||
}
|
||||
|
||||
public void setChatAreaHBox(HBox chatAreaHBox) {
|
||||
ChatAreaHBox = chatAreaHBox;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -12,9 +12,9 @@
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane fx:id="chatPaneRoot" prefHeight="251.0" prefWidth="343.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.chat.ChatController">
|
||||
<AnchorPane fx:id="chatPaneRoot" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.chat.ChatController">
|
||||
<children>
|
||||
<GridPane alignment="CENTER" layoutY="149.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="251.0" prefWidth="343.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<GridPane alignment="CENTER" layoutY="149.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="273.5" prefWidth="2072.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="100.0" />
|
||||
</columnConstraints>
|
||||
@ -34,19 +34,19 @@
|
||||
</AnchorPane>
|
||||
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" GridPane.rowIndex="1">
|
||||
<children>
|
||||
<GridPane alignment="CENTER" layoutX="10.0" layoutY="20.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="75.0" prefWidth="343.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<GridPane alignment="CENTER" layoutX="10.0" layoutY="20.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="82.0" prefWidth="2072.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="7.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="67.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" percentWidth="3.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" percentWidth="10.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="20.0" percentWidth="87.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" percentHeight="90.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="92.0" prefWidth="98.0" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
|
||||
<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">
|
||||
<children>
|
||||
<Button fx:id="sendButton" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="157.0" prefWidth="223.5" text="Send" textOverrun="CENTER_WORD_ELLIPSIS" wrapText="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<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>
|
||||
<Font size="10.0" />
|
||||
</font></Button>
|
||||
@ -57,7 +57,7 @@
|
||||
</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">
|
||||
<children>
|
||||
<TextField fx:id="whisperTargetSelectField" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="50.0" prefWidth="79.0" promptText="whisper..." AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
<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>
|
||||
<GridPane.margin>
|
||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
||||
@ -65,7 +65,7 @@
|
||||
</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">
|
||||
<children>
|
||||
<TextField fx:id="chatMsgField" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="50.0" prefWidth="213.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
<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>
|
||||
<GridPane.margin>
|
||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
||||
@ -86,7 +86,7 @@
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</GridPane>
|
||||
<GridPane fx:id="vBoxGridPane" alignment="CENTER" disable="true" layoutX="-14.0" layoutY="-235.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="167.0" prefWidth="331.0">
|
||||
<GridPane fx:id="vBoxGridPane" alignment="CENTER" disable="true" layoutX="-14.0" layoutY="-235.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="10.0" percentWidth="73.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="10.0" percentWidth="66.0" prefWidth="100.0" />
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.control.ToolBar?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.lounge.LoungeSceneViewController">
|
||||
<children>
|
||||
@ -22,16 +22,21 @@
|
||||
<center>
|
||||
<AnchorPane BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
<Button fx:id="newGameButton" layoutX="136.0" layoutY="105.0" mnemonicParsing="false" text="New Lobby" />
|
||||
<Button fx:id="newGameButton" layoutX="68.0" layoutY="101.0" mnemonicParsing="false" text="New Lobby" />
|
||||
<AnchorPane fx:id="gameAnchorPane" />
|
||||
<Button fx:id="startGame" layoutX="136.0" layoutY="141.0" mnemonicParsing="false" onAction="#startGame" text="Start Game" />
|
||||
<Button fx:id="startGame" layoutX="68.0" layoutY="156.0" mnemonicParsing="false" onAction="#startGame" text="Start Game" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</center>
|
||||
<bottom>
|
||||
<AnchorPane fx:id="ChatArea" BorderPane.alignment="CENTER">
|
||||
<AnchorPane fx:id="ChatArea" minHeight="100.0" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
<HBox fx:id="ChatAreaHBox" layoutX="394.0" layoutY="-33.0" prefWidth="842.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="-33.0" />
|
||||
<SplitPane fx:id="chatSplitPane" dividerPositions="0.5" 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" />
|
||||
</items>
|
||||
</SplitPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</bottom>
|
||||
|
||||
Reference in New Issue
Block a user