feat(Dashboard): ajout energy affichage

This commit is contained in:
2025-12-19 10:43:01 +01:00
parent 0e32a17c66
commit aa941e4a63

View File

@@ -8,6 +8,7 @@ import javax.swing.JPanel;
import model.Game;
import model.car.Car;
import model.car.HybridCar;
/**
* Dashboard représente une vue graphique pour une voiture spécifique.
@@ -144,7 +145,15 @@ public class Dashboard extends GameView {
return false;
}
infoLabel.setText("Carburant : " + car.getFuel() + " | Tours : " + car.getRound());
infoLabel.setText(
String.format(
"Carburant: %d%s | Tours: %d",
car.getFuel(),
switch (car) {
case HybridCar c -> " | énergie: " + c.getEnergy();
default -> "";
},
car.getRound()));
stateLabel.setText("Etat : " + car.getState());
updatePauseButtonText();