mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Merge remote-tracking branch 'origin/NewUI_merge' into NewUI_merge
This commit is contained in:
@@ -41,8 +41,10 @@ import java.util.*;
|
|||||||
public class GameView extends Pane {
|
public class GameView extends Pane {
|
||||||
|
|
||||||
private double bufferSize = 50;
|
private double bufferSize = 50;
|
||||||
|
private double horizontalBuffer = 0;
|
||||||
private double panelWidth = 1280;
|
private double panelWidth = 1280;
|
||||||
private double panelHeight = 960;
|
private double panelHeight = 960;
|
||||||
|
|
||||||
private double canvasWidth = 1100;
|
private double canvasWidth = 1100;
|
||||||
private double canvasHeight = 920;
|
private double canvasHeight = 920;
|
||||||
private boolean horizontalInversion = false;
|
private boolean horizontalInversion = false;
|
||||||
@@ -479,6 +481,9 @@ public class GameView extends Pane {
|
|||||||
borderPoints = border;
|
borderPoints = border;
|
||||||
rescaleRace(new ArrayList<>(borderPoints));
|
rescaleRace(new ArrayList<>(borderPoints));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rescaleRace(new ArrayList<>(border));
|
||||||
|
|
||||||
List<Double> boundaryPoints = new ArrayList<>();
|
List<Double> boundaryPoints = new ArrayList<>();
|
||||||
for (Limit limit : border) {
|
for (Limit limit : border) {
|
||||||
Point2D location = findScaledXY(limit.getLat(), limit.getLng());
|
Point2D location = findScaledXY(limit.getLat(), limit.getLng());
|
||||||
@@ -549,7 +554,7 @@ public class GameView extends Pane {
|
|||||||
*
|
*
|
||||||
* @param limitingCoordinates the set of geo points that contains the extremities of the race.
|
* @param limitingCoordinates the set of geo points that contains the extremities of the race.
|
||||||
*/
|
*/
|
||||||
private void rescaleRace(List<GeoPoint> limitingCoordinates) {
|
public void rescaleRace(List<GeoPoint> limitingCoordinates) {
|
||||||
//Check is called once to avoid unnecessarily change the course limits once the race is running
|
//Check is called once to avoid unnecessarily change the course limits once the race is running
|
||||||
findMinMaxPoint(limitingCoordinates);
|
findMinMaxPoint(limitingCoordinates);
|
||||||
double minLonToMaxLon = scaleRaceExtremities();
|
double minLonToMaxLon = scaleRaceExtremities();
|
||||||
@@ -707,6 +712,7 @@ public class GameView extends Pane {
|
|||||||
referencePointX +=
|
referencePointX +=
|
||||||
((canvasWidth - (bufferSize + bufferSize)) - (minLonToMaxLon * distanceScaleFactor))
|
((canvasWidth - (bufferSize + bufferSize)) - (minLonToMaxLon * distanceScaleFactor))
|
||||||
/ 2;
|
/ 2;
|
||||||
|
referencePointX += horizontalBuffer;
|
||||||
}
|
}
|
||||||
if (horizontalInversion) {
|
if (horizontalInversion) {
|
||||||
referencePointX = canvasWidth - bufferSize - (referencePointX - bufferSize);
|
referencePointX = canvasWidth - bufferSize - (referencePointX - bufferSize);
|
||||||
@@ -942,4 +948,16 @@ public class GameView extends Pane {
|
|||||||
this.fpsDisplay = null;
|
this.fpsDisplay = null;
|
||||||
this.fpsDisplay = fpsDisplay;
|
this.fpsDisplay = fpsDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSize(Double width, Double height){
|
||||||
|
this.canvasWidth = width;
|
||||||
|
this.canvasHeight = height;
|
||||||
|
|
||||||
|
this.panelWidth = width;
|
||||||
|
this.panelHeight = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHorizontalBuffer(Double buff){
|
||||||
|
this.horizontalBuffer = buff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jfoenix.controls.JFXDialog;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
@@ -16,14 +17,21 @@ import javafx.fxml.FXMLLoader;
|
|||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.ScrollPane;
|
import javafx.scene.control.ScrollPane;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import seng302.gameServer.GameStages;
|
import seng302.gameServer.GameStages;
|
||||||
import seng302.gameServer.GameState;
|
import seng302.gameServer.GameState;
|
||||||
import seng302.model.Colors;
|
import seng302.model.Colors;
|
||||||
|
import seng302.model.Limit;
|
||||||
import seng302.model.RaceState;
|
import seng302.model.RaceState;
|
||||||
|
import seng302.model.mark.CompoundMark;
|
||||||
|
import seng302.model.mark.Corner;
|
||||||
|
import seng302.model.stream.xml.parser.RaceXMLData;
|
||||||
import seng302.utilities.Sounds;
|
import seng302.utilities.Sounds;
|
||||||
|
import seng302.utilities.XMLGenerator;
|
||||||
|
import seng302.visualiser.GameView;
|
||||||
import seng302.visualiser.controllers.cells.PlayerCell;
|
import seng302.visualiser.controllers.cells.PlayerCell;
|
||||||
|
|
||||||
public class LobbyController implements Initializable {
|
public class LobbyController implements Initializable {
|
||||||
@@ -41,12 +49,16 @@ public class LobbyController implements Initializable {
|
|||||||
private Label serverName;
|
private Label serverName;
|
||||||
@FXML
|
@FXML
|
||||||
private Label mapName;
|
private Label mapName;
|
||||||
|
@FXML
|
||||||
|
private Pane serverMap;
|
||||||
//---------FXML END---------//
|
//---------FXML END---------//
|
||||||
|
|
||||||
private List<LobbyController_old.LobbyCloseListener> lobbyListeners = new ArrayList<>();
|
private List<LobbyController_old.LobbyCloseListener> lobbyListeners = new ArrayList<>();
|
||||||
private RaceState raceState;
|
private RaceState raceState;
|
||||||
private JFXDialog customizationDialog;
|
private JFXDialog customizationDialog;
|
||||||
public Color playersColor;
|
public Color playersColor;
|
||||||
|
private Double mapWidth, mapHeight;
|
||||||
|
private GameView gameView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
@@ -93,6 +105,45 @@ public class LobbyController implements Initializable {
|
|||||||
customizeButton.setOnMouseEntered(e -> Sounds.playHoverSound());
|
customizeButton.setOnMouseEntered(e -> Sounds.playHoverSound());
|
||||||
beginRaceButton.setOnMouseEntered(e -> Sounds.playHoverSound());
|
beginRaceButton.setOnMouseEntered(e -> Sounds.playHoverSound());
|
||||||
|
|
||||||
|
initMapPreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshMapView(){
|
||||||
|
RaceXMLData raceData = ViewManager.getInstance().getGameClient().getCourseData();
|
||||||
|
List<Limit> border = raceData.getCourseLimit();
|
||||||
|
List<CompoundMark> marks = new ArrayList<CompoundMark>(raceData.getCompoundMarks().values());
|
||||||
|
List<Corner> corners = raceData.getMarkSequence();
|
||||||
|
|
||||||
|
gameView.setSize(mapWidth, mapHeight);
|
||||||
|
|
||||||
|
// Update game view
|
||||||
|
gameView.updateBorder(border);
|
||||||
|
gameView.updateCourse(marks, corners);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private void initMapPreview() {
|
||||||
|
gameView = new GameView();
|
||||||
|
gameView.setHorizontalBuffer(330d);
|
||||||
|
|
||||||
|
mapWidth = 770d;
|
||||||
|
mapHeight = 574d;
|
||||||
|
|
||||||
|
// Add game view
|
||||||
|
serverMap.getChildren().clear();
|
||||||
|
serverMap.getChildren().add(gameView);
|
||||||
|
|
||||||
|
serverMap.widthProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
mapWidth = newValue.doubleValue();
|
||||||
|
refreshMapView();
|
||||||
|
});
|
||||||
|
|
||||||
|
serverMap.heightProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
mapHeight = newValue.doubleValue();
|
||||||
|
refreshMapView();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -60,7 +60,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#serverMap {
|
#serverMap {
|
||||||
-fx-background-image: url("/images/bg.jpg");
|
/*-fx-background-image: url("/images/mapbg.jpg");*/
|
||||||
-fx-background-repeat: no-repeat;
|
/*-fx-background-repeat: no-repeat;*/
|
||||||
-fx-background-size: cover;
|
/*-fx-background-size: cover;*/
|
||||||
|
-fx-background-color: dodgerblue;
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 352 KiB |
Reference in New Issue
Block a user