Bug changement de couleur
This commit is contained in:
parent
a809d51803
commit
d39148970e
@ -26,7 +26,7 @@ public class ColorChooserListener implements ChangeListener {
|
||||
ColorSelectionModel chooser = (ColorSelectionModel) e.getSource();
|
||||
if(this.player == Constants.PLAYER_ONE)
|
||||
Constants.PLAYER_ONE_COLOR = chooser.getSelectedColor();
|
||||
else if(this.player == Constants.PLAYER_THREE)
|
||||
else if(this.player == Constants.PLAYER_TWO)
|
||||
Constants.PLAYER_TWO_COLOR = chooser.getSelectedColor();
|
||||
else
|
||||
Constants.PLAYER_THREE_COLOR = chooser.getSelectedColor();
|
||||
|
@ -63,6 +63,10 @@ public class Puissance4Controller {
|
||||
}
|
||||
this.grille.reset();
|
||||
this.modele.reset();
|
||||
if(this.modele.getPlayerThreeName() != null) {
|
||||
this.modele.setPlayerNumber(3);
|
||||
this.panel.setPlayerNumber(3);
|
||||
}
|
||||
this.panel.changeHoverColor(this.modele.getPlayerTurn());
|
||||
this.panel.changeLabel(this.modele.getPlayerTurn());
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class GrilleModel extends AbstractGridInitiater{
|
||||
int diagonalRow = row;
|
||||
//Vérification horizontal et vertical
|
||||
if(verifyAlignedPiece(column, 0, 0, 1, playerColor) || verifyAlignedPiece(0, row, 1, 0, playerColor)) {
|
||||
this.setPartyStatus(GameStatus.WIN);
|
||||
this.setPartyStatus(GameStatus.FIRST);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -351,4 +351,8 @@ public class GrilleModel extends AbstractGridInitiater{
|
||||
public void setPlayerThreeName(String playerThreeName) {
|
||||
this.playerThreeName = playerThreeName;
|
||||
}
|
||||
|
||||
public void setPlayerNumber(int i) {
|
||||
this.playerNumber = i;
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class ColorChooserDialog extends JDialog{
|
||||
|
||||
playerTwoChooser.getSelectionModel().addChangeListener(new ColorChooserListener(pionP2, Constants.PLAYER_TWO));
|
||||
|
||||
playerThreeChooser.getSelectionModel().addChangeListener(new ColorChooserListener(pionP2, Constants.PLAYER_THREE));
|
||||
playerThreeChooser.getSelectionModel().addChangeListener(new ColorChooserListener(pionP3, Constants.PLAYER_THREE));
|
||||
|
||||
|
||||
JPanel panelP1 = new JPanel(new GridBagLayout());
|
||||
|
Loading…
Reference in New Issue
Block a user