Added the gameView so to the TrainAnimationViewDay but the whole thing is currently in front of all the lobby elements, because the boarder pane is in the way TODO: find a way to make boarderPane truly transparent
This commit is contained in:
parent
19ddf70e72
commit
4079561f7e
@ -2,3 +2,4 @@ B
|
||||
serai
|
||||
serai
|
||||
Jonas of Istanbul
|
||||
serai
|
||||
|
||||
@ -10,6 +10,7 @@ import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.util.Duration;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@ -37,8 +38,11 @@ public class TrainAnimationDayController implements Initializable {
|
||||
@FXML
|
||||
private ImageView lokiImageView;
|
||||
|
||||
|
||||
private ChatApp chatApp;
|
||||
private static ChatApp cApp;
|
||||
private static AnchorPane gamePane;
|
||||
private static ImageView loki;
|
||||
|
||||
public TrainAnimationDayController(){
|
||||
super();
|
||||
@ -57,9 +61,22 @@ public class TrainAnimationDayController implements Initializable {
|
||||
TrainAnimationDayController.cApp = cApp;
|
||||
}
|
||||
|
||||
public AnchorPane getGameAnchorPane() {
|
||||
return gameAnchorPane;
|
||||
}
|
||||
|
||||
public ImageView getWagonFullImageView() {
|
||||
return wagonFullImageView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
LoungeSceneViewController.setTrainAnimationDayController(this);
|
||||
LOGGER.debug(cApp);
|
||||
setChatApp(cApp);
|
||||
LOGGER.debug(gameAnchorPane);
|
||||
gamePane = gameAnchorPane;
|
||||
loki = lokiImageView;
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -69,4 +86,43 @@ public class TrainAnimationDayController implements Initializable {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the gameView to the existing LobbyView
|
||||
*/
|
||||
public void addGameView(ChatApp c) {
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
TrainAnimationDayController controller = new TrainAnimationDayController();
|
||||
LOGGER.debug(gamePane);
|
||||
LOGGER.debug(loki);
|
||||
LOGGER.debug(cApp);
|
||||
gameAnchorPane.getChildren().add(c.game);
|
||||
wagonFullImageView.setVisible(false);
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("Not yet initialized");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the GameView again - needed when a game is over or a lobby is left
|
||||
*/
|
||||
public void removeGameView(ChatApp c) {
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
gameAnchorPane.getChildren().clear();
|
||||
wagonFullImageView.setVisible(true);
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("Not yet initialized");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,6 +97,7 @@ public class LoungeSceneViewController implements Initializable {
|
||||
public static ClientModel client;
|
||||
private static ChatApp chatApp;
|
||||
private ChatApp cApp;
|
||||
private static TrainAnimationDayController trainAnimationDayController;
|
||||
|
||||
ObservableList<ClientListItem> clients = FXCollections.observableArrayList();
|
||||
ObservableList<LobbyListItem> lobbies = FXCollections.observableArrayList();
|
||||
@ -119,6 +120,15 @@ public class LoungeSceneViewController implements Initializable {
|
||||
this.cApp = cApp;
|
||||
}
|
||||
|
||||
public static void setTrainAnimationDayController(
|
||||
TrainAnimationDayController trainAnimationDayController) {
|
||||
LoungeSceneViewController.trainAnimationDayController = trainAnimationDayController;
|
||||
}
|
||||
|
||||
public static TrainAnimationDayController getTrainAnimationDayController() {
|
||||
return trainAnimationDayController;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to initialize a controller after its root element has been completely processed.
|
||||
*
|
||||
@ -141,7 +151,9 @@ public class LoungeSceneViewController implements Initializable {
|
||||
ClientListView.setItems(clients);
|
||||
addChatView();
|
||||
addBackgroundDay();
|
||||
TrainAnimationDayController.setcApp(this.cApp);
|
||||
LOGGER.debug("cApp = " + cApp);
|
||||
LOGGER.debug("chatApp = " + chatApp);
|
||||
TrainAnimationDayController.setcApp(cApp);
|
||||
|
||||
ClientListView.setItems(clients);
|
||||
ClientListView.setCellFactory(param -> {
|
||||
@ -321,13 +333,15 @@ public class LoungeSceneViewController implements Initializable {
|
||||
* Adds the gameView to the existing LobbyView
|
||||
*/
|
||||
public void addGameView() {
|
||||
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
LOGGER.debug(" in addGameView()" + chatApp);
|
||||
newGameButton.setVisible(false);
|
||||
startGame.setVisible(false);
|
||||
gameAnchorPane.getChildren().add(chatApp.game);
|
||||
trainAnimationDayController.addGameView(chatApp);
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("Not yet initialized");
|
||||
}
|
||||
@ -345,7 +359,7 @@ public class LoungeSceneViewController implements Initializable {
|
||||
try {
|
||||
newGameButton.setVisible(true);
|
||||
startGame.setVisible(true);
|
||||
gameAnchorPane.getChildren().clear();
|
||||
trainAnimationDayController.removeGameView(chatApp);
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("Not yet initialized");
|
||||
}
|
||||
|
||||
@ -3,44 +3,49 @@
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
|
||||
<StackPane maxHeight="1080.0" maxWidth="1920.0" minHeight="-Infinity" minWidth="-Infinity" stylesheets="@TrainAnimationDay.css" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.TrainAnimationDayController">
|
||||
<AnchorPane pickOnBounds="false" prefHeight="200.0" prefWidth="200.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.TrainAnimationDayController">
|
||||
<children>
|
||||
<AnchorPane prefHeight="200.0" prefWidth="200.0">
|
||||
<AnchorPane pickOnBounds="false" prefHeight="200.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fx:id="backGroundAnimationImageView" fitHeight="843.75" fitWidth="1500.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<ImageView fx:id="backGroundAnimationImageView" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<ImageView fx:id="shadowTrain" fitHeight="843.75" fitWidth="1500.0" pickOnBounds="true" preserveRatio="true">
|
||||
<ImageView fx:id="shadowTrain" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@game/Day/Shadow_Below_Train.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<ImageView fx:id="wagonBGImageView" fitHeight="843.75" fitWidth="1500.0" pickOnBounds="true" preserveRatio="true">
|
||||
<ImageView fx:id="wagonBGImageView" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@game/Day/Second_Wagon.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<ImageView fx:id="wagonFloorImageView" fitHeight="843.75" fitWidth="1500.0" pickOnBounds="true" preserveRatio="true">
|
||||
<ImageView fx:id="wagonFloorImageView" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@game/Day/Empty_Wagon.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<AnchorPane fx:id="gameAnchorPane" />
|
||||
<ImageView fx:id="wagonFullImageView" fitHeight="843.75" fitWidth="1500.0" pickOnBounds="true" preserveRatio="true">
|
||||
<AnchorPane fx:id="gameAnchorPane" pickOnBounds="false" />
|
||||
<ImageView fx:id="wagonWallImageView" fitHeight="843.75" fitWidth="1500.0" mouseTransparent="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@game/Day/Empty_Wagon_Wall.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<ImageView fx:id="wagonFullImageView" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@game/Day/Full_Wagon.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<ImageView fx:id="lokiImageView" fitHeight="843.75" fitWidth="1500.0" pickOnBounds="true" preserveRatio="true">
|
||||
<ImageView fx:id="lokiImageView" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@game/Day/Loki.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<AnchorPane fx:id="wheelsAnchorPane">
|
||||
<AnchorPane fx:id="wheelsAnchorPane" mouseTransparent="true" pickOnBounds="false">
|
||||
<children>
|
||||
<ImageView fx:id="wheelsImageView" fitHeight="843.75" fitWidth="1500.0" pickOnBounds="true" preserveRatio="true" />
|
||||
</children></AnchorPane>
|
||||
<ImageView fx:id="wheelsImageView" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</StackPane>
|
||||
</AnchorPane>
|
||||
|
||||
@ -9,48 +9,48 @@
|
||||
<?import javafx.scene.text.Font?>
|
||||
<?import javafx.scene.text.TextFlow?>
|
||||
|
||||
<AnchorPane id="BG" fx:id="gameBG" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="843.75" prefWidth="1500.0" styleClass="theme" stylesheets="@GameDay.css" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.game.GameController">
|
||||
<AnchorPane id="BG" fx:id="gameBG" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" pickOnBounds="false" prefHeight="843.75" prefWidth="1500.0" styleClass="theme" stylesheets="@GameDay.css" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.game.GameController">
|
||||
<children>
|
||||
<ImageView fx:id="room0ImageView" fitHeight="843.75" fitWidth="1500.0" pickOnBounds="true" preserveRatio="true">
|
||||
<ImageView fx:id="room0ImageView" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@Day/Room1.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<ImageView fx:id="room1ImageView" fitHeight="843.75" fitWidth="1500.0" pickOnBounds="true" preserveRatio="true">
|
||||
<ImageView fx:id="room1ImageView" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@Day/Room2.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<ImageView fx:id="room2ImageView" fitHeight="843.75" fitWidth="1500.0" pickOnBounds="true" preserveRatio="true">
|
||||
<ImageView fx:id="room2ImageView" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@Day/Room3.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<ImageView fx:id="room3ImageView" fitHeight="843.75" fitWidth="1500.0" pickOnBounds="true" preserveRatio="true">
|
||||
<ImageView fx:id="room3ImageView" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@Day/Room4.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<ImageView fx:id="room4ImageView" fitHeight="843.75" fitWidth="1500.0" pickOnBounds="true" preserveRatio="true">
|
||||
<ImageView fx:id="room4ImageView" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@Day/Room5.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<ImageView fx:id="room5ImageView" fitHeight="843.75" fitWidth="1500.0" pickOnBounds="true" preserveRatio="true">
|
||||
<ImageView fx:id="room5ImageView" fitHeight="843.75" fitWidth="1500.0" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@Day/Room6.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<Group fx:id="roomButtonGroupDay" layoutX="288.0" layoutY="220.0">
|
||||
<children>
|
||||
<HBox fx:id="notificationHBox" layoutX="20.0" layoutY="-55.0" rotate="12.4">
|
||||
<HBox fx:id="notificationHBox" layoutX="20.0" layoutY="-55.0" pickOnBounds="false" rotate="12.4">
|
||||
<children>
|
||||
<ImageView fx:id="noiseImage0" fitHeight="150.0" fitWidth="125.0" pickOnBounds="true" preserveRatio="true" rotate="-12.4" />
|
||||
<ImageView fx:id="noiseImage1" fitHeight="150.0" fitWidth="125.0" pickOnBounds="true" preserveRatio="true" rotate="-12.4" />
|
||||
<ImageView fx:id="noiseImage2" fitHeight="150.0" fitWidth="125.0" pickOnBounds="true" preserveRatio="true" rotate="-12.4" />
|
||||
<ImageView fx:id="noiseImage3" fitHeight="150.0" fitWidth="125.0" pickOnBounds="true" preserveRatio="true" rotate="-12.4" />
|
||||
<ImageView fx:id="noiseImage4" fitHeight="150.0" fitWidth="125.0" pickOnBounds="true" preserveRatio="true" rotate="-12.4" />
|
||||
<ImageView fx:id="noiseImage5" fitHeight="150.0" fitWidth="125.0" pickOnBounds="true" preserveRatio="true" rotate="-12.4" />
|
||||
<ImageView fx:id="noiseImage0" fitHeight="150.0" fitWidth="125.0" preserveRatio="true" rotate="-12.4" />
|
||||
<ImageView fx:id="noiseImage1" fitHeight="150.0" fitWidth="125.0" preserveRatio="true" rotate="-12.4" />
|
||||
<ImageView fx:id="noiseImage2" fitHeight="150.0" fitWidth="125.0" preserveRatio="true" rotate="-12.4" />
|
||||
<ImageView fx:id="noiseImage3" fitHeight="150.0" fitWidth="125.0" preserveRatio="true" rotate="-12.4" />
|
||||
<ImageView fx:id="noiseImage4" fitHeight="150.0" fitWidth="125.0" preserveRatio="true" rotate="-12.4" />
|
||||
<ImageView fx:id="noiseImage5" fitHeight="150.0" fitWidth="125.0" preserveRatio="true" rotate="-12.4" />
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox fx:id="roomLables" alignment="CENTER" layoutY="82.0" prefHeight="62.0" prefWidth="747.0" rotate="12.2">
|
||||
@ -99,7 +99,7 @@
|
||||
<font>
|
||||
<Font name="System Bold" size="21.0" />
|
||||
</font></Button>
|
||||
<TextFlow fx:id="notificationText" accessibleRole="PARENT" layoutX="210.0" layoutY="20.0" prefHeight="200.0" prefWidth="800.0" textAlignment="CENTER" />
|
||||
<AnchorPane fx:id="chatAreaGame" />
|
||||
<TextFlow fx:id="notificationText" accessibleRole="PARENT" layoutX="210.0" layoutY="20.0" pickOnBounds="false" prefHeight="200.0" prefWidth="800.0" textAlignment="CENTER" />
|
||||
<AnchorPane fx:id="chatAreaGame" pickOnBounds="false" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
||||
@ -10,12 +10,11 @@
|
||||
<?import javafx.scene.shape.Line?>
|
||||
<?import javafx.scene.text.TextFlow?>
|
||||
|
||||
<AnchorPane fx:id="backGroundAnchorPane" stylesheets="@loungStyle.css" 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">
|
||||
<AnchorPane fx:id="backGroundAnchorPane" pickOnBounds="false" stylesheets="@loungStyle.css" 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>
|
||||
<AnchorPane fx:id="gameDisplayAnchorPane" />
|
||||
<BorderPane fx:id="LoungeSceneBorderPane" layoutX="860.0" layoutY="440.0" stylesheets="@boarderPane.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<BorderPane fx:id="LoungeSceneBorderPane" layoutX="860.0" layoutY="440.0" pickOnBounds="false" stylesheets="@boarderPane.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<top>
|
||||
<ToolBar fx:id="NTtBToolBar" prefHeight="77.0" BorderPane.alignment="CENTER">
|
||||
<ToolBar fx:id="NTtBToolBar" pickOnBounds="false" prefHeight="77.0" BorderPane.alignment="CENTER">
|
||||
<items>
|
||||
<Button fx:id="highScoreButton" mnemonicParsing="false" onAction="#sendHIghScore" text="High Score" />
|
||||
<Button fx:id="lobbyPrintButton" mnemonicParsing="false" onAction="#sendLilstle" text="Lobby List" />
|
||||
@ -26,7 +25,7 @@
|
||||
</ToolBar>
|
||||
</top>
|
||||
<center>
|
||||
<AnchorPane BorderPane.alignment="CENTER">
|
||||
<AnchorPane pickOnBounds="false" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
<Button fx:id="newGameButton" layoutX="34.0" layoutY="101.0" mnemonicParsing="false" text="New Lobby" />
|
||||
<AnchorPane fx:id="gameAnchorPane" />
|
||||
@ -35,7 +34,7 @@
|
||||
</AnchorPane>
|
||||
</center>
|
||||
<bottom>
|
||||
<AnchorPane fx:id="ChatArea" BorderPane.alignment="CENTER">
|
||||
<AnchorPane fx:id="ChatArea" pickOnBounds="false" 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">
|
||||
<items>
|
||||
@ -55,11 +54,12 @@
|
||||
</AnchorPane>
|
||||
</bottom>
|
||||
<left>
|
||||
<ListView fx:id="ClientListView" BorderPane.alignment="CENTER" />
|
||||
<ListView fx:id="ClientListView" pickOnBounds="false" BorderPane.alignment="CENTER" />
|
||||
</left>
|
||||
<right>
|
||||
<ListView fx:id="LobbyListView" BorderPane.alignment="CENTER" />
|
||||
<ListView fx:id="LobbyListView" pickOnBounds="false" BorderPane.alignment="CENTER" />
|
||||
</right>
|
||||
</BorderPane>
|
||||
<AnchorPane fx:id="gameDisplayAnchorPane" pickOnBounds="false" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
||||
Reference in New Issue
Block a user