Merge commit
This commit is contained in:
@@ -119,4 +119,6 @@ public ModelSyncronizer getModelSyncronizer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InputSynchronizer getInputSyncronizer() { return inputSynchronizer; }
|
public InputSynchronizer getInputSyncronizer() { return inputSynchronizer; }
|
||||||
|
|
||||||
|
public NotificationSynchronizer getNotificationSynchronizer() { return notificationSynchronizer; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,76 +1,98 @@
|
|||||||
package pp.mdga.client;
|
package pp.mdga.client;
|
||||||
|
|
||||||
import pp.mdga.client.view.CeremonyView;
|
import pp.mdga.client.view.CeremonyView;
|
||||||
|
import pp.mdga.client.view.GameView;
|
||||||
import pp.mdga.client.view.LobbyView;
|
import pp.mdga.client.view.LobbyView;
|
||||||
|
import pp.mdga.game.BonusCard;
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
|
import pp.mdga.notification.AcquireCardNotification;
|
||||||
|
import pp.mdga.notification.DrawCardNotification;
|
||||||
|
import pp.mdga.notification.TskSelectNotification;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class ModelSyncronizer {
|
public class ModelSyncronizer {
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(ModelSyncronizer.class.getName());
|
||||||
private MdgaApp app;
|
private MdgaApp app;
|
||||||
|
|
||||||
ModelSyncronizer(MdgaApp app) {
|
ModelSyncronizer(MdgaApp app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectPiece() {
|
public void animationEnd() {
|
||||||
//TODO call from somewhere
|
|
||||||
System.out.println("selectPiece");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectCard() {
|
public void selectSwap(UUID a, UUID b) {
|
||||||
//TODO call from somewhere
|
// TODO call from somewhere
|
||||||
System.out.println("selectCard");
|
LOGGER.log(Level.INFO, "selectPiece");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectPiece(UUID piece) {
|
||||||
|
// TODO call from somewhere
|
||||||
|
LOGGER.log(Level.INFO, "selectPiece");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectCard(BonusCard card) {
|
||||||
|
// TODO call from somewhere
|
||||||
|
LOGGER.log(Level.INFO, "selectCard");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void confirm() {
|
||||||
|
LOGGER.log(Level.INFO, "confirm");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectTsk(Color color) {
|
public void selectTsk(Color color) {
|
||||||
//TODO call from somewhere
|
// TODO call from somewhere
|
||||||
System.out.println("selectTsk: " + color);
|
LOGGER.log(Level.INFO, "selectTsk: {0}", color);
|
||||||
LobbyView view = (LobbyView) app.getView();
|
LobbyView view = (LobbyView) app.getView();
|
||||||
view.setTaken(color, true, true, "OwnPlayerName");
|
view.setTaken(color, true, true, "OwnPlayerName");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unselectTsk() {
|
public void unselectTsk() {
|
||||||
//TODO call from somewhere
|
// TODO call from somewhere
|
||||||
System.out.println("unselectTsk");
|
LOGGER.log(Level.INFO, "unselectTsk");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rolledDice() {
|
public void rolledDice() {
|
||||||
//TODO call from somewhere
|
// TODO call from somewhere
|
||||||
System.out.println("rolledDice");
|
LOGGER.log(Level.INFO, "rolledDice");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
//TODO call from somewhere
|
// TODO call from somewhere
|
||||||
System.out.println("setName:" + name);
|
LOGGER.log(Level.INFO, "setName: {0}", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReady() {
|
public void setReady() {
|
||||||
//TODO call from somewhere
|
LOGGER.log(Level.INFO, "setReady");
|
||||||
System.out.println("setReady");
|
enter(MdgaState.GAME);
|
||||||
app.enter(MdgaState.GAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHost(int port) {
|
public void setHost(int port) {
|
||||||
//TODO call from somewhere
|
// TODO call from somewhere
|
||||||
System.out.println("setHost: " + port);
|
LOGGER.log(Level.INFO, "setHost: {0}", port);
|
||||||
app.enter(MdgaState.LOBBY);
|
enter(MdgaState.LOBBY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJoin(String ip, int port) {
|
public void setJoin(String ip, int port) {
|
||||||
//TODO call from somewhere
|
// TODO call from somewhere
|
||||||
System.out.println("setJoin");
|
LOGGER.log(Level.INFO, "setJoin with IP: {0}, Port: {1}", new Object[]{ip, port});
|
||||||
app.enter(MdgaState.LOBBY);
|
enter(MdgaState.LOBBY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void leave() {
|
public void leave() {
|
||||||
System.out.println("leave");
|
LOGGER.log(Level.INFO, "leave");
|
||||||
app.enter(MdgaState.MAIN);
|
enter(MdgaState.MAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enter(MdgaState state) {
|
public void enter(MdgaState state) {
|
||||||
System.out.println("enter:" + state);
|
LOGGER.log(Level.INFO, "enter: {0}", state);
|
||||||
app.enter(state);
|
app.enter(state);
|
||||||
|
|
||||||
if(state == MdgaState.CEREMONY) {
|
if (state == MdgaState.CEREMONY) {
|
||||||
CeremonyView ceremonyView = (CeremonyView) app.getView();
|
CeremonyView ceremonyView = (CeremonyView) app.getView();
|
||||||
ceremonyView.addCeremonyParticipant(Color.AIRFORCE, 1, "ugidffdg");
|
ceremonyView.addCeremonyParticipant(Color.AIRFORCE, 1, "ugidffdg");
|
||||||
ceremonyView.addCeremonyParticipant(Color.ARMY, 2, "ugidffdg");
|
ceremonyView.addCeremonyParticipant(Color.ARMY, 2, "ugidffdg");
|
||||||
@@ -83,5 +105,19 @@ public void enter(MdgaState state) {
|
|||||||
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
|
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
|
||||||
ceremonyView.addStatisticsRow("Gesamt", 1, 2, 3, 4, 5, 6);
|
ceremonyView.addStatisticsRow("Gesamt", 1, 2, 3, 4, 5, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state == MdgaState.GAME) {
|
||||||
|
GameView gameView = (GameView) app.getView();
|
||||||
|
|
||||||
|
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));
|
||||||
|
lobbyView.setReady(Color.ARMY, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ private void handleMain(Notification notification) {
|
|||||||
private void handleLobby(Notification notification) {
|
private void handleLobby(Notification notification) {
|
||||||
LobbyView lobbyView = (LobbyView) app.getView();
|
LobbyView lobbyView = (LobbyView) app.getView();
|
||||||
|
|
||||||
if (notification instanceof TskSelectNotification) {
|
if (notification instanceof TskSelectNotification tskSelectNotification) {
|
||||||
TskSelectNotification n = (TskSelectNotification)notification;
|
lobbyView.setTaken(tskSelectNotification.getColor(), true, tskSelectNotification.isSelf(), tskSelectNotification.getName());
|
||||||
lobbyView.setTaken(n.getColor(), true, n.isSelf(), n.getName());
|
} else if (notification instanceof TskUnselectNotification tskUnselectNotification) {
|
||||||
} else if (notification instanceof TskUnselectNotification) {
|
lobbyView.setTaken(tskUnselectNotification.getColor(), false, false, null);
|
||||||
TskUnselectNotification n = (TskUnselectNotification)notification;
|
//} else if(notification instanceof LobbyReadyNotification lobbyReadyNotification) {
|
||||||
lobbyView.setTaken(n.getColor(), false, false, null);
|
// lobbyView.setReady(lobbyReadyNotification.getColor(), lobbyReadyNotification.isReady()):
|
||||||
} else if (notification instanceof GameNotification) {
|
} else if (notification instanceof GameNotification) {
|
||||||
app.enter(MdgaState.GAME);
|
app.enter(MdgaState.GAME);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ public enum Taken {
|
|||||||
OTHER,
|
OTHER,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static final ColorRGBA LOBBY_TAKEN = ColorRGBA.fromRGBA255(193,58,59, 25);
|
||||||
|
static final ColorRGBA LOBBY_READY = ColorRGBA.fromRGBA255(55,172,190, 25);
|
||||||
|
static final ColorRGBA LOBBY_READY_HOVER = ColorRGBA.fromRGBA255(17,211,218, 25);
|
||||||
|
static final ColorRGBA LOBBY_SELF_NORMAL = ColorRGBA.fromRGBA255(34,103,24, 25);
|
||||||
|
static final ColorRGBA LOBBY_SELF_HOVER = ColorRGBA.fromRGBA255(42,151,19, 25);
|
||||||
|
|
||||||
static final float WIDTH = 4.0f;
|
static final float WIDTH = 4.0f;
|
||||||
|
|
||||||
private final Node node3d;
|
private final Node node3d;
|
||||||
@@ -33,6 +39,8 @@ public enum Taken {
|
|||||||
|
|
||||||
private LabelButton label;
|
private LabelButton label;
|
||||||
|
|
||||||
|
private boolean isReady = false;
|
||||||
|
|
||||||
public LobbyButton(MdgaApp app, Node node, Node node3d, Runnable action, Color tsk) {
|
public LobbyButton(MdgaApp app, Node node, Node node3d, Runnable action, Color tsk) {
|
||||||
super(app, node, action, "", new Vector2f(WIDTH, 7), new Vector2f(0, 0));
|
super(app, node, action, "", new Vector2f(WIDTH, 7), new Vector2f(0, 0));
|
||||||
|
|
||||||
@@ -89,17 +97,23 @@ public LobbyButton(MdgaApp app, Node node, Node node3d, Runnable action, Color t
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHover() {
|
public void onHover() {
|
||||||
/*switch (taken) {
|
ColorRGBA buttonPressed = BUTTON_PRESSED.clone();
|
||||||
|
|
||||||
|
switch (taken) {
|
||||||
case NOT:
|
case NOT:
|
||||||
|
buttonPressed.a = 0.3f;
|
||||||
break;
|
break;
|
||||||
case SELF:
|
case SELF:
|
||||||
|
buttonPressed = LOBBY_SELF_HOVER;
|
||||||
break;
|
break;
|
||||||
case OTHER:
|
case OTHER:
|
||||||
|
buttonPressed = LOBBY_TAKEN;
|
||||||
break;
|
break;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
ColorRGBA buttonPressed = BUTTON_PRESSED.clone();
|
if(isReady) {
|
||||||
buttonPressed.a = 0.3f;
|
buttonPressed = LOBBY_READY_HOVER;
|
||||||
|
}
|
||||||
|
|
||||||
QuadBackgroundComponent background = new QuadBackgroundComponent(buttonPressed);
|
QuadBackgroundComponent background = new QuadBackgroundComponent(buttonPressed);
|
||||||
instance.setBackground(background);
|
instance.setBackground(background);
|
||||||
@@ -109,17 +123,23 @@ public void onHover() {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUnHover() {
|
public void onUnHover() {
|
||||||
/*switch (taken) {
|
ColorRGBA buttonNormal = ColorRGBA.Gray.clone();// BUTTON_NORMAL.clone();
|
||||||
|
|
||||||
|
switch (taken) {
|
||||||
case NOT:
|
case NOT:
|
||||||
|
buttonNormal.a = 0.1f;
|
||||||
break;
|
break;
|
||||||
case SELF:
|
case SELF:
|
||||||
|
buttonNormal = LOBBY_SELF_NORMAL;
|
||||||
break;
|
break;
|
||||||
case OTHER:
|
case OTHER:
|
||||||
|
buttonNormal = LOBBY_TAKEN;
|
||||||
break;
|
break;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
ColorRGBA buttonNormal = ColorRGBA.Gray.clone();// BUTTON_NORMAL.clone();
|
if(isReady) {
|
||||||
buttonNormal.a = 0.1f;
|
buttonNormal = LOBBY_READY;
|
||||||
|
}
|
||||||
|
|
||||||
QuadBackgroundComponent background = new QuadBackgroundComponent(buttonNormal);
|
QuadBackgroundComponent background = new QuadBackgroundComponent(buttonNormal);
|
||||||
instance.setBackground(background);
|
instance.setBackground(background);
|
||||||
@@ -184,8 +204,15 @@ public void setTaken(Taken taken, String name) {
|
|||||||
|
|
||||||
if(taken == Taken.NOT) {
|
if(taken == Taken.NOT) {
|
||||||
label.setText("- leer -");
|
label.setText("- leer -");
|
||||||
|
isReady = false;
|
||||||
} else {
|
} else {
|
||||||
label.setText(name);
|
label.setText(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onUnHover();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReady(boolean isReady) {
|
||||||
|
this.isReady = isReady;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public class GameView extends MdgaView {
|
|||||||
private ButtonRight cheatButton; //TODO
|
private ButtonRight cheatButton; //TODO
|
||||||
|
|
||||||
private ButtonLeft leaveButton;
|
private ButtonLeft leaveButton;
|
||||||
|
private ButtonRight confirmButton;
|
||||||
|
|
||||||
private Color ownColor = null;
|
private Color ownColor = null;
|
||||||
|
|
||||||
@@ -41,7 +42,9 @@ public GameView(MdgaApp app) {
|
|||||||
super(app);
|
super(app);
|
||||||
|
|
||||||
cheatButton = new ButtonRight(app, settingsNode, () -> app.getModelSyncronizer().enter(MdgaState.CEREMONY), "CHEAT", 1);
|
cheatButton = new ButtonRight(app, settingsNode, () -> app.getModelSyncronizer().enter(MdgaState.CEREMONY), "CHEAT", 1);
|
||||||
|
|
||||||
leaveButton = new ButtonLeft(app, settingsNode, () -> app.getModelSyncronizer().leave(), "Spiel verlassen", 1);
|
leaveButton = new ButtonLeft(app, settingsNode, () -> app.getModelSyncronizer().leave(), "Spiel verlassen", 1);
|
||||||
|
confirmButton = new ButtonRight(app, settingsNode, () -> app.getModelSyncronizer().confirm(), "Bestätigen", 1);
|
||||||
|
|
||||||
fpp = new FilterPostProcessor(app.getAssetManager());
|
fpp = new FilterPostProcessor(app.getAssetManager());
|
||||||
this.camera = new CameraHandler(app, fpp);
|
this.camera = new CameraHandler(app, fpp);
|
||||||
|
|||||||
@@ -139,6 +139,23 @@ public void setTaken(Color color, boolean isTaken, boolean isSelf, String name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setReady(Color color, boolean isReady) {
|
||||||
|
switch (color) {
|
||||||
|
case CYBER:
|
||||||
|
cyberButton.setReady(isReady);
|
||||||
|
break;
|
||||||
|
case AIRFORCE:
|
||||||
|
airforceButton.setReady(isReady);
|
||||||
|
break;
|
||||||
|
case ARMY:
|
||||||
|
armyButton.setReady(isReady);
|
||||||
|
break;
|
||||||
|
case NAVY:
|
||||||
|
navyButton.setReady(isReady);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void toggleTsk(Color color) {
|
private void toggleTsk(Color color) {
|
||||||
LobbyButton.Taken taken = LobbyButton.Taken.NOT;
|
LobbyButton.Taken taken = LobbyButton.Taken.NOT;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user