mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Started work on start screen
- Server now sends out race start status messages during lobby & pre-start stages - Added timer in lobby Tags: #story[1109]
This commit is contained in:
@@ -62,6 +62,8 @@ public class GameState implements Runnable {
|
||||
yachts = new HashMap<>();
|
||||
markOrder = new MarkOrder(); //This could be instantiated at some point with a select map?
|
||||
|
||||
startTime = System.currentTimeMillis() + 20000;
|
||||
|
||||
new Thread(this).start(); //Run the auto updates on the game state
|
||||
}
|
||||
|
||||
@@ -101,10 +103,6 @@ public class GameState implements Runnable {
|
||||
}
|
||||
|
||||
public static void setCurrentStage(GameStages currentStage) {
|
||||
if (currentStage == GameStages.RACING){
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
GameState.currentStage = currentStage;
|
||||
}
|
||||
|
||||
@@ -195,7 +193,7 @@ public class GameState implements Runnable {
|
||||
} catch (InterruptedException e) {
|
||||
System.out.println("[GameState] interrupted exception");
|
||||
}
|
||||
if (currentStage == GameStages.PRE_RACE) {
|
||||
if (currentStage == GameStages.PRE_RACE || currentStage == GameStages.LOBBYING) {
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,6 @@ public class MainServerThread extends Observable implements Runnable, ClientConn
|
||||
t.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
for (ServerToClientThread serverToClientThread : serverToClientThreads) {
|
||||
serverToClientThread.sendRaceStatusMessage();
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ public class ServerToClientThread implements Runnable, Observer {
|
||||
}
|
||||
|
||||
//@TODO calculate lat/lng values
|
||||
xml.setRegatta(new Regatta("RaceVision Test Game", 57.6679590, 11.8503233));
|
||||
xml.setRegatta(new Regatta("Party Parrot Test Server", "Bermuda Test Course", 57.6679590, 11.8503233));
|
||||
xml.setRace(race);
|
||||
|
||||
XMLMessage xmlMessage;
|
||||
@@ -246,6 +246,7 @@ public class ServerToClientThread implements Runnable, Observer {
|
||||
}
|
||||
|
||||
public void updateClient() {
|
||||
sendRaceStatusMessage();
|
||||
sendBoatLocationPackets();
|
||||
updateClient = true;
|
||||
}
|
||||
@@ -376,6 +377,14 @@ public class ServerToClientThread implements Runnable, Observer {
|
||||
sendMessage(new RaceStatusMessage(1, raceStatus, GameState.getStartTime(), GameState.getWindDirection(),
|
||||
GameState.getWindSpeedMMS().longValue(), GameState.getPlayers().size(),
|
||||
RaceType.MATCH_RACE, 1, boatSubMessages));
|
||||
|
||||
if (GameState.getCurrentStage() == GameStages.PRE_RACE || GameState.getCurrentStage() == GameStages.LOBBYING){
|
||||
Long raceStartTime = GameState.getStartTime();
|
||||
|
||||
sendMessage(new RaceStartStatusMessage(1, raceStartTime ,
|
||||
1, RaceStartNotificationType.SET_RACE_START_TIME));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Socket getSocket() {
|
||||
|
||||
Reference in New Issue
Block a user