mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
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:
@@ -215,6 +215,11 @@ public class ClientPacketParser {
|
||||
clientBoat.setEstimateTimeAtNextMark(estTimeAtNextMark);
|
||||
clientBoat.setEstimateTimeAtFinish(estTimeAtFinish);
|
||||
}
|
||||
|
||||
// 3 is race started
|
||||
if (raceStatus == 3) {
|
||||
ClientState.setRaceStarted(true);
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBoatLegPosition(Yacht updatingBoat, Integer leg){
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,11 +95,9 @@ public class ClientToServerThread implements Runnable {
|
||||
// TODO: 17/07/17 wmu16 - Fix this or maybe we dont need to go through the main server at all!?!?
|
||||
// packetBufferDelegate.addToBuffer(new StreamPacket(type, payloadLength, timeStamp, payload));
|
||||
} else {
|
||||
System.err.println("Packet has been dropped");
|
||||
clientLog("Packet has been dropped", 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
closeSocket();
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user