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; package latice.model;
public enum Color { public enum Color {
YELLOW("y"), YELLOW("y", "Y"),
NAVYBLUE("n"), NAVYBLUE("n", "N"),
RED("r"), RED("r", "R"),
MAGENTA("m"), MAGENTA("m", "M"),
GREEN("g"), GREEN("g", "G"),
TURQUOISE("t"); //TODO find what is the color turchese, and write it's color code TURQUOISE("t", "T");
private String stringColor; private String stringColor;
private String stringColorConsole;
Color(String stringColor) { Color(String stringColor, String stringColorConsole) {
this.stringColor = stringColor; this.stringColor = stringColor;
this.stringColorConsole = stringColorConsole;
} }
public String getStringColor() { public String getStringColor() {
return this.stringColor; 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; import javafx.scene.text.Text;
public class Rack { public class Rack {
private static ArrayList<Tile> listRackTile = new ArrayList<Tile>(); private ArrayList<Tile> listRackTile = new ArrayList<Tile>();
private static ArrayList<Image> rackTileImage = new ArrayList<Image>(); private ArrayList<Image> rackTileImage = new ArrayList<Image>();
public Rack(Deck deck) { public Rack(Deck deck) {
Image image = new Image("laticePlateau.png");
ImageView imageView = new ImageView(image);
Tile tile; Tile tile;
System.out.println("Il y a dans le rack : " + listRackTile.size() + " valeurs"); System.out.println("Il y a dans le rack : " + listRackTile.size() + " valeurs");
@ -26,7 +24,7 @@ public class Rack {
tile = (deck.getListTile()).get(index); tile = (deck.getListTile()).get(index);
listRackTile.add(tile); this.listRackTile.add(tile);
// root.setCenter(imageView); // 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<Tile> getListRackTile() { public ArrayList<Tile> getListRackTile() {
return listRackTile; return this.listRackTile;
} }
public void setListRackTile(ArrayList<Tile> listRackTile) { public void setListRackTile(ArrayList<Tile> listRackTile) {
this.listRackTile = 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<Image> getRackTileImage() { public ArrayList<Image> getRackTileImage() {
return rackTileImage; return rackTileImage;
} }

View File

@ -1,20 +1,26 @@
package latice.model; package latice.model;
public enum Shape { public enum Shape {
BIRD("bird"), BIRD("bird", "B"),
DOLPHIN("dolphin"), DOLPHIN("dolphin", "D"),
FLOWER("flower"), FLOWER("flower", "Fl"),
FEATHER("feather"), FEATHER("feather", "F"),
GECKO("gecko"), GECKO("gecko", "G"),
TURTLE("turtle"); TURTLE("turtle", "T");
private String stringShape; private String stringShape;
private String stringShapeConsole;
Shape(String stringShape) { Shape(String stringShape, String stringShapeConsole) {
this.stringShape = stringShape; this.stringShape = stringShape;
this.stringShapeConsole = stringShapeConsole;
} }
public String getStringShape() { public String getStringShape() {
return this.stringShape; return this.stringShape;
} }
public String getStringShapeConsole() {
return this.stringShapeConsole;
}
} }