|
|
|
|
@ -12,7 +12,6 @@ import javafx.scene.chart.LineChart;
|
|
|
|
|
import javafx.scene.control.*;
|
|
|
|
|
import javafx.scene.input.KeyCode;
|
|
|
|
|
import javafx.scene.input.KeyEvent;
|
|
|
|
|
import javafx.scene.input.ScrollEvent;
|
|
|
|
|
import javafx.scene.layout.GridPane;
|
|
|
|
|
import javafx.scene.layout.StackPane;
|
|
|
|
|
import javafx.scene.shape.MeshView;
|
|
|
|
|
@ -27,7 +26,6 @@ import visualiser.app.App;
|
|
|
|
|
import visualiser.enums.TutorialState;
|
|
|
|
|
import visualiser.gameController.ControllerClient;
|
|
|
|
|
import visualiser.gameController.Keys.ControlKey;
|
|
|
|
|
import visualiser.gameController.Keys.KeyFactory;
|
|
|
|
|
import visualiser.layout.Subject3D;
|
|
|
|
|
import visualiser.layout.View3D;
|
|
|
|
|
import visualiser.model.*;
|
|
|
|
|
@ -122,12 +120,12 @@ public class RaceController extends Controller {
|
|
|
|
|
controlKey.onAction(); // Change key state if applicable
|
|
|
|
|
|
|
|
|
|
if (isTutorial){
|
|
|
|
|
|
|
|
|
|
if (controlKey.getProtocolCode().equals(currentState.getAction())){
|
|
|
|
|
updateTutorialState();
|
|
|
|
|
checkTutorialState();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
controllerClient.sendKey(controlKey);
|
|
|
|
|
event.consume();
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
@ -257,9 +255,23 @@ public class RaceController extends Controller {
|
|
|
|
|
if(key != null) {
|
|
|
|
|
switch (key.toString()) {
|
|
|
|
|
case "Zoom In":
|
|
|
|
|
if (currentState.equals(TutorialState.ZOOMIN)) {
|
|
|
|
|
try {
|
|
|
|
|
checkTutorialState();
|
|
|
|
|
} catch (Exception e1) {
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
view3D.updateDistance(-10);
|
|
|
|
|
break;
|
|
|
|
|
case "Zoom Out":
|
|
|
|
|
if (currentState.equals(TutorialState.ZOOMOUT)) {
|
|
|
|
|
try {
|
|
|
|
|
checkTutorialState();
|
|
|
|
|
} catch (Exception e1) {
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
view3D.updateDistance(10);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@ -451,10 +463,10 @@ public class RaceController extends Controller {
|
|
|
|
|
if (parent.getGameType()==2){
|
|
|
|
|
isTutorial = true;
|
|
|
|
|
tutorialStates = new ArrayList<>(Arrays.asList(TutorialState.values()));
|
|
|
|
|
System.out.println(tutorialStates);
|
|
|
|
|
currentState = tutorialStates.get(0);
|
|
|
|
|
tutorialStates.remove(0);
|
|
|
|
|
System.out.println(currentState);
|
|
|
|
|
System.out.println(tutorialStates);
|
|
|
|
|
System.out.println("Welcome to tutorial. Exit at anytime with ESC. Turn upwind.");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -555,35 +567,43 @@ public class RaceController extends Controller {
|
|
|
|
|
infoTableShow = !infoTableShow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateTutorialState() throws Exception {
|
|
|
|
|
private void updateTutorialState(){
|
|
|
|
|
currentState = tutorialStates.get(0);
|
|
|
|
|
tutorialStates.remove(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkTutorialState() throws Exception {
|
|
|
|
|
switch (currentState){
|
|
|
|
|
case UPWIND:
|
|
|
|
|
System.out.println("You turned upwind. Now go downwind.");
|
|
|
|
|
currentState = tutorialStates.get(0);
|
|
|
|
|
tutorialStates.remove(0);
|
|
|
|
|
updateTutorialState();
|
|
|
|
|
break;
|
|
|
|
|
case DOWNWIND:
|
|
|
|
|
System.out.println("You turned downwind. Now go tack/gybe.");
|
|
|
|
|
currentState = tutorialStates.get(0);
|
|
|
|
|
tutorialStates.remove(0);
|
|
|
|
|
updateTutorialState();
|
|
|
|
|
break;
|
|
|
|
|
case TACKGYBE:
|
|
|
|
|
System.out.println("You tack/gybe. Now go VMG.");
|
|
|
|
|
currentState = tutorialStates.get(0);
|
|
|
|
|
tutorialStates.remove(0);
|
|
|
|
|
updateTutorialState();
|
|
|
|
|
break;
|
|
|
|
|
case VMG:
|
|
|
|
|
System.out.println("You VMG. Now sails-in.");
|
|
|
|
|
currentState = tutorialStates.get(0);
|
|
|
|
|
tutorialStates.remove(0);
|
|
|
|
|
updateTutorialState();
|
|
|
|
|
break;
|
|
|
|
|
case SAILSIN:
|
|
|
|
|
System.out.println("You sails-in. Now sails-out.");
|
|
|
|
|
currentState = tutorialStates.get(0);
|
|
|
|
|
tutorialStates.remove(0);
|
|
|
|
|
updateTutorialState();
|
|
|
|
|
break;
|
|
|
|
|
case SAILSOUT:
|
|
|
|
|
System.out.println("You sails-out. Tutorial finished. Well done!");
|
|
|
|
|
System.out.println("You sails-out. Now zoom in.");
|
|
|
|
|
updateTutorialState();
|
|
|
|
|
break;
|
|
|
|
|
case ZOOMIN:
|
|
|
|
|
System.out.println("You zoomed in. Now zoom out.");
|
|
|
|
|
updateTutorialState();
|
|
|
|
|
break;
|
|
|
|
|
case ZOOMOUT:
|
|
|
|
|
System.out.println("You zoomed out. Tutorial finished. Well done!");
|
|
|
|
|
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
|
|
|
alert.setTitle("Finished Tutorial");
|
|
|
|
|
alert.setHeaderText("You have finished the tutorial.");
|
|
|
|
|
|