[TIDY] JavaDoc comments
This commit is contained in:
@@ -14,6 +14,9 @@ import org.apache.logging.log4j.Logger;
|
|||||||
import uk.mgrove.ac.soton.comp1206.network.Communicator;
|
import uk.mgrove.ac.soton.comp1206.network.Communicator;
|
||||||
import uk.mgrove.ac.soton.comp1206.util.Multimedia;
|
import uk.mgrove.ac.soton.comp1206.util.Multimedia;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clas for chat container
|
||||||
|
*/
|
||||||
public class Chat extends VBox {
|
public class Chat extends VBox {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,6 +62,7 @@ public class Chat extends VBox {
|
|||||||
/**
|
/**
|
||||||
* Initialise the chat container with a communicator
|
* Initialise the chat container with a communicator
|
||||||
* @param communicator the communicator to use
|
* @param communicator the communicator to use
|
||||||
|
* @param compact whether the container should have a compact layout
|
||||||
*/
|
*/
|
||||||
public Chat(Communicator communicator, boolean compact) {
|
public Chat(Communicator communicator, boolean compact) {
|
||||||
this.communicator = communicator;
|
this.communicator = communicator;
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ public class GameBlock extends Canvas {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle painting of the block canvas with block preview
|
* Handle painting of the block canvas with block preview
|
||||||
|
* @param color color to paint block preview
|
||||||
*/
|
*/
|
||||||
public void paintPreview(Color color) {
|
public void paintPreview(Color color) {
|
||||||
logger.info("Painting preview overlay on block at x: {}, y: {} with color: {}", getX(), getY(), color);
|
logger.info("Painting preview overlay on block at x: {}, y: {} with color: {}", getX(), getY(), color);
|
||||||
@@ -263,12 +264,12 @@ public class GameBlock extends Canvas {
|
|||||||
private int iterations = 0;
|
private int iterations = 0;
|
||||||
@Override
|
@Override
|
||||||
public void handle(long now) {
|
public void handle(long now) {
|
||||||
if (iterations < 12) {
|
if (iterations < 10) {
|
||||||
color = color.deriveColor(0,1,1.2,1);
|
color = color.deriveColor(0,1,1.2,1);
|
||||||
paintColor(color);
|
paintColor(color);
|
||||||
if (isFocussed) paintFocusOverlay();
|
if (isFocussed) paintFocusOverlay();
|
||||||
} else if (color.getOpacity() > 0.1) {
|
} else if (color.getOpacity() > 0.1) {
|
||||||
color = color.deriveColor(0,1,1,0.95);
|
color = color.deriveColor(0,1,1,0.9);
|
||||||
paintColor(color);
|
paintColor(color);
|
||||||
if (isFocussed) paintFocusOverlay();
|
if (isFocussed) paintFocusOverlay();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ public class GameBoard extends GridPane {
|
|||||||
* Create a block at the given x and y position in the GameBoard
|
* Create a block at the given x and y position in the GameBoard
|
||||||
* @param x column
|
* @param x column
|
||||||
* @param y row
|
* @param y row
|
||||||
|
* @return block that was created
|
||||||
*/
|
*/
|
||||||
protected GameBlock createBlock(int x, int y) {
|
protected GameBlock createBlock(int x, int y) {
|
||||||
logger.info("Creating new block at x: {}, y: {}", x, y);
|
logger.info("Creating new block at x: {}, y: {}", x, y);
|
||||||
@@ -202,6 +203,8 @@ public class GameBoard extends GridPane {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get grid value property
|
* Get grid value property
|
||||||
|
* @param x x-coordinate in grid
|
||||||
|
* @param y y-coordinate in grid
|
||||||
* @return properties for value of block at given location in grid
|
* @return properties for value of block at given location in grid
|
||||||
*/
|
*/
|
||||||
public IntegerProperty getGridProperty(int x, int y) {
|
public IntegerProperty getGridProperty(int x, int y) {
|
||||||
@@ -229,6 +232,10 @@ public class GameBoard extends GridPane {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle game block being hovered
|
||||||
|
* @param gameBlock game block that was hovered
|
||||||
|
*/
|
||||||
public void blockHovered(GameBlock gameBlock) {
|
public void blockHovered(GameBlock gameBlock) {
|
||||||
grid.clearPreview();
|
grid.clearPreview();
|
||||||
if (enableFocus) {
|
if (enableFocus) {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class Leaderboard extends ScoresList {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise the leaderboard
|
* Initialise the leaderboard
|
||||||
|
* @param titleText text for list title
|
||||||
*/
|
*/
|
||||||
public Leaderboard(String titleText) {
|
public Leaderboard(String titleText) {
|
||||||
super();
|
super();
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import org.apache.logging.log4j.LogManager;
|
|||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import uk.mgrove.ac.soton.comp1206.game.GamePiece;
|
import uk.mgrove.ac.soton.comp1206.game.GamePiece;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Smaller board, to show pieces without interaction
|
||||||
|
*/
|
||||||
public class PieceBoard extends GameBoard {
|
public class PieceBoard extends GameBoard {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,6 +26,10 @@ public class PieceBoard extends GameBoard {
|
|||||||
enableFocus = false;
|
enableFocus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a piece in the board
|
||||||
|
* @param piece piece to display
|
||||||
|
*/
|
||||||
public void displayPiece(GamePiece piece) {
|
public void displayPiece(GamePiece piece) {
|
||||||
logger.info("Displaying new piece: {}", piece.toString());
|
logger.info("Displaying new piece: {}", piece.toString());
|
||||||
grid.clearGrid();
|
grid.clearGrid();
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public class ScoresList extends VBox {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise the scores list
|
* Initialise the scores list
|
||||||
|
* @param titleText text for list title
|
||||||
*/
|
*/
|
||||||
public ScoresList(String titleText) {
|
public ScoresList(String titleText) {
|
||||||
logger.info("Building scores list");
|
logger.info("Building scores list");
|
||||||
@@ -49,8 +50,10 @@ public class ScoresList extends VBox {
|
|||||||
logger.info("Detected change in scores list: {}", change);
|
logger.info("Detected change in scores list: {}", change);
|
||||||
getChildren().clear();
|
getChildren().clear();
|
||||||
getChildren().add(title);
|
getChildren().add(title);
|
||||||
|
setSpacing(4);
|
||||||
for (var pair : scores.get()) {
|
for (var pair : scores.get()) {
|
||||||
var individualScoreContainer = new HBox();
|
var individualScoreContainer = new HBox();
|
||||||
|
individualScoreContainer.setSpacing(8);
|
||||||
individualScoreContainer.getChildren().addAll(new Text(pair.getKey()), new Text(pair.getValue().toString()));
|
individualScoreContainer.getChildren().addAll(new Text(pair.getKey()), new Text(pair.getValue().toString()));
|
||||||
getChildren().add(individualScoreContainer);
|
getChildren().add(individualScoreContainer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ public interface ShowScoresSceneListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the scene
|
* Show the scene
|
||||||
|
* @param game the game used when initialising the scores scene
|
||||||
*/
|
*/
|
||||||
void show(Game game);
|
void show(Game game);
|
||||||
|
|
||||||
|
|||||||
@@ -396,6 +396,7 @@ public class Game {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the player's remaining lives
|
* Set the player's remaining lives
|
||||||
|
* @param lives number of remaining lives
|
||||||
*/
|
*/
|
||||||
public void setLives(int lives) {
|
public void setLives(int lives) {
|
||||||
this.lives.set(lives);
|
this.lives.set(lives);
|
||||||
@@ -411,6 +412,7 @@ public class Game {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the player's current multiplier
|
* Set the player's current multiplier
|
||||||
|
* @param multiplier the current multiplier
|
||||||
*/
|
*/
|
||||||
public void setMultiplier(int multiplier) {
|
public void setMultiplier(int multiplier) {
|
||||||
this.multiplier.set(multiplier);
|
this.multiplier.set(multiplier);
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ import java.util.Scanner;
|
|||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for multiplayer games
|
||||||
|
*/
|
||||||
public class MultiplayerGame extends Game {
|
public class MultiplayerGame extends Game {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,6 +57,7 @@ public class MultiplayerGame extends Game {
|
|||||||
*
|
*
|
||||||
* @param cols number of columns
|
* @param cols number of columns
|
||||||
* @param rows number of rows
|
* @param rows number of rows
|
||||||
|
* @param communicator communicator to use
|
||||||
*/
|
*/
|
||||||
public MultiplayerGame(int cols, int rows, Communicator communicator) {
|
public MultiplayerGame(int cols, int rows, Communicator communicator) {
|
||||||
super(cols, rows);
|
super(cols, rows);
|
||||||
|
|||||||
@@ -226,12 +226,21 @@ public class ChallengeScene extends BaseScene {
|
|||||||
gameWindow.startMenu();
|
gameWindow.startMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the scores scene
|
||||||
|
* @param game game that just ended
|
||||||
|
*/
|
||||||
protected void showScores(Game game) {
|
protected void showScores(Game game) {
|
||||||
if (timerCountdownBarFillTransition != null) timerCountdownBarFillTransition.stop();
|
if (timerCountdownBarFillTransition != null) timerCountdownBarFillTransition.stop();
|
||||||
if (timerCountdownBarScaleTransition != null) timerCountdownBarScaleTransition.stop();
|
if (timerCountdownBarScaleTransition != null) timerCountdownBarScaleTransition.stop();
|
||||||
gameWindow.startScores(game);
|
gameWindow.startScores(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current and next piece
|
||||||
|
* @param currentPiece current piece
|
||||||
|
* @param followingPiece next piece
|
||||||
|
*/
|
||||||
protected void setCurrentPiece(GamePiece currentPiece, GamePiece followingPiece) {
|
protected void setCurrentPiece(GamePiece currentPiece, GamePiece followingPiece) {
|
||||||
currentPieceBoard.displayPiece(currentPiece);
|
currentPieceBoard.displayPiece(currentPiece);
|
||||||
followingPieceBoard.displayPiece(followingPiece);
|
followingPieceBoard.displayPiece(followingPiece);
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ import uk.mgrove.ac.soton.comp1206.util.Multimedia;
|
|||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for loading scene, displayed when game is first loading
|
||||||
|
*/
|
||||||
public class LoadingScene extends BaseScene {
|
public class LoadingScene extends BaseScene {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ import uk.mgrove.ac.soton.comp1206.ui.GameWindow;
|
|||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for multiplayer lobby, displayed before multiplayer games start
|
||||||
|
*/
|
||||||
public class LobbyScene extends BaseScene {
|
public class LobbyScene extends BaseScene {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import javafx.beans.property.MapProperty;
|
|||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
import javafx.beans.property.SimpleMapProperty;
|
import javafx.beans.property.SimpleMapProperty;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.Separator;
|
import javafx.scene.control.Separator;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
@@ -82,7 +83,8 @@ public class MultiplayerScene extends ChallengeScene {
|
|||||||
var newBoardContainer = new VBox(newBoardTitle, newGameBoard);
|
var newBoardContainer = new VBox(newBoardTitle, newGameBoard);
|
||||||
newBoardContainer.setAlignment(Pos.CENTER);
|
newBoardContainer.setAlignment(Pos.CENTER);
|
||||||
newBoardContainer.setSpacing(4);
|
newBoardContainer.setSpacing(4);
|
||||||
playerBoardGrid.add(newBoardContainer, 1, 1);
|
newBoardContainer.setPadding(new Insets(8));
|
||||||
|
playerBoardGrid.add(newBoardContainer, rowIndex, columnIndex);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
gameWindow.getCommunicator().send("SCORES");
|
gameWindow.getCommunicator().send("SCORES");
|
||||||
|
|||||||
@@ -116,7 +116,8 @@ public class GameWindow {
|
|||||||
public void startInstructions() { loadScene(new InstructionsScene(this)); }
|
public void startInstructions() { loadScene(new InstructionsScene(this)); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the single player challenge
|
* Display the scores scene
|
||||||
|
* @param game the game that just finished
|
||||||
*/
|
*/
|
||||||
public void startScores(Game game) { loadScene(new ScoresScene(this, game)); }
|
public void startScores(Game game) { loadScene(new ScoresScene(this, game)); }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user