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