Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0e851832a | ||
|
|
d75415a260 | ||
|
|
9b9c3dfdaa | ||
|
|
a4c0aeb4a5 | ||
|
|
4d6de8bc9f | ||
|
|
0b718f4f57 | ||
|
|
8f12f42007 | ||
|
|
79d90f6ad5 | ||
|
|
804d27e055 | ||
|
|
58470ab1fe | ||
|
|
5fd5a3bd54 |
@@ -1,12 +1,29 @@
|
|||||||
package visualiser.Controllers;
|
package visualiser.Controllers;
|
||||||
|
|
||||||
|
import com.interactivemesh.jfx.importer.stl.StlMeshImporter;
|
||||||
|
import javafx.animation.AnimationTimer;
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.AmbientLight;
|
||||||
|
import javafx.scene.PointLight;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
import javafx.scene.media.AudioClip;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.paint.Material;
|
||||||
|
import javafx.scene.paint.PhongMaterial;
|
||||||
|
import javafx.scene.shape.MeshView;
|
||||||
|
import javafx.scene.shape.Shape3D;
|
||||||
|
import visualiser.app.App;
|
||||||
|
import visualiser.layout.*;
|
||||||
import visualiser.model.VisualiserBoat;
|
import visualiser.model.VisualiserBoat;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finish Screen for when the race finishes.
|
* Finish Screen for when the race finishes.
|
||||||
*/
|
*/
|
||||||
@@ -15,12 +32,94 @@ public class RaceFinishController extends Controller {
|
|||||||
private @FXML TableColumn<VisualiserBoat, String> boatRankColumn;
|
private @FXML TableColumn<VisualiserBoat, String> boatRankColumn;
|
||||||
private @FXML TableColumn<VisualiserBoat, String> boatNameColumn;
|
private @FXML TableColumn<VisualiserBoat, String> boatNameColumn;
|
||||||
private @FXML Label raceWinnerLabel;
|
private @FXML Label raceWinnerLabel;
|
||||||
|
private @FXML GridPane animatedPane;
|
||||||
|
private SkyBox skyBox;
|
||||||
|
private SeaSurface seaSurface;
|
||||||
|
private Subject3D boat;
|
||||||
|
private AmbientLight ambientLight;
|
||||||
|
private Subject3D sailsSubject;
|
||||||
|
private ObservableList<Subject3D> subjects = FXCollections.observableArrayList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the table
|
* Display the table
|
||||||
* @param boats boats to display on the table.
|
* @param boats boats to display on the table.
|
||||||
*/
|
*/
|
||||||
public void loadFinish(ObservableList<VisualiserBoat> boats) {
|
public void loadFinish(ObservableList<VisualiserBoat> boats) {
|
||||||
|
|
||||||
|
ambientLight = new AmbientLight(Color.web("#CCCCFF"));
|
||||||
|
ambientLight.setTranslateX(250);
|
||||||
|
ambientLight.setTranslateZ(210);
|
||||||
|
ambientLight.setLightOn(true);
|
||||||
|
|
||||||
|
if (!App.dayMode) ambientLight.setColor(Color.web("#9999AA"));
|
||||||
|
|
||||||
|
PointLight pointLight = new PointLight(Color.web("#AAAAFF"));
|
||||||
|
pointLight.setTranslateX(250);
|
||||||
|
pointLight.setTranslateZ(210);
|
||||||
|
pointLight.setLightOn(true);
|
||||||
|
|
||||||
|
View3D view3D = new View3D();
|
||||||
|
view3D.addAmbientLight(ambientLight);
|
||||||
|
view3D.addPointLight(pointLight);
|
||||||
|
view3D.setDistance(10);
|
||||||
|
view3D.setPitch(5);
|
||||||
|
view3D.setItems(subjects);
|
||||||
|
|
||||||
|
// URL asset = RaceViewController.class.getClassLoader().getResource("assets/V1.2 Complete Boat.stl");
|
||||||
|
// StlMeshImporter importer = new StlMeshImporter();
|
||||||
|
// importer.read(asset);
|
||||||
|
// Subject3D boat = new Subject3D(new MeshView(importer.getImport()), 0);
|
||||||
|
|
||||||
|
Shape3D mesh = Assets3D.getBoat();
|
||||||
|
boat = new Subject3D(mesh, 0);
|
||||||
|
|
||||||
|
skyBox = new SkyBox(750,200,250,0,250);
|
||||||
|
subjects.addAll(skyBox.getSkyBoxPlanes());
|
||||||
|
|
||||||
|
seaSurface = new SeaSurface(750, 200);
|
||||||
|
seaSurface.setX(250);
|
||||||
|
seaSurface.setZ(250);
|
||||||
|
subjects.add(seaSurface);
|
||||||
|
|
||||||
|
double radius = 100;
|
||||||
|
boat.setX(0);
|
||||||
|
boat.setZ(radius);
|
||||||
|
boat.setScale(0.1);
|
||||||
|
|
||||||
|
subjects.add(boat);
|
||||||
|
view3D.trackSubject(boat, -45);
|
||||||
|
|
||||||
|
//add sail
|
||||||
|
Material whiteSail = new PhongMaterial(Color.WHITE);
|
||||||
|
Sails3D sails3D = new Sails3D();
|
||||||
|
sailsSubject = new Subject3D(sails3D, 0);
|
||||||
|
sails3D.setMouseTransparent(true);
|
||||||
|
sails3D.setMaterial(whiteSail);
|
||||||
|
sailsSubject.setXRot(0d);
|
||||||
|
sailsSubject.setX(0);
|
||||||
|
sailsSubject.setZ(radius);
|
||||||
|
sailsSubject.setScale(0.1);
|
||||||
|
subjects.add(sailsSubject);
|
||||||
|
|
||||||
|
animatedPane.add(view3D, 0, 0);
|
||||||
|
|
||||||
|
AnimationTimer loop = new AnimationTimer() {
|
||||||
|
double angle = -90;
|
||||||
|
double offset = 0.05;
|
||||||
|
@Override
|
||||||
|
public void handle(long now) {
|
||||||
|
boat.setX(radius * Math.cos(angle * Math.PI/180));
|
||||||
|
boat.setZ(radius * Math.sin(angle * Math.PI/180));
|
||||||
|
boat.setHeading(-angle);
|
||||||
|
sailsSubject.setX(boat.getX());
|
||||||
|
sailsSubject.setZ(boat.getZ());
|
||||||
|
sailsSubject.setHeading(boat.getHeading().getAngle());
|
||||||
|
angle += offset;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
loop.start();
|
||||||
|
|
||||||
|
|
||||||
// set table contents
|
// set table contents
|
||||||
boatInfoTable.setItems(boats);
|
boatInfoTable.setItems(boats);
|
||||||
//Name.
|
//Name.
|
||||||
@@ -36,4 +135,14 @@ public class RaceFinishController extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void mainMenuPressed() throws IOException {
|
||||||
|
AudioClip sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
|
||||||
|
sound.play();
|
||||||
|
try {
|
||||||
|
App.game.endEvent();
|
||||||
|
} catch (Exception e){};
|
||||||
|
loadTitleScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import javafx.scene.shape.Shape3D;
|
|||||||
import javafx.scene.shape.Sphere;
|
import javafx.scene.shape.Sphere;
|
||||||
import javafx.scene.transform.Translate;
|
import javafx.scene.transform.Translate;
|
||||||
import javafx.util.Callback;
|
import javafx.util.Callback;
|
||||||
|
import network.Messages.Enums.BoatActionEnum;
|
||||||
import network.Messages.Enums.BoatStatusEnum;
|
import network.Messages.Enums.BoatStatusEnum;
|
||||||
import network.Messages.Enums.RaceStatusEnum;
|
import network.Messages.Enums.RaceStatusEnum;
|
||||||
import shared.dataInput.RaceDataSource;
|
import shared.dataInput.RaceDataSource;
|
||||||
@@ -79,7 +80,9 @@ public class RaceViewController extends Controller {
|
|||||||
private boolean mapToggle = true;
|
private boolean mapToggle = true;
|
||||||
private GPSConverter gpsConverter;
|
private GPSConverter gpsConverter;
|
||||||
private ArrayList<HealthEffect> healthEffectList = new ArrayList<>();
|
private ArrayList<HealthEffect> healthEffectList = new ArrayList<>();
|
||||||
|
private Subject3D clientBoat;
|
||||||
|
private List<BoatActionEnum> konamiCodes = new ArrayList<>();
|
||||||
|
private int konamiIndex = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Arrow pointing to next mark in third person
|
* Arrow pointing to next mark in third person
|
||||||
@@ -147,7 +150,16 @@ public class RaceViewController extends Controller {
|
|||||||
initKeypressHandler();
|
initKeypressHandler();
|
||||||
healthLoop();
|
healthLoop();
|
||||||
initialiseRaceVisuals();
|
initialiseRaceVisuals();
|
||||||
|
konamiCodes.add(BoatActionEnum.SAILS_IN);
|
||||||
|
konamiCodes.add(BoatActionEnum.SAILS_OUT);
|
||||||
|
konamiCodes.add(BoatActionEnum.SAILS_IN);
|
||||||
|
konamiCodes.add(BoatActionEnum.SAILS_OUT);
|
||||||
|
konamiCodes.add(BoatActionEnum.UPWIND);
|
||||||
|
konamiCodes.add(BoatActionEnum.DOWNWIND);
|
||||||
|
konamiCodes.add(BoatActionEnum.UPWIND);
|
||||||
|
konamiCodes.add(BoatActionEnum.DOWNWIND);
|
||||||
|
konamiCodes.add(BoatActionEnum.TACK_GYBE);
|
||||||
|
konamiCodes.add(BoatActionEnum.VMG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -201,7 +213,7 @@ public class RaceViewController extends Controller {
|
|||||||
checkTutorialState();
|
checkTutorialState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
checkKonami(controlKey.getProtocolCode());
|
||||||
controllerClient.sendKey(controlKey);
|
controllerClient.sendKey(controlKey);
|
||||||
event.consume();
|
event.consume();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@@ -331,11 +343,16 @@ public class RaceViewController extends Controller {
|
|||||||
new Sparkline(this.raceState, this.sparklineChart);
|
new Sparkline(this.raceState, this.sparklineChart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void initialiseHealthPane(){
|
private void initialiseHealthPane(){
|
||||||
InputStream tomato = this.getClass().getClassLoader().getResourceAsStream("visualiser/images/tomato.png");
|
InputStream tomato = this.getClass().getClassLoader().getResourceAsStream("visualiser/images/tomato.png");
|
||||||
HealthSlider healthSlider = new HealthSlider(new Image(tomato));
|
initialiseHealthPane(tomato);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialiseHealthPane(InputStream picture) {
|
||||||
|
while(playerHealthContainer.getChildren().size() > 0) {
|
||||||
|
playerHealthContainer.getChildren().remove(0);
|
||||||
|
}
|
||||||
|
HealthSlider healthSlider = new HealthSlider(new Image(picture));
|
||||||
playerHealthContainer.add(healthSlider, 0, 0);
|
playerHealthContainer.add(healthSlider, 0, 0);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -462,6 +479,7 @@ public class RaceViewController extends Controller {
|
|||||||
|
|
||||||
// Configure visualiser for client's boat
|
// Configure visualiser for client's boat
|
||||||
if (boat.isClientBoat()) {
|
if (boat.isClientBoat()) {
|
||||||
|
clientBoat = boatModel;
|
||||||
// Add player boat highlight
|
// Add player boat highlight
|
||||||
// Shockwave boatHighlight = new Shockwave(10);
|
// Shockwave boatHighlight = new Shockwave(10);
|
||||||
// boatHighlight.getMesh().setMaterial(new PhongMaterial(new Color(1, 1, 0, 0.1)));
|
// boatHighlight.getMesh().setMaterial(new PhongMaterial(new Color(1, 1, 0, 0.1)));
|
||||||
@@ -1218,6 +1236,27 @@ public class RaceViewController extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkKonami(BoatActionEnum protocolCode){
|
||||||
|
if (protocolCode == konamiCodes.get(konamiIndex)){
|
||||||
|
if (konamiIndex < konamiCodes.size() - 1) {
|
||||||
|
konamiIndex++;
|
||||||
|
System.out.println("Next Konami Code is: " + konamiCodes.get(konamiIndex));
|
||||||
|
} else {
|
||||||
|
turnOnTheKonami();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
konamiIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void turnOnTheKonami(){
|
||||||
|
for(Subject3D seagull: seagulls){
|
||||||
|
((SeagullMesh) seagull.getMesh()).konamiTriggered();
|
||||||
|
}
|
||||||
|
InputStream newHp = this.getClass().getClassLoader().getResourceAsStream("visualiser/images/fannypride.png");
|
||||||
|
initialiseHealthPane(newHp);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialises the map
|
* Initialises the map
|
||||||
*/
|
*/
|
||||||
@@ -1276,6 +1315,14 @@ public class RaceViewController extends Controller {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(long now) {
|
public void handle(long now) {
|
||||||
for (Subject3D seagull: seagulls) {
|
for (Subject3D seagull: seagulls) {
|
||||||
|
// view3D.getPivot().getX(), view3D.getPivot().getZ();
|
||||||
|
|
||||||
|
// if (Math.abs(seagull.getX() - view3D.getPivot().getX()) < 75 &&
|
||||||
|
// Math.abs(seagull.getZ() - view3D.getPivot().getZ()) < 75) {
|
||||||
|
if (Math.abs(seagull.getX() - clientBoat.getX()) < 75 &&
|
||||||
|
Math.abs(seagull.getZ() - clientBoat.getZ()) < 75) {
|
||||||
|
((SeagullMesh) seagull.getMesh()).playCry();
|
||||||
|
}
|
||||||
if (seagullsGoToX.get(seagull).size() > 0) {
|
if (seagullsGoToX.get(seagull).size() > 0) {
|
||||||
//System.out.println(xPosition + " " + yPosition);
|
//System.out.println(xPosition + " " + yPosition);
|
||||||
seagull.setHeading(GPSConverter.getAngle(new GraphCoordinate(seagull.getX(), seagull.getZ()),
|
seagull.setHeading(GPSConverter.getAngle(new GraphCoordinate(seagull.getX(), seagull.getZ()),
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import javafx.stage.StageStyle;
|
|||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
import mock.app.Event;
|
import mock.app.Event;
|
||||||
import visualiser.layout.Assets3D;
|
import visualiser.layout.Assets3D;
|
||||||
|
import visualiser.model.SoundAssets;
|
||||||
|
|
||||||
public class App extends Application {
|
public class App extends Application {
|
||||||
private static Stage stage;
|
private static Stage stage;
|
||||||
@@ -49,7 +50,7 @@ public class App extends Application {
|
|||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
ImageView splash = new ImageView(new Image(
|
ImageView splash = new ImageView(new Image(
|
||||||
getClass().getClassLoader().getResourceAsStream("images/splashScreen.png")
|
getClass().getClassLoader().getResourceAsStream("images/splashScreen.gif")
|
||||||
));
|
));
|
||||||
loadProgress = new ProgressBar();
|
loadProgress = new ProgressBar();
|
||||||
loadProgress.setPrefWidth(SPLASH_WIDTH - 20);
|
loadProgress.setPrefWidth(SPLASH_WIDTH - 20);
|
||||||
@@ -98,6 +99,8 @@ public class App extends Application {
|
|||||||
updateMessage("Adding the " + nextFilling + " . . .");
|
updateMessage("Adding the " + nextFilling + " . . .");
|
||||||
if (i == 0){
|
if (i == 0){
|
||||||
Assets3D.loadAssets();
|
Assets3D.loadAssets();
|
||||||
|
} else if (i == 1){
|
||||||
|
SoundAssets.loadAssets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
@@ -137,7 +140,7 @@ public class App extends Application {
|
|||||||
("/visualiser/scenes/title.fxml"));
|
("/visualiser/scenes/title.fxml"));
|
||||||
Parent root = loader.load();
|
Parent root = loader.load();
|
||||||
Scene scene = new Scene(root);
|
Scene scene = new Scene(root);
|
||||||
stage.setTitle("The Boat Game - Burgers & Boats");
|
stage.setTitle("Smooth Sailing - Burgers & Boats");
|
||||||
stage.getIcons().add(new Image(getClass().getClassLoader().getResourceAsStream("images/SailIcon.png")));
|
stage.getIcons().add(new Image(getClass().getClassLoader().getResourceAsStream("images/SailIcon.png")));
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.show();
|
stage.show();
|
||||||
|
|||||||
@@ -147,7 +147,9 @@ public class Assets3D {
|
|||||||
|
|
||||||
public static Shape3D getSharks(){
|
public static Shape3D getSharks(){
|
||||||
String path = "assets/V1.0 Sharks.x3d";
|
String path = "assets/V1.0 Sharks.x3d";
|
||||||
return loadX3d(path);
|
Shape3D shark = loadX3d(path);
|
||||||
|
shark.setMouseTransparent(true);
|
||||||
|
return shark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Shape3D loadX3d(String path){
|
public static Shape3D loadX3d(String path){
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import javafx.animation.AnimationTimer;
|
|||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.paint.PhongMaterial;
|
import javafx.scene.paint.PhongMaterial;
|
||||||
import javafx.scene.shape.MeshView;
|
import javafx.scene.shape.MeshView;
|
||||||
|
import visualiser.model.SeagullSound;
|
||||||
|
import visualiser.model.SoundAssets;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@@ -16,6 +18,10 @@ public class SeagullMesh extends MeshView{
|
|||||||
private int flapPeriod;
|
private int flapPeriod;
|
||||||
private int flapStrength;
|
private int flapStrength;
|
||||||
private int periodElapsed = 0;
|
private int periodElapsed = 0;
|
||||||
|
private SeagullSound sound;
|
||||||
|
private SeagullSound konamiSound;
|
||||||
|
private int cryCooldown = 600;
|
||||||
|
private int cryState = 0;
|
||||||
|
|
||||||
public SeagullMesh() {
|
public SeagullMesh() {
|
||||||
setMesh(Assets3D.seagull[0].getMesh());
|
setMesh(Assets3D.seagull[0].getMesh());
|
||||||
@@ -26,6 +32,9 @@ public class SeagullMesh extends MeshView{
|
|||||||
flapPeriod = 60 * (11 + flapPeriod);
|
flapPeriod = 60 * (11 + flapPeriod);
|
||||||
flapStrength = rand.nextInt(3) + 2;
|
flapStrength = rand.nextInt(3) + 2;
|
||||||
scheduledFlap.start();
|
scheduledFlap.start();
|
||||||
|
cryCooldown = rand.nextInt(10) * 60 + 600;//chirpyness factor
|
||||||
|
sound = SoundAssets.defaultSound;
|
||||||
|
konamiSound = SoundAssets.seagullSounds.get(rand.nextInt(SoundAssets.seagullSounds.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private AnimationTimer flap = new AnimationTimer() {
|
private AnimationTimer flap = new AnimationTimer() {
|
||||||
@@ -51,10 +60,24 @@ public class SeagullMesh extends MeshView{
|
|||||||
startFlapping();
|
startFlapping();
|
||||||
}
|
}
|
||||||
periodElapsed = (periodElapsed + 1) % flapPeriod;
|
periodElapsed = (periodElapsed + 1) % flapPeriod;
|
||||||
|
if (cryState > 0) {
|
||||||
|
cryState -= 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public void startFlapping(){
|
public void startFlapping(){
|
||||||
flap.start();
|
flap.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void konamiTriggered(){
|
||||||
|
sound = konamiSound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void playCry(){
|
||||||
|
if (cryState == 0) {
|
||||||
|
sound.play();
|
||||||
|
cryState = cryCooldown;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package visualiser.model;
|
||||||
|
|
||||||
|
|
||||||
|
import javafx.scene.media.AudioClip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Gondr on 9/10/2017.
|
||||||
|
*/
|
||||||
|
public class SeagullSound {
|
||||||
|
|
||||||
|
private AudioClip sound;
|
||||||
|
|
||||||
|
public SeagullSound(String file){
|
||||||
|
this.sound = new AudioClip(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVolume(double volume){
|
||||||
|
sound.setVolume(volume);
|
||||||
|
sound.volumeProperty().setValue(volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void play(){
|
||||||
|
this.sound.play();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package visualiser.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Gondr on 9/10/2017.
|
||||||
|
*/
|
||||||
|
public class SoundAssets {
|
||||||
|
public static SeagullSound defaultSound;
|
||||||
|
public static List<SeagullSound> seagullSounds = new ArrayList<>();
|
||||||
|
|
||||||
|
public static void loadAssets(){
|
||||||
|
loadSeagullSounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void loadSeagullSounds(){
|
||||||
|
defaultSound = new SeagullSound(SoundAssets.class.getClassLoader().getResource("assets/Seagull Sounds/default.wav").toExternalForm());
|
||||||
|
defaultSound.setVolume(0.02);
|
||||||
|
seagullSounds.add(new SeagullSound(SoundAssets.class.getClassLoader().getResource("assets/Seagull Sounds/seagle.mp3").toExternalForm()));
|
||||||
|
seagullSounds.get(0).setVolume(0.05);
|
||||||
|
seagullSounds.add(new SeagullSound(SoundAssets.class.getClassLoader().getResource("assets/Seagull Sounds/Seagull 1.wav").toExternalForm()));
|
||||||
|
seagullSounds.get(1).setVolume(0.03);
|
||||||
|
seagullSounds.add(new SeagullSound(SoundAssets.class.getClassLoader().getResource("assets/Seagull Sounds/Seagull 2.wav").toExternalForm()));
|
||||||
|
seagullSounds.get(2).setVolume(0.03);
|
||||||
|
seagullSounds.add(new SeagullSound(SoundAssets.class.getClassLoader().getResource("assets/Seagull Sounds/Seagull 3.wav").toExternalForm()));
|
||||||
|
seagullSounds.get(3).setVolume(0.03);
|
||||||
|
seagullSounds.add(new SeagullSound(SoundAssets.class.getClassLoader().getResource("assets/Seagull Sounds/Seagull 4.wav").toExternalForm()));
|
||||||
|
seagullSounds.get(4).setVolume(0.03);
|
||||||
|
seagullSounds.add(new SeagullSound(SoundAssets.class.getClassLoader().getResource("assets/Seagull Sounds/seagulls.wav").toExternalForm()));
|
||||||
|
seagullSounds.get(5).setVolume(0.06);
|
||||||
|
seagullSounds.add(new SeagullSound(SoundAssets.class.getClassLoader().getResource("assets/Seagull Sounds/Voice 001.wav").toExternalForm()));
|
||||||
|
seagullSounds.get(6).setVolume(0.015);
|
||||||
|
seagullSounds.add(new SeagullSound(SoundAssets.class.getClassLoader().getResource("assets/Seagull Sounds/Why.mp3").toExternalForm()));
|
||||||
|
seagullSounds.get(7).setVolume(0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -33,9 +33,9 @@ public class HttpMatchBrowserClient extends Thread {
|
|||||||
|
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
//e.printStackTrace();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
//e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ public class HttpMatchBrowserHost extends Thread {
|
|||||||
Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
|
Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
|
||||||
boolean matches = false;
|
boolean matches = false;
|
||||||
String ip = "";
|
String ip = "";
|
||||||
Pattern ipPattern = Pattern.compile("192.168.1.*");
|
Pattern localIpPattern = Pattern.compile("192\\.168\\.1\\..*");
|
||||||
|
Pattern ipPattern = Pattern.compile("192\\.168\\..{0,3}\\..*");
|
||||||
while(e.hasMoreElements())
|
while(e.hasMoreElements())
|
||||||
{
|
{
|
||||||
if (matches){
|
if (matches){
|
||||||
@@ -54,10 +55,12 @@ public class HttpMatchBrowserHost extends Thread {
|
|||||||
{
|
{
|
||||||
InetAddress i = ee.nextElement();
|
InetAddress i = ee.nextElement();
|
||||||
matches = ipPattern.matcher(i.getHostAddress()).matches();
|
matches = ipPattern.matcher(i.getHostAddress()).matches();
|
||||||
|
System.out.println(i.getHostAddress());
|
||||||
if (matches){
|
if (matches){
|
||||||
|
if (!localIpPattern.matcher(i.getHostAddress()).matches()) {
|
||||||
ip = i.getHostAddress();
|
ip = i.getHostAddress();
|
||||||
//System.out.println(ip);
|
//break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 92 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 940 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 102 KiB |
@@ -22,7 +22,9 @@
|
|||||||
|
|
||||||
<AnchorPane fx:id="gameLobbyWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.InGameLobbyController">
|
<AnchorPane fx:id="gameLobbyWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.InGameLobbyController">
|
||||||
<children>
|
<children>
|
||||||
<GridPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<StackPane prefHeight="150.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<children>
|
||||||
|
<GridPane>
|
||||||
<children>
|
<children>
|
||||||
<Button fx:id="quitBtn" maxHeight="50.0" maxWidth="125.0" mnemonicParsing="false" onAction="#menuBtnPressed" GridPane.rowIndex="2">
|
<Button fx:id="quitBtn" maxHeight="50.0" maxWidth="125.0" mnemonicParsing="false" onAction="#menuBtnPressed" GridPane.rowIndex="2">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
@@ -80,7 +82,8 @@
|
|||||||
<Button fx:id="startButton" disable="true" maxHeight="50.0" maxWidth="125.0" mnemonicParsing="false" onAction="#startBtnPressed" visible="false" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2">
|
<Button fx:id="startButton" disable="true" maxHeight="50.0" maxWidth="125.0" mnemonicParsing="false" onAction="#startBtnPressed" visible="false" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets right="20.0" />
|
<Insets right="20.0" />
|
||||||
</GridPane.margin></Button>
|
</GridPane.margin>
|
||||||
|
</Button>
|
||||||
</children>
|
</children>
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
@@ -93,7 +96,7 @@
|
|||||||
<RowConstraints maxHeight="80.0" minHeight="80.0" prefHeight="80.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="80.0" minHeight="80.0" prefHeight="80.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
<AnchorPane mouseTransparent="true" opacity="0.3" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: rgba(0, 0, 0, 1);" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<AnchorPane mouseTransparent="true" opacity="0.3" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: rgba(0, 0, 0, 1);">
|
||||||
<children>
|
<children>
|
||||||
<GridPane fx:id="animatedPane" opacity="0.42" style="-fx-background-color: rgba(0, 0, 0, 0.5);" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<GridPane fx:id="animatedPane" opacity="0.42" style="-fx-background-color: rgba(0, 0, 0, 0.5);" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
@@ -106,4 +109,6 @@
|
|||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</children>
|
</children>
|
||||||
|
</StackPane>
|
||||||
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.scene.text.*?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.control.TableColumn?>
|
<?import javafx.scene.control.TableColumn?>
|
||||||
<?import javafx.scene.control.TableView?>
|
<?import javafx.scene.control.TableView?>
|
||||||
@@ -9,9 +13,11 @@
|
|||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<AnchorPane fx:id="finishWrapper" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceFinishController">
|
<AnchorPane fx:id="finishWrapper" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceFinishController">
|
||||||
<children>
|
<children>
|
||||||
<GridPane fx:id="start" alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<StackPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<children>
|
||||||
|
<GridPane fx:id="start" alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="600.0" prefWidth="780.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" prefWidth="200.0" />
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" prefWidth="200.0" />
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="372.0" minWidth="10.0" prefWidth="200.0" />
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="372.0" minWidth="10.0" prefWidth="200.0" />
|
||||||
@@ -43,7 +49,22 @@
|
|||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<Label fx:id="raceWinnerLabel" alignment="CENTER" maxWidth="1.7976931348623157E308" text="Winner" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="4" />
|
<Label fx:id="raceWinnerLabel" alignment="CENTER" maxWidth="1.7976931348623157E308" text="Winner" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="4" />
|
||||||
|
<Button fx:id="mainMenuBtn" maxHeight="50.0" maxWidth="125.0" mnemonicParsing="false" onAction="#mainMenuPressed" GridPane.columnIndex="3" GridPane.halignment="RIGHT" GridPane.rowIndex="5" GridPane.valignment="CENTER" />
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
<AnchorPane mouseTransparent="true" opacity="0.3" prefHeight="200.0" prefWidth="200.0">
|
||||||
|
<children>
|
||||||
|
<GridPane fx:id="animatedPane" opacity="0.4" style="-fx-background-color: rgba(0, 0, 0, 0.5);" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
|
</rowConstraints>
|
||||||
|
</GridPane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
</children>
|
||||||
|
</StackPane>
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
|||||||
Reference in New Issue
Block a user