mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Merge branch 'develop' into 1273_Skybox
This commit is contained in:
@@ -77,7 +77,7 @@ public class App extends Application {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
ViewManager.getInstance().initialStartView(primaryStage);
|
ViewManager.getInstance().initialiseSplashScreen(primaryStage);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void runDiscoveryServer(){
|
private static void runDiscoveryServer(){
|
||||||
|
|||||||
@@ -101,6 +101,10 @@ public class Sounds {
|
|||||||
musicPlayer.setCycleCount(MediaPlayer.INDEFINITE);
|
musicPlayer.setCycleCount(MediaPlayer.INDEFINITE);
|
||||||
musicPlayer.setVolume(0.3);
|
musicPlayer.setVolume(0.3);
|
||||||
musicPlayer.play();
|
musicPlayer.play();
|
||||||
|
musicPlayer.setMute(musicMuted);
|
||||||
|
if (soundEffect != null) {
|
||||||
|
soundEffect.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -284,12 +284,13 @@ public class GameClient {
|
|||||||
|
|
||||||
ClientYacht player = allBoatsMap.get(socketThread.getClientId());
|
ClientYacht player = allBoatsMap.get(socketThread.getClientId());
|
||||||
raceView.loadRace(allBoatsMap, courseData, raceState, player);
|
raceView.loadRace(allBoatsMap, courseData, raceState, player);
|
||||||
|
raceView.showView();
|
||||||
raceView.getSendPressedProperty().addListener((obs, old, isPressed) -> {
|
raceView.getSendPressedProperty().addListener((obs, old, isPressed) -> {
|
||||||
if (isPressed) {
|
if (isPressed) {
|
||||||
formatAndSendChatMessage(raceView.readChatInput());
|
formatAndSendChatMessage(raceView.readChatInput());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,12 +25,8 @@ import javafx.scene.SubScene;
|
|||||||
import javafx.scene.chart.LineChart;
|
import javafx.scene.chart.LineChart;
|
||||||
import javafx.scene.chart.NumberAxis;
|
import javafx.scene.chart.NumberAxis;
|
||||||
import javafx.scene.chart.XYChart.Series;
|
import javafx.scene.chart.XYChart.Series;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.control.ComboBox;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.Slider;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
@@ -74,6 +70,10 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
private static final Double ICON_BLINK_TIMEOUT_RATIO = 0.6;
|
private static final Double ICON_BLINK_TIMEOUT_RATIO = 0.6;
|
||||||
private static final Integer ICON_BLINK_PERIOD = 500;
|
private static final Integer ICON_BLINK_PERIOD = 500;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private AnchorPane loadingScreenPane;
|
||||||
|
@FXML
|
||||||
|
private ImageView loadingScreen;
|
||||||
@FXML
|
@FXML
|
||||||
private Pane basePane;
|
private Pane basePane;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -143,6 +143,24 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
private ImageView iconToDisplay;
|
private ImageView iconToDisplay;
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
contentStackPane.setVisible(false);
|
||||||
|
Image loadingImage = new Image("PP.png");
|
||||||
|
loadingScreen.setImage(loadingImage);
|
||||||
|
//Centers the Image within the image view
|
||||||
|
double w = 0;
|
||||||
|
double h = 0;
|
||||||
|
double ratioX = loadingScreen.getFitWidth() / loadingImage.getWidth();
|
||||||
|
double ratioY = loadingScreen.getFitHeight() / loadingImage.getHeight();
|
||||||
|
double reduceRatio = 0;
|
||||||
|
if(ratioX >= ratioY) {
|
||||||
|
reduceRatio = ratioY;
|
||||||
|
} else {
|
||||||
|
reduceRatio = ratioX;
|
||||||
|
}
|
||||||
|
w = loadingImage.getWidth() * reduceRatio;
|
||||||
|
h = loadingImage.getHeight() * reduceRatio;
|
||||||
|
loadingScreen.setX((loadingScreen.getFitWidth() - w) / 2);
|
||||||
|
loadingScreen.setY((loadingScreen.getFitHeight() - h) / 2);
|
||||||
Sounds.stopMusic();
|
Sounds.stopMusic();
|
||||||
Sounds.playRaceMusic();
|
Sounds.playRaceMusic();
|
||||||
|
|
||||||
@@ -179,6 +197,18 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
createFinishDialog(finishedBoats);
|
createFinishDialog(finishedBoats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showView(){
|
||||||
|
loadingScreenPane.setVisible(false);
|
||||||
|
contentStackPane.setVisible(true);
|
||||||
|
|
||||||
|
Platform.runLater(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
contentStackPane.requestFocus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create finishScreenDialog and set up finishDialogController.
|
* Create finishScreenDialog and set up finishDialogController.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package seng302.visualiser.controllers;
|
||||||
|
|
||||||
|
import com.jfoenix.controls.JFXDecorator;
|
||||||
|
import com.jfoenix.controls.JFXSnackbar;
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.SceneAntialiasing;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.layout.StackPane;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import seng302.gameServer.ServerAdvertiser;
|
||||||
|
import seng302.utilities.Sounds;
|
||||||
|
import seng302.visualiser.GameClient;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Kusal on 26-Sep-17.
|
||||||
|
*/
|
||||||
|
public class SplashScreenController implements Initializable{
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private StackPane rootPane;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
|
new SplashScreen().start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class SplashScreen extends Thread {
|
||||||
|
public void run(){
|
||||||
|
try {
|
||||||
|
Thread.sleep(2000);
|
||||||
|
Platform.runLater(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
Stage stage = new Stage();
|
||||||
|
ViewManager.getInstance().initialStartView(stage);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
rootPane.getScene().getWindow().hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ import javafx.scene.layout.HBox;
|
|||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.StageStyle;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import seng302.gameServer.ServerAdvertiser;
|
import seng302.gameServer.ServerAdvertiser;
|
||||||
@@ -52,10 +53,18 @@ public class ViewManager {
|
|||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new ViewManager();
|
instance = new ViewManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void initialiseSplashScreen(Stage stage) throws IOException {
|
||||||
|
this.stage = stage;
|
||||||
|
Parent root = FXMLLoader.load(getClass().getResource("/views/SplashScreen.fxml"));
|
||||||
|
Scene scene = new Scene(root);
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.initStyle(StageStyle.UNDECORATED);
|
||||||
|
stage.show();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the start view in the given stage.
|
* Initialize the start view in the given stage.
|
||||||
*/
|
*/
|
||||||
@@ -63,7 +72,6 @@ public class ViewManager {
|
|||||||
this.stage = stage;
|
this.stage = stage;
|
||||||
Parent root = FXMLLoader.load(getClass().getResource("/views/StartScreenView.fxml"));
|
Parent root = FXMLLoader.load(getClass().getResource("/views/StartScreenView.fxml"));
|
||||||
stage.setTitle("Party Parrots At Sea");
|
stage.setTitle("Party Parrots At Sea");
|
||||||
|
|
||||||
JFXDecorator decorator = new JFXDecorator(stage, root, false, true, true);
|
JFXDecorator decorator = new JFXDecorator(stage, root, false, true, true);
|
||||||
decorator.setCustomMaximize(true);
|
decorator.setCustomMaximize(true);
|
||||||
decorator.applyCss();
|
decorator.applyCss();
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#background {
|
||||||
|
-fx-background-color: #E7F1F8;
|
||||||
|
}
|
||||||
|
|
||||||
|
#headText {
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
-fx-font-size: 52px;
|
||||||
|
-fx-text-fill: -fx-pp-light-text-color;
|
||||||
|
-fx-effect: -fx-pp-dropshadow-headers;
|
||||||
|
}
|
||||||
@@ -23,11 +23,12 @@
|
|||||||
<?import javafx.scene.layout.StackPane?>
|
<?import javafx.scene.layout.StackPane?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
|
<StackPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1200.0" style="-fx-background-color: skyblue;" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.visualiser.controllers.RaceViewController">
|
||||||
|
<children>
|
||||||
<StackPane fx:id="contentStackPane" maxHeight="1.7976931348623157E308"
|
<StackPane fx:id="contentStackPane" maxHeight="1.7976931348623157E308"
|
||||||
maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0"
|
maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0"
|
||||||
prefWidth="1200.0" style="-fx-background-color: skyblue;" xmlns="http://javafx.com/javafx/8.0.111"
|
prefWidth="1200.0" style="-fx-background-color: skyblue;" xmlns="http://javafx.com/javafx/8.0.111"
|
||||||
xmlns:fx="http://javafx.com/fxml/1"
|
xmlns:fx="http://javafx.com/fxml/1">
|
||||||
fx:controller="seng302.visualiser.controllers.RaceViewController">
|
|
||||||
<children>
|
<children>
|
||||||
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
|
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
|
||||||
prefHeight="800.0" prefWidth="1200.0">
|
prefHeight="800.0" prefWidth="1200.0">
|
||||||
@@ -292,6 +293,14 @@
|
|||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
|
</StackPane>
|
||||||
|
</children>
|
||||||
|
<AnchorPane fx:id="loadingScreenPane">
|
||||||
|
<children>
|
||||||
|
<ImageView fx:id="loadingScreen" fitHeight="672.0" fitWidth="1200.0" pickOnBounds="true" preserveRatio="true" />
|
||||||
|
<JFXSpinner layoutX="566.0" layoutY="692.0" radius="30.0" />
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
<stylesheets>
|
<stylesheets>
|
||||||
<String fx:value="/css/Master.css"/>
|
<String fx:value="/css/Master.css"/>
|
||||||
<String fx:value="/css/RaceView.css"/>
|
<String fx:value="/css/RaceView.css"/>
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.text.*?>
|
||||||
|
<?import javafx.scene.image.*?>
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
<StackPane id="background" fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.visualiser.controllers.SplashScreenController">
|
||||||
|
<stylesheets>
|
||||||
|
<String fx:value="/css/Master.css" />
|
||||||
|
<String fx:value="/css/SplashScreenView.css" />
|
||||||
|
</stylesheets>
|
||||||
|
<children>
|
||||||
|
<ImageView fitHeight="296.0" fitWidth="295.0" pickOnBounds="true" preserveRatio="true" StackPane.alignment="TOP_CENTER">
|
||||||
|
<image>
|
||||||
|
<Image url="@../PP.png" />
|
||||||
|
</image>
|
||||||
|
<StackPane.margin>
|
||||||
|
<Insets top="20.0" />
|
||||||
|
</StackPane.margin>
|
||||||
|
</ImageView>
|
||||||
|
<Text fx:id="headText" strokeType="OUTSIDE" strokeWidth="0.0" text="Party Parrots at Sea" StackPane.alignment="BOTTOM_CENTER">
|
||||||
|
<font>
|
||||||
|
<Font name="System Bold" size="42.0" />
|
||||||
|
</font>
|
||||||
|
<StackPane.margin>
|
||||||
|
<Insets bottom="20.0" />
|
||||||
|
</StackPane.margin>
|
||||||
|
</Text>
|
||||||
|
</children>
|
||||||
|
</StackPane>
|
||||||
Reference in New Issue
Block a user