mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Lobby controller list view is able to react to changes in client state boats and update the list view appropriately.
#story[1055]
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package seng302.client;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Observable;
|
||||
|
||||
/**
|
||||
* Created by zyt10 on 21/07/17.
|
||||
* Used by LobbyController to run a separate thread-loop
|
||||
* updates the controller when change is detected.
|
||||
*/
|
||||
public class ClientStateQueryingRunnable extends Observable implements Runnable {
|
||||
|
||||
@@ -15,9 +15,21 @@ public class ClientStateQueryingRunnable extends Observable implements Runnable
|
||||
@Override
|
||||
public void run() {
|
||||
while(!terminate) {
|
||||
if (ClientState.isRaceStarted() && ClientState.isConnectedToHost()) {
|
||||
// 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 {
|
||||
Thread.sleep(0);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (ClientState.isDirtyState()) {
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
ClientState.setDirtyState(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user