Added start button for host on the ingameLobby screen.

#story[1352]
This commit is contained in:
fjc40
2017-09-24 19:59:56 +13:00
parent 951c3771fa
commit 612b4b455e
4 changed files with 53 additions and 18 deletions
@@ -63,6 +63,8 @@ public class Event {
*/
private SourceIdAllocator sourceIdAllocator;
private RaceLogic raceLogic;
private Thread raceThread;
private Thread connectionThread;
@@ -171,20 +173,20 @@ public class Event {
}
RaceLogic newRace = new RaceLogic(
this.raceLogic = new RaceLogic(
mockRace,
this.latestMessages,
this.compositeCommand);
this.raceThread = new Thread(newRace, "Event.Start()->RaceLogic thread");
this.raceThread = new Thread(raceLogic, "Event.Start()->RaceLogic thread");
raceThread.start();
//Create connection acceptor.
this.sourceIdAllocator = new SourceIdAllocator(newRace.getRace());
this.sourceIdAllocator = new SourceIdAllocator(raceLogic.getRace());
try {
this.connectionAcceptor = new ConnectionAcceptor(latestMessages, compositeCommand, sourceIdAllocator, newRace);
this.connectionAcceptor = new ConnectionAcceptor(latestMessages, compositeCommand, sourceIdAllocator, raceLogic);
} catch (IOException e) {
throw new EventConstructionException("Could not create ConnectionAcceptor.", e);
@@ -241,4 +243,9 @@ public class Event {
return new HostGame(ip, 3779,(byte) 1,(byte) 1, RaceStatusEnum.PRESTART, (byte) 1, (byte) 1);
}
public RaceLogic getRaceLogic() {
return raceLogic;
}
}
@@ -195,6 +195,19 @@ public class MockRace extends RaceState {
this.racePreparatoryTime = racePreparatoryTime;
}
public long getRacePreparatoryTime() {
return racePreparatoryTime;
}
/**
* Starts the race in #timeToStartMilli milliseconds.
* @param timeToStartMilli Millseconds before starting the race.
*/
public void startRace(long timeToStartMilli) {
//TODO
}
/**
* Sets the status of all boats in the race to RACING.
*/