UPDATE Color, Rack, Shape

master
Mathis 2022-05-17 10:09:24 +02:00
parent bc278df804
commit bea07979aa
3 changed files with 47 additions and 23 deletions

View File

@ -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;
}
}

View File

@ -10,13 +10,11 @@ import javafx.scene.layout.HBox;
import javafx.scene.text.Text;
public class Rack {
private static ArrayList<Tile> listRackTile = new ArrayList<Tile>();
private static ArrayList<Image> rackTileImage = new ArrayList<Image>();
private ArrayList<Tile> listRackTile = new ArrayList<Tile>();
private ArrayList<Image> rackTileImage = new ArrayList<Image>();
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,17 +32,31 @@ 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<Tile> getListRackTile() {
return listRackTile;
public ArrayList<Tile> getListRackTile() {
return this.listRackTile;
}
public void setListRackTile(ArrayList<Tile> 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();
}
public HBox createImageTileOfRack() {
@ -77,7 +89,7 @@ public class Rack {
}
public static ArrayList<Image> getRackTileImage() {
public ArrayList<Image> getRackTileImage() {
return rackTileImage;
}

View File

@ -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;
}
}