Keep finding some bugs, keep fixing them: Some wierd messages were sent from VoteHandler
This commit is contained in:
parent
84ed547372
commit
d87dd237f7
@ -95,7 +95,7 @@ public class Game implements Runnable {
|
||||
passenger.send(GuiParameters.updateGameState, getGame());
|
||||
}
|
||||
try {
|
||||
Thread.sleep(2000); //TODO: Is this a good intervall?
|
||||
Thread.sleep(1000); //TODO: Is this a good intervall?
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -120,7 +120,7 @@ public class Game implements Runnable {
|
||||
Passenger[] passengerTrain = gameState.getPassengerTrain();
|
||||
|
||||
|
||||
LOGGER.info(gameState.toString());
|
||||
LOGGER.info(gameState.toGhostString());
|
||||
for (ClientHandler client : lobbyClients) {//begins filling the train with clients
|
||||
int index = order[i];
|
||||
if (passengerTrain[index].getIsGhost()) { //if there is a ghost
|
||||
@ -146,7 +146,7 @@ public class Game implements Runnable {
|
||||
}
|
||||
i++;
|
||||
}
|
||||
LOGGER.info(gameState.toString());
|
||||
LOGGER.info(gameState.toGhostString());
|
||||
gameStateModelUpdater(); //TODO: does that work?
|
||||
for(Passenger passenger : gameState.getPassengerTrain()) {
|
||||
passenger.send(Protocol.positionOfClient + "$" + passenger.getPosition(), this);
|
||||
|
||||
@ -157,7 +157,7 @@ public class GameState {
|
||||
* where one can see who is a ghost and who is a human, who is a player and who an NPC
|
||||
* @return a String that displays passengerTrain
|
||||
*/
|
||||
public String toString() {
|
||||
public String toGhostString() {
|
||||
Passenger[] array = passengerTrain;
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
String[] print = new String[6];
|
||||
|
||||
@ -67,7 +67,7 @@ public class ServerGameInfoHandler {
|
||||
msg = Protocol.printToClientConsole + "$Humans are voting";
|
||||
break;
|
||||
case GuiParameters.updateGameState:
|
||||
msg = Protocol.printToGUI + "$" + GuiParameters.updateGameState + game.getGameState().toString();
|
||||
msg = Protocol.printToGUI + "$" + GuiParameters.updateGameState + game.getGameState().toGhostString();
|
||||
break;
|
||||
default:
|
||||
if(!msg.contains("$")) {
|
||||
|
||||
@ -78,7 +78,7 @@ public class VoteHandler {
|
||||
if (!passengers[newGhostPosition].getIsSpectator()) {
|
||||
passengers[newGhostPosition].send(
|
||||
ClientGameInfoHandler.youGotGhostyfied, game);
|
||||
passengers[newGhostPosition].send(game.gameState.toString(), game);
|
||||
passengers[newGhostPosition].send(GuiParameters.updateGameState, game);
|
||||
}
|
||||
|
||||
/* notify passengers the ghosts passed by - for each ghost that ghostified a player, an instance of NoiseHandler
|
||||
|
||||
@ -47,7 +47,7 @@ public class GhostPlayer extends Ghost {
|
||||
public void send(String msg, Game game) {
|
||||
String formattedMsg;
|
||||
if (msg.equals(GuiParameters.updateGameState)) {
|
||||
formattedMsg = Protocol.printToGUI + "$" + GuiParameters.updateGameState + game.getGameState().toString();
|
||||
formattedMsg = Protocol.printToGUI + "$" + GuiParameters.updateGameState + game.getGameState().toGhostString();
|
||||
} else {
|
||||
formattedMsg = ServerGameInfoHandler.format(msg, this, game);
|
||||
}
|
||||
|
||||
@ -101,11 +101,17 @@ public class GameStateModel {
|
||||
}
|
||||
|
||||
public String getYourRoleFromPosition(int position) {
|
||||
try {
|
||||
return passengerTrainClone[1][position];
|
||||
} catch (Exception e) {
|
||||
LOGGER.info(e.getMessage());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public int getNrOfPlayers() {
|
||||
return nrOfPlayers;
|
||||
return
|
||||
nrOfPlayers;
|
||||
}
|
||||
|
||||
public void setDayClone(boolean dayClone) {
|
||||
|
||||
@ -396,12 +396,22 @@ public class GameController implements Initializable {
|
||||
}
|
||||
|
||||
public void setNoiseButtonInvisible() {
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
noiseButton.setVisible(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setNoiseButtonVisible() {
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
noiseButton.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a given message and displays it in the notificationText Flow in the game Scene
|
||||
|
||||
@ -18,10 +18,11 @@
|
||||
|
||||
|
||||
|
||||
.text-field{
|
||||
.textField{
|
||||
-fx-text-fill: white;
|
||||
-fx-background-color: transparent;
|
||||
-fx-effect: null;
|
||||
-fx-highlight-text-fill: black;
|
||||
-fx-animated: null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user