Skip to content

Commit

Permalink
Merge pull request #67 from DjLegolas/dev-ido
Browse files Browse the repository at this point in the history
last update fox ex2
  • Loading branch information
DjLegolas authored Jun 20, 2017
2 parents 74b2cfa + f0db4b6 commit 4147d60
Show file tree
Hide file tree
Showing 15 changed files with 193 additions and 133 deletions.
23 changes: 23 additions & 0 deletions .idea/artifacts/WordiadaApp.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/artifacts/WordiadaEngine_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions DesktopUI/src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Manifest-Version: 1.0
Class-Path: WordiadaEngine.jar
Main-Class: desktopUI.Main

2 changes: 1 addition & 1 deletion DesktopUI/src/desktopUI/Board/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private void loadBoard(){
public Node createTile() {
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("desktopUI/Tile/Tile.fxml"));
loader.setLocation(getClass().getResource("/desktopUI/Tile/Tile.fxml"));
Button singleLetterTile = loader.load();

SingleLetterController singleLetterController = loader.getController();
Expand Down
64 changes: 15 additions & 49 deletions DesktopUI/src/desktopUI/Controller/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import desktopUI.Board.Board;
import desktopUI.userInfo.UserInfoController;
import desktopUI.utils.Common;
import engine.ComputerTask;
import engine.Player;
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
Expand All @@ -17,7 +15,6 @@
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import desktopUI.GameManager.GameManager;
import engine.Player.Type;

import java.io.File;
import java.util.ArrayList;
Expand All @@ -29,8 +26,7 @@ public class Controller {


private Stage primaryStage;
private GameManager gameManager = new GameManager(this);
private ComputerTask computerTask;
private GameManager gameManager;
private Board board;
private Map<Short, UserInfoController> userInfoControllerMap;

Expand All @@ -45,9 +41,9 @@ public class Controller {
@FXML private Button helpButton;
@FXML private Label turnNumberLabel;
@FXML private ScrollPane boardScrollPane;
@FXML private Label initInfoGame;
@FXML private Label titleInfoGame;
@FXML private Label titlePlayerData;
@FXML private Label initInfoGame;
@FXML private Label titleInfoGame;
@FXML private Label titlePlayerData;
@FXML private VBox playerVBox;
@FXML private Button checkWord;
@FXML private Label buildWordLabel;
Expand Down Expand Up @@ -78,6 +74,7 @@ public Controller(){
wordBuildProperty = new SimpleStringProperty();
tryNumberProperty = new SimpleIntegerProperty();
totalTriesProperty = new SimpleIntegerProperty();
gameManager= new GameManager(this);
}

@FXML
Expand Down Expand Up @@ -268,14 +265,6 @@ public Board getBoard() {

alert.setHeaderText(null);
alert.show();
/* TODO: noy's original
if(gameManager.getGameEngine().getCurrentPlayer().getType().equals(Type.COMPUTER)){
setAllDisable();
computerTask = new ComputerTask(gameManager.getPlayerById(id, gameManager.getGameEngine().getPlayers()), gameManager.getGameEngine());
computerTask.run();
computerTask.getSelectedPoints();
}
*/
}

public void selectPlayer(short prevId, short newId) {
Expand All @@ -292,7 +281,7 @@ public void selectPlayer(short prevId, short newId) {
}

public void checkComputer() {
if (gameManager.isPlayerComputer()) {
if (!gameManager.getGameEngine().isGameEnded() && gameManager.isPlayerComputer()) {
gameManager.runComputer();
}
}
Expand All @@ -316,17 +305,15 @@ private void setAllDisable() {
Common.showError(notEnoughTilesError);
return;
}

tryNumberProperty.set(1);
gameManager.updateBoard(board.getPressedButtonsIndices());

// updateBoard(gameManager.getGameEngine().getBoardObject().getBoardWithAllSignsShown());
}

public void updateBoard(char[][] board) {
String outputMessageValidMove = "Now you can watch the hidden letters you chose to open!\n\n" +
"Try to build a word from those letter by pressing them by the order in which they apper. (If you" +
"Try to build a word from those letter by pressing them by the order in which they appear. (If you" +
" accidentally pressed the wrong order, that's OK, just press again, so the letters will " +
"be covered by a blue background).\n When you have a word in your mind, press on the Check Word Button to continue.\n\nGood Luch!!!";
"be covered by a blue background).\n When you have a word in your mind, press on the Check Word Button to continue.\n\nGood Luck!!!";

Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Message");
Expand Down Expand Up @@ -365,29 +352,8 @@ public void savedBoardUpdate(char[][] board, List<int[]> pressedButtonsIndices)

}

/*
//TODO: remove if we remove the build button - dunno yet
@FXML public void buildWord(){
checkWord.setDisable(false);
board.getPressedButtons().clear();
moveButton.setDisable(true);
buildWord.setDisable(true);
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Instructions");
alert.setContentText("Now that you chose the letters, all you need is to create a word that combines them. It can combines all letters or part of them." +
"\nOnce you have a word in your mind, press on the letters by the order in which they appear in the word. (If you accidentally pressed the wrong order, that's fine, just press again, so the letters will be covered by a blue background).\n When you are done, press on the Make a Move button.\n\nGood Luch!!!");
alert.setHeaderText(null);
alert.showAndWait();
board.buildWord(true, () -> {
wordBuildProperty.set(gameManager.buttonsToStr(board.getPressedButtons(),board.getButtonsMap(),gameManager.getGameEngine().getBoardObject().getBoardWithAllSignsShown()));
return Boolean.TRUE;
});
tryNumberProperty.set(1);
}*/

@FXML
public void throwDie() {
public void throwDie() {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
boolean allShown = false;
if(!gameManager.getIsFishMod())
Expand Down Expand Up @@ -426,9 +392,9 @@ public void exitGame() {
}
}

public void playerRetired(short retiredPlayerId) {
public void playerRetired(short retiredPlayerId, boolean isRetired) {
UserInfoController userInfoController = userInfoControllerMap.get(retiredPlayerId);
userInfoController.setStrikeThrough();
userInfoController.setStrikeThrough(isRetired);
}

@FXML
Expand All @@ -454,9 +420,9 @@ public void help() {
//update board
String updateBoardHelpTitle = "Message";
String updateBoardHelpContent = "Now you can watch the hidden letters you chose to open!\n\n" +
"Try to build a word from those letter by pressing them by the order in which they apper. (If you" +
"Try to build a word from those letter by pressing them by the order in which they appear. (If you" +
" accidentally pressed the wrong order, that's OK, just press again, so the letters will " +
"be covered by a blue background).\n When you have a word in your mind, press on the Check Word Button to continue.\n\nGood Luch!!!";
"be covered by a blue background).\n When you have a word in your mind, press on the Check Word Button to continue.\n\nGood Luck!!!";

String title = null;
String content = null;
Expand Down Expand Up @@ -487,10 +453,10 @@ public void endOfGameStatus(){
retireButton.setDisable(true);
checkWord.setDisable(true);
board.resetAllButtons();
initScore();
next();
showEndGameControllers(true);
prevButton.setDisable(true);
initScore();
}

private void showEndGameControllers(boolean show) {
Expand Down
Loading

0 comments on commit 4147d60

Please sign in to comment.