Merge remote-tracking branch 'remotes/origin/story77_lobby' into story86-3D

This commit is contained in:
Connor Taylor-Brown
2017-08-29 22:55:07 +12:00
7 changed files with 330 additions and 116 deletions
@@ -1,21 +1,18 @@
package visualiser.Controllers;
import javafx.fxml.FXML;
import javafx.scene.control.TextField;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.SplitPane;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import mock.app.Event;
import org.xml.sax.SAXException;
import mock.exceptions.EventConstructionException;
import shared.exceptions.InvalidBoatDataException;
import shared.exceptions.InvalidRaceDataException;
import shared.exceptions.InvalidRegattaDataException;
import shared.exceptions.XMLReaderException;
import javax.xml.bind.JAXBException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.net.Socket;
import java.net.URL;
import java.util.Optional;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -26,15 +23,27 @@ import java.util.logging.Logger;
public class HostController extends Controller {
@FXML
TextField gameNameField;
// @FXML
// TextField gameNameField;
//
// @FXML
// TextField hostNameField;
@FXML
TextField hostNameField;
private ImageView imageView;
@FXML
AnchorPane hostWrapper;
@FXML
AnchorPane imagePane;
@FXML
SplitPane splitPane;
@FXML
AnchorPane specPane;
private Event game;
@@ -81,12 +90,33 @@ public class HostController extends Controller {
* Hosts a game.
*/
public void hostGame(){
splitPane.setResizableWithParent(specPane, false);
splitPane.lookupAll(".split-pane-divider").stream().forEach(div -> div.setMouseTransparent(true));
imageView.fitWidthProperty().bind(imagePane.widthProperty());
imageView.fitHeightProperty().bind(imagePane.heightProperty());
hostWrapper.setVisible(true);
}
/**
* Menu button pressed. Prompt alert then return to menu
*/
public void menuBtnPressed(){
hostWrapper.setVisible(false);
parent.enterTitle();
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Quitting race");
alert.setContentText("Do you wish to quit the race?");
alert.setHeaderText("You are about to quit the race");
Optional<ButtonType> result = alert.showAndWait();
if(result.get() == ButtonType.OK){
hostWrapper.setVisible(false);
parent.enterTitle();
}
}
/**
* Start button pressed. Currently only prints out start
*/
public void startBtnPressed(){
System.out.println("Should start the race. This button is only visible for the host");
}
}