Tokens now display on the right and are clickable for further information

#story[1293]
This commit is contained in:
William Muir
2017-09-28 12:20:16 +13:00
parent 5cbd729214
commit 5688e10e6f
3 changed files with 29 additions and 11 deletions
@@ -203,28 +203,28 @@ public class LobbyController implements Initializable {
private JFXDialog makeTokenDialog(Pane inducingPane) {
String header = "...";
String body = "Nothing to see here";
Group token = new Group();
ModelType modelType = ModelType.RANDOM_PICKUP;
if (inducingPane == speedTokenPane) {
header = "Speed Boost";
body = "Increases your max velocity";
token = ModelFactory.importModel(ModelType.VELOCITY_PICKUP).getAssets();
modelType = ModelType.VELOCITY_PICKUP;
} else if (inducingPane == handlingTokenPane) {
header = "Handling Boost";
body = "Increases your turing rate";
token = ModelFactory.importModel(ModelType.HANDLING_PICKUP).getAssets();
modelType = ModelType.HANDLING_PICKUP;
} else if (inducingPane == windWalkerTokenPane) {
header = "Wind Walker";
body = "The wind now rotates with you, giving you your optimal speed in all directions";
token = ModelFactory.importModel(ModelType.WIND_WALKER_PICKUP).getAssets();
modelType = ModelType.WIND_WALKER_PICKUP;
} else if (inducingPane == bumperTokenPane) {
header = "Bumper";
body = "While this is active, upon hitting another boat, you will power it down for a short time";
token = ModelFactory.importModel(ModelType.BUMPER_PICKUP).getAssets();
modelType = ModelType.BUMPER_PICKUP;
} else if (inducingPane == randomTokenPane) {
header = "Random";
body = "A 50% chance of becoming any other token and a 50% chance of slowing your boat for a time";
token = ModelFactory.importModel(ModelType.RANDOM_PICKUP).getAssets();
modelType = ModelType.RANDOM_PICKUP;
}
FXMLLoader dialog = new FXMLLoader(
@@ -243,7 +243,7 @@ public class LobbyController implements Initializable {
controller.setParentController(this);
controller.setHeader(header);
controller.setContent(body);
controller.setToken(token);
controller.setToken(modelType);
return tokenInfoDialog;
}
@@ -302,7 +302,7 @@ public class ViewManager {
Stage stage = new Stage();
initialStartView(stage);
} catch (Exception e) {
e.printStackTrace();
logger.warn("Could not go to start view");
}
}
@@ -7,16 +7,20 @@ import java.util.ResourceBundle;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Point3D;
import javafx.scene.Group;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Pane;
import javafx.scene.transform.Rotate;
import javafx.scene.transform.Scale;
import javafx.scene.transform.Translate;
import seng302.utilities.Sounds;
import seng302.visualiser.controllers.LobbyController;
import seng302.visualiser.fxObjects.assets_3D.ModelFactory;
import seng302.visualiser.fxObjects.assets_3D.ModelType;
/**
* Created by wmu16 on 28/09/17.
@@ -54,14 +58,28 @@ public class TokenInfoDialogController implements Initializable {
this.headerLabel.setText(header);
}
public void setToken(Group token) {
public void setToken(ModelType token) {
tokenPane.getChildren().clear();
token.getTransforms().addAll(
Group tokenObject = ModelFactory.importModel(token).getAssets();
tokenObject.getTransforms().addAll(
new Translate(138 / 2, 138 / 2, 0),
new Scale(20, 20, 20));
tokenPane.getChildren().add(token);
if (token == ModelType.WIND_WALKER_PICKUP) {
tokenObject.getTransforms().addAll(
new Rotate(-70, new Point3D(1, 0, 0)),
new Translate(0, 2, 0)
);
} else if (token == ModelType.RANDOM_PICKUP) {
tokenObject.getTransforms().addAll(
new Rotate(-90, new Point3D(1, 0, 0)),
new Translate(0, 0, 1)
);
}
tokenPane.getChildren().add(tokenObject);
}
public void setParentController(LobbyController lobbyController) {