mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
6ee2517f74
There is not background music and sound effects (button clicking, ocean noises, crashes for collisions). Can mute the sound and the music independently of each other from the main menu. #story[1249]
77 lines
2.0 KiB
Java
77 lines
2.0 KiB
Java
package seng302.visualiser.controllers;
|
|
|
|
import javafx.fxml.FXML;
|
|
import javafx.scene.control.Button;
|
|
import javafx.scene.control.ColorPicker;
|
|
import javafx.scene.control.TextField;
|
|
import javafx.scene.paint.Color;
|
|
import javafx.stage.Stage;
|
|
import seng302.gameServer.messages.CustomizeRequestType;
|
|
import seng302.utilities.Sounds;
|
|
import seng302.visualiser.ClientToServerThread;
|
|
|
|
public class CustomizationController {
|
|
|
|
@FXML
|
|
private TextField nameField;
|
|
|
|
@FXML
|
|
private ColorPicker boatColorPicker;
|
|
|
|
@FXML
|
|
private Button customizeSubmit;
|
|
|
|
private LobbyController lc;
|
|
private ClientToServerThread socketThread;
|
|
private Stage windowStage;
|
|
|
|
public void initialize() {
|
|
|
|
}
|
|
|
|
public void setServerThread(ClientToServerThread ctsThread) {
|
|
this.socketThread = ctsThread;
|
|
}
|
|
|
|
@FXML
|
|
public void submitCustomization() {
|
|
Sounds.playButtonClick();
|
|
// System.out.println("Attempting to send");
|
|
socketThread.sendCustomizationRequest(CustomizeRequestType.NAME, nameField.getText().getBytes());
|
|
// TODO: 16/08/17 ajm412: Turn colors into byte array.
|
|
Color color = boatColorPicker.getValue();
|
|
|
|
short red = (short) (color.getRed() * 255);
|
|
short green = (short) (color.getGreen() * 255);
|
|
short blue = (short) (color.getBlue() * 255);
|
|
|
|
byte[] colorArray = new byte[3];
|
|
|
|
colorArray[0] = (byte) red;
|
|
colorArray[1] = (byte) green;
|
|
colorArray[2] = (byte) blue;
|
|
|
|
socketThread.sendCustomizationRequest(CustomizeRequestType.COLOR, colorArray);
|
|
lc.setPlayersColor(color);
|
|
windowStage.close();
|
|
}
|
|
|
|
public void setLobbyController(LobbyController lc) {
|
|
this.lc = lc;
|
|
}
|
|
|
|
public void setStage(Stage stage) {
|
|
this.windowStage = stage;
|
|
}
|
|
|
|
public void setPlayerName(String name) {
|
|
this.nameField.setText(name);
|
|
}
|
|
|
|
public void setPlayerColor(Color playerColor) {
|
|
this.boatColorPicker.setValue(playerColor);
|
|
}
|
|
|
|
|
|
}
|