Dernières modifications de style
This commit is contained in:
@@ -54,7 +54,7 @@ public class Options {
|
|||||||
|
|
||||||
public static boolean AUTO_FOCUS = true;
|
public static boolean AUTO_FOCUS = true;
|
||||||
|
|
||||||
public static final int MAX_TILE_NUMBER = 5;
|
public static final int MAX_TILE_NUMBER = 50;
|
||||||
|
|
||||||
public static boolean FULL_SCREEN = false;
|
public static boolean FULL_SCREEN = false;
|
||||||
|
|
||||||
|
@@ -43,12 +43,15 @@ public class GameOver extends JPanel {
|
|||||||
|
|
||||||
// Spacer
|
// Spacer
|
||||||
mainPanel.add(Box.createVerticalStrut(30));
|
mainPanel.add(Box.createVerticalStrut(30));
|
||||||
|
|
||||||
// Display final score
|
// Display the final score
|
||||||
JLabel scoreLabel = new JLabel("Votre score est de : " + finalScore);
|
JLabel scoreLabel = new JLabel("Votre score est de : " + finalScore);
|
||||||
scoreLabel.setFont(Fonts.SCORE.getFont(36)); // Using the SCORE font
|
scoreLabel.setFont(Fonts.SCORE.getFont(36)); // Using the SCORE font
|
||||||
scoreLabel.setForeground(Color.WHITE);
|
scoreLabel.setForeground(Color.WHITE);
|
||||||
scoreLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
|
scoreLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||||
|
scoreLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); // Padding
|
||||||
|
scoreLabel.setOpaque(true);
|
||||||
|
scoreLabel.setBackground(new Color(0, 0, 0, 100)); // Background color with transparency
|
||||||
mainPanel.add(scoreLabel);
|
mainPanel.add(scoreLabel);
|
||||||
|
|
||||||
// Spacer
|
// Spacer
|
||||||
|
@@ -18,23 +18,23 @@ public class LeaderboardWorldWide extends Leaderboard {
|
|||||||
@Override
|
@Override
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
removeAll(); // Supprime tout contenu existant
|
removeAll(); // Supprime tout contenu existant
|
||||||
setBackground(new Color(238, 238, 238)); // Gris clair moderne
|
setBackground(new Color(245, 245, 245)); // Gris clair plus chaleureux
|
||||||
|
|
||||||
// Panel principal pour centrer le leaderboard
|
// Panel principal pour centrer le leaderboard
|
||||||
JPanel mainPanel = new JPanel();
|
JPanel mainPanel = new JPanel();
|
||||||
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
|
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
|
||||||
mainPanel.setBackground(new Color(238, 238, 238)); // Gris clair
|
mainPanel.setBackground(new Color(245, 245, 245)); // Gris clair
|
||||||
mainPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
|
mainPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
|
||||||
|
|
||||||
// Titre
|
// Titre
|
||||||
JLabel titleLabel = new JLabel("Classement mondial");
|
JLabel titleLabel = new JLabel("Classement mondial");
|
||||||
titleLabel.setForeground(new Color(34, 139, 34)); // Vert forêt pour le titre
|
titleLabel.setForeground(new Color(76, 175, 80)); // Vert plus doux et moderne
|
||||||
titleLabel.setFont(new Font("Roboto", Font.BOLD, 32)); // Police moderne
|
titleLabel.setFont(new Font("Roboto", Font.BOLD, 32)); // Police moderne
|
||||||
titleLabel.setAlignmentX(CENTER_ALIGNMENT);
|
titleLabel.setAlignmentX(CENTER_ALIGNMENT);
|
||||||
|
|
||||||
// Panel pour les trois premiers
|
// Panel pour les trois premiers
|
||||||
JPanel topThreePanel = new JPanel(new GridBagLayout());
|
JPanel topThreePanel = new JPanel(new GridBagLayout());
|
||||||
topThreePanel.setBackground(new Color(238, 238, 238)); // Gris clair
|
topThreePanel.setBackground(new Color(245, 245, 245)); // Gris clair
|
||||||
GridBagConstraints gbc = new GridBagConstraints();
|
GridBagConstraints gbc = new GridBagConstraints();
|
||||||
gbc.fill = GridBagConstraints.BOTH;
|
gbc.fill = GridBagConstraints.BOTH;
|
||||||
gbc.insets = new Insets(0, 10, 0, 10);
|
gbc.insets = new Insets(0, 10, 0, 10);
|
||||||
@@ -101,20 +101,20 @@ public class LeaderboardWorldWide extends Leaderboard {
|
|||||||
JPanel panel = new JPanel();
|
JPanel panel = new JPanel();
|
||||||
panel.setLayout(new BorderLayout());
|
panel.setLayout(new BorderLayout());
|
||||||
panel.setBackground(new Color(250, 250, 250)); // Blanc cassé
|
panel.setBackground(new Color(250, 250, 250)); // Blanc cassé
|
||||||
panel.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, new Color(200, 200, 200))); // Bordure gris clair
|
panel.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, new Color(220, 220, 220))); // Bordure gris clair
|
||||||
|
|
||||||
JLabel rankLabel = new JLabel(rank + ". ");
|
JLabel rankLabel = new JLabel(rank + ". ");
|
||||||
rankLabel.setFont(new Font("Roboto", Font.BOLD, 18));
|
rankLabel.setFont(new Font("Roboto", Font.BOLD, 18));
|
||||||
rankLabel.setForeground(new Color(34, 139, 34)); // Vert forêt pour le rang
|
rankLabel.setForeground(new Color(76, 175, 80)); // Vert doux pour le rang
|
||||||
rankLabel.setPreferredSize(new Dimension(40, 40));
|
rankLabel.setPreferredSize(new Dimension(40, 40));
|
||||||
|
|
||||||
JLabel nameLabel = new JLabel(playerName);
|
JLabel nameLabel = new JLabel(playerName);
|
||||||
nameLabel.setFont(new Font("Roboto", Font.PLAIN, 18));
|
nameLabel.setFont(new Font("Roboto", Font.PLAIN, 18));
|
||||||
nameLabel.setForeground(new Color(58, 58, 58)); // Gris clair
|
nameLabel.setForeground(new Color(60, 60, 60)); // Gris foncé pour le nom
|
||||||
|
|
||||||
JLabel scoreLabel = new JLabel(Integer.toString(score));
|
JLabel scoreLabel = new JLabel(Integer.toString(score));
|
||||||
scoreLabel.setFont(new Font("Roboto", Font.BOLD, 18));
|
scoreLabel.setFont(new Font("Roboto", Font.BOLD, 18));
|
||||||
scoreLabel.setForeground(new Color(255, 165, 0)); // Orange moderne
|
scoreLabel.setForeground(new Color(255, 140, 0)); // Orange moderne pour le score
|
||||||
|
|
||||||
panel.add(rankLabel, BorderLayout.WEST);
|
panel.add(rankLabel, BorderLayout.WEST);
|
||||||
panel.add(nameLabel, BorderLayout.CENTER);
|
panel.add(nameLabel, BorderLayout.CENTER);
|
||||||
@@ -132,7 +132,7 @@ public class LeaderboardWorldWide extends Leaderboard {
|
|||||||
private JPanel createTopPlayerPanel(String playerName, int score, String medalPath, boolean isFirst) {
|
private JPanel createTopPlayerPanel(String playerName, int score, String medalPath, boolean isFirst) {
|
||||||
JPanel panel = new JPanel();
|
JPanel panel = new JPanel();
|
||||||
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
|
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
|
||||||
panel.setBackground(isFirst ? new Color(255, 223, 0) : new Color(144, 238, 144)); // Doré pour le premier
|
panel.setBackground(isFirst ? new Color(255, 215, 0) : new Color(144, 238, 144)); // Or doré pour le premier, vert clair pour les autres
|
||||||
panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
|
panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
|
||||||
|
|
||||||
// Ajout de l'icône de médaille redimensionnée
|
// Ajout de l'icône de médaille redimensionnée
|
||||||
@@ -141,12 +141,12 @@ public class LeaderboardWorldWide extends Leaderboard {
|
|||||||
|
|
||||||
JLabel nameLabel = new JLabel(playerName);
|
JLabel nameLabel = new JLabel(playerName);
|
||||||
nameLabel.setFont(new Font("Roboto", isFirst ? Font.BOLD : Font.PLAIN, 20));
|
nameLabel.setFont(new Font("Roboto", isFirst ? Font.BOLD : Font.PLAIN, 20));
|
||||||
nameLabel.setForeground(new Color(34, 139, 34)); // Vert forêt pour le nom
|
nameLabel.setForeground(new Color(76, 175, 80)); // Vert doux pour le nom
|
||||||
nameLabel.setAlignmentX(CENTER_ALIGNMENT);
|
nameLabel.setAlignmentX(CENTER_ALIGNMENT);
|
||||||
|
|
||||||
JLabel scoreLabel = new JLabel(Integer.toString(score));
|
JLabel scoreLabel = new JLabel(Integer.toString(score));
|
||||||
scoreLabel.setFont(new Font("Roboto", Font.BOLD, isFirst ? 32 : 28));
|
scoreLabel.setFont(new Font("Roboto", Font.BOLD, isFirst ? 32 : 28));
|
||||||
scoreLabel.setForeground(new Color(58, 58, 58));
|
scoreLabel.setForeground(new Color(60, 60, 60)); // Gris foncé pour le score
|
||||||
scoreLabel.setAlignmentX(CENTER_ALIGNMENT);
|
scoreLabel.setAlignmentX(CENTER_ALIGNMENT);
|
||||||
|
|
||||||
panel.add(medalLabel);
|
panel.add(medalLabel);
|
||||||
|
@@ -5,7 +5,6 @@ import fr.monkhanny.dorfromantik.utils.ImageLoader;
|
|||||||
import fr.monkhanny.dorfromantik.enums.Fonts;
|
import fr.monkhanny.dorfromantik.enums.Fonts;
|
||||||
import fr.monkhanny.dorfromantik.components.Title;
|
import fr.monkhanny.dorfromantik.components.Title;
|
||||||
import fr.monkhanny.dorfromantik.Options;
|
import fr.monkhanny.dorfromantik.Options;
|
||||||
import fr.monkhanny.dorfromantik.listeners.LeaderboardToggleActionListener;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -17,7 +16,6 @@ public class MainMenu extends JFrame {
|
|||||||
private ButtonPanel buttonPanel;
|
private ButtonPanel buttonPanel;
|
||||||
private JPanel leaderboardContainer; // Conteneur pour le leaderboard
|
private JPanel leaderboardContainer; // Conteneur pour le leaderboard
|
||||||
private Leaderboard currentLeaderboard; // Référence au leaderboard actuel
|
private Leaderboard currentLeaderboard; // Référence au leaderboard actuel
|
||||||
private JButton toggleLeaderboardButton; // Bouton pour basculer entre les leaderboards
|
|
||||||
|
|
||||||
public MainMenu() {
|
public MainMenu() {
|
||||||
// Charger les polices pour le titre et les boutons
|
// Charger les polices pour le titre et les boutons
|
||||||
@@ -63,18 +61,6 @@ public class MainMenu extends JFrame {
|
|||||||
currentLeaderboard = new LeaderboardWorldWide();
|
currentLeaderboard = new LeaderboardWorldWide();
|
||||||
leaderboardContainer.add(currentLeaderboard, BorderLayout.CENTER);
|
leaderboardContainer.add(currentLeaderboard, BorderLayout.CENTER);
|
||||||
|
|
||||||
// Bouton pour basculer entre les leaderboards
|
|
||||||
toggleLeaderboardButton = new JButton("Changement de classement");
|
|
||||||
toggleLeaderboardButton.setFont(new Font("Arial", Font.BOLD, 16));
|
|
||||||
toggleLeaderboardButton.setBackground(new Color(64, 0, 128));
|
|
||||||
toggleLeaderboardButton.setForeground(Color.WHITE);
|
|
||||||
toggleLeaderboardButton.setFocusPainted(false);
|
|
||||||
toggleLeaderboardButton.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
|
||||||
leaderboardContainer.add(toggleLeaderboardButton, BorderLayout.SOUTH);
|
|
||||||
|
|
||||||
// Ajouter l'action du bouton
|
|
||||||
toggleLeaderboardButton.addActionListener(new LeaderboardToggleActionListener(leaderboardContainer, currentLeaderboard));
|
|
||||||
|
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,39 +0,0 @@
|
|||||||
package fr.monkhanny.dorfromantik.listeners;
|
|
||||||
|
|
||||||
import fr.monkhanny.dorfromantik.gui.Leaderboard;
|
|
||||||
import fr.monkhanny.dorfromantik.gui.LeaderboardByTier;
|
|
||||||
import fr.monkhanny.dorfromantik.gui.LeaderboardWorldWide;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
|
|
||||||
public class LeaderboardToggleActionListener implements ActionListener {
|
|
||||||
|
|
||||||
private boolean showingWorldwide = true;
|
|
||||||
private JPanel leaderboardContainer;
|
|
||||||
private Leaderboard currentLeaderboard;
|
|
||||||
|
|
||||||
// Constructeur qui reçoit le conteneur du leaderboard
|
|
||||||
public LeaderboardToggleActionListener(JPanel leaderboardContainer, Leaderboard currentLeaderboard) {
|
|
||||||
this.leaderboardContainer = leaderboardContainer;
|
|
||||||
this.currentLeaderboard = currentLeaderboard;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
// Basculer entre les deux leaderboards
|
|
||||||
leaderboardContainer.remove(currentLeaderboard);
|
|
||||||
if (showingWorldwide) {
|
|
||||||
currentLeaderboard = new LeaderboardByTier(); // Leaderboard par tranche
|
|
||||||
} else {
|
|
||||||
currentLeaderboard = new LeaderboardWorldWide(); // Leaderboard avec les meilleurs joueurs du monde
|
|
||||||
}
|
|
||||||
showingWorldwide = !showingWorldwide;
|
|
||||||
|
|
||||||
leaderboardContainer.add(currentLeaderboard, BorderLayout.CENTER);
|
|
||||||
leaderboardContainer.revalidate();
|
|
||||||
leaderboardContainer.repaint();
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user