You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.3 KiB
61 lines
2.3 KiB
package seng302.Controllers;
|
|
|
|
import javafx.collections.ObservableList;
|
|
import javafx.fxml.FXML;
|
|
import javafx.scene.layout.AnchorPane;
|
|
import seng302.Model.Boat;
|
|
import seng302.Model.RaceClock;
|
|
import seng302.VisualiserInput;
|
|
|
|
import java.net.Socket;
|
|
import java.net.URL;
|
|
import java.util.ResourceBundle;
|
|
|
|
/**
|
|
* Controller that everything is overlayed onto. This makes it so that changing scenes does not resize your stage.
|
|
*/
|
|
public class MainController extends Controller {
|
|
@FXML private StartController startController;
|
|
@FXML private RaceController raceController;
|
|
@FXML private ConnectionController connectionController;
|
|
@FXML private FinishController finishController;
|
|
|
|
public void beginRace(VisualiserInput visualiserInput, RaceClock raceClock) {
|
|
raceController.startRace(visualiserInput, raceClock);
|
|
}
|
|
|
|
public void enterLobby(Socket socket) {
|
|
startController.enterLobby(socket);
|
|
}
|
|
|
|
public void enterFinish(ObservableList<Boat> boats) { finishController.enterFinish(boats); }
|
|
|
|
/**
|
|
* Main Controller for the applications will house the menu and the displayed pane.
|
|
*
|
|
* @param location of resources
|
|
* @param resources bundle
|
|
*/
|
|
@Override
|
|
public void initialize(URL location, ResourceBundle resources) {
|
|
startController.setParent(this);
|
|
raceController.setParent(this);
|
|
connectionController.setParent(this);
|
|
finishController.setParent(this);
|
|
AnchorPane.setTopAnchor(startController.startWrapper(), 0.0);
|
|
AnchorPane.setBottomAnchor(startController.startWrapper(), 0.0);
|
|
AnchorPane.setLeftAnchor(startController.startWrapper(), 0.0);
|
|
AnchorPane.setRightAnchor(startController.startWrapper(), 0.0);
|
|
|
|
AnchorPane.setTopAnchor(connectionController.startWrapper(), 0.0);
|
|
AnchorPane.setBottomAnchor(connectionController.startWrapper(), 0.0);
|
|
AnchorPane.setLeftAnchor(connectionController.startWrapper(), 0.0);
|
|
AnchorPane.setRightAnchor(connectionController.startWrapper(), 0.0);
|
|
|
|
AnchorPane.setTopAnchor(finishController.finishWrapper, 0.0);
|
|
AnchorPane.setBottomAnchor(finishController.finishWrapper, 0.0);
|
|
AnchorPane.setLeftAnchor(finishController.finishWrapper, 0.0);
|
|
AnchorPane.setRightAnchor(finishController.finishWrapper, 0.0);
|
|
}
|
|
}
|