mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Merge remote-tracking branch 'origin/NewUI_merge' into NewUI_merge
This commit is contained in:
@@ -2,7 +2,6 @@ package seng302.utilities;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.lang.reflect.Array;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,8 +14,12 @@ import org.xml.sax.InputSource;
|
|||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import seng302.model.stream.packets.PacketType;
|
import seng302.model.stream.packets.PacketType;
|
||||||
import seng302.model.stream.packets.StreamPacket;
|
import seng302.model.stream.packets.StreamPacket;
|
||||||
import seng302.model.stream.parser.*;
|
import seng302.model.stream.parser.MarkRoundingData;
|
||||||
|
import seng302.model.stream.parser.PositionUpdateData;
|
||||||
import seng302.model.stream.parser.PositionUpdateData.DeviceType;
|
import seng302.model.stream.parser.PositionUpdateData.DeviceType;
|
||||||
|
import seng302.model.stream.parser.RaceStartData;
|
||||||
|
import seng302.model.stream.parser.RaceStatusData;
|
||||||
|
import seng302.model.stream.parser.YachtEventData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StreamParser is a utilities class for taking byte data, formatted according to the AC35 streaming
|
* StreamParser is a utilities class for taking byte data, formatted according to the AC35 streaming
|
||||||
@@ -37,7 +40,6 @@ public class StreamParser {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
long heartbeat = bytesToLong(packet.getPayload());
|
long heartbeat = bytesToLong(packet.getPayload());
|
||||||
System.out.println("heartbeat = " + heartbeat);
|
|
||||||
return heartbeat;
|
return heartbeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -341,10 +341,10 @@ public class GameClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (raceFinished) {
|
if (raceFinished) {
|
||||||
System.out.println(raceViewController);
|
|
||||||
raceViewController.showFinishDialog(finishedBoats);
|
raceViewController.showFinishDialog(finishedBoats);
|
||||||
Sounds.playFinishSound();
|
Sounds.playFinishSound();
|
||||||
close();
|
close();
|
||||||
|
ViewManager.getInstance().getGameClient().stopGame();
|
||||||
//loadFinishScreenView();
|
//loadFinishScreenView();
|
||||||
}
|
}
|
||||||
raceState.setRaceFinished();
|
raceState.setRaceFinished();
|
||||||
@@ -450,7 +450,7 @@ public class GameClient {
|
|||||||
if (server != null) server.terminate();
|
if (server != null) server.terminate();
|
||||||
if (socketThread != null) socketThread.setSocketToClose();
|
if (socketThread != null) socketThread.setSocketToClose();
|
||||||
server = null;
|
server = null;
|
||||||
socketThread = null;
|
// socketThread = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, ClientYacht> getAllBoatsMap() {
|
public Map<Integer, ClientYacht> getAllBoatsMap() {
|
||||||
|
|||||||
@@ -245,11 +245,6 @@ public class GameView3D {
|
|||||||
|
|
||||||
private void createStartLineArrows () {
|
private void createStartLineArrows () {
|
||||||
for (Mark mark : course.get(0).getMarks()) {
|
for (Mark mark : course.get(0).getMarks()) {
|
||||||
System.out.println(
|
|
||||||
"GeoUtility.getBearing(mark, course.get(1).getMidPoint()) = " + GeoUtility
|
|
||||||
.getBearing(mark, course.get(1).getMidPoint()));
|
|
||||||
System.out.println("mark = " + mark);
|
|
||||||
System.out.println("course.get(1) = " + course.get(1));
|
|
||||||
markerObjects.get(mark).addArrows(
|
markerObjects.get(mark).addArrows(
|
||||||
mark.getRoundingSide() == RoundingSide.STARBOARD ? MarkArrowFactory.RoundingSide.STARBOARD : MarkArrowFactory.RoundingSide.PORT,
|
mark.getRoundingSide() == RoundingSide.STARBOARD ? MarkArrowFactory.RoundingSide.STARBOARD : MarkArrowFactory.RoundingSide.PORT,
|
||||||
0d, //90
|
0d, //90
|
||||||
@@ -590,7 +585,7 @@ public class GameView3D {
|
|||||||
new Scale(1, lastLocation.distance(location) / 5, 1)
|
new Scale(1, lastLocation.distance(location) / 5, 1)
|
||||||
);
|
);
|
||||||
trail.getChildren().add(segment);
|
trail.getChildren().add(segment);
|
||||||
if (trail.getChildren().size() > 100) {
|
if (trail.getChildren().size() > 50) {
|
||||||
trail.getChildren().remove(0);
|
trail.getChildren().remove(0);
|
||||||
}
|
}
|
||||||
lastLocation = location;
|
lastLocation = location;
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
private Label timerLabel;
|
private Label timerLabel;
|
||||||
@FXML
|
@FXML
|
||||||
private StackPane contentAnchorPane;
|
private StackPane contentAnchorPane;
|
||||||
|
|
||||||
private GridPane contentGridPane;
|
private GridPane contentGridPane;
|
||||||
@FXML
|
@FXML
|
||||||
private AnchorPane rvAnchorPane;
|
private AnchorPane rvAnchorPane;
|
||||||
@@ -200,7 +201,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
public void showFinishDialog(ArrayList<ClientYacht> finishedBoats) {
|
public void showFinishDialog(ArrayList<ClientYacht> finishedBoats) {
|
||||||
raceState.setRaceStarted(false);
|
raceState.setRaceStarted(false);
|
||||||
finishDialogController.setFinishedBoats(finishedBoats);
|
finishDialogController.setFinishedBoats(finishedBoats);
|
||||||
ViewManager.getInstance().getGameClient().stopGame();
|
|
||||||
finishScreenDialog.show();
|
finishScreenDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,9 +250,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
.bind(ViewManager.getInstance().getStage().widthProperty());
|
.bind(ViewManager.getInstance().getStage().widthProperty());
|
||||||
((SubScene) gameView.getAssets()).heightProperty()
|
((SubScene) gameView.getAssets()).heightProperty()
|
||||||
.bind(ViewManager.getInstance().getStage().heightProperty());
|
.bind(ViewManager.getInstance().getStage().heightProperty());
|
||||||
System.out.println(((SubScene) gameView.getAssets()).getHeight());
|
|
||||||
System.out.println(((SubScene) gameView.getAssets()).getWidth());
|
|
||||||
|
|
||||||
});
|
});
|
||||||
gameView.setBoats(new ArrayList<>(participants.values()));
|
gameView.setBoats(new ArrayList<>(participants.values()));
|
||||||
gameView.updateBorder(raceData.getCourseLimit());
|
gameView.updateBorder(raceData.getCourseLimit());
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ public class ServerCell implements Initializable {
|
|||||||
* Attempts to connect to the chosen server using the button on the serverCell.
|
* Attempts to connect to the chosen server using the button on the serverCell.
|
||||||
*/
|
*/
|
||||||
private void joinServer() {
|
private void joinServer() {
|
||||||
System.out.println("Connecting to " + serverName.getText());
|
|
||||||
ViewManager.getInstance().getGameClient().runAsClient(hostName, portNumber);
|
ViewManager.getInstance().getGameClient().runAsClient(hostName, portNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.jfoenix.controls.JFXButton;
|
|||||||
import com.jfoenix.controls.JFXListView;
|
import com.jfoenix.controls.JFXListView;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
@@ -30,8 +31,8 @@ public class FinishDialogController implements Initializable {
|
|||||||
|
|
||||||
public void setFinishedBoats(ArrayList<ClientYacht> finishedBoats) {
|
public void setFinishedBoats(ArrayList<ClientYacht> finishedBoats) {
|
||||||
finishersList.getItems().clear();
|
finishersList.getItems().clear();
|
||||||
for (ClientYacht yacht : finishedBoats) {
|
for (int i = 0; i < finishedBoats.size(); i++) {
|
||||||
finishersList.getItems().add(new Label(yacht.getBoatName()));
|
finishersList.getItems().add(new Label(Integer.toString(i+1) +". " + finishedBoats.get(i).getBoatName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import javafx.scene.paint.Color;
|
|||||||
import javafx.scene.paint.Paint;
|
import javafx.scene.paint.Paint;
|
||||||
import javafx.scene.shape.Arc;
|
import javafx.scene.shape.Arc;
|
||||||
import javafx.scene.shape.ArcType;
|
import javafx.scene.shape.ArcType;
|
||||||
import javafx.scene.shape.Circle;
|
|
||||||
import javafx.scene.shape.Polygon;
|
import javafx.scene.shape.Polygon;
|
||||||
import javafx.scene.shape.Polyline;
|
import javafx.scene.shape.Polyline;
|
||||||
import javafx.scene.shape.StrokeLineCap;
|
import javafx.scene.shape.StrokeLineCap;
|
||||||
@@ -39,14 +38,19 @@ public class MarkArrowFactory {
|
|||||||
public static Model constructEntryArrow3D (
|
public static Model constructEntryArrow3D (
|
||||||
RoundingSide roundingSide, double angle, ModelType type) {
|
RoundingSide roundingSide, double angle, ModelType type) {
|
||||||
Model entryArrow = ModelFactory.importModel(type);
|
Model entryArrow = ModelFactory.importModel(type);
|
||||||
|
|
||||||
|
double angleDeg = angle;
|
||||||
|
angle = 180 - angle;
|
||||||
|
angle = Math.toRadians(angle);
|
||||||
|
|
||||||
int multiplier = roundingSide == RoundingSide.STARBOARD ? 1 : -1;
|
int multiplier = roundingSide == RoundingSide.STARBOARD ? 1 : -1;
|
||||||
double relativeX = multiplier * 5 * Math.sin(angle + Math.PI / 2);
|
double relativeX = multiplier * 5.7 * Math.sin(angle + Math.PI / 2);
|
||||||
double relativeY = multiplier * 5 * Math.cos(angle + Math.PI / 2);
|
double relativeY = multiplier * 5.7 * Math.cos(angle + Math.PI / 2);
|
||||||
double xStart = relativeX + multiplier * 20 * Math.sin(angle + Math.PI / 2);
|
double xStart = relativeX + -10 * Math.sin(angle);
|
||||||
double yStart = relativeY + multiplier * 20 * Math.cos(angle + Math.PI / 2);
|
double yStart = relativeY + -10 * Math.cos(angle);
|
||||||
entryArrow.getAssets().getTransforms().addAll(
|
entryArrow.getAssets().getTransforms().addAll(
|
||||||
new Translate(xStart, yStart, 0),
|
new Translate(xStart, yStart, 0),
|
||||||
new Rotate(Math.toDegrees(angle), new Point3D(0,0,1))
|
new Rotate(angleDeg, new Point3D(0,0,1))
|
||||||
);
|
);
|
||||||
return entryArrow;
|
return entryArrow;
|
||||||
}
|
}
|
||||||
@@ -54,18 +58,21 @@ public class MarkArrowFactory {
|
|||||||
public static Model constructExitArrow3D (
|
public static Model constructExitArrow3D (
|
||||||
RoundingSide roundingSide, double angle, ModelType type) {
|
RoundingSide roundingSide, double angle, ModelType type) {
|
||||||
Model exitArrow = ModelFactory.importModel(type);
|
Model exitArrow = ModelFactory.importModel(type);
|
||||||
// angle = Math.toRadians(angle-65);
|
|
||||||
|
double angleDeg = angle;
|
||||||
|
angle = 180 - angle;
|
||||||
angle = Math.toRadians(angle);
|
angle = Math.toRadians(angle);
|
||||||
|
|
||||||
int multiplier = roundingSide == RoundingSide.STARBOARD ? 1 : -1;
|
int multiplier = roundingSide == RoundingSide.STARBOARD ? 1 : -1;
|
||||||
double xStart = multiplier * 6 * Math.sin(angle + Math.PI / 2);
|
double xStart = multiplier * 5.7 * Math.sin(angle + Math.PI / 2);
|
||||||
double yStart = multiplier * 6 * Math.cos(angle + Math.PI / 2);
|
double yStart = multiplier * 5.7 * Math.cos(angle + Math.PI / 2);
|
||||||
// exitArrow.getAssets().getTransforms().addAll(
|
|
||||||
// new Translate(xStart, yStart, 0),
|
exitArrow.getAssets().getTransforms().addAll(
|
||||||
// new Rotate(Math.toDegrees(Math.toDegrees(angle)), new Point3D(0,0,1))
|
new Translate(xStart, yStart, 0),
|
||||||
// );
|
new Rotate(angleDeg, new Point3D(0,0,1))
|
||||||
Circle c = new Circle(xStart, yStart, 1, Color.RED);
|
);
|
||||||
c.setStroke(Color.TRANSPARENT);
|
|
||||||
return new Model(new Group(c), null);
|
return exitArrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#raceFinishLabel {
|
||||||
|
-fx-font-size: 23px !important;
|
||||||
|
-fx-text-fill: -fx-pp-dark-text-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
#finishersList {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#playAgain {
|
||||||
|
-fx-background-color: -fx-pp-theme-color;
|
||||||
|
-fx-text-fill: -fx-pp-light-text-color;
|
||||||
|
-fx-font-size: 20px !important;
|
||||||
|
-fx-effect: -fx-pp-dropshadow-dark;
|
||||||
|
-fx-min-width: 130px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#playAgain:hover {
|
||||||
|
-fx-font-size: 23px !important;
|
||||||
|
-fx-background-color: -fx-pp-light-theme-color;
|
||||||
|
}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
<stylesheets>
|
<stylesheets>
|
||||||
<String fx:value="/css/dialogs/BoatCustomize.css"/>
|
<String fx:value="/css/dialogs/FinishScreen.css"/>
|
||||||
<String fx:value="/css/Master.css"/>
|
<String fx:value="/css/Master.css"/>
|
||||||
</stylesheets>
|
</stylesheets>
|
||||||
</JFXDialogLayout>
|
</JFXDialogLayout>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class ChatCommandsTest {
|
|||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
ie.printStackTrace();
|
ie.printStackTrace();
|
||||||
}
|
}
|
||||||
host.sendChatterMessage("[time_prefix] <name_prefix> >finish");
|
host.sendChatterMessage("[time_prefix] <name_prefix> /finish");
|
||||||
dcSent = true;
|
dcSent = true;
|
||||||
try {
|
try {
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
@@ -104,7 +104,7 @@ public class ChatCommandsTest {
|
|||||||
ie.printStackTrace();
|
ie.printStackTrace();
|
||||||
}
|
}
|
||||||
mst.startGame();
|
mst.startGame();
|
||||||
host.sendChatterMessage("[time_prefix] <name_prefix> >speed 5");
|
host.sendChatterMessage("[time_prefix] <name_prefix> /speed 5");
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
@@ -143,7 +143,7 @@ public class ChatCommandsTest {
|
|||||||
ie.printStackTrace();
|
ie.printStackTrace();
|
||||||
}
|
}
|
||||||
mst.startGame();
|
mst.startGame();
|
||||||
host.sendChatterMessage("[time_prefix] <name_prefix> >speed fdgdgdfg");
|
host.sendChatterMessage("[time_prefix] <name_prefix> /speed fdgdgdfg");
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
@@ -188,7 +188,7 @@ public class ChatCommandsTest {
|
|||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
ie.printStackTrace();
|
ie.printStackTrace();
|
||||||
}
|
}
|
||||||
client.sendChatterMessage("[time_prefix] <name_prefix> >speed 5.0");
|
client.sendChatterMessage("[time_prefix] <name_prefix> /speed 5.0");
|
||||||
try {
|
try {
|
||||||
Thread.sleep(200);
|
Thread.sleep(200);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
@@ -248,7 +248,7 @@ public class ChatCommandsTest {
|
|||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
ioe.printStackTrace();
|
ioe.printStackTrace();
|
||||||
}
|
}
|
||||||
host.sendChatterMessage("[time_prefix] <name_prefix> >finish");
|
host.sendChatterMessage("[time_prefix] <name_prefix> /finish");
|
||||||
dcSent = true;
|
dcSent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user