Fixed some quirks with the YourRole checking, now the full Wagon should appear at the right time
This commit is contained in:
parent
c3683a1083
commit
84ed547372
@ -5,3 +5,4 @@ Jonas of Istanbul
|
||||
serai
|
||||
serai
|
||||
serai
|
||||
serai
|
||||
|
||||
@ -371,6 +371,7 @@ public class Client {
|
||||
//TODO
|
||||
break;
|
||||
case GuiParameters.VoteIsOver:
|
||||
chatApp.getGameController().setNoiseButtonInvisible();
|
||||
chatApp.getGameController().clearAllNoiseDisplay();
|
||||
break;
|
||||
case GuiParameters.getMembersInLobby:
|
||||
|
||||
@ -50,6 +50,7 @@ public class JClientProtocolParser {
|
||||
break;
|
||||
case Protocol.serverConfirmQuit:
|
||||
c.disconnectFromServer();
|
||||
c.getGameStateModel().setGameOver(true);
|
||||
break;
|
||||
case Protocol.serverRequestsGhostVote:
|
||||
LOGGER.debug("Ghost received Vote request");
|
||||
|
||||
@ -26,16 +26,24 @@ public class DayNightChangeListener implements Runnable {
|
||||
while(!gameStateModel.isGameOver()) {
|
||||
if(gameStateModel.getDayClone()) { //its Day
|
||||
LoungeSceneViewController.getTrainAnimationDayController().dontShowFullWagon();
|
||||
Sprites.setDaySprites(gameStateModel.getPassengerTrainClone()[1], GameController.getGameStateModel().getKickedOff());
|
||||
chatApp.getGameController().updateGameSprites(LoungeSceneViewController.getTrainAnimationDayController());
|
||||
Sprites.setDaySprites(gameStateModel.getPassengerTrainClone()[1],
|
||||
GameController.getGameStateModel().getKickedOff());
|
||||
chatApp.getGameController()
|
||||
.updateGameSprites(LoungeSceneViewController.getTrainAnimationDayController());
|
||||
chatApp.getGameController().setNoiseButtonVisible();
|
||||
chatApp.getGameController().setVoteButtonVisibilityDay(gameStateModel);
|
||||
} else { //its night
|
||||
if (gameStateModel.getYourRole().equals("h")) {
|
||||
try {
|
||||
if (gameStateModel.getYourRoleFromPosition(position).equals("")) {
|
||||
LoungeSceneViewController.getTrainAnimationDayController().showFullWagon();
|
||||
}
|
||||
Sprites.setNightSprites(gameStateModel.getPassengerTrainClone()[1], GameController.getGameStateModel().getKickedOff());
|
||||
chatApp.getGameController().updateGameSprites(LoungeSceneViewController.getTrainAnimationDayController());
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
}
|
||||
Sprites.setNightSprites(gameStateModel.getPassengerTrainClone()[1],
|
||||
GameController.getGameStateModel().getKickedOff());
|
||||
chatApp.getGameController()
|
||||
.updateGameSprites(LoungeSceneViewController.getTrainAnimationDayController());
|
||||
chatApp.getGameController().setNoiseButtonInvisible();
|
||||
chatApp.getGameController().setVoteButtonVisibilityNight(gameStateModel);
|
||||
}
|
||||
|
||||
@ -30,6 +30,8 @@ public class GameStateModel {
|
||||
*/
|
||||
private String yourRole; //TODO: Maybe add a GUI field to show this in
|
||||
|
||||
private int yourPosition;
|
||||
|
||||
/**
|
||||
* A primitive clone of the passengerTrain in the GameState of the server.
|
||||
* in passengerTrainClone[0] the names of the passengers are stored, in passengerTrainClone[1] the roles
|
||||
@ -98,6 +100,10 @@ public class GameStateModel {
|
||||
return yourRole;
|
||||
}
|
||||
|
||||
public String getYourRoleFromPosition(int position) {
|
||||
return passengerTrainClone[1][position];
|
||||
}
|
||||
|
||||
public int getNrOfPlayers() {
|
||||
return nrOfPlayers;
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ public class GameController implements Initializable {
|
||||
@Override
|
||||
public void run() {
|
||||
LOGGER.debug(buttonRoom0);
|
||||
if (g.getYourRole().equals("h")) {
|
||||
if (g.getYourRoleFromPosition(client.getClient().getPosition()).equals("")) { //human
|
||||
try {
|
||||
buttonRoom0.setVisible(true);
|
||||
buttonRoom1.setVisible(true);
|
||||
@ -177,7 +177,7 @@ public class GameController implements Initializable {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
} else { //ghost
|
||||
try {
|
||||
buttonRoom0.setVisible(false);
|
||||
buttonRoom1.setVisible(false);
|
||||
@ -198,7 +198,7 @@ public class GameController implements Initializable {
|
||||
@Override
|
||||
public void run() {
|
||||
LOGGER.debug(buttonRoom0);
|
||||
if (g.getYourRole().equals("g")) {
|
||||
if (g.getYourRoleFromPosition(client.getClient().getPosition()).equals("g")) {//ghost
|
||||
try {
|
||||
buttonRoom0.setVisible(true);
|
||||
buttonRoom1.setVisible(true);
|
||||
|
||||
Reference in New Issue
Block a user