Merge remote-tracking branch 'origin/NewUI_merge' into NewUI_merge

This commit is contained in:
Haoming Yin
2017-09-11 23:43:46 +12:00
77 changed files with 20678 additions and 20608 deletions
+19 -1
View File
@@ -41,8 +41,10 @@ import java.util.*;
public class GameView extends Pane {
private double bufferSize = 50;
private double horizontalBuffer = 0;
private double panelWidth = 1280;
private double panelHeight = 960;
private double canvasWidth = 1100;
private double canvasHeight = 920;
private boolean horizontalInversion = false;
@@ -479,6 +481,9 @@ public class GameView extends Pane {
borderPoints = border;
rescaleRace(new ArrayList<>(borderPoints));
}
rescaleRace(new ArrayList<>(border));
List<Double> boundaryPoints = new ArrayList<>();
for (Limit limit : border) {
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.
*/
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
findMinMaxPoint(limitingCoordinates);
double minLonToMaxLon = scaleRaceExtremities();
@@ -707,6 +712,7 @@ public class GameView extends Pane {
referencePointX +=
((canvasWidth - (bufferSize + bufferSize)) - (minLonToMaxLon * distanceScaleFactor))
/ 2;
referencePointX += horizontalBuffer;
}
if (horizontalInversion) {
referencePointX = canvasWidth - bufferSize - (referencePointX - bufferSize);
@@ -942,4 +948,16 @@ public class GameView extends Pane {
this.fpsDisplay = null;
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.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.ResourceBundle;
@@ -16,14 +17,21 @@ import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import seng302.gameServer.GameStages;
import seng302.gameServer.GameState;
import seng302.model.Colors;
import seng302.model.Limit;
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.XMLGenerator;
import seng302.visualiser.GameView;
import seng302.visualiser.controllers.cells.PlayerCell;
public class LobbyController implements Initializable {
@@ -41,12 +49,16 @@ public class LobbyController implements Initializable {
private Label serverName;
@FXML
private Label mapName;
@FXML
private Pane serverMap;
//---------FXML END---------//
private List<LobbyController_old.LobbyCloseListener> lobbyListeners = new ArrayList<>();
private RaceState raceState;
private JFXDialog customizationDialog;
public Color playersColor;
private Double mapWidth, mapHeight;
private GameView gameView;
@Override
public void initialize(URL location, ResourceBundle resources) {
@@ -93,6 +105,45 @@ public class LobbyController implements Initializable {
customizeButton.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();
});
}
/**
+4 -3
View File
@@ -60,7 +60,8 @@
}
#serverMap {
-fx-background-image: url("/images/bg.jpg");
-fx-background-repeat: no-repeat;
-fx-background-size: cover;
/*-fx-background-image: url("/images/mapbg.jpg");*/
/*-fx-background-repeat: no-repeat;*/
/*-fx-background-size: cover;*/
-fx-background-color: dodgerblue;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 352 KiB