Changed labels for timer
-preRace countdown now has text saying "Time until race starts:" -Timer during race now says "Race clock:" #story [16]
This commit is contained in:
@@ -92,7 +92,7 @@ public abstract class Race implements Runnable {
|
|||||||
remainingSeconds = currentTimeInSeconds % 60;
|
remainingSeconds = currentTimeInSeconds % 60;
|
||||||
hours = minutes / 60;
|
hours = minutes / 60;
|
||||||
minutes = minutes % 60;
|
minutes = minutes % 60;
|
||||||
updateTime(String.format("%02d:%02d:%02d", hours, minutes, remainingSeconds));
|
updateTime(String.format("Time until race starts: %02d:%02d:%02d", hours, minutes, remainingSeconds));
|
||||||
try {
|
try {
|
||||||
timeLoopEnded = System.currentTimeMillis();
|
timeLoopEnded = System.currentTimeMillis();
|
||||||
Thread.sleep(SLEEP_TIME - (timeLoopEnded - currentTime));
|
Thread.sleep(SLEEP_TIME - (timeLoopEnded - currentTime));
|
||||||
@@ -114,7 +114,7 @@ public abstract class Race implements Runnable {
|
|||||||
remainingSeconds = currentTimeInSeconds % 60;
|
remainingSeconds = currentTimeInSeconds % 60;
|
||||||
hours = minutes / 60;
|
hours = minutes / 60;
|
||||||
minutes = minutes % 60;
|
minutes = minutes % 60;
|
||||||
return String.format("%02d:%02d:%02d", hours, minutes, remainingSeconds);
|
return String.format("Race clock: %02d:%02d:%02d", hours, minutes, remainingSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTime(String time){
|
private void updateTime(String time){
|
||||||
@@ -167,7 +167,7 @@ public abstract class Race implements Runnable {
|
|||||||
*/
|
*/
|
||||||
protected void checkPosition(BoatInRace boat, long timeElapsed) {
|
protected void checkPosition(BoatInRace boat, long timeElapsed) {
|
||||||
if (boat.getDistanceTravelledInLeg() > boat.getCurrentLeg().getDistance()){
|
if (boat.getDistanceTravelledInLeg() > boat.getCurrentLeg().getDistance()){
|
||||||
//updateController(); removed as we do not update the table every time anymore.
|
// updateController();
|
||||||
//boat has passed onto new leg
|
//boat has passed onto new leg
|
||||||
if (boat.getCurrentLeg().getName().equals("Finish")) {
|
if (boat.getCurrentLeg().getName().equals("Finish")) {
|
||||||
//boat has finished
|
//boat has finished
|
||||||
@@ -176,6 +176,7 @@ public abstract class Race implements Runnable {
|
|||||||
} else {
|
} else {
|
||||||
boat.setDistanceTravelledInLeg(boat.getDistanceTravelledInLeg() - boat.getCurrentLeg().getDistance());
|
boat.setDistanceTravelledInLeg(boat.getDistanceTravelledInLeg() - boat.getCurrentLeg().getDistance());
|
||||||
Leg nextLeg = legs.get(boat.getCurrentLeg().getLegNumber() + 1);
|
Leg nextLeg = legs.get(boat.getCurrentLeg().getLegNumber() + 1);
|
||||||
|
|
||||||
boat.setCurrentLeg(nextLeg);
|
boat.setCurrentLeg(nextLeg);
|
||||||
boat.setDistanceTravelledInLeg(boat.getDistanceTravelledInLeg());
|
boat.setDistanceTravelledInLeg(boat.getDistanceTravelledInLeg());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user