mirror of
https://github.com/guezoloic/racing-game.git
synced 2026-03-28 18:03:50 +00:00
feat(Dashboard): ajout energy affichage
This commit is contained in:
@@ -8,6 +8,7 @@ import javax.swing.JPanel;
|
|||||||
|
|
||||||
import model.Game;
|
import model.Game;
|
||||||
import model.car.Car;
|
import model.car.Car;
|
||||||
|
import model.car.HybridCar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dashboard représente une vue graphique pour une voiture spécifique.
|
* Dashboard représente une vue graphique pour une voiture spécifique.
|
||||||
@@ -144,7 +145,15 @@ public class Dashboard extends GameView {
|
|||||||
return false;
|
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());
|
stateLabel.setText("Etat : " + car.getState());
|
||||||
|
|
||||||
updatePauseButtonText();
|
updatePauseButtonText();
|
||||||
|
|||||||
Reference in New Issue
Block a user