- Added documentation to controllers

tags : #story[1245]
This commit is contained in:
Alistair McIntyre
2017-09-12 16:54:40 +12:00
parent 9dad88e56a
commit 7e9e96c091
13 changed files with 82 additions and 120 deletions
@@ -3,11 +3,9 @@ package seng302.visualiser.controllers.cells;
import javafx.fxml.FXML;
import javafx.scene.Group;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import seng302.utilities.Sounds;
import seng302.visualiser.fxObjects.assets_3D.BoatMeshType;
import seng302.visualiser.fxObjects.assets_3D.BoatModel;
import seng302.visualiser.fxObjects.assets_3D.ModelFactory;
@@ -34,12 +32,13 @@ public class PlayerCell {
}
public void initialize() {
// Set Player Name
playerName.setText(name);
// Add Rotating Boat to Player Cell with players color on it.
Group group = new Group();
boatPane.getChildren().add(group);
BoatModel bo = ModelFactory.boatIconView(BoatMeshType.DINGHY, this.boatColor);
group.getChildren().add(bo.getAssets());
}
public Integer getPlayerId() {
@@ -53,8 +52,4 @@ public class PlayerCell {
public Color getBoatColor() {
return boatColor;
}
public void playButtonHoverSound(MouseEvent mouseEvent) {
Sounds.playHoverSound();
}
}
}
@@ -1,27 +1,15 @@
package seng302.visualiser.controllers.cells;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXDecorator;
import com.sun.org.apache.bcel.internal.classfile.Unknown;
import java.io.IOException;
import java.net.InetAddress;
import java.net.URL;
import java.net.UnknownHostException;
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.effect.DropShadow;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.scene.layout.VBox;
import seng302.gameServer.ServerDescription;
import seng302.utilities.Sounds;
import seng302.visualiser.GameClient;
import seng302.visualiser.controllers.ViewManager;
public class ServerCell implements Initializable {
@@ -29,6 +17,8 @@ public class ServerCell implements Initializable {
//--------FXML BEGIN--------//
//Layout
@FXML
private VBox serverCellVBox;
@FXML
private GridPane serverListCell;
//Server Information
@FXML
@@ -66,21 +56,21 @@ public class ServerCell implements Initializable {
serverPlayerCount.setText(currPlayerCount);
mapName.setText(mapNameString);
serverCellVBox.setOnMouseEntered(event -> Sounds.playHoverSound());
serverConnButton.setOnMouseReleased(event -> {
Sounds.playButtonClick();
joinServer();
});
}
/**
*
* Attempts to connect to the chosen server using the button on the serverCell.
*/
private void joinServer() {
System.out.println("Connecting to " + serverName.getText());
ViewManager.getInstance().getGameClient().runAsClient(hostName, portNumber);
}
public void playButtonHoverSound(MouseEvent mouseEvent) {
Sounds.playHoverSound();
}
}