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.StringReader;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -15,8 +14,12 @@ import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import seng302.model.stream.packets.PacketType;
|
||||
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.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
|
||||
@@ -37,7 +40,6 @@ public class StreamParser {
|
||||
return null;
|
||||
}
|
||||
long heartbeat = bytesToLong(packet.getPayload());
|
||||
System.out.println("heartbeat = " + heartbeat);
|
||||
return heartbeat;
|
||||
}
|
||||
|
||||
|
||||
@@ -341,10 +341,10 @@ public class GameClient {
|
||||
}
|
||||
|
||||
if (raceFinished) {
|
||||
System.out.println(raceViewController);
|
||||
raceViewController.showFinishDialog(finishedBoats);
|
||||
Sounds.playFinishSound();
|
||||
close();
|
||||
ViewManager.getInstance().getGameClient().stopGame();
|
||||
//loadFinishScreenView();
|
||||
}
|
||||
raceState.setRaceFinished();
|
||||
@@ -450,7 +450,7 @@ public class GameClient {
|
||||
if (server != null) server.terminate();
|
||||
if (socketThread != null) socketThread.setSocketToClose();
|
||||
server = null;
|
||||
socketThread = null;
|
||||
// socketThread = null;
|
||||
}
|
||||
|
||||
public Map<Integer, ClientYacht> getAllBoatsMap() {
|
||||
|
||||
@@ -245,11 +245,6 @@ public class GameView3D {
|
||||
|
||||
private void createStartLineArrows () {
|
||||
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(
|
||||
mark.getRoundingSide() == RoundingSide.STARBOARD ? MarkArrowFactory.RoundingSide.STARBOARD : MarkArrowFactory.RoundingSide.PORT,
|
||||
0d, //90
|
||||
@@ -590,7 +585,7 @@ public class GameView3D {
|
||||
new Scale(1, lastLocation.distance(location) / 5, 1)
|
||||
);
|
||||
trail.getChildren().add(segment);
|
||||
if (trail.getChildren().size() > 100) {
|
||||
if (trail.getChildren().size() > 50) {
|
||||
trail.getChildren().remove(0);
|
||||
}
|
||||
lastLocation = location;
|
||||
|
||||
@@ -88,6 +88,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
private Label timerLabel;
|
||||
@FXML
|
||||
private StackPane contentAnchorPane;
|
||||
|
||||
private GridPane contentGridPane;
|
||||
@FXML
|
||||
private AnchorPane rvAnchorPane;
|
||||
@@ -200,7 +201,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
public void showFinishDialog(ArrayList<ClientYacht> finishedBoats) {
|
||||
raceState.setRaceStarted(false);
|
||||
finishDialogController.setFinishedBoats(finishedBoats);
|
||||
ViewManager.getInstance().getGameClient().stopGame();
|
||||
finishScreenDialog.show();
|
||||
}
|
||||
|
||||
@@ -250,9 +250,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
.bind(ViewManager.getInstance().getStage().widthProperty());
|
||||
((SubScene) gameView.getAssets()).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.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.
|
||||
*/
|
||||
private void joinServer() {
|
||||
System.out.println("Connecting to " + serverName.getText());
|
||||
ViewManager.getInstance().getGameClient().runAsClient(hostName, portNumber);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXListView;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
@@ -30,8 +31,8 @@ public class FinishDialogController implements Initializable {
|
||||
|
||||
public void setFinishedBoats(ArrayList<ClientYacht> finishedBoats) {
|
||||
finishersList.getItems().clear();
|
||||
for (ClientYacht yacht : finishedBoats) {
|
||||
finishersList.getItems().add(new Label(yacht.getBoatName()));
|
||||
for (int i = 0; i < finishedBoats.size(); i++) {
|
||||
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.shape.Arc;
|
||||
import javafx.scene.shape.ArcType;
|
||||
import javafx.scene.shape.Circle;
|
||||
import javafx.scene.shape.Polygon;
|
||||
import javafx.scene.shape.Polyline;
|
||||
import javafx.scene.shape.StrokeLineCap;
|
||||
@@ -39,14 +38,19 @@ public class MarkArrowFactory {
|
||||
public static Model constructEntryArrow3D (
|
||||
RoundingSide roundingSide, double angle, ModelType type) {
|
||||
Model entryArrow = ModelFactory.importModel(type);
|
||||
|
||||
double angleDeg = angle;
|
||||
angle = 180 - angle;
|
||||
angle = Math.toRadians(angle);
|
||||
|
||||
int multiplier = roundingSide == RoundingSide.STARBOARD ? 1 : -1;
|
||||
double relativeX = multiplier * 5 * Math.sin(angle + Math.PI / 2);
|
||||
double relativeY = multiplier * 5 * Math.cos(angle + Math.PI / 2);
|
||||
double xStart = relativeX + multiplier * 20 * Math.sin(angle + Math.PI / 2);
|
||||
double yStart = relativeY + multiplier * 20 * Math.cos(angle + Math.PI / 2);
|
||||
double relativeX = multiplier * 5.7 * Math.sin(angle + Math.PI / 2);
|
||||
double relativeY = multiplier * 5.7 * Math.cos(angle + Math.PI / 2);
|
||||
double xStart = relativeX + -10 * Math.sin(angle);
|
||||
double yStart = relativeY + -10 * Math.cos(angle);
|
||||
entryArrow.getAssets().getTransforms().addAll(
|
||||
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;
|
||||
}
|
||||
@@ -54,18 +58,21 @@ public class MarkArrowFactory {
|
||||
public static Model constructExitArrow3D (
|
||||
RoundingSide roundingSide, double angle, ModelType type) {
|
||||
Model exitArrow = ModelFactory.importModel(type);
|
||||
// angle = Math.toRadians(angle-65);
|
||||
|
||||
double angleDeg = angle;
|
||||
angle = 180 - angle;
|
||||
angle = Math.toRadians(angle);
|
||||
|
||||
int multiplier = roundingSide == RoundingSide.STARBOARD ? 1 : -1;
|
||||
double xStart = multiplier * 6 * Math.sin(angle + Math.PI / 2);
|
||||
double yStart = multiplier * 6 * Math.cos(angle + Math.PI / 2);
|
||||
// exitArrow.getAssets().getTransforms().addAll(
|
||||
// new Translate(xStart, yStart, 0),
|
||||
// new Rotate(Math.toDegrees(Math.toDegrees(angle)), 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);
|
||||
double xStart = multiplier * 5.7 * Math.sin(angle + Math.PI / 2);
|
||||
double yStart = multiplier * 5.7 * Math.cos(angle + Math.PI / 2);
|
||||
|
||||
exitArrow.getAssets().getTransforms().addAll(
|
||||
new Translate(xStart, yStart, 0),
|
||||
new Rotate(angleDeg, new Point3D(0,0,1))
|
||||
);
|
||||
|
||||
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>
|
||||
</children>
|
||||
<stylesheets>
|
||||
<String fx:value="/css/dialogs/BoatCustomize.css"/>
|
||||
<String fx:value="/css/dialogs/FinishScreen.css"/>
|
||||
<String fx:value="/css/Master.css"/>
|
||||
</stylesheets>
|
||||
</JFXDialogLayout>
|
||||
|
||||
Reference in New Issue
Block a user