added finish text; edited Notifications
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
import pp.mdga.game.BonusCard;
|
||||
import pp.mdga.game.Color;
|
||||
import pp.mdga.game.Piece;
|
||||
import pp.mdga.notification.FinishNotification;
|
||||
import pp.mdga.notification.SelectableCardsNotification;
|
||||
|
||||
import java.util.List;
|
||||
@@ -116,7 +117,7 @@ else if(boardSelect != null) {
|
||||
}
|
||||
if(name.equals("Test") &&isPressed){
|
||||
if(app.getView() instanceof GameView gameView){
|
||||
app.getNotificationSynchronizer().addTestNotification(new SelectableCardsNotification(List.of(BonusCard.SHIELD)));
|
||||
app.getNotificationSynchronizer().addTestNotification(new FinishNotification(Color.NAVY));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,8 +113,6 @@ private void handleGame(Notification notification) {
|
||||
}
|
||||
} else if (notification instanceof DiceNowNotification) {
|
||||
guiHandler.showDice();
|
||||
} else if (notification instanceof DicingNotification n) {
|
||||
//TODO ???
|
||||
} else if (notification instanceof DrawCardNotification n) {
|
||||
guiHandler.drawCard(n.getColor());
|
||||
} else if (notification instanceof HomeMoveNotification home) {
|
||||
@@ -131,6 +129,7 @@ private void handleGame(Notification notification) {
|
||||
//InfieldMove
|
||||
boardHandler.movePiece(n.getPiece(), n.getStartIndex(), n.getMoveIndex());
|
||||
}
|
||||
guiHandler.hideText();
|
||||
} else if (notification instanceof ThrowPieceNotification n) {
|
||||
boardHandler.throwPiece(n.getPieceId());
|
||||
} else if (notification instanceof NoShieldNotification n) {
|
||||
@@ -179,6 +178,8 @@ private void handleGame(Notification notification) {
|
||||
modelSynchronizer.setSwap(false);
|
||||
} else if (notification instanceof TurboActiveNotification){
|
||||
guiHandler.turbo();
|
||||
} else if (notification instanceof FinishNotification n){
|
||||
guiHandler.finish(n.getColorFinished());
|
||||
} else {
|
||||
throw new RuntimeException("notification not expected: " + notification.toString());
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
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){
|
||||
return switch (color){
|
||||
case ARMY -> ColorRGBA.Green;
|
||||
|
||||
@@ -51,7 +51,7 @@ public void rollDice(int rollNum, int mult) {
|
||||
if(mult == -1) actionTextHandler.ownDice(rollNum);
|
||||
else actionTextHandler.ownDiceMult(rollNum, mult);
|
||||
hideDice();
|
||||
//TODO send Model finished
|
||||
app.getModelSynchronize().animationEnd();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -129,5 +129,10 @@ public void drawCard(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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user