merge dev into test #30

Merged
j23f0712 merged 45 commits from development into dev/test 2024-12-02 01:29:40 +01:00
6 changed files with 36 additions and 35 deletions
Showing only changes of commit 9dd2d3f58b - Show all commits

View File

@@ -21,6 +21,7 @@
import pp.mdga.game.BonusCard; import pp.mdga.game.BonusCard;
import pp.mdga.game.Color; import pp.mdga.game.Color;
import pp.mdga.game.Piece; import pp.mdga.game.Piece;
import pp.mdga.notification.FinishNotification;
import pp.mdga.notification.SelectableCardsNotification; import pp.mdga.notification.SelectableCardsNotification;
import java.util.List; import java.util.List;
@@ -116,7 +117,7 @@ else if(boardSelect != null) {
} }
if(name.equals("Test") &&isPressed){ if(name.equals("Test") &&isPressed){
if(app.getView() instanceof GameView gameView){ if(app.getView() instanceof GameView gameView){
app.getNotificationSynchronizer().addTestNotification(new SelectableCardsNotification(List.of(BonusCard.SHIELD))); app.getNotificationSynchronizer().addTestNotification(new FinishNotification(Color.NAVY));
} }
} }
} }

View File

@@ -113,8 +113,6 @@ private void handleGame(Notification notification) {
} }
} else if (notification instanceof DiceNowNotification) { } else if (notification instanceof DiceNowNotification) {
guiHandler.showDice(); guiHandler.showDice();
} else if (notification instanceof DicingNotification n) {
//TODO ???
} else if (notification instanceof DrawCardNotification n) { } else if (notification instanceof DrawCardNotification n) {
guiHandler.drawCard(n.getColor()); guiHandler.drawCard(n.getColor());
} else if (notification instanceof HomeMoveNotification home) { } else if (notification instanceof HomeMoveNotification home) {
@@ -131,6 +129,7 @@ private void handleGame(Notification notification) {
//InfieldMove //InfieldMove
boardHandler.movePiece(n.getPiece(), n.getStartIndex(), n.getMoveIndex()); boardHandler.movePiece(n.getPiece(), n.getStartIndex(), n.getMoveIndex());
} }
guiHandler.hideText();
} else if (notification instanceof ThrowPieceNotification n) { } else if (notification instanceof ThrowPieceNotification n) {
boardHandler.throwPiece(n.getPieceId()); boardHandler.throwPiece(n.getPieceId());
} else if (notification instanceof NoShieldNotification n) { } else if (notification instanceof NoShieldNotification n) {
@@ -179,6 +178,8 @@ private void handleGame(Notification notification) {
modelSynchronizer.setSwap(false); modelSynchronizer.setSwap(false);
} else if (notification instanceof TurboActiveNotification){ } else if (notification instanceof TurboActiveNotification){
guiHandler.turbo(); guiHandler.turbo();
} else if (notification instanceof FinishNotification n){
guiHandler.finish(n.getColorFinished());
} else { } else {
throw new RuntimeException("notification not expected: " + notification.toString()); throw new RuntimeException("notification not expected: " + notification.toString());
} }

View File

@@ -111,6 +111,16 @@ public void drawCardOwn(Color color){
createTopText(new String[]{"Du"," erhälst eine Bonuskarte"}, 5,70, new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0).addControl(new ZoomControl()); createTopText(new String[]{"Du"," erhälst eine Bonuskarte"}, 5,70, new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0).addControl(new ZoomControl());
} }
public void finishText(String name, Color color){
createTopText(new String[]{name," ist fertig!"}, 7,70, new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0).addControl(new ZoomControl());
}
public void finishTextOwn(Color color){
createTopText(new String[]{"Du", " bist fertig!"}, 7,70, new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0).addControl(new ZoomControl());
}
private ColorRGBA playerColorToColorRGBA(Color color){ private ColorRGBA playerColorToColorRGBA(Color color){
return switch (color){ return switch (color){
case ARMY -> ColorRGBA.Green; case ARMY -> ColorRGBA.Green;

View File

@@ -51,7 +51,7 @@ public void rollDice(int rollNum, int mult) {
if(mult == -1) actionTextHandler.ownDice(rollNum); if(mult == -1) actionTextHandler.ownDice(rollNum);
else actionTextHandler.ownDiceMult(rollNum, mult); else actionTextHandler.ownDiceMult(rollNum, mult);
hideDice(); hideDice();
//TODO send Model finished app.getModelSynchronize().animationEnd();
}); });
} }
@@ -129,5 +129,10 @@ public void drawCard(Color color) {
else actionTextHandler.drawCard(playerNameHandler.getName(color), color); else actionTextHandler.drawCard(playerNameHandler.getName(color), color);
} }
public void finish(Color color){
if(ownColor == color) actionTextHandler.finishTextOwn(color);
else actionTextHandler.finishText(playerNameHandler.getName(color), color);
}
} }

View File

@@ -1,31 +0,0 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
/**
* Notification that is sent when a player has diced.
*/
public class DicingNotification extends Notification {
/**
* The color of the player that diced.
*/
private final Color color;
/**
* Constructor.
*
* @param color The color of the player that diced.
*/
public DicingNotification(Color color) {
this.color = color;
}
/**
* Get the color of the player that diced.
*
* @return The color of the player that diced.
*/
public Color getColor() {
return color;
}
}

View File

@@ -0,0 +1,15 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
public class FinishNotification extends Notification{
private Color colorFinished;
public FinishNotification(Color colorFinished){
this.colorFinished = colorFinished;
}
public Color getColorFinished() {
return colorFinished;
}
}