- Fixed bug in customize dialog.

tags : #story[1245]
This commit is contained in:
Alistair McIntyre
2017-09-14 13:02:31 +12:00
parent 889098bb50
commit 7d0a47446d
4 changed files with 30 additions and 17 deletions
@@ -110,7 +110,6 @@ public class LobbyController implements Initializable {
} }
private JFXDialog createCustomizeDialog() { private JFXDialog createCustomizeDialog() {
// TODO: 12/09/17 ajm412: Why is this here? is there no better way we can do this? Ideally inside the LobbyController.
FXMLLoader dialog = new FXMLLoader( FXMLLoader dialog = new FXMLLoader(
getClass().getResource("/views/dialogs/BoatCustomizeDialog.fxml")); getClass().getResource("/views/dialogs/BoatCustomizeDialog.fxml"));
@@ -119,7 +118,6 @@ public class LobbyController implements Initializable {
try { try {
customizationDialog = new JFXDialog(serverListMainStackPane, dialog.load(), customizationDialog = new JFXDialog(serverListMainStackPane, dialog.load(),
JFXDialog.DialogTransition.CENTER); JFXDialog.DialogTransition.CENTER);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -128,6 +126,9 @@ public class LobbyController implements Initializable {
controller.setParentController(this); controller.setParentController(this);
controller.setPlayerColor(this.playersColor); controller.setPlayerColor(this.playersColor);
controller.setPlayerName(this.playerBoats
.get(ViewManager.getInstance().getGameClient().getServerThread().getClientId())
.getBoatName());
return customizationDialog; return customizationDialog;
} }
@@ -38,10 +38,6 @@ public class BoatCustomizeController implements Initializable{
@Override @Override
public void initialize(URL location, ResourceBundle resources) { public void initialize(URL location, ResourceBundle resources) {
submitBtn.setOnMouseReleased(event -> {
Sounds.playButtonClick();
submitCustomization();
});
socketThread = ViewManager.getInstance().getGameClient().getServerThread(); socketThread = ViewManager.getInstance().getGameClient().getServerThread();
@@ -53,6 +49,11 @@ public class BoatCustomizeController implements Initializable{
boatName.setValidators(playerNameLengthValidator, playerNameReqValidator); boatName.setValidators(playerNameLengthValidator, playerNameReqValidator);
submitBtn.setOnMouseReleased(event -> {
Sounds.playButtonClick();
submitCustomization();
});
submitBtn.setOnMouseEntered(e -> Sounds.playHoverSound()); submitBtn.setOnMouseEntered(e -> Sounds.playHoverSound());
} }
@@ -1,6 +1,3 @@
* {
-fx-text-fill: -fx-pp-dark-text-color;
}
#submitBtn { #submitBtn {
-fx-background-color: -fx-pp-theme-color; -fx-background-color: -fx-pp-theme-color;
@@ -23,7 +20,15 @@
-fx-font-size: 18px; -fx-font-size: 18px;
} }
#boatName, #boatColorLabel, #hostDialogHeader {
-fx-text-fill: -fx-pp-dark-text-color;
}
#boatName { #boatName {
-fx-font-size: 18px; -fx-font-size: 18px;
-fx-prompt-text-fill: -fx-pp-dark-text-color; -fx-prompt-text-fill: -fx-pp-dark-text-color;
}
#boatName .error-label {
-fx-font-size: 13px;
} }
@@ -22,8 +22,10 @@
<rowConstraints> <rowConstraints>
<RowConstraints maxHeight="90.0" minHeight="90.0" prefHeight="90.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="90.0" minHeight="90.0" prefHeight="90.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="100.0" minHeight="100.0" prefHeight="100.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="100.0" minHeight="100.0" prefHeight="100.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="125.0" minHeight="61.0" prefHeight="61.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="125.0" minHeight="61.0" prefHeight="99.0"
<RowConstraints maxHeight="164.0" minHeight="100.0" prefHeight="164.0" vgrow="SOMETIMES" /> vgrow="SOMETIMES"/>
<RowConstraints maxHeight="164.0" minHeight="100.0" prefHeight="126.0"
vgrow="SOMETIMES"/>
</rowConstraints> </rowConstraints>
<children> <children>
<Label fx:id="hostDialogHeader" text="Customize Boat" GridPane.halignment="CENTER" <Label fx:id="hostDialogHeader" text="Customize Boat" GridPane.halignment="CENTER"
@@ -34,22 +36,26 @@
<GridPane.margin> <GridPane.margin>
<Insets left="30.0" right="30.0" /> <Insets left="30.0" right="30.0" />
</GridPane.margin></JFXTextField> </GridPane.margin></JFXTextField>
<GridPane GridPane.rowIndex="2"> <GridPane GridPane.halignment="CENTER" GridPane.rowIndex="2"
GridPane.valignment="CENTER">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="139.0" minWidth="10.0" prefWidth="89.0" /> <ColumnConstraints hgrow="SOMETIMES" maxWidth="139.0" minWidth="10.0"
<ColumnConstraints hgrow="SOMETIMES" maxWidth="203.0" minWidth="10.0" prefWidth="203.0" /> prefWidth="94.0"/>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="203.0" minWidth="10.0"
prefWidth="198.0"/>
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>
<RowConstraints maxHeight="69.0" minHeight="10.0" percentHeight="60.0" prefHeight="19.6" vgrow="SOMETIMES" /> <RowConstraints percentHeight="100.0" valignment="CENTER" vgrow="SOMETIMES"/>
</rowConstraints> </rowConstraints>
<children> <children>
<Label fx:id="boatColorLabel" prefHeight="25.0" prefWidth="96.0" <Label fx:id="boatColorLabel" prefHeight="25.0" prefWidth="96.0"
text="Boat Color"> text="Boat Color" GridPane.valignment="CENTER">
<GridPane.margin> <GridPane.margin>
<Insets top="-10.0" /> <Insets top="-10.0" />
</GridPane.margin> </GridPane.margin>
</Label> </Label>
<JFXColorPicker fx:id="colorPicker" onAction="#colorChanged" GridPane.columnIndex="1"> <JFXColorPicker fx:id="colorPicker" onAction="#colorChanged"
GridPane.columnIndex="1" GridPane.valignment="CENTER">
<GridPane.margin> <GridPane.margin>
<Insets left="30.0" top="-10.0"/> <Insets left="30.0" top="-10.0"/>
</GridPane.margin> </GridPane.margin>