DOD, and added javadocs/fixed javadocs #story[1087]
This commit is contained in:
@@ -19,7 +19,7 @@ import java.net.UnknownHostException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Created by zwu18 on 25/07/17.
|
||||
* Controller for Hosting a game.
|
||||
*/
|
||||
public class HostController extends Controller {
|
||||
|
||||
@@ -38,6 +38,10 @@ public class HostController extends Controller {
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Hosts a game
|
||||
* @throws IOException if socket cannot be connected to
|
||||
*/
|
||||
public void hostGamePressed() throws IOException{
|
||||
try {
|
||||
Event game = Event.getEvent();
|
||||
@@ -54,6 +58,11 @@ public class HostController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a socket
|
||||
* @param address address of the server
|
||||
* @param port port that the server is run off
|
||||
*/
|
||||
public void connectSocket(String address, int port) {
|
||||
try{
|
||||
Socket socket = new Socket(address, port);
|
||||
@@ -66,6 +75,9 @@ public class HostController extends Controller {
|
||||
return hostWrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hosts a game.
|
||||
*/
|
||||
public void hostGame(){
|
||||
hostWrapper.setVisible(true);
|
||||
System.out.println("Reacted hostGame");
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Created by zwu18 on 25/07/17.
|
||||
* Controller for the Lobby for entering games
|
||||
*/
|
||||
public class LobbyController extends Controller {
|
||||
|
||||
@@ -64,6 +64,9 @@ public class LobbyController extends Controller {
|
||||
joinGameBtn.setDisable(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes the connections in the lobby
|
||||
*/
|
||||
public void refreshBtnPressed(){
|
||||
for(RaceConnection connection: connections) {
|
||||
connection.check();
|
||||
@@ -82,6 +85,9 @@ public class LobbyController extends Controller {
|
||||
} catch (Exception e){}
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a connection.
|
||||
*/
|
||||
public void connectSocket() {
|
||||
try{
|
||||
RaceConnection connection = lobbyTable.getSelectionModel().getSelectedItem();
|
||||
@@ -113,6 +119,9 @@ public class LobbyController extends Controller {
|
||||
return lobbyWrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter the lobby page.
|
||||
*/
|
||||
public void enterLobby(){
|
||||
lobbyWrapper.setVisible(true);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ public class MainController extends Controller {
|
||||
* Transitions from the StartController screen (displays pre-race information) to the RaceController (displays the actual race).
|
||||
* @param visualiserInput The object used to read packets from the race server.
|
||||
* @param visualiserRace The object modelling the race.
|
||||
* @param controllerClient Socket Client that manipulates the controller.
|
||||
*/
|
||||
public void beginRace(VisualiserInput visualiserInput, VisualiserRace visualiserRace, ControllerClient controllerClient) {
|
||||
raceController.startRace(visualiserInput, visualiserRace, controllerClient);
|
||||
|
||||
@@ -338,6 +338,7 @@ public class RaceController extends Controller {
|
||||
* Displays a specified race.
|
||||
* @param visualiserInput Object used to read packets from server.
|
||||
* @param visualiserRace Object modelling the race.
|
||||
* @param controllerClient Socket Client that manipulates the controller.
|
||||
*/
|
||||
public void startRace(VisualiserInput visualiserInput, VisualiserRace visualiserRace, ControllerClient controllerClient) {
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@ public class TitleController extends Controller {
|
||||
App.getStage().setResizable(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch the scene to the title page.
|
||||
*/
|
||||
public void enterTitle(){
|
||||
titleWrapper.setVisible(true);
|
||||
}
|
||||
@@ -57,12 +60,18 @@ public class TitleController extends Controller {
|
||||
App.getStage().setResizable(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches the css of the program to day mode theme
|
||||
*/
|
||||
public void setDayMode(){
|
||||
dayModeRD.getScene().getStylesheets().clear();
|
||||
dayModeRD.getScene().getStylesheets().add("/css/dayMode.css");
|
||||
nightModeRD.setSelected(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches the css of the program to night mode theme
|
||||
*/
|
||||
public void setNightMode(){
|
||||
nightModeRD.getScene().getStylesheets().clear();
|
||||
nightModeRD.getScene().getStylesheets().add("/css/nightMode.css");
|
||||
|
||||
Reference in New Issue
Block a user