Tutorial option in title screen will now created a game with tutorial xmls. Host game will now created a game with the race xml instead of tutorial xml as well. Made changes to tutorial label in title. #story[1189]

This commit is contained in:
David Wu
2017-09-01 12:28:09 +12:00
parent c7af4f2eb7
commit ea029baf22
6 changed files with 30 additions and 16 deletions
@@ -37,6 +37,8 @@ public class HostController extends Controller {
private Event game;
private int gameType = 0;
@Override
public void initialize(URL location, ResourceBundle resources) {
@@ -48,7 +50,7 @@ public class HostController extends Controller {
*/
public void hostGamePressed() throws IOException{
try {
this.game = new Event(false);
this.game = new Event(gameType);
connectSocket("localhost", 4942);
} catch (EventConstructionException e) {
Logger.getGlobal().log(Level.SEVERE, "Could not create Event.", e);
@@ -89,4 +91,8 @@ public class HostController extends Controller {
parent.enterTitle();
}
public void setGameType(int gameType){
this.gameType = gameType;
}
}
@@ -94,6 +94,10 @@ public class MainController extends Controller {
hostController.hostGamePressed();
}
public void setGameType(int gameType){
hostController.setGameType(gameType);
}
/**
* Main Controller for the applications will house the menu and the displayed pane.
*
@@ -47,6 +47,7 @@ public class TitleController extends Controller {
*/
public void hostAGame() throws IOException {
titleWrapper.setVisible(false);
parent.setGameType(0);
parent.hostGame();
App.getStage().setResizable(true);
}
@@ -117,6 +118,7 @@ public class TitleController extends Controller {
public void tutorialStartPressed() throws IOException {
titleWrapper.setVisible(false);
System.out.println("Start the tutorial!");
parent.setGameType(2);
parent.beginGame();
}