-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reformat code & make ready for presentation
- Loading branch information
1 parent
ffc9664
commit a6c1db1
Showing
35 changed files
with
301 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 18 additions & 23 deletions
41
src/main/java/yugioh/controller/gamephasescontrollers/CardSelectionMenuController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,59 @@ | ||
package yugioh.controller.gamephasescontrollers; | ||
|
||
import javafx.event.Event; | ||
import javafx.event.EventHandler; | ||
import javafx.fxml.Initializable; | ||
import javafx.geometry.Insets; | ||
import javafx.scene.control.ScrollPane; | ||
import javafx.scene.input.MouseEvent; | ||
import javafx.scene.layout.Background; | ||
import javafx.scene.layout.BackgroundFill; | ||
import javafx.scene.layout.CornerRadii; | ||
import javafx.scene.layout.GridPane; | ||
import javafx.scene.paint.Color; | ||
import javafx.scene.paint.Paint; | ||
import javafx.scene.shape.Rectangle; | ||
import yugioh.model.board.Cell; | ||
import yugioh.model.exceptions.GameException; | ||
import yugioh.view.gamephases.CardSelectionMenu; | ||
import yugioh.view.gamephases.Duel; | ||
|
||
import java.awt.*; | ||
import java.net.URL; | ||
import java.util.ArrayList; | ||
import java.util.ResourceBundle; | ||
|
||
public class CardSelectionMenuController implements Initializable { | ||
public ScrollPane scrollBar; | ||
public static ArrayList<Cell> cardsToShow=new ArrayList<>(); | ||
public static ArrayList<Cell> cardsToShow = new ArrayList<>(); | ||
|
||
static { | ||
|
||
} | ||
|
||
public ScrollPane scrollBar; | ||
|
||
public static void setCardsToShow(ArrayList<Cell> cardsToShow) { | ||
CardSelectionMenuController.cardsToShow = cardsToShow; | ||
} | ||
|
||
@Override | ||
public void initialize(URL url, ResourceBundle resourceBundle) { | ||
GridPane cardsPane = new GridPane(); | ||
cardsPane.setHgap(10); | ||
cardsPane.setVgap(10); | ||
cardsPane.setPadding(new Insets(10, 10, 10, 10)); | ||
for(Cell cell : cardsToShow){ | ||
Rectangle rectangle =cell.getCellRectangle(); | ||
for (Cell cell : cardsToShow) { | ||
Rectangle rectangle = cell.getCellRectangle(); | ||
rectangle.setOnMouseClicked(new EventHandler<MouseEvent>() { | ||
@Override | ||
public void handle(MouseEvent mouseEvent) { | ||
Cell.setSelectedCell(Cell.getSelectedCellByRectangle(rectangle)); | ||
GameController gameController= Duel.getGameController(); | ||
try { | ||
gameController.getMainPhase1Controller().specialSummon(gameController); | ||
} catch (GameException e) { | ||
e.printStackTrace(); | ||
} | ||
GameController gameController = Duel.getGameController(); | ||
try { | ||
gameController.getMainPhase1Controller().specialSummon(gameController); | ||
} catch (GameException e) { | ||
e.printStackTrace(); | ||
} | ||
CardSelectionMenu.cardSelectionStage.close(); | ||
Cell.deselectCell(); | ||
gameController.changeTurn(true,true); | ||
Cell.deselectCell(); | ||
gameController.changeTurn(true, true); | ||
} | ||
}); | ||
cardsPane.getChildren().add(cell.getCellRectangle()); | ||
} | ||
scrollBar.contentProperty().set(cardsPane); | ||
} | ||
|
||
public static void setCardsToShow(ArrayList<Cell> cardsToShow) { | ||
CardSelectionMenuController.cardsToShow = cardsToShow; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.