Started to redesign the gui layout a little, so it isn't all over the place
This commit is contained in:
parent
02012f316d
commit
d5d58ac862
@ -52,6 +52,7 @@ public class GameState {
|
||||
for (int i = 0; i < nrOfPlayers; i++) {
|
||||
if (i == train.getPositionOfGhost()) {
|
||||
LOGGER.info("OG position: " + train.getOrderOfTrain()[i]);
|
||||
System.out.println("Og-Ghost Position: " + train.getOrderOfTrain()[i]);
|
||||
Ghost g = new Ghost();
|
||||
g.setPosition(train.getOrderOfTrain()[i]);
|
||||
g.setGhost();
|
||||
|
||||
@ -49,7 +49,7 @@ public class LobbyDisplayHandler {
|
||||
if (searchForLobbyId(id) == null) { //the lobby is new and has not been saved yet
|
||||
addLobbyFromString(id, admin, isOpen, oneLobby);
|
||||
} else { // the lobby exists but might need to be updated
|
||||
updateExistingLobby(id, isOpen, oneLobby);
|
||||
updateExistingLobby(id, admin, isOpen, oneLobby);
|
||||
}
|
||||
}
|
||||
//System.out.println("lobby size before removal: " + lobbies.size());
|
||||
@ -77,9 +77,12 @@ public class LobbyDisplayHandler {
|
||||
//System.out.println("lobby size: " + lobbies.size());
|
||||
}
|
||||
|
||||
private void updateExistingLobby(int id, boolean isOpen, String[] oneLobby) {
|
||||
private void updateExistingLobby(int id, String admin,boolean isOpen, String[] oneLobby) {
|
||||
//System.out.println("update");
|
||||
LobbyModel oldLobby = searchForLobbyId(id);
|
||||
if (!oldLobby.getAdmin().equals(admin)) {
|
||||
oldLobby.setAdmin(admin);
|
||||
}
|
||||
oldLobby.setHasBeenVisited(true);
|
||||
oldLobby.setLobbyIsOpen(isOpen);
|
||||
oldLobby.removeAllMembers();
|
||||
|
||||
@ -8,7 +8,7 @@ import java.util.HashSet;
|
||||
*/
|
||||
public class LobbyModel {
|
||||
private final int id;
|
||||
private final String admin;
|
||||
private String admin;
|
||||
private HashSet<String> members = new HashSet<String>(5);
|
||||
private boolean lobbyIsOpen = true;
|
||||
private boolean hasBeenVisited = false;
|
||||
@ -42,6 +42,10 @@ public class LobbyModel {
|
||||
return admin;
|
||||
}
|
||||
|
||||
public void setAdmin(String admin) {
|
||||
this.admin = admin;
|
||||
}
|
||||
|
||||
public void setHasBeenVisited(boolean hasBeenVisited) {
|
||||
this.hasBeenVisited = hasBeenVisited;
|
||||
}
|
||||
|
||||
@ -47,50 +47,38 @@ public class LoungeSceneViewController implements Initializable {
|
||||
|
||||
public static final Logger LOGGER = LogManager.getLogger(LoungeSceneViewController.class);
|
||||
public static final BudaLogConfig l = new BudaLogConfig(LOGGER);
|
||||
|
||||
@FXML
|
||||
private AnchorPane listLobbyAnchorPane;
|
||||
@FXML
|
||||
private AnchorPane buttonPane;
|
||||
@FXML
|
||||
private AnchorPane buttonLobbyPane;
|
||||
@FXML
|
||||
private AnchorPane backGroundAnimationPane;
|
||||
|
||||
@FXML
|
||||
private AnchorPane backGroundAnchorPane;
|
||||
@FXML
|
||||
private AnchorPane gameDisplayAnchorPane;
|
||||
@FXML
|
||||
private AnchorPane listLobbyAnchorPane;
|
||||
@FXML
|
||||
private TextFlow highScore;
|
||||
@FXML
|
||||
private SplitPane chatSplitPane;
|
||||
@FXML
|
||||
public Button highScoreButton;
|
||||
@FXML
|
||||
private Button leaveLobbyButton;
|
||||
@FXML
|
||||
private Button lobbyPrintButton;
|
||||
@FXML
|
||||
private Button startGame;
|
||||
@FXML
|
||||
private Button newGameButton;
|
||||
@FXML
|
||||
private AnchorPane gameAnchorPane;
|
||||
private ToolBar LobbyControlsToolBar;
|
||||
@FXML
|
||||
private BorderPane allLobbyElementsBorderPane;
|
||||
@FXML
|
||||
private AnchorPane ChatArea;
|
||||
@FXML
|
||||
private Button ChangeNameButton;
|
||||
@FXML
|
||||
private Button leaveLobbyButton;
|
||||
@FXML
|
||||
private Button LeaveServerButton;
|
||||
@FXML
|
||||
private AnchorPane ChatArea;
|
||||
private AnchorPane backGroundAnchorPane;
|
||||
@FXML
|
||||
private AnchorPane backGroundAnimationPane;
|
||||
@FXML
|
||||
private BorderPane LoungeSceneBorderPane;
|
||||
@FXML
|
||||
private ToolBar NTtBToolBar;
|
||||
|
||||
|
||||
public static ClientModel client;
|
||||
private static ChatApp chatApp;
|
||||
|
||||
private ChatApp cApp;
|
||||
private static TrainAnimationDayController trainAnimationDayController;
|
||||
|
||||
@ -172,7 +160,7 @@ public class LoungeSceneViewController implements Initializable {
|
||||
public void run() {
|
||||
try {
|
||||
LOGGER.debug(" in GameView()" + chatApp);
|
||||
buttonLobbyPane.setVisible(false);
|
||||
allLobbyElementsBorderPane.setVisible(false);
|
||||
gameDisplayAnchorPane.getChildren().add(chatApp.game);
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("Not yet initialized");
|
||||
@ -190,7 +178,7 @@ public class LoungeSceneViewController implements Initializable {
|
||||
public void run() {
|
||||
try {
|
||||
trainAnimationDayController.showFullWagon();
|
||||
buttonLobbyPane.setVisible(true);
|
||||
allLobbyElementsBorderPane.setVisible(true);
|
||||
gameDisplayAnchorPane.getChildren().clear();
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("Not yet initialized");
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package ch.unibas.dmi.dbis.cs108.multiplayer.server;
|
||||
|
||||
import ch.unibas.dmi.dbis.cs108.BudaLogConfig;
|
||||
import ch.unibas.dmi.dbis.cs108.highscore.OgGhostHighScore;
|
||||
import ch.unibas.dmi.dbis.cs108.multiplayer.helpers.GuiParameters;
|
||||
import ch.unibas.dmi.dbis.cs108.multiplayer.helpers.Protocol;
|
||||
import ch.unibas.dmi.dbis.cs108.multiplayer.helpers.ServerPinger;
|
||||
@ -18,12 +19,19 @@ public class LobbyUpdater implements Runnable{
|
||||
public void run() {
|
||||
while (true) {
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
LOGGER.warn(e.getMessage());
|
||||
}
|
||||
String lobbiesAsString = Lobby.lobbiesToString();
|
||||
for (ClientHandler client : ClientHandler.getConnectedClients()) {
|
||||
String list = OgGhostHighScore.formatGhostHighscoreList();
|
||||
String[] listarray = list.split("\\R");
|
||||
StringBuilder forGui = new StringBuilder();
|
||||
for (String s : listarray) {
|
||||
forGui.append(s).append("/n");
|
||||
}
|
||||
client.sendMsgToClient(Protocol.printToGUI + "$" + GuiParameters.updateHighScore + "$" + forGui.toString());
|
||||
if (!Lobby.lobbies.isEmpty()) {
|
||||
client.sendMsgToClient(
|
||||
Protocol.printToGUI + "$" + GuiParameters.updateLobbyString + "$" + lobbiesAsString);
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
.button:pressed{
|
||||
-fx-background-color: transparent;
|
||||
-fx-border-color: transparent;
|
||||
-fx-boarder-color: lightgrey;
|
||||
}
|
||||
|
||||
#noiseButton{
|
||||
@ -27,6 +27,7 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
.textField{
|
||||
-fx-text-fill: white;
|
||||
-fx-background-color: transparent;
|
||||
|
||||
@ -15,8 +15,6 @@
|
||||
<top>
|
||||
<ToolBar fx:id="NTtBToolBar" pickOnBounds="false" prefHeight="30.0" BorderPane.alignment="CENTER">
|
||||
<items>
|
||||
<Button fx:id="highScoreButton" mnemonicParsing="false" onAction="#sendHIghScore" pickOnBounds="false" text="High Score" />
|
||||
<Button fx:id="lobbyPrintButton" mnemonicParsing="false" onAction="#sendLilstle" pickOnBounds="false" text="Lobby List" />
|
||||
<Button fx:id="LeaveServerButton" mnemonicParsing="false" pickOnBounds="false" text="Leave server" />
|
||||
<Button fx:id="leaveLobbyButton" mnemonicParsing="false" onAction="#leaveLobby" pickOnBounds="false" text="Leave Lobby" />
|
||||
<Button fx:id="ChangeNameButton" mnemonicParsing="false" pickOnBounds="false" text="Change Name" />
|
||||
@ -24,22 +22,8 @@
|
||||
</ToolBar>
|
||||
</top>
|
||||
<left>
|
||||
<AnchorPane prefHeight="316.0" prefWidth="181.0" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
<Label layoutX="59.0" layoutY="200.0" pickOnBounds="false" text="High Score:" />
|
||||
<TextFlow fx:id="highScore" layoutX="62.0" layoutY="232.0" pickOnBounds="false" prefHeight="167.0" prefWidth="181.0" AnchorPane.bottomAnchor="1.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="232.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane prefHeight="316.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
|
||||
</left>
|
||||
<center>
|
||||
<AnchorPane fx:id="buttonLobbyPane" pickOnBounds="false" prefHeight="122.0" prefWidth="85.0" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
<Button fx:id="newGameButton" layoutX="9.0" layoutY="109.0" mnemonicParsing="false" pickOnBounds="false" text="New Lobby" AnchorPane.leftAnchor="9.0" />
|
||||
<AnchorPane fx:id="gameAnchorPane" pickOnBounds="false" />
|
||||
<Button fx:id="startGame" alignment="BASELINE_CENTER" layoutX="9.0" layoutY="140.0" mnemonicParsing="false" onAction="#startGame" pickOnBounds="false" text="Start Game" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</center>
|
||||
<bottom>
|
||||
<TilePane alignment="CENTER" orientation="VERTICAL" prefColumns="1" prefRows="1" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
@ -48,12 +32,33 @@
|
||||
</TilePane>
|
||||
</bottom>
|
||||
<right>
|
||||
<AnchorPane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
<AnchorPane fx:id="listLobbyAnchorPane" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
|
||||
</right>
|
||||
<center>
|
||||
<TilePane alignment="CENTER" orientation="VERTICAL" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
<BorderPane fx:id="allLobbyElementsBorderPane" prefHeight="600.0" prefWidth="500.0">
|
||||
<top>
|
||||
<ToolBar fx:id="LobbyControlsToolBar" prefHeight="37.0" prefWidth="500.0" BorderPane.alignment="CENTER">
|
||||
<items>
|
||||
<Button fx:id="newGameButton" mnemonicParsing="false" pickOnBounds="false" text="New Lobby" />
|
||||
</items>
|
||||
</ToolBar>
|
||||
</top>
|
||||
<bottom>
|
||||
<TextFlow fx:id="highScore" pickOnBounds="false" prefHeight="100.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
<Label pickOnBounds="false" text="High Score:" />
|
||||
</children>
|
||||
</TextFlow>
|
||||
</bottom>
|
||||
<center>
|
||||
<AnchorPane fx:id="listLobbyAnchorPane" prefWidth="0.0" BorderPane.alignment="CENTER" />
|
||||
</center>
|
||||
</BorderPane>
|
||||
</children>
|
||||
</TilePane>
|
||||
</center>
|
||||
</BorderPane>
|
||||
<AnchorPane fx:id="gameDisplayAnchorPane" maxHeight="843.75" maxWidth="1500.0" pickOnBounds="false" />
|
||||
</children>
|
||||
|
||||
Reference in New Issue
Block a user