Rangement
This commit is contained in:
@@ -9,6 +9,8 @@ import fr.monkhanny.dorfromantik.Options;
|
||||
import fr.monkhanny.dorfromantik.enums.Biome;
|
||||
import fr.monkhanny.dorfromantik.enums.Fonts;
|
||||
import fr.monkhanny.dorfromantik.enums.TileOrientation;
|
||||
import fr.monkhanny.dorfromantik.gui.GameControlsMenu;
|
||||
import fr.monkhanny.dorfromantik.gui.GameOver;
|
||||
import fr.monkhanny.dorfromantik.utils.Database;
|
||||
|
||||
import java.util.List;
|
||||
@@ -39,7 +41,7 @@ public class Board extends JPanel{
|
||||
private Database database;
|
||||
private RemainingTilesIndicator remainingTilesIndicator;
|
||||
private ScoreDisplay scoreDisplay;
|
||||
private ControlsMenu controlsMenu;
|
||||
private GameControlsMenu controlsMenu;
|
||||
|
||||
|
||||
// Constructeur avec seed
|
||||
@@ -82,7 +84,7 @@ public class Board extends JPanel{
|
||||
this.addMouseMotionListener(new CustomMouseMotionAdapter(this));
|
||||
|
||||
// Ajouter le menu des contrôles
|
||||
controlsMenu = new ControlsMenu();
|
||||
controlsMenu = new GameControlsMenu();
|
||||
setLayout(null); // Utiliser un layout absolu pour placer le menu
|
||||
|
||||
// Ajouter le menu au panneau principal
|
||||
@@ -93,7 +95,7 @@ public class Board extends JPanel{
|
||||
gameFrame.addKeyListener(new CustomKeyAdapter(this));
|
||||
}
|
||||
|
||||
public ControlsMenu getControlsMenu() {
|
||||
public GameControlsMenu getControlsMenu() {
|
||||
return controlsMenu;
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,9 @@
|
||||
package fr.monkhanny.dorfromantik.game;
|
||||
|
||||
import fr.monkhanny.dorfromantik.Options;
|
||||
import fr.monkhanny.dorfromantik.listeners.GameQuitButtonListener;
|
||||
import fr.monkhanny.dorfromantik.listeners.GameResumeButtonListener;
|
||||
import fr.monkhanny.dorfromantik.listeners.GameSettingsButtonListener;
|
||||
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
@@ -8,18 +11,18 @@ import javax.swing.JFrame;
|
||||
|
||||
public class PauseGame extends KeyAdapter {
|
||||
private EscapeMenu escapeMenu;
|
||||
private ResumeButtonListener resumeButtonListener;
|
||||
private QuitButtonListener quitButtonListener;
|
||||
private SettingsButtonListener settingsButtonListener;
|
||||
private GameResumeButtonListener resumeButtonListener;
|
||||
private GameQuitButtonListener quitButtonListener;
|
||||
private GameSettingsButtonListener settingsButtonListener;
|
||||
|
||||
public PauseGame(JFrame gameFrame, Game game) {
|
||||
// Initialiser escapeMenu ici avant de le passer à SettingsButtonListener
|
||||
this.escapeMenu = new EscapeMenu(gameFrame, game); // Initialisation ici
|
||||
this.escapeMenu.setVisible(false);
|
||||
this.escapeMenu.setAlwaysOnTop(true);
|
||||
this.resumeButtonListener = new ResumeButtonListener(this.escapeMenu);
|
||||
this.quitButtonListener = new QuitButtonListener();; // Initialisé après la création de escapeMenu
|
||||
this.settingsButtonListener = new SettingsButtonListener(gameFrame, this.escapeMenu); // Passer escapeMenu correctement
|
||||
this.resumeButtonListener = new GameResumeButtonListener(this.escapeMenu);
|
||||
this.quitButtonListener = new GameQuitButtonListener();; // Initialisé après la création de escapeMenu
|
||||
this.settingsButtonListener = new GameSettingsButtonListener(gameFrame, this.escapeMenu); // Passer escapeMenu correctement
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package fr.monkhanny.dorfromantik.game;
|
||||
package fr.monkhanny.dorfromantik.gui;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
@@ -1,16 +1,16 @@
|
||||
package fr.monkhanny.dorfromantik.game;
|
||||
package fr.monkhanny.dorfromantik.gui;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.net.URL;
|
||||
|
||||
public class ControlsMenu extends JPanel {
|
||||
public class GameControlsMenu extends JPanel {
|
||||
private boolean isVisible = true;
|
||||
|
||||
// Chemin de base pour les icônes
|
||||
private static final String ICON_PATH = "/ressources/images/Icone/Keyboard-Mouse/";
|
||||
|
||||
public ControlsMenu() {
|
||||
public GameControlsMenu() {
|
||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // Mise en page verticale
|
||||
setBackground(new Color(0, 0, 0, 150)); // Fond semi-transparent
|
||||
|
@@ -2,6 +2,10 @@ package fr.monkhanny.dorfromantik.gui;
|
||||
|
||||
import fr.monkhanny.dorfromantik.components.Title;
|
||||
import fr.monkhanny.dorfromantik.listeners.CloseButtonListener;
|
||||
import fr.monkhanny.dorfromantik.listeners.GameModeFilterButtonActionListener;
|
||||
import fr.monkhanny.dorfromantik.listeners.GameModeHoverEffectMouseListener;
|
||||
import fr.monkhanny.dorfromantik.listeners.GameModeNextButtonActionListener;
|
||||
import fr.monkhanny.dorfromantik.listeners.GameModePrevButtonActionListener;
|
||||
import fr.monkhanny.dorfromantik.utils.Database;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package fr.monkhanny.dorfromantik.game;
|
||||
package fr.monkhanny.dorfromantik.gui;
|
||||
|
||||
import fr.monkhanny.dorfromantik.utils.Database;
|
||||
import fr.monkhanny.dorfromantik.gui.MainMenu;
|
||||
import fr.monkhanny.dorfromantik.listeners.GameMainMenuButtonListener;
|
||||
import fr.monkhanny.dorfromantik.Options;
|
||||
import fr.monkhanny.dorfromantik.enums.Fonts;
|
||||
|
||||
@@ -139,7 +139,7 @@ public class GameOver extends JPanel {
|
||||
returnButton.setForeground(Color.BLACK); // Couleur du texte du bouton
|
||||
|
||||
// Ajouter un listener d'action au bouton
|
||||
MainMenuButtonListener listener = new MainMenuButtonListener(gameFrame);
|
||||
GameMainMenuButtonListener listener = new GameMainMenuButtonListener(gameFrame);
|
||||
returnButton.addActionListener(listener);
|
||||
|
||||
// Ajouter le bouton au panneau principal
|
@@ -1,4 +1,4 @@
|
||||
package fr.monkhanny.dorfromantik.game;
|
||||
package fr.monkhanny.dorfromantik.listeners;
|
||||
|
||||
import fr.monkhanny.dorfromantik.Main;
|
||||
|
||||
@@ -6,10 +6,10 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class MainMenuButtonListener implements ActionListener {
|
||||
public class GameMainMenuButtonListener implements ActionListener {
|
||||
private JFrame gameFrame;
|
||||
|
||||
public MainMenuButtonListener(JFrame gameFrame) {
|
||||
public GameMainMenuButtonListener(JFrame gameFrame) {
|
||||
this.gameFrame = gameFrame;
|
||||
}
|
||||
|
@@ -1,8 +1,10 @@
|
||||
package fr.monkhanny.dorfromantik.gui;
|
||||
package fr.monkhanny.dorfromantik.listeners;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import fr.monkhanny.dorfromantik.gui.GameModeSelectionPanel;
|
||||
|
||||
public class GameModeFilterButtonActionListener implements ActionListener {
|
||||
private GameModeSelectionPanel panel;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package fr.monkhanny.dorfromantik.gui;
|
||||
package fr.monkhanny.dorfromantik.listeners;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.MouseAdapter;
|
@@ -1,8 +1,10 @@
|
||||
package fr.monkhanny.dorfromantik.gui;
|
||||
package fr.monkhanny.dorfromantik.listeners;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import fr.monkhanny.dorfromantik.gui.GameModeSelectionPanel;
|
||||
|
||||
public class GameModeNextButtonActionListener implements ActionListener {
|
||||
private GameModeSelectionPanel panel;
|
||||
|
@@ -1,8 +1,10 @@
|
||||
package fr.monkhanny.dorfromantik.gui;
|
||||
package fr.monkhanny.dorfromantik.listeners;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import fr.monkhanny.dorfromantik.gui.GameModeSelectionPanel;
|
||||
|
||||
public class GameModePrevButtonActionListener implements ActionListener {
|
||||
private GameModeSelectionPanel panel;
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package fr.monkhanny.dorfromantik.game;
|
||||
package fr.monkhanny.dorfromantik.listeners;
|
||||
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class QuitButtonListener implements ActionListener {
|
||||
public class GameQuitButtonListener implements ActionListener {
|
||||
|
||||
public QuitButtonListener() {
|
||||
public GameQuitButtonListener() {
|
||||
|
||||
}
|
||||
|
@@ -1,14 +1,15 @@
|
||||
package fr.monkhanny.dorfromantik.game;
|
||||
package fr.monkhanny.dorfromantik.listeners;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import fr.monkhanny.dorfromantik.Options;
|
||||
import fr.monkhanny.dorfromantik.game.EscapeMenu;
|
||||
|
||||
public class ResumeButtonListener implements ActionListener {
|
||||
public class GameResumeButtonListener implements ActionListener {
|
||||
private EscapeMenu escapeMenu;
|
||||
|
||||
public ResumeButtonListener(EscapeMenu escapeMenu) {
|
||||
public GameResumeButtonListener(EscapeMenu escapeMenu) {
|
||||
this.escapeMenu = escapeMenu;
|
||||
}
|
||||
|
@@ -1,19 +1,20 @@
|
||||
package fr.monkhanny.dorfromantik.game;
|
||||
package fr.monkhanny.dorfromantik.listeners;
|
||||
|
||||
import fr.monkhanny.dorfromantik.Options;
|
||||
import fr.monkhanny.dorfromantik.game.EscapeMenu;
|
||||
import fr.monkhanny.dorfromantik.gui.SettingsPanel;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class SettingsButtonListener implements ActionListener {
|
||||
public class GameSettingsButtonListener implements ActionListener {
|
||||
private JFrame gameFrame;
|
||||
private JFrame settingsFrame;
|
||||
private SettingsPanel settingsPanel;
|
||||
private EscapeMenu escapeMenu;
|
||||
|
||||
public SettingsButtonListener(JFrame gameFrame, EscapeMenu escapeMenu) {
|
||||
public GameSettingsButtonListener(JFrame gameFrame, EscapeMenu escapeMenu) {
|
||||
this.gameFrame = gameFrame;
|
||||
this.escapeMenu = escapeMenu;
|
||||
this.settingsFrame = new JFrame("Paramètres - Dorfromantik");
|
||||
@@ -21,7 +22,7 @@ public class SettingsButtonListener implements ActionListener {
|
||||
this.settingsPanel.setReturnButtonVisible(false); // On cache le bouton de retour au menu principal
|
||||
|
||||
// Ajouter le WindowListener pour réafficher la gameFrame lors de la fermeture de settingsFrame
|
||||
this.settingsFrame.addWindowListener(new SettingsWindowListener(gameFrame));
|
||||
this.settingsFrame.addWindowListener(new GameSettingsWindowListener(gameFrame));
|
||||
}
|
||||
|
||||
@Override
|
@@ -1,13 +1,13 @@
|
||||
package fr.monkhanny.dorfromantik.game;
|
||||
package fr.monkhanny.dorfromantik.listeners;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowListener;
|
||||
|
||||
public class SettingsWindowListener implements WindowListener {
|
||||
public class GameSettingsWindowListener implements WindowListener {
|
||||
private JFrame gameFrame;
|
||||
|
||||
public SettingsWindowListener(JFrame gameFrame) {
|
||||
public GameSettingsWindowListener(JFrame gameFrame) {
|
||||
this.gameFrame = gameFrame;
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@ import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.ArrayList;
|
||||
@@ -14,10 +13,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import fr.monkhanny.dorfromantik.gui.Reward;
|
||||
|
||||
public class Database {
|
||||
// Chargement des variables d'environnement
|
||||
private static final String URL = "jdbc:mariadb://dwarves.iut-fbleau.fr/stiti";
|
||||
@@ -91,10 +86,6 @@ public class Database {
|
||||
while (rs.next()) {
|
||||
int score = rs.getInt("score");
|
||||
String seriesName = rs.getString("name"); // Nom de la série
|
||||
|
||||
// Créer un texte à afficher incluant le score et le nom de la série
|
||||
String displayText = "Score: " + score + " | Série: " + seriesName;
|
||||
|
||||
// Ajouter l'objet PlayerScore à la liste avec un nom générique et le score
|
||||
allScores.add(new PlayerScore(seriesName, score)); // Ajout du nom de la série
|
||||
}
|
||||
@@ -297,9 +288,6 @@ public class Database {
|
||||
int score = rs.getInt("score");
|
||||
String seriesName = rs.getString("name"); // Nom de la série
|
||||
|
||||
// Créer un texte à afficher incluant le score et le nom de la série
|
||||
String displayText = "Score: " + score + " | Série: " + seriesName;
|
||||
|
||||
// Ajouter l'objet PlayerScore à la liste
|
||||
topPlayers.add(new PlayerScore(seriesName, score)); // Assurez-vous que PlayerScore accepte un nom de série
|
||||
}
|
||||
|
Reference in New Issue
Block a user