mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Updated and added more documentations
#story[1047]
This commit is contained in:
@@ -112,6 +112,7 @@ public class LobbyController implements Initializable, Observer{
|
||||
readyButton.setDisable(true);
|
||||
}
|
||||
|
||||
// put all javafx objects in lists, so we can iterate though conveniently
|
||||
imageViews = new ArrayList<>();
|
||||
Collections.addAll(imageViews, firstImageView, secondImageView, thirdImageView, fourthImageView,
|
||||
fifthImageView, sixthImageView, seventhImageView, eighthImageView);
|
||||
@@ -134,6 +135,13 @@ public class LobbyController implements Initializable, Observer{
|
||||
clientStateQueryingThread.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Observers "ClientStateQueryingRunnable".
|
||||
* When the clients state has been marked to "race start", the querying thread
|
||||
* will notify this lobby to change the view
|
||||
* @param o
|
||||
* @param arg
|
||||
*/
|
||||
@Override
|
||||
public void update(Observable o, Object arg) {
|
||||
Platform.runLater(new Runnable() {
|
||||
@@ -149,6 +157,9 @@ public class LobbyController implements Initializable, Observer{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all ListViews and ImageViews according to the current competitors
|
||||
*/
|
||||
private void initialiseListView() {
|
||||
listViews.forEach(listView -> listView.getItems().clear());
|
||||
imageViews.forEach(gif -> gif.setVisible(false));
|
||||
@@ -162,6 +173,9 @@ public class LobbyController implements Initializable, Observer{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads preset images into imageViews
|
||||
*/
|
||||
private void initialiseImageView() {
|
||||
for (int i = 0; i < MAX_NUM_PLAYERS; i++) {
|
||||
imageViews.get(i).setImage(new Image(getClass().getResourceAsStream("/pics/sail.png")));
|
||||
@@ -195,14 +209,11 @@ public class LobbyController implements Initializable, Observer{
|
||||
|
||||
@FXML
|
||||
public void readyButtonPressed() {
|
||||
// setContentPane("/views/RaceView.fxml");
|
||||
GameState.setCurrentStage(GameStages.RACING);
|
||||
mainServerThread.startGame();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void switchToRaceView() {
|
||||
if (!switchedPane) {
|
||||
switchedPane = true;
|
||||
|
||||
Reference in New Issue
Block a user