mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Added mark rounding noise and hover button noise.
#story[1249]
This commit is contained in:
@@ -19,17 +19,23 @@ public class Sounds {
|
|||||||
|
|
||||||
|
|
||||||
public static void stopMusic() {
|
public static void stopMusic() {
|
||||||
|
if (musicPlayer != null) {
|
||||||
musicPlayer.stop();
|
musicPlayer.stop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void stopSoundEffects() {
|
public static void stopSoundEffects() {
|
||||||
|
if (soundEffect != null) {
|
||||||
soundEffect.stop();
|
soundEffect.stop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void toggleMuteMusic() {
|
public static void toggleMuteMusic() {
|
||||||
musicMuted = !musicMuted;
|
musicMuted = !musicMuted;
|
||||||
|
if (musicPlayer != null) {
|
||||||
musicPlayer.setMute(musicMuted);
|
musicPlayer.setMute(musicMuted);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void toggleMuteEffects() {
|
public static void toggleMuteEffects() {
|
||||||
soundEffectsMuted = !soundEffectsMuted;
|
soundEffectsMuted = !soundEffectsMuted;
|
||||||
@@ -83,21 +89,32 @@ public class Sounds {
|
|||||||
Media finishSound = new Media(Sounds.class.getClassLoader().getResource("sounds/Sms-notification.mp3").toString());
|
Media finishSound = new Media(Sounds.class.getClassLoader().getResource("sounds/Sms-notification.mp3").toString());
|
||||||
soundPlayer = new MediaPlayer(finishSound);
|
soundPlayer = new MediaPlayer(finishSound);
|
||||||
soundPlayer.play();
|
soundPlayer.play();
|
||||||
soundPlayer.setMute(soundEffectsMuted);
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void playMarkRoundingSound() {
|
||||||
|
Media markRoundingSound = new Media(Sounds.class.getClassLoader().getResource("sounds/sms-tone.mp3").toString());
|
||||||
|
soundPlayer = new MediaPlayer(markRoundingSound);
|
||||||
|
soundPlayer.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void playCapGunSound() {
|
public static void playCapGunSound() {
|
||||||
Media gunSound = new Media(Sounds.class.getClassLoader().getResource("sounds/Gunshot-sound.mp3").toString());
|
Media gunSound = new Media(Sounds.class.getClassLoader().getResource("sounds/Gunshot-sound.mp3").toString());
|
||||||
soundPlayer = new MediaPlayer(gunSound);
|
soundPlayer = new MediaPlayer(gunSound);
|
||||||
soundPlayer.play();
|
soundPlayer.play();
|
||||||
soundPlayer.setMute(soundEffectsMuted);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void playCrashSound() {
|
public static void playCrashSound() {
|
||||||
Media crashSound = new Media(Sounds.class.getClassLoader().getResource("sounds/Large-metal-door-slam.mp3").toString());
|
Media crashSound = new Media(Sounds.class.getClassLoader().getResource("sounds/Large-metal-door-slam.mp3").toString());
|
||||||
soundPlayer = new MediaPlayer(crashSound);
|
soundPlayer = new MediaPlayer(crashSound);
|
||||||
soundPlayer.play();
|
soundPlayer.play();
|
||||||
soundPlayer.setMute(soundEffectsMuted);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void playHoverSound() {
|
||||||
|
Media hoverSound = new Media(Sounds.class.getClassLoader().getResource("sounds/sound-over.wav").toString());
|
||||||
|
soundPlayer = new MediaPlayer(hoverSound);
|
||||||
|
soundPlayer.play();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,7 +164,6 @@ public class GameClient {
|
|||||||
// server = null;
|
// server = null;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Sounds.stopSoundEffects();
|
|
||||||
Sounds.stopMusic();
|
Sounds.stopMusic();
|
||||||
Sounds.playMenuMusic();
|
Sounds.playMenuMusic();
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(
|
FXMLLoader fxmlLoader = new FXMLLoader(
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import seng302.model.mark.CompoundMark;
|
|||||||
import seng302.model.mark.Corner;
|
import seng302.model.mark.Corner;
|
||||||
import seng302.model.mark.Mark;
|
import seng302.model.mark.Mark;
|
||||||
import seng302.utilities.GeoUtility;
|
import seng302.utilities.GeoUtility;
|
||||||
|
import seng302.utilities.Sounds;
|
||||||
import seng302.visualiser.fxObjects.AnnotationBox;
|
import seng302.visualiser.fxObjects.AnnotationBox;
|
||||||
import seng302.visualiser.fxObjects.BoatObject;
|
import seng302.visualiser.fxObjects.BoatObject;
|
||||||
import seng302.visualiser.fxObjects.CourseBoundary;
|
import seng302.visualiser.fxObjects.CourseBoundary;
|
||||||
@@ -785,12 +786,14 @@ public class GameView extends Pane {
|
|||||||
private void updateMarkArrows (ClientYacht yacht, CompoundMark compoundMark, int legNumber) {
|
private void updateMarkArrows (ClientYacht yacht, CompoundMark compoundMark, int legNumber) {
|
||||||
//Only show arrows for this and next leg.
|
//Only show arrows for this and next leg.
|
||||||
if (compoundMark != null) {
|
if (compoundMark != null) {
|
||||||
|
Sounds.playMarkRoundingSound();
|
||||||
for (Mark mark : compoundMark.getMarks()) {
|
for (Mark mark : compoundMark.getMarks()) {
|
||||||
markerObjects.get(mark).showNextExitArrow();
|
markerObjects.get(mark).showNextExitArrow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CompoundMark nextMark = null;
|
CompoundMark nextMark = null;
|
||||||
if (legNumber < course.size() - 1) {
|
if (legNumber < course.size() - 1) {
|
||||||
|
Sounds.playMarkRoundingSound();
|
||||||
nextMark = course.get(legNumber);
|
nextMark = course.get(legNumber);
|
||||||
for (Mark mark : nextMark.getMarks()) {
|
for (Mark mark : nextMark.getMarks()) {
|
||||||
markerObjects.get(mark).showNextEnterArrow();
|
markerObjects.get(mark).showNextEnterArrow();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import javafx.fxml.FXML;
|
|||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.control.ToggleButton;
|
import javafx.scene.control.ToggleButton;
|
||||||
|
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 seng302.gameServer.GameState;
|
import seng302.gameServer.GameState;
|
||||||
@@ -205,4 +206,8 @@ public class StartScreenController implements Initializable {
|
|||||||
muteSoundsButton.setText("Mute Sounds");
|
muteSoundsButton.setText("Mute Sounds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void playButtonHoverSound(MouseEvent mouseEvent) {
|
||||||
|
Sounds.playHoverSound();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -25,8 +25,8 @@
|
|||||||
<Font size="40.0" />
|
<Font size="40.0" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<Button mnemonicParsing="false" onAction="#hostButtonPressed" prefHeight="25.0" prefWidth="175.0" text="Host" GridPane.columnSpan="2147483647" GridPane.halignment="CENTER" GridPane.rowIndex="2" />
|
<Button mnemonicParsing="false" onAction="#hostButtonPressed" onMouseEntered="#playButtonHoverSound" prefHeight="25.0" prefWidth="175.0" text="Host" GridPane.columnSpan="2147483647" GridPane.halignment="CENTER" GridPane.rowIndex="2" />
|
||||||
<Button mnemonicParsing="false" onAction="#connectButtonPressed" prefHeight="25.0" prefWidth="147.0" text="Connect" GridPane.columnIndex="1" GridPane.rowIndex="4">
|
<Button mnemonicParsing="false" onAction="#connectButtonPressed" onMouseEntered="#playButtonHoverSound" prefHeight="25.0" prefWidth="147.0" text="Connect" GridPane.columnIndex="1" GridPane.rowIndex="4">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets left="5.0" right="5.0" />
|
<Insets left="5.0" right="5.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
@@ -58,12 +58,12 @@
|
|||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<ToggleButton fx:id="muteMusicButton" mnemonicParsing="false" onAction="#toggleMusic" prefWidth="130.0" text="Mute Music" GridPane.halignment="RIGHT">
|
<ToggleButton fx:id="muteMusicButton" mnemonicParsing="false" onAction="#toggleMusic" onMouseEntered="#playButtonHoverSound" prefWidth="130.0" text="Mute Music" GridPane.halignment="RIGHT">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets left="5.0" right="5.0" />
|
<Insets left="5.0" right="5.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<ToggleButton fx:id="muteSoundsButton" mnemonicParsing="false" onAction="#toggleSounds" prefWidth="130.0" text="Mute Sounds" GridPane.columnIndex="1">
|
<ToggleButton fx:id="muteSoundsButton" mnemonicParsing="false" onAction="#toggleSounds" onMouseEntered="#playButtonHoverSound" prefWidth="130.0" text="Mute Sounds" GridPane.columnIndex="1">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets left="5.0" right="5.0" />
|
<Insets left="5.0" right="5.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
|
|||||||
Reference in New Issue
Block a user