From bea07979aa1785af337dbf6b922985310c9e9c67 Mon Sep 17 00:00:00 2001 From: Mathis Date: Tue, 17 May 2022 10:09:24 +0200 Subject: [PATCH] UPDATE Color, Rack, Shape --- src/main/java/latice/model/Color.java | 20 +++++++++++------- src/main/java/latice/model/Rack.java | 30 +++++++++++++++++++-------- src/main/java/latice/model/Shape.java | 20 +++++++++++------- 3 files changed, 47 insertions(+), 23 deletions(-) diff --git a/src/main/java/latice/model/Color.java b/src/main/java/latice/model/Color.java index 7c3fe17..bf0a682 100644 --- a/src/main/java/latice/model/Color.java +++ b/src/main/java/latice/model/Color.java @@ -1,20 +1,26 @@ package latice.model; public enum Color { - YELLOW("y"), - NAVYBLUE("n"), - RED("r"), - MAGENTA("m"), - GREEN("g"), - TURQUOISE("t"); //TODO find what is the color turchese, and write it's color code + YELLOW("y", "Y"), + NAVYBLUE("n", "N"), + RED("r", "R"), + MAGENTA("m", "M"), + GREEN("g", "G"), + TURQUOISE("t", "T"); private String stringColor; + private String stringColorConsole; - Color(String stringColor) { + Color(String stringColor, String stringColorConsole) { this.stringColor = stringColor; + this.stringColorConsole = stringColorConsole; } public String getStringColor() { return this.stringColor; } + + public String getStringColorConsole() { + return this.stringColorConsole; + } } diff --git a/src/main/java/latice/model/Rack.java b/src/main/java/latice/model/Rack.java index d55b768..1bb35a7 100644 --- a/src/main/java/latice/model/Rack.java +++ b/src/main/java/latice/model/Rack.java @@ -10,13 +10,11 @@ import javafx.scene.layout.HBox; import javafx.scene.text.Text; public class Rack { - private static ArrayList listRackTile = new ArrayList(); - private static ArrayList rackTileImage = new ArrayList(); + private ArrayList listRackTile = new ArrayList(); + private ArrayList rackTileImage = new ArrayList(); public Rack(Deck deck) { - Image image = new Image("laticePlateau.png"); - ImageView imageView = new ImageView(image); Tile tile; System.out.println("Il y a dans le rack : " + listRackTile.size() + " valeurs"); @@ -26,7 +24,7 @@ public class Rack { tile = (deck.getListTile()).get(index); - listRackTile.add(tile); + this.listRackTile.add(tile); // root.setCenter(imageView); @@ -34,16 +32,30 @@ public class Rack { } - System.out.println("Il y a dans le rack : " + listRackTile.size() + " valeurs"); + System.out.println("Il y a dans le rack : " + this.listRackTile.size() + " valeurs"); } - public static ArrayList getListRackTile() { - return listRackTile; + public ArrayList getListRackTile() { + return this.listRackTile; } public void setListRackTile(ArrayList listRackTile) { this.listRackTile = listRackTile; } + + public void displayRack() { + boolean success = false; + System.out.print("rack : "); + for (Tile tile : this.listRackTile) { + if (success) { + System.out.print(", " + tile.getShape().getStringShapeConsole() + tile.getColor().getStringColorConsole()); + }else { + System.out.print(tile.getShape().getStringShapeConsole() + tile.getColor().getStringColorConsole()); + success = true; + } + } + System.out.println(); + } @@ -77,7 +89,7 @@ public class Rack { } - public static ArrayList getRackTileImage() { + public ArrayList getRackTileImage() { return rackTileImage; } diff --git a/src/main/java/latice/model/Shape.java b/src/main/java/latice/model/Shape.java index e6d7da5..442ef31 100644 --- a/src/main/java/latice/model/Shape.java +++ b/src/main/java/latice/model/Shape.java @@ -1,20 +1,26 @@ package latice.model; public enum Shape { - BIRD("bird"), - DOLPHIN("dolphin"), - FLOWER("flower"), - FEATHER("feather"), - GECKO("gecko"), - TURTLE("turtle"); + BIRD("bird", "B"), + DOLPHIN("dolphin", "D"), + FLOWER("flower", "Fl"), + FEATHER("feather", "F"), + GECKO("gecko", "G"), + TURTLE("turtle", "T"); private String stringShape; + private String stringShapeConsole; - Shape(String stringShape) { + Shape(String stringShape, String stringShapeConsole) { this.stringShape = stringShape; + this.stringShapeConsole = stringShapeConsole; } public String getStringShape() { return this.stringShape; } + + public String getStringShapeConsole() { + return this.stringShapeConsole; + } }