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/develop' into NewUI_merge
# Conflicts: # src/main/resources/views/RaceView.fxml
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -249,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user