Added a race importer. Added imported races to visualizer. Made it so that the host sets the race. Refactored server to no longer be dependant on a specific race. Tested functionality of map manually. Some bugs found and listed below.

#implement #testmanual #story[1275]

Known bugs:
 * Can't move
 * Map is off center in lobby view.
 * 3D Map is off center
This commit is contained in:
Calum
2017-09-23 22:45:53 +12:00
parent 6ca75b2cac
commit 9b00ba654a
23 changed files with 442 additions and 421 deletions
@@ -153,7 +153,7 @@ public class LobbyController implements Initializable {
* Initializes a top down preview of the race course map.
*/
private void initMapPreview() {
gameView = new GameView();
gameView = new GameView(new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
gameView.setHorizontalBuffer(330d);
mapWidth = 770d;
@@ -123,6 +123,7 @@ public class ServerListController implements Initializable, ServerListenerDelega
Sounds.playButtonClick();
});
} catch (IOException e) {
e.printStackTrace();
logger.warn("Could not create Server Creation Dialog.");
}
});
@@ -14,7 +14,7 @@ import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import seng302.gameServer.ServerDescription;
import seng302.utilities.Sounds;
import seng302.utilities.XMLParser;
import seng302.visualiser.MapMaker;
import seng302.visualiser.controllers.ViewManager;
import seng302.visualiser.validators.FieldLengthValidator;
import seng302.visualiser.validators.ValidationTools;
@@ -45,6 +45,8 @@ public class ServerCreationController implements Initializable {
@FXML
private AnchorPane mapHolder;
private MapMaker mapMaker = MapMaker.getInstance();
//---------FXML END---------//
public void initialize(URL location, ResourceBundle resources) {
@@ -81,7 +83,8 @@ public class ServerCreationController implements Initializable {
lastMap();
});
XMLParser.parseRaceDef("/maps/horseshoe.xml", "test", 2);
mapHolder.getChildren().setAll(mapMaker.getCurrentGameView());
mapNameLabel.setText(mapMaker.getCurrentRegatta().getCourseName());
}
/**
@@ -102,7 +105,7 @@ public class ServerCreationController implements Initializable {
private void createServer() {
ServerDescription serverDescription = ViewManager.getInstance().getGameClient()
.runAsHost("localhost", 4941, serverName.getText(), (int) maxPlayersSlider
.getValue());
.getValue(), mapMaker.getCurrentRacePath(), (int) legsSlider.getValue());
ViewManager.getInstance().setProperty("serverName", serverDescription.getName());
ViewManager.getInstance().setProperty("mapName", serverDescription.getMapName());
@@ -129,11 +132,15 @@ public class ServerCreationController implements Initializable {
}
private void nextMap() {
mapMaker.next();
mapHolder.getChildren().setAll(mapMaker.getCurrentGameView());
mapNameLabel.setText(mapMaker.getCurrentRegatta().getCourseName());
}
private void lastMap() {
mapMaker.previous();
mapHolder.getChildren().setAll(mapMaker.getCurrentGameView());
mapNameLabel.setText(mapMaker.getCurrentRegatta().getCourseName());
}
}