Added some documentation where it was appropriate.
Positively knackered - what ever happens: I'm out for the Day
This commit is contained in:
parent
26b9243df2
commit
4ba87a91a3
@ -65,11 +65,19 @@ public class ChatApp extends Application {
|
|||||||
this.gameC = gameC;
|
this.gameC = gameC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* are u sure this is the field you want to get?
|
||||||
|
* @param lSVController a LoungeSceneViewController
|
||||||
|
*/
|
||||||
public void setlSVController(
|
public void setlSVController(
|
||||||
LoungeSceneViewController lSVController) {
|
LoungeSceneViewController lSVController) {
|
||||||
this.lSVController = lSVController;
|
this.lSVController = lSVController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* are u sure this is the field you want to get?
|
||||||
|
* @return the clientModel of this chatApp
|
||||||
|
*/
|
||||||
public ClientModel getcModel() {
|
public ClientModel getcModel() {
|
||||||
return cModel;
|
return cModel;
|
||||||
}
|
}
|
||||||
@ -79,6 +87,10 @@ public class ChatApp extends Application {
|
|||||||
ChatApp.gameController = gameController;
|
ChatApp.gameController = gameController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* needs to be called, if the gameController needs to be accessed from outside the application thread
|
||||||
|
* @return the relevant GameController
|
||||||
|
*/
|
||||||
public GameController getGameController() {
|
public GameController getGameController() {
|
||||||
return gameController;
|
return gameController;
|
||||||
}
|
}
|
||||||
@ -95,18 +107,31 @@ public class ChatApp extends Application {
|
|||||||
return clientModel;
|
return clientModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* needs to be called, if the chatController needs to be accessed from outside the application thread
|
||||||
|
* @return the relevant ChatController
|
||||||
|
*/
|
||||||
public ChatController getChatController() {
|
public ChatController getChatController() {
|
||||||
return chatController;
|
return chatController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* needs to be called, if the LoungeSceneViewController needs to be accessed from outside the application thread
|
||||||
|
* @return the relevant LoungeSceneViewController
|
||||||
|
*/
|
||||||
public LoungeSceneViewController getLoungeSceneViewController() {
|
public LoungeSceneViewController getLoungeSceneViewController() {
|
||||||
return loungeSceneViewController;
|
return loungeSceneViewController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sure this is the field u want? not the static one?
|
||||||
|
* @return a LoungeSceneViewController
|
||||||
|
*/
|
||||||
public LoungeSceneViewController getlSVController() {
|
public LoungeSceneViewController getlSVController() {
|
||||||
return lSVController;
|
return lSVController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void setLoungeSceneViewController(LoungeSceneViewController controller) {
|
public static void setLoungeSceneViewController(LoungeSceneViewController controller) {
|
||||||
loungeSceneViewController = controller;
|
loungeSceneViewController = controller;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -236,6 +236,7 @@ public class GameController implements Initializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the labels of the rooms accordingly to the datastructures in GameStateModel
|
* Updates the labels of the rooms accordingly to the datastructures in GameStateModel
|
||||||
|
* TODO(Seraina): use a method to shorten, its madness
|
||||||
*/
|
*/
|
||||||
public void updateRoomLabels() {
|
public void updateRoomLabels() {
|
||||||
LOGGER.debug("roomlables update");
|
LOGGER.debug("roomlables update");
|
||||||
@ -338,6 +339,10 @@ public class GameController implements Initializable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* loads the notification Bell from resource
|
||||||
|
* @return the Image node containing the BellImage
|
||||||
|
*/
|
||||||
public Image loadBellImage() {
|
public Image loadBellImage() {
|
||||||
Image bell = new Image("ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/game/DayOpen/bell.png");
|
Image bell = new Image("ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/game/DayOpen/bell.png");
|
||||||
return bell;
|
return bell;
|
||||||
|
|||||||
@ -312,6 +312,9 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
LobbyListView.setVisible(true);
|
LobbyListView.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the gameView to the existing LobbyView
|
||||||
|
*/
|
||||||
public void addGameView() {
|
public void addGameView() {
|
||||||
Platform.runLater(new Runnable() {
|
Platform.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -327,6 +330,9 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the GameView again - needed when a game is over or a lobby is left
|
||||||
|
*/
|
||||||
public void removeGameView() {
|
public void removeGameView() {
|
||||||
Platform.runLater(new Runnable() {
|
Platform.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -342,6 +348,9 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the ChatView to the LobbyView, should be done right in the initialisation
|
||||||
|
*/
|
||||||
public void addChatView() {
|
public void addChatView() {
|
||||||
Platform.runLater(new Runnable() {
|
Platform.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -419,20 +428,33 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
LOGGER.debug("In newLobby()3 LobbyListView" + LobbyListView);
|
LOGGER.debug("In newLobby()3 LobbyListView" + LobbyListView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send the joinLobby Protocol message
|
||||||
|
* @param lobbyID the Lobby to be joinded
|
||||||
|
*/
|
||||||
public void joinGame(String lobbyID) {
|
public void joinGame(String lobbyID) {
|
||||||
client.getClient().sendMsgToServer(Protocol.joinLobby + "$" + lobbyID);
|
client.getClient().sendMsgToServer(Protocol.joinLobby + "$" + lobbyID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the startNewGame Protocol message
|
||||||
|
*/
|
||||||
public void startGame() {
|
public void startGame() {
|
||||||
client.getClient().sendMsgToServer(Protocol.startANewGame);
|
client.getClient().sendMsgToServer(Protocol.startANewGame);
|
||||||
//addGameView();
|
//addGameView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the leaveLobby protocol message
|
||||||
|
*/
|
||||||
public void leaveLobby() {
|
public void leaveLobby() {
|
||||||
client.getClient().sendMsgToServer(Protocol.leaveLobby);
|
client.getClient().sendMsgToServer(Protocol.leaveLobby);
|
||||||
removeGameView();
|
removeGameView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the Quit protocol message
|
||||||
|
*/
|
||||||
public void leaveServer() {
|
public void leaveServer() {
|
||||||
client.getClient().sendMsgToServer(Protocol.clientQuitRequest);
|
client.getClient().sendMsgToServer(Protocol.clientQuitRequest);
|
||||||
}
|
}
|
||||||
@ -456,6 +478,10 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sould remove a client of a certain name from the ListView
|
||||||
|
* @param name the name of the client to be removed
|
||||||
|
*/
|
||||||
public void removeClientFromList(String name){
|
public void removeClientFromList(String name){
|
||||||
Iterator<ClientListItem> it = clients.iterator();
|
Iterator<ClientListItem> it = clients.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
@ -470,11 +496,16 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
//todo
|
//todo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the create New Lobby Protocol message
|
||||||
|
*/
|
||||||
public void newGame() {
|
public void newGame() {
|
||||||
client.getClient().sendMsgToServer(Protocol.createNewLobby);
|
client.getClient().sendMsgToServer(Protocol.createNewLobby);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the nameChange command, taking the new Name from the TextFlied
|
||||||
|
*/
|
||||||
public void changeName() {
|
public void changeName() {
|
||||||
TextField name = new TextField();
|
TextField name = new TextField();
|
||||||
name.setPromptText("Enter new Nickname!");
|
name.setPromptText("Enter new Nickname!");
|
||||||
@ -497,10 +528,16 @@ public class LoungeSceneViewController implements Initializable {
|
|||||||
LoungeSceneViewController.client = client;
|
LoungeSceneViewController.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the highScore request message
|
||||||
|
*/
|
||||||
public void sendHIghScore() {
|
public void sendHIghScore() {
|
||||||
client.getClient().sendMsgToServer(Protocol.highScoreList);
|
client.getClient().sendMsgToServer(Protocol.highScoreList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the listLobbies protocol message
|
||||||
|
*/
|
||||||
public void sendLilstle() {
|
public void sendLilstle() {
|
||||||
client.getClient().sendMsgToServer(Protocol.listLobbies);
|
client.getClient().sendMsgToServer(Protocol.listLobbies);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user