Added button press sounds for hosting a game, entering lobby list and entering host menu. #story[1195]

main
David Wu 9 years ago
parent 7086af6057
commit c3be9665ac

@ -3,6 +3,7 @@ package visualiser.Controllers;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.media.AudioClip;
import visualiser.app.App; import visualiser.app.App;
import visualiser.gameController.ControllerClient; import visualiser.gameController.ControllerClient;
import visualiser.model.VisualiserBoat; import visualiser.model.VisualiserBoat;
@ -27,6 +28,8 @@ public class MainController extends Controller {
@FXML private HostController hostController; @FXML private HostController hostController;
@FXML private LobbyController lobbyController; @FXML private LobbyController lobbyController;
private AudioClip sound;
/** /**
* Ctor. * Ctor.
@ -53,6 +56,8 @@ 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.play();
startController.enterLobby(socket, isHost); startController.enterLobby(socket, isHost);
} }
@ -74,12 +79,18 @@ public class MainController extends Controller {
/** /**
* Transitions into lobby screen * Transitions into lobby screen
*/ */
public void enterLobby(){ lobbyController.enterLobby(); } public void enterLobby(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.mp3").toExternalForm());
sound.play();
lobbyController.enterLobby(); }
/** /**
* Transitions into host game screen * Transitions into host game screen
*/ */
public void hostGame(){ hostController.hostGame(); } public void hostGame(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.mp3").toExternalForm());
sound.play();
hostController.hostGame(); }
/** /**
* Sets up the css for the start of the program * Sets up the css for the start of the program

@ -7,11 +7,16 @@ import javafx.scene.Scene;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.RadioButton; import javafx.scene.control.RadioButton;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.media.AudioClip;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.stage.Modality; import javafx.stage.Modality;
import javafx.stage.Stage; import javafx.stage.Stage;
import visualiser.app.App; import visualiser.app.App;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.util.ResourceBundle; import java.util.ResourceBundle;
@ -38,7 +43,8 @@ public class TitleController extends Controller {
* Currently used to run the RaceVision mock. * Currently used to run the RaceVision mock.
* @throws IOException if main has problems * @throws IOException if main has problems
*/ */
public void hostAGame() throws IOException { public void hostAGame() throws IOException, URISyntaxException {
titleWrapper.setVisible(false); titleWrapper.setVisible(false);
parent.hostGame(); parent.hostGame();
App.getStage().setResizable(true); App.getStage().setResizable(true);

Loading…
Cancel
Save