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:
@@ -2,7 +2,6 @@ package seng302.visualiser.controllers;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXDialog;
|
||||
import com.jfoenix.controls.JFXDialog.DialogTransition;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@@ -24,7 +23,7 @@ import seng302.gameServer.GameStages;
|
||||
import seng302.gameServer.GameState;
|
||||
import seng302.model.Colors;
|
||||
import seng302.model.RaceState;
|
||||
import seng302.visualiser.ServerListener;
|
||||
import seng302.visualiser.controllers.cells.PlayerCell;
|
||||
|
||||
public class LobbyController implements Initializable {
|
||||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package seng302.visualiser.controllers;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.effect.DropShadow;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
|
||||
public class PlayerCell {
|
||||
@FXML
|
||||
private Label playerName;
|
||||
|
||||
@FXML
|
||||
private GridPane playerListCell;
|
||||
|
||||
private String name;
|
||||
|
||||
public PlayerCell(String playerName) {
|
||||
this.name = playerName;
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
playerName.setText(name);
|
||||
|
||||
DropShadow dropShadow = new DropShadow();
|
||||
dropShadow.setRadius(10.0);
|
||||
dropShadow.setOffsetX(3.0);
|
||||
dropShadow.setOffsetY(4.0);
|
||||
dropShadow.setColor(Color.color(0, 0, 0, 0.1));
|
||||
playerListCell.setEffect(dropShadow);
|
||||
|
||||
DropShadow dropShadow2 = new DropShadow();
|
||||
dropShadow2.setRadius(10.0);
|
||||
dropShadow2.setOffsetX(5.0);
|
||||
dropShadow2.setOffsetY(6.0);
|
||||
dropShadow2.setColor(Color.color(0, 0, 0, 0.3));
|
||||
|
||||
playerListCell.setOnMouseEntered(event -> {
|
||||
playerListCell.setEffect(dropShadow2);
|
||||
});
|
||||
|
||||
playerListCell.setOnMouseExited(event -> {
|
||||
playerListCell.setEffect(dropShadow);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,9 @@ import javafx.scene.layout.VBox;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import seng302.gameServer.ServerDescription;
|
||||
import seng302.visualiser.GameClient;
|
||||
import seng302.visualiser.ServerListener;
|
||||
import seng302.visualiser.ServerListenerDelegate;
|
||||
import seng302.visualiser.controllers.cells.ServerCell;
|
||||
|
||||
public class ServerListController implements Initializable, ServerListenerDelegate {
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import seng302.model.ClientYacht;
|
||||
import seng302.visualiser.GameClient;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import seng302.visualiser.controllers.dialogs.BoatCustomizeController;
|
||||
|
||||
public class ViewManager {
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package seng302.visualiser.controllers.cells;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.effect.DropShadow;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
|
||||
public class PlayerCell {
|
||||
@FXML
|
||||
private Label playerName;
|
||||
|
||||
@FXML
|
||||
private GridPane playerListCell;
|
||||
|
||||
private String name;
|
||||
|
||||
public PlayerCell(String playerName) {
|
||||
this.name = playerName;
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
playerName.setText(name);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
package seng302.visualiser.controllers;
|
||||
package seng302.visualiser.controllers.cells;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXDecorator;
|
||||
@@ -17,6 +17,7 @@ import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import seng302.gameServer.ServerDescription;
|
||||
import seng302.visualiser.GameClient;
|
||||
import seng302.visualiser.controllers.ViewManager;
|
||||
|
||||
public class ServerCell implements Initializable {
|
||||
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
package seng302.visualiser.controllers;
|
||||
package seng302.visualiser.controllers.dialogs;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXColorPicker;
|
||||
@@ -13,6 +13,7 @@ import seng302.visualiser.ClientToServerThread;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import seng302.visualiser.controllers.LobbyController;
|
||||
|
||||
public class BoatCustomizeController implements Initializable{
|
||||
|
||||
+10
-11
@@ -1,20 +1,16 @@
|
||||
package seng302.visualiser.controllers;
|
||||
package seng302.visualiser.controllers.dialogs;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXDecorator;
|
||||
import com.jfoenix.controls.JFXSlider;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import com.jfoenix.controls.JFXTextField;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import seng302.gameServer.ServerDescription;
|
||||
import seng302.visualiser.controllers.ViewManager;
|
||||
|
||||
public class ServerCreationController implements Initializable {
|
||||
|
||||
@@ -23,7 +19,7 @@ public class ServerCreationController implements Initializable {
|
||||
private JFXTextField serverName;
|
||||
|
||||
@FXML
|
||||
private JFXSlider maxPlayers;
|
||||
private JFXSlider maxPlayersSlider;
|
||||
@FXML
|
||||
private Label maxPlayersLabel;
|
||||
|
||||
@@ -33,23 +29,26 @@ public class ServerCreationController implements Initializable {
|
||||
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
updateMaxPlayerLabel();
|
||||
maxPlayers.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||
maxPlayersSlider.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||
updateMaxPlayerLabel();
|
||||
});
|
||||
|
||||
submitBtn.setOnMouseClicked(event -> submitBtn.setText("CREATING..."));
|
||||
submitBtn.setOnMouseReleased(event -> createServer());
|
||||
}
|
||||
|
||||
public void createServer() {
|
||||
|
||||
ServerDescription serverDescription = ViewManager.getInstance().getGameClient().runAsHost("localhost", 4941, serverName.getText(), (int) maxPlayers.getValue());
|
||||
ServerDescription serverDescription = ViewManager.getInstance().getGameClient()
|
||||
.runAsHost("localhost", 4941, serverName.getText(), (int) maxPlayersSlider
|
||||
.getValue());
|
||||
|
||||
ViewManager.getInstance().setProperty("serverName", serverDescription.getName());
|
||||
ViewManager.getInstance().setProperty("mapName", serverDescription.getMapName());
|
||||
}
|
||||
|
||||
private void updateMaxPlayerLabel() {
|
||||
maxPlayers.setValue(Math.floor(maxPlayers.getValue()));
|
||||
maxPlayersLabel.setText(Double.toString(maxPlayers.getValue()));
|
||||
maxPlayersSlider.setValue(Math.floor(maxPlayersSlider.getValue()));
|
||||
maxPlayersLabel.setText(String.format("YOU SELECTED: %.0f", maxPlayersSlider.getValue()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user