Add confirm button
This commit is contained in:
@@ -17,6 +17,10 @@ public class ModelSyncronizer {
|
||||
private static final Logger LOGGER = Logger.getLogger(ModelSyncronizer.class.getName());
|
||||
private MdgaApp app;
|
||||
|
||||
private UUID a;
|
||||
private UUID b;
|
||||
private BonusCard card;
|
||||
|
||||
ModelSyncronizer(MdgaApp app) {
|
||||
this.app = app;
|
||||
}
|
||||
@@ -26,43 +30,73 @@ public void animationEnd() {
|
||||
}
|
||||
|
||||
public void selectSwap(UUID a, UUID b) {
|
||||
// TODO call from somewhere
|
||||
LOGGER.log(Level.INFO, "selectPiece");
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
|
||||
GameView gameView = (GameView) app.getView();
|
||||
if(a != null && b != null) {
|
||||
gameView.needConfirm();
|
||||
} else {
|
||||
gameView.noConfirm();
|
||||
}
|
||||
}
|
||||
|
||||
public void selectPiece(UUID piece) {
|
||||
// TODO call from somewhere
|
||||
LOGGER.log(Level.INFO, "selectPiece");
|
||||
|
||||
this.a = piece;
|
||||
|
||||
GameView gameView = (GameView) app.getView();
|
||||
if(piece != null) {
|
||||
gameView.needConfirm();
|
||||
} else {
|
||||
gameView.noConfirm();
|
||||
}
|
||||
}
|
||||
|
||||
public void selectCard(BonusCard card) {
|
||||
// TODO call from somewhere
|
||||
LOGGER.log(Level.INFO, "selectCard");
|
||||
|
||||
this.card = card;
|
||||
|
||||
GameView gameView = (GameView) app.getView();
|
||||
if(card != null) {
|
||||
gameView.needConfirm();
|
||||
} else {
|
||||
gameView.noConfirm();
|
||||
}
|
||||
}
|
||||
|
||||
public void confirm() {
|
||||
LOGGER.log(Level.INFO, "confirm");
|
||||
|
||||
if(a != null && b != null) {
|
||||
//swap
|
||||
} else if (a != null) {
|
||||
//piece
|
||||
} else if (card != null){
|
||||
//card
|
||||
} else {
|
||||
throw new RuntimeException("nothing to confirm");
|
||||
}
|
||||
}
|
||||
|
||||
public void selectTsk(Color color) {
|
||||
// TODO call from somewhere
|
||||
LOGGER.log(Level.INFO, "selectTsk: {0}", color);
|
||||
LobbyView view = (LobbyView) app.getView();
|
||||
view.setTaken(color, true, true, "OwnPlayerName");
|
||||
}
|
||||
|
||||
public void unselectTsk() {
|
||||
// TODO call from somewhere
|
||||
LOGGER.log(Level.INFO, "unselectTsk");
|
||||
}
|
||||
|
||||
public void rolledDice() {
|
||||
// TODO call from somewhere
|
||||
LOGGER.log(Level.INFO, "rolledDice");
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
// TODO call from somewhere
|
||||
LOGGER.log(Level.INFO, "setName: {0}", name);
|
||||
}
|
||||
|
||||
@@ -72,13 +106,11 @@ public void setReady() {
|
||||
}
|
||||
|
||||
public void setHost(int port) {
|
||||
// TODO call from somewhere
|
||||
LOGGER.log(Level.INFO, "setHost: {0}", port);
|
||||
enter(MdgaState.LOBBY);
|
||||
}
|
||||
|
||||
public void setJoin(String ip, int port) {
|
||||
// TODO call from somewhere
|
||||
LOGGER.log(Level.INFO, "setJoin with IP: {0}, Port: {1}", new Object[]{ip, port});
|
||||
enter(MdgaState.LOBBY);
|
||||
}
|
||||
@@ -109,14 +141,14 @@ public void enter(MdgaState state) {
|
||||
if (state == MdgaState.GAME) {
|
||||
GameView gameView = (GameView) app.getView();
|
||||
|
||||
app.getNotificationSynchronizer().addTestNotification(new DrawCardNotification(Color.AIRFORCE, BonusCard.SHIELD));
|
||||
//app.getNotificationSynchronizer().addTestNotification(new DrawCardNotification(Color.AIRFORCE, BonusCard.SHIELD));
|
||||
}
|
||||
|
||||
if (state == MdgaState.LOBBY) {
|
||||
LobbyView lobbyView = (LobbyView) app.getView();
|
||||
|
||||
app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.CYBER, "blablabupp", false));
|
||||
app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.ARMY, "Spieler 2", false));
|
||||
//app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.CYBER, "blablabupp", false));
|
||||
//app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.ARMY, "Spieler 2", false));
|
||||
lobbyView.setReady(Color.ARMY, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,4 +117,12 @@ public void setOwnColor(Color ownColor) {
|
||||
public Color getOwnColor() {
|
||||
return ownColor;
|
||||
}
|
||||
|
||||
public void needConfirm() {
|
||||
confirmButton.show();
|
||||
}
|
||||
|
||||
public void noConfirm() {
|
||||
confirmButton.hide();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user