Merge branch 'master' into conflit-3
@ -5,10 +5,11 @@ import fr.lnl.game.server.games.action.Shot;
|
||||
import fr.lnl.game.server.games.grid.elements.Bomb;
|
||||
import fr.lnl.game.server.games.grid.elements.EnergyBall;
|
||||
import fr.lnl.game.server.games.grid.elements.Mine;
|
||||
import fr.lnl.game.server.games.grid.elements.Wall;
|
||||
import fr.lnl.game.server.games.player.Player;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
|
||||
@ -18,13 +19,20 @@ import javafx.scene.shape.Rectangle;
|
||||
*/
|
||||
public class Cell extends Rectangle {
|
||||
|
||||
//Images libres de droit :
|
||||
//https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/resource-packs/1242533-pixel-perfection-now-with-polar-bears-1-11
|
||||
//https://www.stocklib.fr/media-134367689/pixel-game-icons-vector-isolated-bombs-with-fire-graphics-of-retro-gaming-flat-style-of-weapon-with-flames-destruction-and-danger-explosive-substance.html?keyword=bomb%20pixel
|
||||
|
||||
private static final Image PLAYER_IMAGE = new Image("player.png");
|
||||
private static final Image PLAYER_SHIELD_IMAGE = new Image("player_shield.png");
|
||||
private static final Image PLAYER_SHOT_IMAGE = new Image("player_shot.png");
|
||||
private static final Image ENERGY_BALL_IMAGE = new Image("energyBall.png");
|
||||
private static final Image BOMB_IMAGE = new Image("bomb.png");
|
||||
private static final Image MINE_IMAGE = new Image("mine.png");
|
||||
private static final Image WALL_IMAGE = new Image("wall.jpg");
|
||||
private static final Image WALL_IMAGE = new Image("wall.png");
|
||||
private static final Image BACKGROUND_IMAGE = new Image("background.png");
|
||||
private static final BackgroundImage BG = new BackgroundImage(BACKGROUND_IMAGE,BackgroundRepeat.NO_REPEAT,BackgroundRepeat.NO_REPEAT,BackgroundPosition.DEFAULT,
|
||||
BackgroundSize.DEFAULT);
|
||||
|
||||
public Cell(int x, int y){
|
||||
setWidth(Window.cellSize);
|
||||
@ -39,7 +47,9 @@ public class Cell extends Rectangle {
|
||||
public static StackPane setImageObject(Object object, Game game){
|
||||
StackPane sp = new StackPane();
|
||||
Image in;
|
||||
BackgroundImage bg = BG;
|
||||
if(object instanceof Player){
|
||||
bg = null;
|
||||
if(object.equals(game.getCurrentPlayer()) && game.getSelectedAction() instanceof Shot){
|
||||
in = PLAYER_SHOT_IMAGE;
|
||||
}
|
||||
@ -55,15 +65,24 @@ public class Cell extends Rectangle {
|
||||
in = BOMB_IMAGE;
|
||||
} else if(object instanceof Mine){
|
||||
in = MINE_IMAGE;
|
||||
} else{
|
||||
}
|
||||
else if(object instanceof Wall){
|
||||
in = WALL_IMAGE;
|
||||
bg = null;
|
||||
}
|
||||
else{
|
||||
in = null;
|
||||
}
|
||||
|
||||
ImageView iv = new ImageView(in);
|
||||
iv.setFitHeight(Window.cellSize);
|
||||
iv.setFitWidth(Window.cellSize);
|
||||
sp.getChildren().add(iv);
|
||||
sp.setBackground(new Background(bg));
|
||||
return sp;
|
||||
}
|
||||
|
||||
public static Image getPlayerImage() {
|
||||
return PLAYER_IMAGE;
|
||||
}
|
||||
}
|
||||
|
@ -15,12 +15,12 @@ import fr.lnl.game.server.utils.Pair;
|
||||
import fr.lnl.game.server.utils.Point;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
import javafx.scene.text.Text;
|
||||
@ -35,6 +35,8 @@ public class Window extends AbstractView {
|
||||
public static final int cellSize = 40;
|
||||
public static final int width = 500;
|
||||
public static final int height = 160;
|
||||
private static final Color dark = Color.valueOf("1F1F1F");
|
||||
private static final Background bg = new Background(new BackgroundFill(dark, CornerRadii.EMPTY, Insets.EMPTY));
|
||||
|
||||
|
||||
private final Stage stage;
|
||||
@ -52,6 +54,7 @@ public class Window extends AbstractView {
|
||||
Scene scene = new Scene(createContent());
|
||||
stage.setScene(scene);
|
||||
stage.setTitle("Game");
|
||||
stage.getIcons().add(Cell.getPlayerImage());
|
||||
stage.setResizable(false);
|
||||
stage.sizeToScene();
|
||||
stage.show();
|
||||
@ -124,14 +127,20 @@ public class Window extends AbstractView {
|
||||
if (value.getB() instanceof Wall || value.getB() instanceof EnergyBall) {
|
||||
addToPrincipalPanel(value.getB(), principalPane, i, j);
|
||||
}
|
||||
if(value.getB() instanceof Explosive){
|
||||
else if(value.getB() instanceof Explosive){
|
||||
if(((Explosive) value.getB()).getPlayer().equals(player)){
|
||||
addToPrincipalPanel(value.getB(), principalPane, i, j);
|
||||
}
|
||||
else{
|
||||
addToPrincipalPanel(null,principalPane, i, j);
|
||||
}
|
||||
if (value.getA() != null) {
|
||||
}
|
||||
else if (value.getA() != null) {
|
||||
addToPrincipalPanel(value.getA(), principalPane, i, j);
|
||||
}
|
||||
else{
|
||||
addToPrincipalPanel(null,principalPane, i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
putStatePlayerPane(principalPane);
|
||||
@ -150,6 +159,7 @@ public class Window extends AbstractView {
|
||||
}
|
||||
|
||||
principalPane.getChildren().add(buttonPane);
|
||||
principalPane.setBackground(bg);
|
||||
return principalPane;
|
||||
}
|
||||
|
||||
@ -184,9 +194,9 @@ public class Window extends AbstractView {
|
||||
r.setWidth(500);
|
||||
r.setHeight(90);
|
||||
if(game.getPlayers().get(playerNumber).getEnergy() <= 0){
|
||||
r.setFill(Color.RED);
|
||||
r.setFill(Color.valueOf("A54747"));
|
||||
}else{
|
||||
r.setFill(Color.GREEN);
|
||||
r.setFill(Color.valueOf("62B262"));
|
||||
}
|
||||
r.setStrokeWidth(1);
|
||||
r.setStroke(Color.BLACK);
|
||||
@ -210,12 +220,13 @@ public class Window extends AbstractView {
|
||||
}
|
||||
|
||||
Text t = new Text(s);
|
||||
t.setFill(Color.WHITE);
|
||||
Rectangle r = new Rectangle();
|
||||
r.setWidth(478);
|
||||
r.setHeight(165);
|
||||
r.setStrokeWidth(1);
|
||||
r.setStroke(Color.BLACK);
|
||||
r.setFill(Color.WHITE);
|
||||
r.setFill(dark);
|
||||
subSp.getChildren().addAll(r,t);
|
||||
return subSp;
|
||||
}
|
||||
|
BIN
client/src/main/resources/background.png
Normal file
After Width: | Height: | Size: 334 B |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 285 B |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 525 B |
Before Width: | Height: | Size: 56 KiB |
BIN
client/src/main/resources/wall.png
Normal file
After Width: | Height: | Size: 360 B |