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:
@@ -74,23 +74,29 @@ public class Event {
|
||||
|
||||
/**
|
||||
* Constructs an event, using various XML files.
|
||||
* @param singlePlayer Whether or not to create a single player event.
|
||||
* @param gameType Type of game to create. Determines which XML files to send
|
||||
* @throws EventConstructionException Thrown if we cannot create an Event for any reason.
|
||||
*/
|
||||
public Event(boolean singlePlayer) throws EventConstructionException {
|
||||
public Event(int gameType) throws EventConstructionException {
|
||||
|
||||
//String raceXMLFile = "mock/mockXML/raceTest.xml";
|
||||
String raceXMLFile = "mock/mockXML/raceTutorial.xml";
|
||||
//String boatsXMLFile = "mock/mockXML/boatTest.xml";
|
||||
String boatsXMLFile = "mock/mockXML/boatTutorial.xml";
|
||||
//String regattaXMLFile = "mock/mockXML/regattaTest.xml";
|
||||
String regattaXMLFile = "mock/mockXML/regattaTutorial.xml";
|
||||
String raceXMLFile = "mock/mockXML/raceTest.xml";
|
||||
|
||||
if (singlePlayer) {
|
||||
String boatsXMLFile = "mock/mockXML/boatTest.xml";
|
||||
|
||||
String regattaXMLFile = "mock/mockXML/regattaTest.xml";
|
||||
|
||||
|
||||
if (gameType == 1) {
|
||||
raceXMLFile = "mock/mockXML/raceSinglePlayer.xml";
|
||||
boatsXMLFile = "mock/mockXML/boatsSinglePlayer.xml";
|
||||
}
|
||||
|
||||
if (gameType == 2){
|
||||
raceXMLFile = "mock/mockXML/raceTutorial.xml";
|
||||
boatsXMLFile = "mock/mockXML/boatTutorial.xml";
|
||||
regattaXMLFile = "mock/mockXML/regattaTutorial.xml";
|
||||
}
|
||||
|
||||
//Read XML files.
|
||||
try {
|
||||
//this.raceXML = RaceXMLCreator.alterRaceToWind(raceXMLFile, 90);
|
||||
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user