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]

This commit is contained in:
zwu18
2017-09-03 21:22:26 +12:00
parent abf325e5ea
commit cd685ae467
10 changed files with 18 additions and 4 deletions
@@ -3,6 +3,7 @@ package visualiser.Controllers;
import javafx.fxml.FXML;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javafx.scene.media.AudioClip;
import mock.app.Event;
import org.xml.sax.SAXException;
import mock.exceptions.EventConstructionException;
@@ -85,6 +86,8 @@ public class HostController extends Controller {
}
public void menuBtnPressed(){
AudioClip sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
hostWrapper.setVisible(false);
parent.enterTitle();
}
@@ -8,6 +8,7 @@ import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javafx.scene.media.AudioClip;
import visualiser.model.RaceConnection;
import java.io.IOException;
@@ -39,6 +40,8 @@ public class LobbyController extends Controller {
private ObservableList<RaceConnection> connections;
private AudioClip sound;
@Override
public void initialize(URL location, ResourceBundle resources) {
@@ -66,6 +69,8 @@ public class LobbyController extends Controller {
* Refreshes the connections in the lobby
*/
public void refreshBtnPressed(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
for(RaceConnection connection: connections) {
connection.check();
}
@@ -93,6 +98,8 @@ public class LobbyController extends Controller {
}
public void menuBtnPressed(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
lobbyWrapper.setVisible(false);
parent.enterTitle();
}
@@ -101,6 +108,8 @@ public class LobbyController extends Controller {
* adds a new connection
*/
public void addConnectionPressed(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
String hostName = addressFld.getText();
String portString = portFld.getText();
try{
@@ -56,7 +56,7 @@ public class MainController extends Controller {
* @param isHost is connection a host
*/
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();
startController.enterLobby(socket, isHost);
}
@@ -80,7 +80,7 @@ public class MainController extends Controller {
* Transitions into lobby screen
*/
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();
lobbyController.enterLobby(); }
@@ -88,7 +88,7 @@ public class MainController extends Controller {
* Transitions into host game screen
*/
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();
hostController.hostGame(); }
@@ -94,6 +94,8 @@ public class TitleController extends Controller {
* Called when control button is pressed. New pop up window displaying controls
*/
public void controlBtnPressed(){
AudioClip sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/visualiser/scenes/controls.fxml"));
Parent layout;