Added button sounds on hover, click and in the lobby

- Started playing start & lobby sounds
 - Started playing button hover & click sounds

Tags: #story[1249]
This commit is contained in:
Michael Rausch
2017-09-11 19:50:17 +12:00
parent 3d0209300e
commit 131cd80e02
16 changed files with 171 additions and 356 deletions
@@ -10,6 +10,7 @@ import javafx.fxml.Initializable;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import seng302.gameServer.messages.CustomizeRequestType;
import seng302.utilities.Sounds;
import seng302.visualiser.ClientToServerThread;
import java.net.URL;
@@ -39,6 +40,7 @@ public class BoatCustomizeController implements Initializable{
@Override
public void initialize(URL location, ResourceBundle resources) {
submitBtn.setOnMouseReleased(event -> {
Sounds.playButtonClick();
submitCustomization();
});
@@ -49,6 +51,8 @@ public class BoatCustomizeController implements Initializable{
playerNameLengthValidator.setMessage("Player name too long.");
boatName.setValidators(playerNameLengthValidator, playerNameReqValidator);
submitBtn.setOnMouseEntered(e -> Sounds.playHoverSound());
}
/**
@@ -7,7 +7,9 @@ import com.jfoenix.validation.RequiredFieldValidator;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import seng302.gameServer.ServerDescription;
import seng302.utilities.Sounds;
import seng302.visualiser.controllers.ViewManager;
import seng302.visualiser.validators.FieldLengthValidator;
@@ -43,6 +45,11 @@ public class ServerCreationController implements Initializable {
serverName.setValidators(fieldLengthValidator, fieldRequiredValidator);
submitBtn.setOnMouseReleased(event -> validateServerSettings());
submitBtn.setOnMouseClicked(event -> submitBtn.setText("CREATING..."));
submitBtn.setOnMouseReleased(event -> {
Sounds.playButtonClick();
validateServerSettings();
});
}
/**
@@ -76,4 +83,9 @@ public class ServerCreationController implements Initializable {
maxPlayersSlider.setValue(Math.floor(maxPlayersSlider.getValue()));
maxPlayersLabel.setText(String.format("YOU SELECTED: %.0f", maxPlayersSlider.getValue()));
}
public void playButtonHoverSound(MouseEvent mouseEvent) {
Sounds.playHoverSound();
}
}