reformat code

This commit is contained in:
Daniel Langbein 2024-11-09 21:40:31 +01:00
parent 6e9a53dd72
commit aa3bdfde55
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
44 changed files with 2337 additions and 2332 deletions

View File

@ -7,7 +7,7 @@ import javax.swing.*;
/**
* Game
*
* <p>
* Spawns the game.
*
* @author Valerian Saliou <valerian@valeriansaliou.name>

View File

@ -8,7 +8,7 @@ import javazoom.jl.player.FactoryRegistry;
/**
* SoundJLayerBridge
*
* <p>
* Sound bridge to the JLayer library.
*
* @author Valerian Saliou <valerian@valeriansaliou.name>

View File

@ -7,7 +7,7 @@ import fr.enssat.BoulderDash.helpers.AudioLoadHelper;
/**
* ElementPositionUpdateHelper
*
* <p>
* Updates position of all elements displayed on the map, according to their
* next potential position. Each object has a weight, which is used to compare
* their power to destroy in the food chain. Sorry for that Darwinism.
@ -39,7 +39,7 @@ public class BoulderAndDiamondController implements Runnable {
*/
public void run() {
while (this.levelModel.isGameRunning()) {
if(!this.levelModel.getGamePaused()){
if (!this.levelModel.getGamePaused()) {
this.manageFallingObject();
}
try {
@ -61,7 +61,7 @@ public class BoulderAndDiamondController implements Runnable {
// Gets the spriteName of actual DisplayableElementModel object scanned
DisplayableElementModel elementModel = this.levelModel.getGroundLevelModel()[x][y];
if(elementModel == null) {
if (elementModel == null) {
elementModel = new DirtModel();
}
@ -70,8 +70,8 @@ public class BoulderAndDiamondController implements Runnable {
// If it is a boulder or a diamond...
if (spriteName == "boulder" || spriteName == "diamond") {
this.manageFall(x, y);
} else if(spriteName == "expandingwall"){
if(this.expandWall(x,y).equals("left")){
} else if (spriteName == "expandingwall") {
if (this.expandWall(x, y).equals("left")) {
x -= 1;
}
}
@ -92,12 +92,12 @@ public class BoulderAndDiamondController implements Runnable {
String spriteNameRight = elementRight.getSpriteName();
String way = "";
if(spriteNameLeft == "black"){
this.levelModel.expandThisWallToLeft(x,y);
if (spriteNameLeft == "black") {
this.levelModel.expandThisWallToLeft(x, y);
way = "left";
}
if(spriteNameRight == "black"){
this.levelModel.expandThisWallToRight(x,y);
if (spriteNameRight == "black") {
this.levelModel.expandThisWallToRight(x, y);
way = "right";
}
return way;
@ -143,9 +143,9 @@ public class BoulderAndDiamondController implements Runnable {
this.levelModel.setGameRunning(false);
} else if (spriteNameBelow == "magicwall") {
if (this.levelModel.getGroundLevelModel()[x][y].getSpriteName() == "boulder"
&& (this.levelModel.getGroundLevelModel()[x][y+2].getSpriteName() == "dirt" ||
this.levelModel.getGroundLevelModel()[x][y+2].getSpriteName() == "black")) {
if(this.levelModel.getGroundLevelModel()[x][y].isConvertible()) {
&& (this.levelModel.getGroundLevelModel()[x][y + 2].getSpriteName() == "dirt" ||
this.levelModel.getGroundLevelModel()[x][y + 2].getSpriteName() == "black")) {
if (this.levelModel.getGroundLevelModel()[x][y].isConvertible()) {
this.levelModel.transformThisBoulderIntoADiamond(x, y);
} else {
this.levelModel.deleteThisBoulder(x, y);

View File

@ -12,7 +12,7 @@ import java.awt.event.ActionListener;
/**
* GameController
*
* <p>
* This system creates the view.
* The game loop is also handled there.
*
@ -53,11 +53,11 @@ public class GameController implements ActionListener {
* @param event Action event
*/
public void actionPerformed(ActionEvent event) {
switch(event.getActionCommand()) {
switch (event.getActionCommand()) {
case "pause":
if(this.firstClickOnPause) {
if (this.firstClickOnPause) {
this.levelModel.setGamePaused(true);
} else if(!this.firstClickOnPause) {
} else if (!this.firstClickOnPause) {
this.levelModel.setGamePaused(false);
}
@ -85,7 +85,7 @@ public class GameController implements ActionListener {
private void resetGame(String source) {
this.gameView.dispose();
if(source.equals("restart")){
if (source.equals("restart")) {
this.levelModel = new LevelModel(this.navigationBetweenViewController.getPickedLevelIdentifier(), audioLoadHelper);
this.gameView = new GameView(this, levelModel);
this.gameView.setVisible(true);
@ -103,6 +103,7 @@ public class GameController implements ActionListener {
/**
* Return the game view
*
* @return gameView
*/
public GameView getGameView() {
@ -111,6 +112,7 @@ public class GameController implements ActionListener {
/**
* Set the gameView
*
* @param gameView
*/
public void setGameView(GameView gameView) {

View File

@ -12,7 +12,7 @@ import java.awt.event.KeyListener;
/**
* GameKeyController
*
* <p>
* Manages the key events controller.
*
* @author Colin Leverger <me@colinleverger.fr>
@ -21,6 +21,7 @@ import java.awt.event.KeyListener;
public class GameKeyController implements KeyListener {
private LevelModel levelModel;
private RockfordUpdateController updatePosRockford;
/**
* Class constructor
*

View File

@ -15,7 +15,7 @@ import javax.swing.*;
/**
* LevelEditorController
*
* <p>
* Manages the level editor controller.
*
* @author Valerian Saliou <valerian@valeriansaliou.name>
@ -50,7 +50,7 @@ public class LevelEditorController implements ActionListener {
* @param event Action event
*/
public void actionPerformed(ActionEvent event) {
switch(event.getActionCommand()) {
switch (event.getActionCommand()) {
case "menu":
this.levelEditorView.setVisible(false);
this.nav.setMenuView();
@ -67,7 +67,7 @@ public class LevelEditorController implements ActionListener {
String levelId = this.levelEditorView.getSelectedLevel();
LevelSaveHelper levelSave;
if(levelId == null || levelId.isEmpty()) {
if (levelId == null || levelId.isEmpty()) {
// Create a new level
levelSave = new LevelSaveHelper(levelModel.getGroundLevelModel());
} else {
@ -79,7 +79,7 @@ public class LevelEditorController implements ActionListener {
JOptionPane.showMessageDialog(frameDialog, "Level saved");
this.levelEditorView.openedLevelChange(levelSave.getLevelId());
} catch(LevelConstraintNotRespectedException e) {
} catch (LevelConstraintNotRespectedException e) {
JFrame frameDialog = new JFrame("Error");
JOptionPane.showMessageDialog(frameDialog, e.getMessage());
}
@ -90,7 +90,7 @@ public class LevelEditorController implements ActionListener {
String levelId = this.levelEditorView.getSelectedLevel();
JFrame frameDialog = new JFrame("Info");
if(levelId == null || levelId.isEmpty()) {
if (levelId == null || levelId.isEmpty()) {
JOptionPane.showMessageDialog(frameDialog, "Level not yet saved, no need to delete it!");
} else {
new LevelRemoveHelper(levelId);

View File

@ -9,7 +9,7 @@ import java.awt.event.KeyListener;
/**
* LevelEditorKeyController
*
* <p>
* Manages the key events controller.
*
* @author Valerian Saliou <valerian@valeriansaliou.name>
@ -72,7 +72,7 @@ public class LevelEditorKeyController implements KeyListener {
}
// Hold block change (quick edit)
if(capLocks) {
if (capLocks) {
this.levelModel.triggerBlockChange(this.levelEditorView.getPickedBlockValue());
}
}

View File

@ -13,7 +13,6 @@ import fr.enssat.BoulderDash.controllers.GameController;
* Controller to navigate between the different views
*
* @author Colin Leverger <me@colinleverger.fr>
*
*/
public class NavigationBetweenViewController implements ActionListener {
private LevelEditorController levelEditorController;

View File

@ -4,7 +4,7 @@ import fr.enssat.BoulderDash.models.LevelModel;
/**
* ElementPositionUpdateHelper
*
* <p>
* Updates position of all elements displayed on the map, according to their
* next potential position. Each object has a weight, which is used to compare
* their power to destroy in the food chain. Sorry for that Darwinism.
@ -36,7 +36,7 @@ public class RockfordUpdateController implements Runnable {
*/
public void run() {
while (this.levelModel.isGameRunning()) {
if(!this.levelModel.getGamePaused()){
if (!this.levelModel.getGamePaused()) {
if (this.rockfordHasMoved) {
this.levelModel.setPositionOfRockford(rockfordPositionX, rockfordPositionY);
this.rockfordHasMoved = false;

View File

@ -3,7 +3,7 @@ package fr.enssat.BoulderDash.exceptions;
/**
* LevelConstraintNotRespectedException
*
* <p>
* Raises an 'LevelConstraintNotRespectedException' exception.
* Given the exception message.
*

View File

@ -3,7 +3,7 @@ package fr.enssat.BoulderDash.exceptions;
/**
* ModelNotReadyException
*
* <p>
* Raises an 'ModelNotReadyException' exception.
* Given the exception message.
*

View File

@ -3,7 +3,7 @@ package fr.enssat.BoulderDash.exceptions;
/**
* UnknownModelException
*
* <p>
* Raises an 'UnknownSpriteException' exception.
* Given the exception message.
*

View File

@ -8,7 +8,7 @@ import java.util.HashMap;
/**
* AudioLoadHelper
*
* <p>
* Manages audio
*
* @author Valerian Saliou <valerian@valeriansaliou.name>
@ -43,7 +43,7 @@ public class AudioLoadHelper {
* @param musicId Music identifier
*/
public void startMusic(String musicId) {
if(this.musicToPlay != null) {
if (this.musicToPlay != null) {
this.stopMusic();
}
@ -70,7 +70,7 @@ public class AudioLoadHelper {
// List sound files
File soundsDir = new File(AudioLoadHelper.pathToAudioStore + "/sounds/");
File [] soundFiles = soundsDir.listFiles(new FilenameFilter() {
File[] soundFiles = soundsDir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".mp3");

View File

@ -36,7 +36,7 @@ import java.util.Locale;
/**
* LevelLoadHelper
*
* <p>
* Proceeds level load routine
* Able to deserialize level data from storage, and format it to
* internal representation To be used as a data factory from level
@ -225,11 +225,11 @@ public class LevelLoadHelper {
boolean currentSpriteConvertible = false;
// No name? Continue.
if(currentSpriteName == null || currentSpriteName.isEmpty()) {
if (currentSpriteName == null || currentSpriteName.isEmpty()) {
continue;
}
if(currentSpriteConvertibleValue.equals("1")) {
if (currentSpriteConvertibleValue.equals("1")) {
currentSpriteConvertible = true;
}
@ -459,6 +459,7 @@ public class LevelLoadHelper {
/**
* Gets the number of Diamonds to catch
*
* @return number of Diamonds to catch
*/
public int getDiamondsToCatch() {
@ -467,6 +468,7 @@ public class LevelLoadHelper {
/**
* Sets the number of Diamonds to catch
*
* @param diamondsToCatch
*/
public void setDiamondsToCatch(int diamondsToCatch) {

View File

@ -5,7 +5,7 @@ import java.io.File;
/**
* LevelRemoveHelper
*
* <p>
* Proceeds level save routine
* Able to iterate on internal representation of a map and serialize it to XML
*

View File

@ -23,7 +23,7 @@ import fr.enssat.BoulderDash.models.DirtModel;
/**
* LevelSaveHelper
*
* <p>
* Proceeds level save routine
* Able to iterate on internal representation of a map and serialize it to XML
*
@ -93,13 +93,13 @@ public class LevelSaveHelper {
Pattern pattern = Pattern.compile("^level([0-9]+)\\.xml");
Matcher matcher;
for (File file : fileList){
for (File file : fileList) {
matcher = pattern.matcher(file.getName());
if (matcher.matches()) {
matchedId = matcher.group(1);
if(!matchedId.isEmpty()) {
if (!matchedId.isEmpty()) {
tempLevelId = new Integer(matchedId);
if (tempLevelId > electedLastLevelId) {
@ -117,7 +117,7 @@ public class LevelSaveHelper {
electedLastLevelId += 1;
// Stringify
if(electedLastLevelId < 10) {
if (electedLastLevelId < 10) {
finalLevelId = "0" + electedLastLevelId.toString();
} else {
finalLevelId = electedLastLevelId.toString();
@ -227,11 +227,11 @@ public class LevelSaveHelper {
widthValue = this.getGroundGrid().length - 2;
if(widthValue > 0) {
if (widthValue > 0) {
heightValue = this.getGroundGrid()[0].length - 2;
}
if(heightValue < 0 || widthValue < 0) {
if (heightValue < 0 || widthValue < 0) {
heightValue = 0;
widthValue = 0;
}
@ -256,7 +256,7 @@ public class LevelSaveHelper {
gridElement.setAttribute("state", "initial");
// Iterate in MATRIX:{x}
if(this.getGroundGrid().length > 2) {
if (this.getGroundGrid().length > 2) {
// XML structure matrix is the inverse of the internal representation (hence the weird loop)
for (Integer curLineIndex = 1; curLineIndex < (this.getGroundGrid()[0].length - 1); curLineIndex++) {
gridElement.appendChild(this.gridLineNode(document, curLineIndex));
@ -278,7 +278,7 @@ public class LevelSaveHelper {
gridLineElement.setAttribute("index", Integer.toString(curLineIndex - 1));
// Iterate in MATRIX:X:{y}
if(this.getGroundGrid().length > 2) {
if (this.getGroundGrid().length > 2) {
// XML structure matrix is the inverse of the internal representation (hence the weird loop)
for (Integer curItemIndex = 1; curItemIndex < (this.getGroundGrid().length - 1); curItemIndex++) {
gridLineElement.appendChild(this.gridLineItemNode(document, curLineIndex, curItemIndex));
@ -319,7 +319,7 @@ public class LevelSaveHelper {
DisplayableElementModel curGridElement = this.getGroundGrid()[curItemIndex][curLineIndex];
// Null?
if(curGridElement == null) {
if (curGridElement == null) {
curGridElement = new DirtModel();
}
@ -341,7 +341,7 @@ public class LevelSaveHelper {
gridLineItemSpriteElement.setAttribute("name", nameValue);
gridLineItemSpriteElement.setAttribute("state", stateValue);
if("1".equals(convertibleValue)) {
if ("1".equals(convertibleValue)) {
gridLineItemSpriteElement.setAttribute("convertible", convertibleValue);
}

View File

@ -10,7 +10,7 @@ import java.util.List;
/**
* LevelSelectorHelper
*
* <p>
* Level selector helper
*
* @author Valerian Saliou <valerian@valeriansaliou.name>
@ -45,10 +45,11 @@ public class LevelSelectorHelper {
// Proceed available levels listing
MenuLevelSelector menuLevelList = new MenuLevelSelector(availableLevels, this.levelEditorView);
if(availableLevels.length > 0) {
if (availableLevels.length > 0) {
menuLevelList.setChoiceValue(availableLevels[0]);
menuLevelList.setSelectedIndex(0);
};
}
;
menuLevelList.addActionListener(menuLevelList);
@ -69,18 +70,18 @@ public class LevelSelectorHelper {
int fileNameExtIndex;
// Add empty element?
if(this.hasEmptyElement) {
if (this.hasEmptyElement) {
stockList.add("");
}
for (File file : fileList){
for (File file : fileList) {
fileName = file.getName();
fileNameExtIndex = fileName.lastIndexOf('.');
if (fileNameExtIndex > 0) {
fileNameExtValue = fileName.substring(fileNameExtIndex, fileName.length());
if(fileNameExtValue.equals(".xml")) {
if (fileNameExtValue.equals(".xml")) {
fileName = fileName.substring(0, fileNameExtIndex);
stockList.add(fileName);
}

View File

@ -16,7 +16,7 @@ import fr.enssat.BoulderDash.models.SteelWallModel;
/**
* ModelConvertHelper
*
* <p>
* Provides model conversion services.
*
* @author Valerian Saliou <valerian@valeriansaliou.name>

View File

@ -5,7 +5,7 @@ import fr.enssat.BoulderDash.models.DisplayableElementModel;
/**
* BoulderModel
*
* <p>
* Represents the boulders.
*
* @author Colin Leverger <me@colinleverger.fr>

View File

@ -5,7 +5,7 @@ import fr.enssat.BoulderDash.models.DisplayableElementModel;
/**
* BrickWallModel
*
* <p>
* Represents the brick wall in the game.
*
* @author Colin Leverger <me@colinleverger.fr>

View File

@ -5,7 +5,7 @@ import fr.enssat.BoulderDash.models.DisplayableElementModel;
/**
* CursorModel
*
* <p>
* Represents the field cursor pointer.
*
* @author Valerian Saliou <valerian@valeriansaliou.name>

View File

@ -8,7 +8,7 @@ import fr.enssat.BoulderDash.models.DisplayableElementModel;
/**
* DiamondModel
*
* <p>
* Represents a diamond in the game.
*
* @author Colin Leverger <me@colinleverger.fr>

View File

@ -5,7 +5,7 @@ import fr.enssat.BoulderDash.models.DisplayableElementModel;
/**
* DirtModel
*
* <p>
* Represents the dirt in the game.
*
* @author Colin Leverger <me@colinleverger.fr>

View File

@ -8,7 +8,7 @@ import java.io.IOException;
/**
* DisplayableElementModel
*
* <p>
* Represents a abstract displayable element
*
* @author Colin Leverger <me@colinleverger.fr>
@ -296,7 +296,9 @@ public abstract class DisplayableElementModel {
/**
* Function to update the sprites
*
* @param currentTimeMillis Current time in milliseconds
*/
public void update(long currentTimeMillis) {}
public void update(long currentTimeMillis) {
}
}

View File

@ -5,7 +5,7 @@ import fr.enssat.BoulderDash.models.DisplayableElementModel;
/**
* DoorModel
*
* <p>
* Represents escape door.
*
* @author Colin Leverger <me@colinleverger.fr>

View File

@ -5,7 +5,7 @@ import fr.enssat.BoulderDash.models.DisplayableElementModel;
/**
* EmptyModel
*
* <p>
* Represents "nothing".
*
* @author Colin Leverger <me@colinleverger.fr>

View File

@ -5,7 +5,7 @@ import fr.enssat.BoulderDash.models.DisplayableElementModel;
/**
* ExpandingWallModel
*
* <p>
* Represents a ExpandingWall in the game.
*
* @author Colin Leverger <me@colinleverger.fr>

View File

@ -9,7 +9,6 @@ import java.util.Observable;
*
* @author Colin Leverger <me@colinleverger.fr>
* @since 2015-06-19
*
*/
public class GameInformationModel extends Observable {
private int score;
@ -96,7 +95,7 @@ public class GameInformationModel extends Observable {
* Decrement of one the number total of remaining diamonds.
*/
public void decrementRemainingsDiamonds() {
if(remainingsDiamonds > 0){
if (remainingsDiamonds > 0) {
this.remainingsDiamonds -= 1;
this.myNotify();
}

View File

@ -22,7 +22,7 @@ import java.util.Observable;
/**
* LevelModel
*
* <p>
* Levels are loaded from XML file. The view knows the model, the controller is
* going to modify the model in function of the game panel. The model notifies
* the view when there are changes on it.
@ -84,7 +84,7 @@ public class LevelModel extends Observable implements Runnable {
this.createLimits();
if(this.mode.equals("game")) {
if (this.mode.equals("game")) {
this.initRockford();
this.initThreadAnimator();
}
@ -274,12 +274,12 @@ public class LevelModel extends Observable implements Runnable {
*/
public void triggerBlockChange(String blockValue) {
// No block value?
if(blockValue == null || blockValue.isEmpty()) {
if (blockValue == null || blockValue.isEmpty()) {
return;
}
// Cancel if Rockford is already in model
if((blockValue.equals("Rockford") || blockValue.equals("rockford")) && this.isRockfordInModel()) {
if ((blockValue.equals("Rockford") || blockValue.equals("rockford")) && this.isRockfordInModel()) {
return;
}
@ -343,7 +343,7 @@ public class LevelModel extends Observable implements Runnable {
public BufferedImage getImage(int x, int y) {
DisplayableElementModel elementModel = this.getDisplayableElement(x, y);
if(elementModel == null) {
if (elementModel == null) {
return new DirtModel().getSprite();
}
@ -376,7 +376,7 @@ public class LevelModel extends Observable implements Runnable {
// Iterate and catch it!
for (int x = 0; x < this.getSizeWidth() && !isInModel; x++) {
for (int y = 0; y < this.getSizeHeight() && !isInModel; y++) {
if(this.groundGrid[x][y] != null && this.groundGrid[x][y].getSpriteName() == "rockford") {
if (this.groundGrid[x][y] != null && this.groundGrid[x][y].getSpriteName() == "rockford") {
isInModel = true;
}
}
@ -396,7 +396,7 @@ public class LevelModel extends Observable implements Runnable {
// Iterate and catch it!
for (int x = 0; x < this.getSizeWidth(); x++) {
for (int y = 0; y < this.getSizeHeight(); y++) {
if(this.groundGrid[x][y] != null && this.groundGrid[x][y].getSpriteName() == "diamond") {
if (this.groundGrid[x][y] != null && this.groundGrid[x][y].getSpriteName() == "diamond") {
numberOfDiamonds += 1;
}
}
@ -410,12 +410,12 @@ public class LevelModel extends Observable implements Runnable {
*/
public void checkConstraints() throws LevelConstraintNotRespectedException {
// Diamonds number?
if(this.countDiamonds() < 3) {
if (this.countDiamonds() < 3) {
throw new LevelConstraintNotRespectedException("Add at least 3 diamonds!");
}
// Rockford in model?
if(!this.isRockfordInModel()) {
if (!this.isRockfordInModel()) {
throw new LevelConstraintNotRespectedException("Add Rockford on the map!");
}
}
@ -480,7 +480,7 @@ public class LevelModel extends Observable implements Runnable {
* @param y Sprite block vertical position
*/
public void updateSprites(int x, int y) {
if(groundGrid[x][y] == null) {
if (groundGrid[x][y] == null) {
groundGrid[x][y] = new DirtModel();
}

View File

@ -8,7 +8,7 @@ import fr.enssat.BoulderDash.models.DisplayableElementModel;
/**
* MagicWallModel
*
* <p>
* Represents the magic wall.
*
* @author Colin Leverger <me@colinleverger.fr>

View File

@ -8,7 +8,7 @@ import fr.enssat.BoulderDash.models.DisplayableElementModel;
/**
* RockfordModel
*
* <p>
* Represents the hero of the game.
*
* @author Colin Leverger <me@colinleverger.fr>
@ -296,7 +296,7 @@ public class RockfordModel extends DisplayableElementModel {
*
* @param hasExploded Whether Rockford has exploded or not
*/
public void setHasExplosed(boolean hasExploded){
public void setHasExplosed(boolean hasExploded) {
this.hasExploded = hasExploded;
}
}

View File

@ -5,7 +5,7 @@ import fr.enssat.BoulderDash.models.DisplayableElementModel;
/**
* SteelWallModel
*
* <p>
* Represents the steelWall
*
* @author Colin Leverger <me@colinleverger.fr>

View File

@ -11,7 +11,7 @@ import fr.enssat.BoulderDash.views.LevelEditorView;
/**
* AssetsLevelEditorComponent
*
* <p>
* Information panel element.
*
* @author Valerian Saliou <valerian@valeriansaliou.name>
@ -41,7 +41,7 @@ public class AssetsLevelEditorComponent extends JPanel implements ActionListener
String curListChoice;
for(int i = 0; i < choiceList.size(); i++) {
for (int i = 0; i < choiceList.size(); i++) {
curListChoice = choiceList.get(i);
// Create radio buttons from list

View File

@ -11,7 +11,7 @@ import java.awt.*;
/**
* GameFieldView
*
* <p>
* Game field view for the game itself.
*
* @author Valerian Saliou <valerian@valeriansaliou.name>

View File

@ -14,7 +14,7 @@ import fr.enssat.BoulderDash.views.InformationPanel;
/**
* GameView
*
* <p>
* Specifies the game view itself.
*
* @author Colin Leverger <me@colinleverger.fr>

View File

@ -10,16 +10,15 @@ import java.util.Observer;
/**
* FieldView
*
* <p>
* FieldView, created by controller; we notice that we don't need to make
* levelModel observable; Because of the sprites we have to refresh the game
* windows very often so don't need of observers/observable mechanism
*
* @author Colin Leverger <me@colinleverger.fr>
* @since 2015-06-19
*
* <p>
* This view is basically drawing into the Frame the levelModel.
*
*/
public abstract class GroundView extends JPanel implements Observer {
protected LevelModel levelModel;
@ -50,8 +49,8 @@ public abstract class GroundView extends JPanel implements Observer {
}
}
if(!this.levelModel.isGameRunning()) {
if(!this.levelModel.getRockford().getHasExplosed()) {
if (!this.levelModel.isGameRunning()) {
if (!this.levelModel.getRockford().getHasExplosed()) {
this.displayWin();
} else {
this.displayLose();

View File

@ -5,12 +5,12 @@ import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JTextArea;
public class HelpView extends JFrame{
public class HelpView extends JFrame {
/**
* Generate the HelpView
*/
public HelpView(){
public HelpView() {
this.initializeView();
this.createLayout();
}

View File

@ -11,7 +11,7 @@ import fr.enssat.BoulderDash.models.LevelModel;
/**
* InformationPanel
*
* <p>
* Information panel element.
*
* @author Colin Leverger <me@colinleverger.fr>

View File

@ -8,7 +8,7 @@ import fr.enssat.BoulderDash.models.LevelModel;
/**
* LevelEditorFieldView
*
* <p>
* Game field view for the level editor.
*
* @author Valerian Saliou <valerian@valeriansaliou.name>

View File

@ -16,7 +16,7 @@ import fr.enssat.BoulderDash.views.MenuLevelSelector;
/**
* LevelEditorView
*
* <p>
* Specifies the level editor view.
*
* @author Colin Leverger <me@colinleverger.fr>
@ -167,7 +167,7 @@ public class LevelEditorView extends JFrame implements Observer {
public void openedLevelChange(String selectedLevelValue) {
LevelModel pickedLevelModel;
if(selectedLevelValue != null && !selectedLevelValue.isEmpty()) {
if (selectedLevelValue != null && !selectedLevelValue.isEmpty()) {
// Load existing model
pickedLevelModel = new LevelModel(selectedLevelValue, this.nav.getAudioLoadHelper(), "editor");
} else {
@ -201,7 +201,7 @@ public class LevelEditorView extends JFrame implements Observer {
String selectedLevelValue = changedSelector.getChoiceValue().toString();
// Value didn't change?
if(selectedLevelValue.equals(this.getSelectedLevel())) {
if (selectedLevelValue.equals(this.getSelectedLevel())) {
return;
}

View File

@ -10,7 +10,7 @@ import javax.swing.JPanel;
/**
* MenuImage
*
* <p>
* Specifies the menu image
*
* @author Valerian Saliou <valerian@valeriansaliou.name>

View File

@ -8,7 +8,7 @@ import fr.enssat.BoulderDash.views.LevelEditorView;
/**
* MenuLevelSelector
*
* <p>
* Specifies the menu level selector
*
* @author Valerian Saliou <valerian@valeriansaliou.name>
@ -39,7 +39,7 @@ public class MenuLevelSelector extends JComboBox {
JComboBox comboBoxSource = (JComboBox) e.getSource();
this.choiceValue = (String) comboBoxSource.getSelectedItem();
if(this.levelEditorView != null) {
if (this.levelEditorView != null) {
this.levelEditorView.menuLevelSelectorChanged(this);
}
}

View File

@ -12,7 +12,7 @@ import fr.enssat.BoulderDash.controllers.NavigationBetweenViewController;
/**
* MenuView
*
* <p>
* Menu view
*
* @author Valerian Saliou <valerian@valeriansaliou.name>

View File

@ -5,14 +5,14 @@ import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JTextArea;
public class WinLoseView extends JFrame{
public class WinLoseView extends JFrame {
private String winOrLose;
/**
* Generate the HelpView
*/
public WinLoseView(String winOrLose){
public WinLoseView(String winOrLose) {
this.winOrLose = winOrLose;
this.initializeView();
this.createLayout();
@ -39,7 +39,7 @@ public class WinLoseView extends JFrame{
private void createLayout() {
JTextArea help = new JTextArea();
help.setEditable(false);
if(winOrLose.equals("win"))
if (winOrLose.equals("win"))
help.setText("YOU WIN THE GAME :-)");
else
help.setText("YOU LOSE THE GAME :-( TRY AGAIN!");