Lobby view will switch to race view when received race status packet with race start type.

Ready button can only be pressed by host. Once pressed, it will send out race status packet with race start to all clients.

#story[1055]
This commit is contained in:
Zhi You Tan
2017-07-25 00:01:59 +12:00
parent 8b0af5bb62
commit d1d659b698
9 changed files with 97 additions and 401 deletions
@@ -15,10 +15,6 @@ public class ClientStateQueryingRunnable extends Observable implements Runnable
@Override
public void run() {
while(!terminate) {
// if (ClientState.isRaceStarted() && ClientState.isConnectedToHost()) {
// setChanged();
// notifyObservers();
// }
// Sleeping the thread so it will respond to the if statement below
// if you know a better fix, pls tell me :) -ryan
try {
@@ -26,9 +22,16 @@ public class ClientStateQueryingRunnable extends Observable implements Runnable
} catch (InterruptedException e) {
e.printStackTrace();
}
if (ClientState.isRaceStarted() && ClientState.isConnectedToHost()) {
setChanged();
notifyObservers("game started");
terminate();
}
if (ClientState.isDirtyState()) {
setChanged();
notifyObservers();
notifyObservers("update players");
ClientState.setDirtyState(false);
}
}