fixed missing messages
This commit is contained in:
@@ -145,11 +145,11 @@ private void handleGame(Notification notification) {
|
||||
//TODO
|
||||
} else if (notification instanceof RollDiceNotification n) {
|
||||
if(n.getColor() == gameView.getOwnColor()){
|
||||
//guiHandler.rollDice(n.getEyes(), n.isTurbo() ? n.getMultiplier() : -1);
|
||||
guiHandler.rollDice(n.getEyes(), n.isTurbo() ? n.getMultiplier() : -1);
|
||||
}
|
||||
else {
|
||||
//if (n.isTurbo()) guiHandler.showRolledDiceMult(n.getEyes(), n.getMultiplier(), n.getColor());
|
||||
//else guiHandler.showRolledDice(n.getEyes(), n.getColor());
|
||||
if (n.isTurbo()) guiHandler.showRolledDiceMult(n.getEyes(), n.getMultiplier(), n.getColor());
|
||||
else guiHandler.showRolledDice(n.getEyes(), n.getColor());
|
||||
}
|
||||
} else if (notification instanceof SelectableCardsNotification n) {
|
||||
guiHandler.setSelectableCards(n.getCards());
|
||||
@@ -168,10 +168,10 @@ private void handleGame(Notification notification) {
|
||||
boardHandler.outlineMove(n.getPieces(), n.getMoveIndexe(), n.getHomeMoves());
|
||||
} else if (notification instanceof SelectableSwapNotification n) {
|
||||
boardHandler.outlineSwap(n.getOwnPieces(), n.getEnemyPieces());
|
||||
// } //else if (notification instanceof SelectableShieldNotification n) {
|
||||
// boardHandler.outlineShield(n.getOwnPieces());
|
||||
//} else if (notification instanceof TurboActiveNotification){
|
||||
// guiHandler.turbo();
|
||||
} else if (notification instanceof SelectableShieldNotification n) {
|
||||
boardHandler.outlineShield(n.getPieces());
|
||||
} else if (notification instanceof TurboActiveNotification){
|
||||
guiHandler.turbo();
|
||||
} else {
|
||||
throw new RuntimeException("notification not expected: " + notification.toString());
|
||||
}
|
||||
|
||||
@@ -15,11 +15,11 @@ public class GuiHandler {
|
||||
private final CardLayerHandler cardLayerHandler;
|
||||
private final PlayerNameHandler playerNameHandler;
|
||||
private final ActionTextHandler actionTextHandler;
|
||||
private final Color ownColor;
|
||||
private Color ownColor;
|
||||
|
||||
private FrameBuffer backFrameBuffer;
|
||||
|
||||
public GuiHandler(MdgaApp app, Node guiNode, Color ownColor) {
|
||||
public GuiHandler(MdgaApp app, Node guiNode) {
|
||||
this.app = app;
|
||||
this.ownColor = ownColor;
|
||||
|
||||
@@ -33,8 +33,10 @@ public GuiHandler(MdgaApp app, Node guiNode, Color ownColor) {
|
||||
actionTextHandler = new ActionTextHandler(guiNode, app.getAssetManager(), app.getContext().getSettings());
|
||||
}
|
||||
|
||||
public void init() {
|
||||
public void init(Color ownColor) {
|
||||
cardLayerHandler.init();
|
||||
playerNameHandler.show();
|
||||
this.ownColor = ownColor;
|
||||
app.getViewPort().setOutputFrameBuffer(backFrameBuffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,11 +12,15 @@
|
||||
import pp.mdga.game.BonusCard;
|
||||
import pp.mdga.game.Color;
|
||||
import pp.mdga.notification.AcquireCardNotification;
|
||||
import pp.mdga.notification.ActivePlayerNotification;
|
||||
import pp.mdga.notification.DiceNowNotification;
|
||||
import pp.mdga.notification.GameNotification;
|
||||
import pp.mdga.notification.MovePieceNotification;
|
||||
import pp.mdga.notification.PlayerInGameNotification;
|
||||
import pp.mdga.notification.RollDiceNotification;
|
||||
import pp.mdga.notification.SelectableCardsNotification;
|
||||
import pp.mdga.notification.SelectableMoveNotification;
|
||||
import pp.mdga.notification.ShieldActiveNotification;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -48,10 +52,23 @@ public GameView(MdgaApp app) {
|
||||
this.camera = new CameraHandler(app, fpp);
|
||||
this.boardHandler = new BoardHandler(app, rootNode, fpp);
|
||||
|
||||
guiHandler = new GuiHandler(app, guiNode, ownColor);
|
||||
guiHandler = new GuiHandler(app, guiNode);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnter() {
|
||||
camera.init();
|
||||
boardHandler.init();
|
||||
setOwnColor(Color.AIRFORCE);
|
||||
guiHandler.init(ownColor);
|
||||
|
||||
app.getViewPort().addProcessor(fpp);
|
||||
|
||||
app.getAcousticHandler().playSound(MdgaSound.START);
|
||||
|
||||
|
||||
//Test
|
||||
setOwnColor(Color.AIRFORCE);
|
||||
|
||||
List<UUID> uuid1 = new ArrayList<>();
|
||||
UUID p1 = UUID.randomUUID();
|
||||
@@ -60,27 +77,31 @@ public GameView(MdgaApp app) {
|
||||
uuid1.add(p2);
|
||||
uuid1.add(UUID.randomUUID());
|
||||
uuid1.add(UUID.randomUUID());
|
||||
List<UUID> uuid2 = new ArrayList<>();
|
||||
UUID p1_2 = UUID.randomUUID();
|
||||
UUID p2_2 = UUID.randomUUID();
|
||||
uuid2.add(p1_2);
|
||||
uuid2.add(p2_2);
|
||||
uuid2.add(UUID.randomUUID());
|
||||
uuid2.add(UUID.randomUUID());
|
||||
|
||||
|
||||
app.getNotificationSynchronizer().addTestNotification(new PlayerInGameNotification(Color.AIRFORCE, uuid1, "Cedric"));
|
||||
app.getNotificationSynchronizer().addTestNotification(new PlayerInGameNotification(Color.NAVY, uuid2, "Test"));
|
||||
app.getNotificationSynchronizer().addTestNotification(new MovePieceNotification(p1, 0, true));
|
||||
app.getNotificationSynchronizer().addTestNotification(new MovePieceNotification(p1_2, 30, true));
|
||||
app.getNotificationSynchronizer().addTestNotification(new SelectableMoveNotification(List.of(p1), List.of(4), List.of(false)));
|
||||
app.getNotificationSynchronizer().addTestNotification(new AcquireCardNotification(BonusCard.SHIELD));
|
||||
app.getNotificationSynchronizer().addTestNotification(new SelectableCardsNotification(List.of(BonusCard.SHIELD)));
|
||||
app.getNotificationSynchronizer().addTestNotification(new ShieldActiveNotification(p1));
|
||||
app.getNotificationSynchronizer().addTestNotification(new ActivePlayerNotification(Color.NAVY));
|
||||
|
||||
// app.getNotificationSynchronizer().addTestNotification(new DiceNowNotification());
|
||||
// app.getNotificationSynchronizer().addTestNotification(new RollDiceNotification(Color.AIRFORCE, 5, true, 2));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnter() {
|
||||
camera.init();
|
||||
boardHandler.init();
|
||||
guiHandler.init();
|
||||
|
||||
app.getViewPort().addProcessor(fpp);
|
||||
|
||||
app.getAcousticHandler().playSound(MdgaSound.START);
|
||||
p1 = p1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public void received(CeremonyMessage msg){
|
||||
@Override
|
||||
public void received(DieMessage msg){
|
||||
logic.getGame().setDiceEyes(msg.getDiceEye());
|
||||
logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), logic.getGame().getDiceEyes(), logic.getGame().getDiceEyes() * logic.getGame().getDiceModifier()));
|
||||
// logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), logic.getGame().getDiceEyes(), logic.getGame().getDiceEyes() * logic.getGame().getDiceModifier()));
|
||||
if(msg.getDiceEye() == 6){
|
||||
logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPlayerStatistic().increaseDiced6();
|
||||
logic.getGame().getGameStatistics().increaseDiced6();
|
||||
|
||||
@@ -40,7 +40,7 @@ public void received(DiceNowMessage msg){
|
||||
@Override
|
||||
public void received(DieMessage msg){
|
||||
logic.getGame().setDiceEyes(msg.getDiceEye());
|
||||
logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), logic.getGame().getDiceEyes(), logic.getGame().getDiceEyes() * logic.getGame().getDiceModifier()));
|
||||
// logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), logic.getGame().getDiceEyes(), logic.getGame().getDiceEyes() * logic.getGame().getDiceModifier()));
|
||||
if(msg.getDiceEye() == 6){
|
||||
logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPlayerStatistic().increaseDiced6();
|
||||
logic.getGame().getGameStatistics().increaseDiced6();
|
||||
|
||||
@@ -9,18 +9,26 @@ public class RollDiceNotification extends Notification{
|
||||
|
||||
private Color color;
|
||||
private int eyes;
|
||||
private int moveNumber;
|
||||
private boolean turbo;
|
||||
private int multiplier;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param color the color of the player that rolled the die.
|
||||
* @param eyes the number of eyes that were rolled.
|
||||
* @param moveNumber the number of the move that was made.
|
||||
*/
|
||||
public RollDiceNotification(Color color, int eyes, int moveNumber) {
|
||||
public RollDiceNotification(Color color, int eyes) {
|
||||
this.color = color;
|
||||
this.eyes = eyes;
|
||||
this.moveNumber = moveNumber;
|
||||
this.turbo = false;
|
||||
this.multiplier = -1;
|
||||
}
|
||||
|
||||
public RollDiceNotification(Color color, int eyes, boolean turbo, int multiplier) {
|
||||
this.color = color;
|
||||
this.eyes = eyes;
|
||||
this.turbo = turbo;
|
||||
this.multiplier = multiplier;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,11 +47,11 @@ public int getEyes() {
|
||||
return eyes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of the move that was made.
|
||||
* @return the number of the move that was made.
|
||||
*/
|
||||
public int getMoveNumber() {
|
||||
return moveNumber;
|
||||
public int getMultiplier() {
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
public boolean isTurbo() {
|
||||
return turbo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package pp.mdga.notification;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SelectableShieldNotification extends Notification{
|
||||
private List<UUID> pieces;
|
||||
|
||||
public SelectableShieldNotification(List<UUID> pieces){
|
||||
this.pieces = pieces;
|
||||
}
|
||||
|
||||
public List<UUID> getPieces() {
|
||||
return pieces;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.notification;
|
||||
|
||||
public class TurboActiveNotification extends Notification{
|
||||
}
|
||||
Reference in New Issue
Block a user