Commit f055c8f9 authored by erreiip's avatar erreiip
Browse files

[View] Add piecesColor and remove pieceImageMap in model

parent d895fcfd
Loading
Loading
Loading
Loading
−2 B (670 B)
Loading image diff...
+7 −8
Changes for jeuAssemblage/src/view/component/GamePanel.java: 7 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -8,10 +8,10 @@ import model.PlayBoard;
import view.MainFrame;
import view.component.board.Finish;
import view.component.board.Grid;
import view.component.board.PieceBoard;
import view.component.board.TimerPanel;
import view.component.board.TimerPanel.Timer;
import view.screen.SoloGameFinishScreen;
import view.utils.PiecesColor;
import view.utils.SwingUtils;

import java.awt.Graphics;
@@ -20,30 +20,29 @@ public class GamePanel extends JPanel {
	
	private final Grid grid;
	private final TimerPanel timerPanel;
	private final PieceBoard pieceBoard;
	private final Finish finish;

	public GamePanel(MainFrame mainFrame, PlayBoard playBoard, Timer timer) {
	public GamePanel(MainFrame mainFrame, PlayBoard playBoard, PiecesColor piecesColor, Timer timer) {

		super();

		this.setLayout(null);


		this.grid = new Grid(playBoard, piecesColor);
		this.finish = new Finish(mainFrame, playBoard, piecesColor);

		this.timerPanel = new TimerPanel(mainFrame, timer, new Runnable() {
			
			@Override
			public void run() {
				
				mainFrame.setContentPane(new SoloGameFinishScreen(mainFrame, playBoard));
				mainFrame.setContentPane(new SoloGameFinishScreen(mainFrame, playBoard, piecesColor));
			}
		});
		this.pieceBoard = new PieceBoard(playBoard);
		this.grid = new Grid(playBoard);
		this.finish = new Finish(mainFrame, playBoard);

		this.add(this.grid);
		this.add(this.timerPanel);
		// this.add(this.pieceBoard);
		this.add(this.finish);
	}

+6 −2
Changes for jeuAssemblage/src/view/component/GameSummary.java: 6 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ import javax.swing.JPanel;

import model.PlayBoard;
import piece.Piece;
import view.utils.PiecesColor;
import view.utils.SwingUtils;

import java.awt.Graphics;
@@ -20,12 +21,15 @@ import java.awt.Color;
public class GameSummary extends JPanel {

    private final PlayBoard playBoard;
    private final PiecesColor piecesColor;

    public GameSummary(PlayBoard playBoard) {

    public GameSummary(PlayBoard playBoard, PiecesColor piecesColor) {

        super();

        this.playBoard = playBoard;
        this.piecesColor = piecesColor;

        this.setLayout(null);
    }
@@ -70,7 +74,7 @@ public class GameSummary extends JPanel {

                    Piece p = playBoard.getPieceById(matrices[i][j]);

					Image img = playBoard.getCellImageByPieceId(matrices[i][j]);
					Image img = piecesColor.getImageById(matrices[i][j]);

		 			g2d.drawImage(
		 				img,
+4 −3
Changes for jeuAssemblage/src/view/component/MultiplayerGamePanel.java: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import view.MainFrame;
import view.component.board.Grid;
import view.component.board.TimerPanel.Timer;
import view.screen.AIGameCreation.BotDescriptor;
import view.utils.PiecesColor;
import view.utils.SwingUtils;

public class MultiplayerGamePanel extends JPanel {
@@ -17,18 +18,18 @@ public class MultiplayerGamePanel extends JPanel {

	private final JScrollPane scrollPane = new JScrollPane();

	public MultiplayerGamePanel(MainFrame mainFrame, PlayBoard playBoard, Timer timer, Iterable<BotDescriptor> botDescriptors) {
	public MultiplayerGamePanel(MainFrame mainFrame, PlayBoard playBoard, PiecesColor piecesColor, Timer timer, Iterable<BotDescriptor> botDescriptors) {

		super();

		this.gamePanel = new GamePanel(mainFrame, playBoard, timer);
		this.gamePanel = new GamePanel(mainFrame, playBoard, piecesColor, timer);

		JPanel bots = new JPanel();
		bots.setLayout(new BoxLayout(bots, BoxLayout.Y_AXIS));

		for (BotDescriptor botDescriptor : botDescriptors) {

			Grid grid = new Grid(PlayBoard.constructCopyPlayBoard(playBoard), true);
			Grid grid = new Grid(PlayBoard.constructCopyPlayBoard(playBoard), true, piecesColor);

			bots.add(grid);
		}
+3 −2
Changes for jeuAssemblage/src/view/component/board/Finish.java: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ import model.PlayBoard;
import model.listener.IPlayBoardListener;
import view.MainFrame;
import view.screen.SoloGameFinishScreen;
import view.utils.PiecesColor;
import view.utils.SwingUtils;

public class Finish extends JPanel {
@@ -26,7 +27,7 @@ public class Finish extends JPanel {
	private final MainFrame mainFrame;
    private final PlayBoard playBoard;

    public Finish(MainFrame mainFrame, PlayBoard playBoard) {
    public Finish(MainFrame mainFrame, PlayBoard playBoard, PiecesColor piecesColor) {

		super();

@@ -58,7 +59,7 @@ public class Finish extends JPanel {

        this.btnFinish.addActionListener(e -> {

            mainFrame.setContentPane(new SoloGameFinishScreen(mainFrame, playBoard));
            mainFrame.setContentPane(new SoloGameFinishScreen(mainFrame, playBoard, piecesColor));
        });

        this.add(this.lblPreciseArea);
Loading