Supression des classes anonymes et des lambda de test
This commit is contained in:
@@ -4,6 +4,7 @@ import fr.monkhanny.dorfromantik.listeners.GameResizeListener;
|
||||
import fr.monkhanny.dorfromantik.listeners.GameZoomListener;
|
||||
import fr.monkhanny.dorfromantik.listeners.GameArrowKeyListener;
|
||||
import fr.monkhanny.dorfromantik.listeners.GameSpaceKeyListener;
|
||||
import fr.monkhanny.dorfromantik.listeners.GameMouseClickListener;
|
||||
import fr.monkhanny.dorfromantik.Options;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -56,12 +57,7 @@ public class Board extends JPanel{
|
||||
|
||||
gameFrame.addKeyListener(new GameSpaceKeyListener(this));
|
||||
|
||||
this.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
public void mousePressed(java.awt.event.MouseEvent e) {
|
||||
handleMouseClick(e);
|
||||
}
|
||||
|
||||
});
|
||||
this.addMouseListener(new GameMouseClickListener(this));
|
||||
}
|
||||
|
||||
private void initializeNextTile() {
|
||||
@@ -133,7 +129,7 @@ public class Board extends JPanel{
|
||||
|
||||
|
||||
|
||||
private void handleMouseClick(java.awt.event.MouseEvent e) {
|
||||
public void handleMouseClick(java.awt.event.MouseEvent e) {
|
||||
// Récupérer les coordonnées du clic
|
||||
Point clickedPoint = e.getPoint();
|
||||
|
||||
@@ -274,7 +270,7 @@ public class Board extends JPanel{
|
||||
int targetOffsetX = (int) ((getWidth() - newlyPlacedTile.getRadius() * 2) / 2 - newlyPlacedTileX);
|
||||
int targetOffsetY = (int) ((getHeight() - newlyPlacedTile.getRadius() * 2) / 2 - newlyPlacedTileY);
|
||||
|
||||
TilePanningTransition panningTransition = new TilePanningTransition(this, targetOffsetX, targetOffsetY, 20, 20);
|
||||
TilePanningTransition panningTransition = new TilePanningTransition(this, targetOffsetX, targetOffsetY, 50, 15);
|
||||
panningTransition.start();
|
||||
}
|
||||
}
|
||||
|
@@ -2,8 +2,9 @@ package fr.monkhanny.dorfromantik.gui;
|
||||
|
||||
import fr.monkhanny.dorfromantik.components.Title;
|
||||
import fr.monkhanny.dorfromantik.gui.Step;
|
||||
import fr.monkhanny.dorfromantik.listeners.CloseButtonListener;
|
||||
import fr.monkhanny.dorfromantik.gui.MainMenu;
|
||||
import fr.monkhanny.dorfromantik.listeners.CloseButtonListener;
|
||||
import fr.monkhanny.dorfromantik.listeners.TutorialButtonHoverListener;
|
||||
import fr.monkhanny.dorfromantik.enums.Images;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -145,14 +146,7 @@ public class TutorialPanel extends JPanel {
|
||||
button.setFocusPainted(false); // Pas de focus visible
|
||||
|
||||
// Ajout de l'effet de survol
|
||||
button.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
public void mouseEntered(java.awt.event.MouseEvent evt) {
|
||||
button.setBackground(new Color(60, 60, 60)); // Couleur plus claire au survol
|
||||
}
|
||||
public void mouseExited(java.awt.event.MouseEvent evt) {
|
||||
button.setBackground(new Color(34, 34, 34)); // Retour à la couleur originale
|
||||
}
|
||||
});
|
||||
button.addMouseListener(new TutorialButtonHoverListener(button, new Color(60,60,60), new Color(34,34,34)));
|
||||
}
|
||||
|
||||
private void showPreviousStep() {
|
||||
|
@@ -0,0 +1,19 @@
|
||||
package fr.monkhanny.dorfromantik.listeners;
|
||||
|
||||
import fr.monkhanny.dorfromantik.game.Board;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.Point;
|
||||
|
||||
public class GameMouseClickListener extends MouseAdapter {
|
||||
private Board board;
|
||||
|
||||
public GameMouseClickListener(Board board) {
|
||||
this.board = board;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
board.handleMouseClick(e);
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package fr.monkhanny.dorfromantik.listeners;
|
||||
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JButton;
|
||||
import java.awt.Color;
|
||||
|
||||
public class TutorialButtonHoverListener extends MouseAdapter {
|
||||
|
||||
private final JButton button;
|
||||
private final Color hoverColor;
|
||||
private final Color originalColor;
|
||||
|
||||
public TutorialButtonHoverListener(JButton button, Color hoverColor, Color originalColor) {
|
||||
this.button = button;
|
||||
this.hoverColor = hoverColor;
|
||||
this.originalColor = originalColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent evt) {
|
||||
button.setBackground(hoverColor); // Couleur plus claire au survol
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent evt) {
|
||||
button.setBackground(originalColor); // Retour à la couleur originale
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user