mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Fixed some UI bugs, and redesigned some UI elements.
- Changed class structure (added dialogs, cells folder) - Changed font to Baloo as it has better font height - Figured out a way to change the font color of max player slider thumb - Added cursor effect when mouse hover on any button - Fixed drop shadow bug for lobby view player cell - Moved drop shadow effect from player cell controller to css #story[1245]
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
package seng302.visualiser.controllers.dialogs;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXColorPicker;
|
||||
import com.jfoenix.controls.JFXTextField;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.stage.Stage;
|
||||
import seng302.gameServer.messages.CustomizeRequestType;
|
||||
import seng302.visualiser.ClientToServerThread;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import seng302.visualiser.controllers.LobbyController;
|
||||
|
||||
public class BoatCustomizeController implements Initializable{
|
||||
|
||||
@FXML
|
||||
private JFXColorPicker colorPicker;
|
||||
|
||||
@FXML
|
||||
private JFXButton submitBtn;
|
||||
|
||||
@FXML
|
||||
private JFXTextField boatName;
|
||||
private ClientToServerThread socketThread;
|
||||
private LobbyController lobbyController;
|
||||
|
||||
|
||||
public BoatCustomizeController(){
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
void colorChanged(ActionEvent event) {
|
||||
Color color = colorPicker.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
colorPicker.setValue(Color.BISQUE);
|
||||
submitBtn.setOnMouseReleased(event -> {
|
||||
submitCustomization();
|
||||
lobbyController.closeCustomizationDialog();
|
||||
});
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void submitCustomization() {
|
||||
socketThread.sendCustomizationRequest(CustomizeRequestType.NAME, boatName.getText().getBytes());
|
||||
// TODO: 16/08/17 ajm412: Turn colors into byte array.
|
||||
Color color = colorPicker.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);
|
||||
lobbyController.closeCustomizationDialog();
|
||||
}
|
||||
|
||||
public void setPlayerName(String name) {
|
||||
this.boatName.setText(name);
|
||||
}
|
||||
|
||||
public void setPlayerColor(Color playerColor) {
|
||||
this.colorPicker.setValue(playerColor);
|
||||
}
|
||||
|
||||
public void setServerThread(ClientToServerThread ctsThread) {
|
||||
this.socketThread = ctsThread;
|
||||
}
|
||||
|
||||
public void setParentController(LobbyController lobbyController){
|
||||
this.lobbyController = lobbyController;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user