Added sound effect files for button clicks and mark rounding and linked them up to application. Collision audio is added too but not linked up. #story[1195]

main
zwu18 9 years ago
parent abf325e5ea
commit cd685ae467

@ -178,7 +178,7 @@ public class RaceStatusCommand implements Command {
visualiserRace.getLegCompletionOrder().get(boat.getCurrentLeg()).add(boat); visualiserRace.getLegCompletionOrder().get(boat.getCurrentLeg()).add(boat);
//play sound //play sound
AudioClip sound = new AudioClip(getClass().getResource("/visualiser/sounds/buttonpress.mp3").toExternalForm()); AudioClip sound = new AudioClip(getClass().getResource("/visualiser/sounds/passmark.wav").toExternalForm());
sound.play(); sound.play();
//Update boat. //Update boat.

@ -3,6 +3,7 @@ package visualiser.Controllers;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.media.AudioClip;
import mock.app.Event; import mock.app.Event;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import mock.exceptions.EventConstructionException; import mock.exceptions.EventConstructionException;
@ -85,6 +86,8 @@ public class HostController extends Controller {
} }
public void menuBtnPressed(){ public void menuBtnPressed(){
AudioClip sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
hostWrapper.setVisible(false); hostWrapper.setVisible(false);
parent.enterTitle(); parent.enterTitle();
} }

@ -8,6 +8,7 @@ import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.media.AudioClip;
import visualiser.model.RaceConnection; import visualiser.model.RaceConnection;
import java.io.IOException; import java.io.IOException;
@ -39,6 +40,8 @@ public class LobbyController extends Controller {
private ObservableList<RaceConnection> connections; private ObservableList<RaceConnection> connections;
private AudioClip sound;
@Override @Override
public void initialize(URL location, ResourceBundle resources) { public void initialize(URL location, ResourceBundle resources) {
@ -66,6 +69,8 @@ public class LobbyController extends Controller {
* Refreshes the connections in the lobby * Refreshes the connections in the lobby
*/ */
public void refreshBtnPressed(){ public void refreshBtnPressed(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
for(RaceConnection connection: connections) { for(RaceConnection connection: connections) {
connection.check(); connection.check();
} }
@ -93,6 +98,8 @@ public class LobbyController extends Controller {
} }
public void menuBtnPressed(){ public void menuBtnPressed(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
lobbyWrapper.setVisible(false); lobbyWrapper.setVisible(false);
parent.enterTitle(); parent.enterTitle();
} }
@ -101,6 +108,8 @@ public class LobbyController extends Controller {
* adds a new connection * adds a new connection
*/ */
public void addConnectionPressed(){ public void addConnectionPressed(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
String hostName = addressFld.getText(); String hostName = addressFld.getText();
String portString = portFld.getText(); String portString = portFld.getText();
try{ try{

@ -56,7 +56,7 @@ public class MainController extends Controller {
* @param isHost is connection a host * @param isHost is connection a host
*/ */
public void enterLobby(Socket socket, Boolean isHost) { public void enterLobby(Socket socket, Boolean isHost) {
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.mp3").toExternalForm()); sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play(); sound.play();
startController.enterLobby(socket, isHost); startController.enterLobby(socket, isHost);
} }
@ -80,7 +80,7 @@ public class MainController extends Controller {
* Transitions into lobby screen * Transitions into lobby screen
*/ */
public void enterLobby(){ public void enterLobby(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.mp3").toExternalForm()); sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play(); sound.play();
lobbyController.enterLobby(); } lobbyController.enterLobby(); }
@ -88,7 +88,7 @@ public class MainController extends Controller {
* Transitions into host game screen * Transitions into host game screen
*/ */
public void hostGame(){ public void hostGame(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.mp3").toExternalForm()); sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play(); sound.play();
hostController.hostGame(); } hostController.hostGame(); }

@ -94,6 +94,8 @@ public class TitleController extends Controller {
* Called when control button is pressed. New pop up window displaying controls * Called when control button is pressed. New pop up window displaying controls
*/ */
public void controlBtnPressed(){ public void controlBtnPressed(){
AudioClip sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
FXMLLoader loader = new FXMLLoader(); FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/visualiser/scenes/controls.fxml")); loader.setLocation(getClass().getResource("/visualiser/scenes/controls.fxml"));
Parent layout; Parent layout;

Loading…
Cancel
Save