mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Added finish music and merged with text chat.
#story[1249]
This commit is contained in:
@@ -15,7 +15,6 @@ import org.apache.commons.cli.ParseException;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import seng302.model.PolarTable;
|
import seng302.model.PolarTable;
|
||||||
import seng302.utilities.Sounds;
|
|
||||||
|
|
||||||
public class App extends Application {
|
public class App extends Application {
|
||||||
|
|
||||||
@@ -68,7 +67,6 @@ public class App extends Application {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
Sounds.playMenuMusic();
|
|
||||||
Parent root = FXMLLoader.load(getClass().getResource("/views/StartScreenView.fxml"));
|
Parent root = FXMLLoader.load(getClass().getResource("/views/StartScreenView.fxml"));
|
||||||
primaryStage.setTitle("Party Parrots at Sea");
|
primaryStage.setTitle("Party Parrots at Sea");
|
||||||
Scene scene = new Scene(root, 1530, 960);
|
Scene scene = new Scene(root, 1530, 960);
|
||||||
|
|||||||
@@ -24,6 +24,18 @@ public class Sounds {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setMutes() {
|
||||||
|
if (soundPlayer != null) {
|
||||||
|
soundPlayer.setMute(soundEffectsMuted);
|
||||||
|
}
|
||||||
|
if (soundEffect != null) {
|
||||||
|
soundEffect.setMute(soundEffectsMuted);
|
||||||
|
}
|
||||||
|
if (musicPlayer != null) {
|
||||||
|
musicPlayer.setMute(musicMuted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void stopSoundEffects() {
|
public static void stopSoundEffects() {
|
||||||
if (soundEffect != null) {
|
if (soundEffect != null) {
|
||||||
soundEffect.stop();
|
soundEffect.stop();
|
||||||
@@ -71,10 +83,19 @@ public class Sounds {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void playMenuMusic() {
|
public static void playMenuMusic() {
|
||||||
Media menuMusic = new Media(Sounds.class.getClassLoader().getResource("sounds/Elevator-music.mp3").toString());
|
Media menuMusic = new Media(
|
||||||
|
Sounds.class.getClassLoader().getResource("sounds/Elevator-music.mp3").toString());
|
||||||
musicPlayer = new MediaPlayer(menuMusic);
|
musicPlayer = new MediaPlayer(menuMusic);
|
||||||
musicPlayer.setCycleCount(MediaPlayer.INDEFINITE);
|
musicPlayer.setCycleCount(MediaPlayer.INDEFINITE);
|
||||||
musicPlayer.play();
|
musicPlayer.play();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void playFinishMusic() {
|
||||||
|
Media finishMusic = new Media(Sounds.class.getClassLoader().getResource("sounds/Happy-birthday-song.mp3").toString());
|
||||||
|
musicPlayer = new MediaPlayer(finishMusic);
|
||||||
|
musicPlayer.setCycleCount(MediaPlayer.INDEFINITE);
|
||||||
|
musicPlayer.play();
|
||||||
musicPlayer.setMute(musicMuted);
|
musicPlayer.setMute(musicMuted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,8 +153,7 @@ public class GameClient {
|
|||||||
if (socketThread != null) {
|
if (socketThread != null) {
|
||||||
socketThread.setSocketToClose();
|
socketThread.setSocketToClose();
|
||||||
}
|
}
|
||||||
Sounds.stopMusic();
|
|
||||||
Sounds.playMenuMusic();
|
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(
|
FXMLLoader fxmlLoader = new FXMLLoader(
|
||||||
getClass().getResource("/views/StartScreenView.fxml"));
|
getClass().getResource("/views/StartScreenView.fxml"));
|
||||||
try {
|
try {
|
||||||
@@ -213,6 +212,9 @@ public class GameClient {
|
|||||||
|
|
||||||
|
|
||||||
private void loadFinishScreenView() {
|
private void loadFinishScreenView() {
|
||||||
|
Sounds.stopMusic();
|
||||||
|
Sounds.stopSoundEffects();
|
||||||
|
Sounds.playFinishMusic();
|
||||||
FXMLLoader fxmlLoader = loadFXMLToHolder("/views/FinishScreenView.fxml");
|
FXMLLoader fxmlLoader = loadFXMLToHolder("/views/FinishScreenView.fxml");
|
||||||
FinishScreenViewController controller = fxmlLoader.getController();
|
FinishScreenViewController controller = fxmlLoader.getController();
|
||||||
controller.setFinishers(raceState.getPlayerPositions());
|
controller.setFinishers(raceState.getPlayerPositions());
|
||||||
|
|||||||
@@ -15,10 +15,12 @@ import javafx.fxml.Initializable;
|
|||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import seng302.model.ClientYacht;
|
import seng302.model.ClientYacht;
|
||||||
|
import seng302.utilities.Sounds;
|
||||||
|
|
||||||
public class FinishScreenViewController implements Initializable {
|
public class FinishScreenViewController implements Initializable {
|
||||||
|
|
||||||
@@ -87,4 +89,8 @@ public class FinishScreenViewController implements Initializable {
|
|||||||
public void switchToStartScreenView() {
|
public void switchToStartScreenView() {
|
||||||
setContentPane("/views/StartScreenView.fxml");
|
setContentPane("/views/StartScreenView.fxml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void playButtonHoverSound(MouseEvent mouseEvent) {
|
||||||
|
Sounds.playHoverSound();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import javafx.scene.control.Button;
|
|||||||
import javafx.scene.control.TextArea;
|
import javafx.scene.control.TextArea;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
@@ -32,6 +33,10 @@ import seng302.visualiser.ClientToServerThread;
|
|||||||
*/
|
*/
|
||||||
public class LobbyController {
|
public class LobbyController {
|
||||||
|
|
||||||
|
public void playButtonHoverSound(MouseEvent mouseEvent) {
|
||||||
|
Sounds.playHoverSound();
|
||||||
|
}
|
||||||
|
|
||||||
public enum CloseStatus {
|
public enum CloseStatus {
|
||||||
LEAVE,
|
LEAVE,
|
||||||
READY
|
READY
|
||||||
|
|||||||
@@ -36,7 +36,9 @@ public class StartScreenController implements Initializable {
|
|||||||
private GameClient gameClient;
|
private GameClient gameClient;
|
||||||
|
|
||||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||||
|
Sounds.stopMusic();
|
||||||
|
Sounds.stopSoundEffects();
|
||||||
|
Sounds.playMenuMusic();
|
||||||
if (Sounds.isMusicMuted()) {
|
if (Sounds.isMusicMuted()) {
|
||||||
muteMusicButton.setText("UnMute Music");
|
muteMusicButton.setText("UnMute Music");
|
||||||
} else {
|
} else {
|
||||||
@@ -47,7 +49,7 @@ public class StartScreenController implements Initializable {
|
|||||||
} else {
|
} else {
|
||||||
muteSoundsButton.setText("Mute Sounds");
|
muteSoundsButton.setText("Mute Sounds");
|
||||||
}
|
}
|
||||||
|
Sounds.setMutes();
|
||||||
// gameClient = new GameClient(holder);
|
// gameClient = new GameClient(holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.scene.text.*?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
@@ -10,6 +15,7 @@
|
|||||||
<?import javafx.scene.layout.GridPane?>
|
<?import javafx.scene.layout.GridPane?>
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<GridPane fx:id="finishScreenGridPane" maxHeight="837.0" maxWidth="837.0" minHeight="837.0" minWidth="837.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="837.0" prefWidth="837.0" style="-fx-background-color: #2C2c36;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.visualiser.controllers.FinishScreenViewController">
|
<GridPane fx:id="finishScreenGridPane" maxHeight="837.0" maxWidth="837.0" minHeight="837.0" minWidth="837.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="837.0" prefWidth="837.0" style="-fx-background-color: #2C2c36;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.visualiser.controllers.FinishScreenViewController">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
@@ -42,6 +48,6 @@
|
|||||||
<Insets bottom="50.0" />
|
<Insets bottom="50.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</TableView>
|
</TableView>
|
||||||
<Button mnemonicParsing="false" onAction="#switchToStartScreenView" styleClass="blue-ui-btn" text="Return to Start Screen" GridPane.halignment="CENTER" GridPane.rowIndex="3" GridPane.valignment="TOP" />
|
<Button mnemonicParsing="false" onAction="#switchToStartScreenView" onMouseEntered="#playButtonHoverSound" styleClass="blue-ui-btn" text="Return to Start Screen" GridPane.halignment="CENTER" GridPane.rowIndex="3" GridPane.valignment="TOP" />
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
|||||||
@@ -37,9 +37,9 @@
|
|||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Button fx:id="readyButton" focusTraversable="false" mnemonicParsing="false" onAction="#readyButtonPressed" prefWidth="101.0" text="Ready" GridPane.halignment="CENTER" />
|
<Button fx:id="readyButton" focusTraversable="false" mnemonicParsing="false" onAction="#readyButtonPressed" onMouseEntered="#playButtonHoverSound" prefWidth="101.0" text="Ready" GridPane.halignment="CENTER" />
|
||||||
<Button focusTraversable="false" mnemonicParsing="false" onAction="#leaveLobbyButtonPressed" text="Leave Lobby" GridPane.columnIndex="2" GridPane.halignment="CENTER" />
|
<Button focusTraversable="false" mnemonicParsing="false" onAction="#leaveLobbyButtonPressed" onMouseEntered="#playButtonHoverSound" text="Leave Lobby" GridPane.columnIndex="2" GridPane.halignment="CENTER" />
|
||||||
<Button fx:id="customizeButton" focusTraversable="false" mnemonicParsing="false" onAction="#customize" text="Customization" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="CENTER" />
|
<Button fx:id="customizeButton" focusTraversable="false" mnemonicParsing="false" onAction="#customize" onMouseEntered="#playButtonHoverSound" text="Customization" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="CENTER" />
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
<GridPane GridPane.rowIndex="1">
|
<GridPane GridPane.rowIndex="1">
|
||||||
|
|||||||
Reference in New Issue
Block a user