mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Made continous turning the default. Added triangles to minimap. Made mark areas bigger
#fix #implement
This commit is contained in:
@@ -49,12 +49,6 @@ import seng302.visualiser.controllers.RaceViewController;
|
|||||||
import seng302.visualiser.controllers.ViewManager;
|
import seng302.visualiser.controllers.ViewManager;
|
||||||
import seng302.visualiser.controllers.dialogs.PopupDialogController;
|
import seng302.visualiser.controllers.dialogs.PopupDialogController;
|
||||||
|
|
||||||
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
|
||||||
* with a JavaFX Pane to insert itself into.
|
* with a JavaFX Pane to insert itself into.
|
||||||
@@ -287,6 +281,7 @@ public class GameClient {
|
|||||||
formatAndSendChatMessage(raceView.readChatInput());
|
formatAndSendChatMessage(raceView.readChatInput());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
gameKeyBind.toggleTurningMode();
|
||||||
sendToggleTurningModePacket(); // notify the server about player's steering mode
|
sendToggleTurningModePacket(); // notify the server about player's steering mode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import java.util.List;
|
|||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.geometry.Point2D;
|
import javafx.geometry.Point2D;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.shape.Circle;
|
|
||||||
import javafx.scene.shape.Polygon;
|
import javafx.scene.shape.Polygon;
|
||||||
|
import javafx.scene.transform.Rotate;
|
||||||
import seng302.model.ClientYacht;
|
import seng302.model.ClientYacht;
|
||||||
import seng302.model.Limit;
|
import seng302.model.Limit;
|
||||||
import seng302.model.mark.CompoundMark;
|
import seng302.model.mark.CompoundMark;
|
||||||
@@ -15,11 +15,11 @@ import seng302.model.mark.Mark;
|
|||||||
import seng302.utilities.Sounds;
|
import seng302.utilities.Sounds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by cir27 on 28/09/17.
|
* Class converts a map preview to a minimap by adding boats.
|
||||||
*/
|
*/
|
||||||
public class MiniMap extends MapPreview {
|
public class MiniMap extends MapPreview {
|
||||||
|
|
||||||
private HashMap<ClientYacht, Circle> boatIcons = new HashMap<>();
|
private HashMap<ClientYacht, Polygon> boatIcons = new HashMap<>();
|
||||||
private Polygon playerBoat;
|
private Polygon playerBoat;
|
||||||
private double playerRotation;
|
private double playerRotation;
|
||||||
private List<ClientYacht> boats;
|
private List<ClientYacht> boats;
|
||||||
@@ -35,17 +35,19 @@ public class MiniMap extends MapPreview {
|
|||||||
|
|
||||||
public void setBoats(List<ClientYacht> yachts) {
|
public void setBoats(List<ClientYacht> yachts) {
|
||||||
for (ClientYacht yacht : yachts) {
|
for (ClientYacht yacht : yachts) {
|
||||||
Circle boatIcon = new Circle(0, 0, 4);
|
Polygon boatIcon = new Polygon(0, -3.5, 3.5, 3.5, -3.5, 3.5);
|
||||||
boatIcon.setStroke(Color.BLACK);
|
boatIcon.setStroke(Color.BLACK);
|
||||||
boatIcon.setFill(Color.GRAY);
|
boatIcon.setFill(Color.GRAY);
|
||||||
boatIcon.setFill(yacht.getColour());
|
boatIcon.setFill(yacht.getColour());
|
||||||
boatIcon.setFill(yacht.getColour());
|
boatIcon.setFill(yacht.getColour());
|
||||||
boatIcons.put(yacht, boatIcon);
|
boatIcons.put(yacht, boatIcon);
|
||||||
|
boatIcon.getTransforms().add(new Rotate(0));
|
||||||
yacht.addLocationListener((boat, lat, lon, heading, sailIn, velocity) -> {
|
yacht.addLocationListener((boat, lat, lon, heading, sailIn, velocity) -> {
|
||||||
Circle bi = boatIcons.get(boat);
|
Polygon bi = boatIcons.get(boat);
|
||||||
Point2D p2d = scaledPoint.findScaledXY(lat, lon);
|
Point2D p2d = scaledPoint.findScaledXY(lat, lon);
|
||||||
bi.setCenterX(p2d.getX());
|
bi.setLayoutX(p2d.getX());
|
||||||
bi.setCenterY(p2d.getY());
|
bi.setLayoutY(p2d.getY());
|
||||||
|
((Rotate) bi.getTransforms().get(0)).setAngle(heading);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
|||||||
@@ -194,10 +194,10 @@ public class RaceViewController extends Thread {
|
|||||||
miniMapButton.setOnMouseClicked((event) -> {
|
miniMapButton.setOnMouseClicked((event) -> {
|
||||||
if (miniMapPane.visibleProperty().get()) {
|
if (miniMapPane.visibleProperty().get()) {
|
||||||
miniMapPane.setVisible(false);
|
miniMapPane.setVisible(false);
|
||||||
miniMapButton.setText("✕");
|
miniMapButton.setText("✓");
|
||||||
} else {
|
} else {
|
||||||
miniMapPane.setVisible(true);
|
miniMapPane.setVisible(true);
|
||||||
miniMapButton.setText("✓");
|
miniMapButton.setText("✕");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -236,7 +236,7 @@
|
|||||||
<Insets right="15.0" top="15.0" />
|
<Insets right="15.0" top="15.0" />
|
||||||
</StackPane.margin>
|
</StackPane.margin>
|
||||||
</Pane>
|
</Pane>
|
||||||
<JFXButton fx:id="miniMapButton" style="-fx-background-color: white; -fx-opacity: 0.45; -fx-background-radius: 10;" text="✓" StackPane.alignment="TOP_RIGHT">
|
<JFXButton fx:id="miniMapButton" style="-fx-background-color: white; -fx-opacity: 0.45; -fx-background-radius: 10;" text="✕" StackPane.alignment="TOP_RIGHT">
|
||||||
<font>
|
<font>
|
||||||
<Font size="15.0" />
|
<Font size="15.0" />
|
||||||
</font>
|
</font>
|
||||||
|
|||||||
Reference in New Issue
Block a user