mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Merge develop into NewUI, and 3D
tags: #story[1245]
This commit is contained in:
@@ -12,8 +12,6 @@ import seng302.model.PolarTable;
|
|||||||
import seng302.model.ServerYacht;
|
import seng302.model.ServerYacht;
|
||||||
import seng302.model.mark.CompoundMark;
|
import seng302.model.mark.CompoundMark;
|
||||||
import seng302.model.stream.xml.parser.RegattaXMLData;
|
import seng302.model.stream.xml.parser.RegattaXMLData;
|
||||||
import seng302.model.token.Token;
|
|
||||||
import seng302.model.token.TokenType;
|
|
||||||
import seng302.utilities.GeoUtility;
|
import seng302.utilities.GeoUtility;
|
||||||
import seng302.utilities.XMLGenerator;
|
import seng302.utilities.XMLGenerator;
|
||||||
import seng302.utilities.XMLParser;
|
import seng302.utilities.XMLParser;
|
||||||
@@ -24,7 +22,10 @@ import javax.xml.parsers.ParserConfigurationException;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class describing the overall server, which creates and collects server threads for each client
|
* A class describing the overall server, which creates and collects server threads for each client
|
||||||
@@ -45,8 +46,7 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
|||||||
private Thread thread;
|
private Thread thread;
|
||||||
|
|
||||||
private ServerSocket serverSocket = null;
|
private ServerSocket serverSocket = null;
|
||||||
private ArrayList<ServerToClientThread> serverToClientThreads = new ArrayList<>();
|
private ArrayList<ServerToClientThread> serverToClientThreads = new ArrayList<>();;
|
||||||
private Logger logger = LoggerFactory.getLogger(MainServerThread.class);
|
|
||||||
private static Integer capacity;
|
private static Integer capacity;
|
||||||
|
|
||||||
private void startAdvertisingServer() {
|
private void startAdvertisingServer() {
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
package seng302.visualiser;
|
package seng302.visualiser;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.ZoneOffset;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.TimeZone;
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
@@ -20,8 +10,8 @@ import javafx.scene.control.Alert.AlertType;
|
|||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
import javafx.scene.input.KeyEvent;
|
import javafx.scene.input.KeyEvent;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import seng302.gameServer.GameStages;
|
|
||||||
import javafx.util.Pair;
|
import javafx.util.Pair;
|
||||||
|
import seng302.gameServer.GameStages;
|
||||||
import seng302.gameServer.GameState;
|
import seng302.gameServer.GameState;
|
||||||
import seng302.gameServer.MainServerThread;
|
import seng302.gameServer.MainServerThread;
|
||||||
import seng302.gameServer.ServerDescription;
|
import seng302.gameServer.ServerDescription;
|
||||||
@@ -43,7 +33,12 @@ import seng302.utilities.StreamParser;
|
|||||||
import seng302.utilities.XMLGenerator;
|
import seng302.utilities.XMLGenerator;
|
||||||
import seng302.utilities.XMLParser;
|
import seng302.utilities.XMLParser;
|
||||||
import seng302.visualiser.controllers.*;
|
import seng302.visualiser.controllers.*;
|
||||||
import seng302.visualiser.controllers.LobbyController_old.CloseStatus;
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is a client side instance of a yacht racing game in JavaFX. The game is instantiated
|
* This class is a client side instance of a yacht racing game in JavaFX. The game is instantiated
|
||||||
@@ -74,6 +69,17 @@ public class GameClient {
|
|||||||
*/
|
*/
|
||||||
public GameClient(Pane holder) {
|
public GameClient(Pane holder) {
|
||||||
this.holderPane = holder;
|
this.holderPane = holder;
|
||||||
|
// if (holderPane.getParent() == null) {
|
||||||
|
// this.holderPane.parentProperty().addListener(((observable, oldValue, newValue) -> {
|
||||||
|
// if (newValue != null) {
|
||||||
|
// newValue.getScene().setOnKeyPressed(this::keyPressed);
|
||||||
|
// newValue.getScene().setOnKeyReleased(this::keyReleased);
|
||||||
|
// }
|
||||||
|
// }));
|
||||||
|
// } else {
|
||||||
|
// this.holderPane.getParent().getScene().setOnKeyPressed(this::keyPressed);
|
||||||
|
// this.holderPane.getParent().getScene().setOnKeyReleased(this::keyReleased);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -420,7 +426,7 @@ public class GameClient {
|
|||||||
* Handle the key-pressed event from the text field.
|
* Handle the key-pressed event from the text field.
|
||||||
* @param e The key event triggering this call
|
* @param e The key event triggering this call
|
||||||
*/
|
*/
|
||||||
private void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {
|
||||||
if (raceView.isChatInputFocused()) {
|
if (raceView.isChatInputFocused()) {
|
||||||
if (e.getCode() == KeyCode.ENTER) {
|
if (e.getCode() == KeyCode.ENTER) {
|
||||||
formatAndSendChatMessage(raceView.readChatInput());
|
formatAndSendChatMessage(raceView.readChatInput());
|
||||||
@@ -441,7 +447,7 @@ public class GameClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void keyReleased(KeyEvent e) {
|
public void keyReleased(KeyEvent e) {
|
||||||
if (raceView.isChatInputFocused()) {
|
if (raceView.isChatInputFocused()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -487,21 +493,21 @@ public class GameClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void startGame(){
|
public void startGame(){
|
||||||
// server.startGame();
|
server.startGame();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public ClientToServerThread getServerThread() {
|
public ClientToServerThread getServerThread() {
|
||||||
// return socketThread;
|
return socketThread;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public List<String> getPlayerNames(){
|
public List<String> getPlayerNames(){
|
||||||
// return Collections.unmodifiableList(clientLobbyList.sorted());
|
return Collections.unmodifiableList(clientLobbyList.sorted());
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public void stopGame() {
|
public void stopGame() {
|
||||||
// GameState.setCurrentStage(GameStages.CANCELLED);
|
GameState.setCurrentStage(GameStages.CANCELLED);
|
||||||
// if (server != null) server.terminate();
|
if (server != null) server.terminate();
|
||||||
// if (socketThread != null) socketThread.setSocketToClose();
|
if (socketThread != null) socketThread.setSocketToClose();
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,14 @@
|
|||||||
package seng302.visualiser;
|
package seng302.visualiser;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import javafx.animation.AnimationTimer;
|
import javafx.animation.AnimationTimer;
|
||||||
import javafx.animation.KeyFrame;
|
import javafx.animation.KeyFrame;
|
||||||
import javafx.animation.KeyValue;
|
import javafx.animation.KeyValue;
|
||||||
import javafx.animation.Timeline;
|
import javafx.animation.Timeline;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.value.ChangeListener;
|
|
||||||
import javafx.beans.value.ObservableValue;
|
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.geometry.Point2D;
|
import javafx.geometry.Point2D;
|
||||||
import javafx.scene.*;
|
import javafx.scene.*;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.input.KeyCode;
|
|
||||||
import javafx.scene.input.KeyEvent;
|
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
@@ -26,7 +16,6 @@ import javafx.scene.paint.Paint;
|
|||||||
import javafx.scene.shape.Circle;
|
import javafx.scene.shape.Circle;
|
||||||
import javafx.scene.shape.Polygon;
|
import javafx.scene.shape.Polygon;
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
import javafx.scene.transform.Scale;
|
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
import seng302.gameServer.messages.RoundingSide;
|
import seng302.gameServer.messages.RoundingSide;
|
||||||
import seng302.model.ClientYacht;
|
import seng302.model.ClientYacht;
|
||||||
@@ -37,24 +26,15 @@ import seng302.model.mark.Corner;
|
|||||||
import seng302.model.mark.Mark;
|
import seng302.model.mark.Mark;
|
||||||
import seng302.model.token.Token;
|
import seng302.model.token.Token;
|
||||||
import seng302.utilities.GeoUtility;
|
import seng302.utilities.GeoUtility;
|
||||||
import seng302.visualiser.fxObjects.assets_2D.AnnotationBox;
|
import seng302.utilities.Sounds;
|
||||||
import seng302.visualiser.fxObjects.assets_2D.BoatObject;
|
import seng302.visualiser.fxObjects.assets_2D.*;
|
||||||
import seng302.visualiser.fxObjects.assets_2D.CourseBoundary;
|
|
||||||
import seng302.visualiser.fxObjects.assets_2D.Gate;
|
|
||||||
import seng302.visualiser.fxObjects.assets_2D.MarkArrowFactory;
|
|
||||||
import seng302.visualiser.fxObjects.assets_2D.Marker;
|
|
||||||
import seng302.visualiser.fxObjects.assets_3D.ModelFactory;
|
import seng302.visualiser.fxObjects.assets_3D.ModelFactory;
|
||||||
import seng302.visualiser.fxObjects.assets_3D.ModelType;
|
import seng302.visualiser.fxObjects.assets_3D.ModelType;
|
||||||
import seng302.utilities.Sounds;
|
|
||||||
import seng302.visualiser.fxObjects.AnnotationBox;
|
|
||||||
import seng302.visualiser.fxObjects.BoatObject;
|
|
||||||
import seng302.visualiser.fxObjects.CourseBoundary;
|
|
||||||
import seng302.visualiser.fxObjects.Gate;
|
|
||||||
import seng302.visualiser.fxObjects.MarkArrowFactory;
|
|
||||||
import seng302.visualiser.fxObjects.Marker;
|
|
||||||
import seng302.visualiser.map.Boundary;
|
import seng302.visualiser.map.Boundary;
|
||||||
import seng302.visualiser.map.CanvasMap;
|
import seng302.visualiser.map.CanvasMap;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by cir27 on 20/07/17.
|
* Created by cir27 on 20/07/17.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -15,16 +15,10 @@ import javafx.scene.chart.NumberAxis;
|
|||||||
import javafx.scene.chart.XYChart;
|
import javafx.scene.chart.XYChart;
|
||||||
import javafx.scene.chart.XYChart.Data;
|
import javafx.scene.chart.XYChart.Data;
|
||||||
import javafx.scene.chart.XYChart.Series;
|
import javafx.scene.chart.XYChart.Series;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.layout.*;
|
||||||
import javafx.scene.control.ComboBox;
|
|
||||||
import javafx.scene.control.Slider;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.scene.layout.Pane;
|
|
||||||
import javafx.scene.layout.StackPane;
|
|
||||||
import javafx.scene.layout.VBox;
|
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.paint.Paint;
|
||||||
import javafx.scene.shape.Line;
|
import javafx.scene.shape.Line;
|
||||||
import javafx.scene.shape.Polyline;
|
import javafx.scene.shape.Polyline;
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
@@ -36,13 +30,10 @@ import seng302.model.mark.CompoundMark;
|
|||||||
import seng302.model.mark.Mark;
|
import seng302.model.mark.Mark;
|
||||||
import seng302.model.stream.xml.parser.RaceXMLData;
|
import seng302.model.stream.xml.parser.RaceXMLData;
|
||||||
import seng302.utilities.Sounds;
|
import seng302.utilities.Sounds;
|
||||||
import seng302.visualiser.GameView;
|
|
||||||
import seng302.visualiser.controllers.annotations.Annotation;
|
|
||||||
import seng302.visualiser.GameView3D;
|
import seng302.visualiser.GameView3D;
|
||||||
import seng302.visualiser.controllers.annotations.ImportantAnnotationController;
|
import seng302.visualiser.controllers.annotations.ImportantAnnotationController;
|
||||||
import seng302.visualiser.controllers.annotations.ImportantAnnotationDelegate;
|
import seng302.visualiser.controllers.annotations.ImportantAnnotationDelegate;
|
||||||
import seng302.visualiser.controllers.annotations.ImportantAnnotationsState;
|
import seng302.visualiser.controllers.annotations.ImportantAnnotationsState;
|
||||||
import seng302.visualiser.fxObjects.BoatObject;
|
|
||||||
import seng302.visualiser.fxObjects.ChatHistory;
|
import seng302.visualiser.fxObjects.ChatHistory;
|
||||||
import seng302.visualiser.fxObjects.assets_2D.BoatObject;
|
import seng302.visualiser.fxObjects.assets_2D.BoatObject;
|
||||||
import seng302.visualiser.fxObjects.assets_2D.WindArrow;
|
import seng302.visualiser.fxObjects.assets_2D.WindArrow;
|
||||||
@@ -127,10 +118,10 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
//sparklineYAxis.setTickMarkVisible(false);
|
//sparklineYAxis.setTickMarkVisible(false);
|
||||||
|
|
||||||
//positionVbox.getStylesheets().add(getClass().getResource("/css/master.css").toString());
|
//positionVbox.getStylesheets().add(getClass().getResource("/css/master.css").toString());
|
||||||
raceSparkLine.visibleProperty().setValue(false);
|
// raceSparkLine.visibleProperty().setValue(false);
|
||||||
raceSparkLine.getYAxis().setAutoRanging(false);
|
// raceSparkLine.getYAxis().setAutoRanging(false);
|
||||||
sparklineYAxis.setTickMarkVisible(false);
|
// sparklineYAxis.setTickMarkVisible(false);
|
||||||
positionVbox.getStylesheets().add(getClass().getResource("/css/master.css").toString());
|
// positionVbox.getStylesheets().add(getClass().getResource("/css/master.css").toString());
|
||||||
|
|
||||||
//selectAnnotationBtn.setOnAction(event -> loadSelectAnnotationView());
|
//selectAnnotationBtn.setOnAction(event -> loadSelectAnnotationView());
|
||||||
// rvAnchorPane.prefWidthProperty().bind(ViewManager.getInstance().getDecorator().widthProperty());
|
// rvAnchorPane.prefWidthProperty().bind(ViewManager.getInstance().getDecorator().widthProperty());
|
||||||
@@ -140,28 +131,28 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
// windArrow.setLayoutX(windArrowHolder.getWidth() / 2);
|
// windArrow.setLayoutX(windArrowHolder.getWidth() / 2);
|
||||||
// windArrow.setLayoutY(windArrowHolder.getHeight() / 2);
|
// windArrow.setLayoutY(windArrowHolder.getHeight() / 2);
|
||||||
|
|
||||||
selectAnnotationBtn.setOnAction(event -> loadSelectAnnotationView());
|
// selectAnnotationBtn.setOnAction(event -> loadSelectAnnotationView());
|
||||||
chatInput.lengthProperty().addListener((obs, oldLen, newLen) -> {
|
// chatInput.lengthProperty().addListener((obs, oldLen, newLen) -> {
|
||||||
if (newLen.intValue() > CHAT_LIMIT) {
|
// if (newLen.intValue() > CHAT_LIMIT) {
|
||||||
chatInput.setText(chatInput.getText().substring(0, CHAT_LIMIT));
|
// chatInput.setText(chatInput.getText().substring(0, CHAT_LIMIT));
|
||||||
}
|
// }
|
||||||
});
|
|
||||||
chatHistory = new ChatHistory();
|
|
||||||
chatHistoryHolder.getChildren().addAll(chatHistory);
|
|
||||||
chatHistory.prefWidthProperty().bind(
|
|
||||||
chatHistoryHolder.widthProperty()
|
|
||||||
);
|
|
||||||
chatHistory.prefHeightProperty().bind(
|
|
||||||
chatHistoryHolder.heightProperty()
|
|
||||||
);
|
|
||||||
// chatHistory.setFitToWidth(true);
|
|
||||||
// chatHistory.setFitToHeight(true);
|
|
||||||
// chatHistory.textProperty().addListener((obs, oldValue, newValue) -> {
|
|
||||||
// chatHistory.setScrollTop(Double.MAX_VALUE);
|
|
||||||
// });
|
// });
|
||||||
contentGridPane.setOnMouseClicked((event) ->
|
// chatHistory = new ChatHistory();
|
||||||
contentGridPane.requestFocus()
|
// chatHistoryHolder.getChildren().addAll(chatHistory);
|
||||||
);
|
// chatHistory.prefWidthProperty().bind(
|
||||||
|
// chatHistoryHolder.widthProperty()
|
||||||
|
// );
|
||||||
|
// chatHistory.prefHeightProperty().bind(
|
||||||
|
// chatHistoryHolder.heightProperty()
|
||||||
|
// );
|
||||||
|
//// chatHistory.setFitToWidth(true);
|
||||||
|
//// chatHistory.setFitToHeight(true);
|
||||||
|
//// chatHistory.textProperty().addListener((obs, oldValue, newValue) -> {
|
||||||
|
//// chatHistory.setScrollTop(Double.MAX_VALUE);
|
||||||
|
//// });
|
||||||
|
// contentGridPane.setOnMouseClicked((event) ->
|
||||||
|
// contentGridPane.requestFocus()
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadRace (
|
public void loadRace (
|
||||||
@@ -711,7 +702,8 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChatInputFocused() {
|
public boolean isChatInputFocused() {
|
||||||
return chatInput.focusedProperty().getValue();
|
// return chatInput.focusedProperty().getValue();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String readChatInput() {
|
public String readChatInput() {
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
package seng302.visualiser.controllers;
|
package seng302.visualiser.controllers;
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
@@ -13,31 +8,16 @@ import javafx.fxml.Initializable;
|
|||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.effect.DropShadow;
|
import javafx.scene.effect.DropShadow;
|
||||||
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import javafx.scene.control.Alert;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.ListView;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.control.ToggleButton;
|
|
||||||
import javafx.scene.input.MouseEvent;
|
|
||||||
import javafx.scene.layout.AnchorPane;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import seng302.gameServer.ServerAdvertiser;
|
|
||||||
import seng302.gameServer.ServerDescription;
|
import seng302.gameServer.ServerDescription;
|
||||||
import seng302.gameServer.GameState;
|
|
||||||
import seng302.utilities.Sounds;
|
import seng302.utilities.Sounds;
|
||||||
import seng302.visualiser.GameClient;
|
import seng302.visualiser.GameClient;
|
||||||
import seng302.visualiser.ServerListener;
|
|
||||||
import seng302.visualiser.ServerListenerDelegate;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Inet4Address;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.NetworkInterface;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
@@ -54,23 +34,24 @@ public class StartScreenController implements Initializable{
|
|||||||
private Logger logger = LoggerFactory.getLogger(StartScreenController.class);
|
private Logger logger = LoggerFactory.getLogger(StartScreenController.class);
|
||||||
|
|
||||||
private List<ServerDescription> servers;
|
private List<ServerDescription> servers;
|
||||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
private GameClient gameClient;
|
||||||
Sounds.stopMusic();
|
// public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||||
Sounds.stopSoundEffects();
|
// Sounds.stopMusic();
|
||||||
Sounds.playMenuMusic();
|
// Sounds.stopSoundEffects();
|
||||||
if (Sounds.isMusicMuted()) {
|
// Sounds.playMenuMusic();
|
||||||
muteMusicButton.setText("UnMute Music");
|
// if (Sounds.isMusicMuted()) {
|
||||||
} else {
|
// muteMusicButton.setText("UnMute Music");
|
||||||
muteMusicButton.setText("Mute Music");
|
// } else {
|
||||||
}
|
// muteMusicButton.setText("Mute Music");
|
||||||
if (Sounds.isSoundEffectsMuted()) {
|
// }
|
||||||
muteSoundsButton.setText("UnMute Sounds");
|
// if (Sounds.isSoundEffectsMuted()) {
|
||||||
} else {
|
// muteSoundsButton.setText("UnMute Sounds");
|
||||||
muteSoundsButton.setText("Mute Sounds");
|
// } else {
|
||||||
}
|
// muteSoundsButton.setText("Mute Sounds");
|
||||||
Sounds.setMutes();
|
// }
|
||||||
// gameClient = new GameClient(holder);
|
// Sounds.setMutes();
|
||||||
}
|
//// gameClient = new GameClient(holder);
|
||||||
|
// }
|
||||||
|
|
||||||
private void setInitialDropShadow() {
|
private void setInitialDropShadow() {
|
||||||
DropShadow dropShadow = new DropShadow();
|
DropShadow dropShadow = new DropShadow();
|
||||||
@@ -79,25 +60,6 @@ public class StartScreenController implements Initializable{
|
|||||||
dropShadow.setOffsetY(4.0);
|
dropShadow.setOffsetY(4.0);
|
||||||
dropShadow.setColor(Color.color(0, 0, 0, 0.5));
|
dropShadow.setColor(Color.color(0, 0, 0, 0.5));
|
||||||
headText.setEffect(dropShadow);
|
headText.setEffect(dropShadow);
|
||||||
/**
|
|
||||||
* Creates an instance of GameClient and runs it as a host.
|
|
||||||
*/
|
|
||||||
@FXML
|
|
||||||
public void hostButtonPressed() {
|
|
||||||
Sounds.playButtonClick();
|
|
||||||
gameClient = new GameClient(holder);
|
|
||||||
gameClient.runAsHost(getLocalHostIp(), 4942);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an instance of GameClient and runs it has a client.
|
|
||||||
*/
|
|
||||||
@FXML
|
|
||||||
public void connectButtonPressed() {
|
|
||||||
// TODO: 10/07/17 wmu16 - Finish function
|
|
||||||
Sounds.playButtonClick();
|
|
||||||
gameClient = new GameClient(holder);
|
|
||||||
gameClient.runAsClient(ipTextField.getText().trim().toLowerCase(), 4942);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void preloadServerListView(){
|
private void preloadServerListView(){
|
||||||
@@ -132,9 +94,9 @@ public class StartScreenController implements Initializable{
|
|||||||
Sounds.toggleMuteMusic();
|
Sounds.toggleMuteMusic();
|
||||||
Sounds.playButtonClick();
|
Sounds.playButtonClick();
|
||||||
if (Sounds.isMusicMuted()) {
|
if (Sounds.isMusicMuted()) {
|
||||||
muteMusicButton.setText("UnMute Music");
|
// muteMusicButton.setText("UnMute Music");
|
||||||
} else {
|
} else {
|
||||||
muteMusicButton.setText("Mute Music");
|
// muteMusicButton.setText("Mute Music");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,9 +104,9 @@ public class StartScreenController implements Initializable{
|
|||||||
Sounds.toggleMuteEffects();
|
Sounds.toggleMuteEffects();
|
||||||
Sounds.playButtonClick();
|
Sounds.playButtonClick();
|
||||||
if (Sounds.isSoundEffectsMuted()) {
|
if (Sounds.isSoundEffectsMuted()) {
|
||||||
muteSoundsButton.setText("UnMute Sounds");
|
// muteSoundsButton.setText("UnMute Sounds");
|
||||||
} else {
|
} else {
|
||||||
muteSoundsButton.setText("Mute Sounds");
|
// muteSoundsButton.setText("Mute Sounds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import seng302.gameServer.ServerAdvertiser;
|
import seng302.gameServer.ServerAdvertiser;
|
||||||
import seng302.visualiser.GameClient;
|
import seng302.visualiser.GameClient;
|
||||||
|
import seng302.visualiser.controllers.dialogs.BoatCustomizeController;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import seng302.visualiser.controllers.dialogs.BoatCustomizeController;
|
|
||||||
|
|
||||||
public class ViewManager {
|
public class ViewManager {
|
||||||
|
|
||||||
@@ -33,7 +33,6 @@ public class ViewManager {
|
|||||||
|
|
||||||
private ViewManager(){
|
private ViewManager(){
|
||||||
properties = new HashMap<>();
|
properties = new HashMap<>();
|
||||||
gameClient = new GameClient(decorator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private FXMLLoader loadFxml(String fxmlLocation) {
|
private FXMLLoader loadFxml(String fxmlLocation) {
|
||||||
@@ -65,6 +64,7 @@ public class ViewManager {
|
|||||||
.add(getClass().getResource("/css/master.css").toExternalForm());
|
.add(getClass().getResource("/css/master.css").toExternalForm());
|
||||||
|
|
||||||
this.decorator = decorator;
|
this.decorator = decorator;
|
||||||
|
gameClient = new GameClient(decorator);
|
||||||
|
|
||||||
stage.getIcons().add(new Image(getClass().getResourceAsStream("/PP.png")));
|
stage.getIcons().add(new Image(getClass().getResourceAsStream("/PP.png")));
|
||||||
Scene scene = new Scene(decorator, 1200, 800);
|
Scene scene = new Scene(decorator, 1200, 800);
|
||||||
@@ -156,8 +156,8 @@ public class ViewManager {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
decorator.getScene().setOnKeyPressed((ke) -> gameClient.keyPressed(ke));
|
decorator.getScene().setOnKeyPressed(gameClient::keyPressed);
|
||||||
decorator.getScene().setOnKeyReleased((ke) -> gameClient.keyReleased(ke));
|
decorator.getScene().setOnKeyReleased(gameClient::keyReleased);
|
||||||
|
|
||||||
return loader.getController();
|
return loader.getController();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user