Merge branch 'development2' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-01 into development2
This commit is contained in:
		@@ -18,7 +18,7 @@ public class GameView extends MdgaView {
 | 
			
		||||
    private GuiHandler guiHandler;
 | 
			
		||||
 | 
			
		||||
    private ButtonLeft leaveButton;
 | 
			
		||||
    private ButtonRight confirmButton;
 | 
			
		||||
    public ButtonRight confirmButton;
 | 
			
		||||
 | 
			
		||||
    private ButtonRight noPowerButton;
 | 
			
		||||
 | 
			
		||||
@@ -28,6 +28,9 @@ public class GameView extends MdgaView {
 | 
			
		||||
 | 
			
		||||
    private FilterPostProcessor fpp;
 | 
			
		||||
 | 
			
		||||
    public boolean needConfirm = false;
 | 
			
		||||
    public boolean needNoPower = false;
 | 
			
		||||
 | 
			
		||||
    private Node guiHandlerNode = new Node();
 | 
			
		||||
 | 
			
		||||
    public GameView(MdgaApp app) {
 | 
			
		||||
@@ -116,19 +119,26 @@ public Color getOwnColor() {
 | 
			
		||||
    public void needConfirm() {
 | 
			
		||||
        noPowerButton.hide();
 | 
			
		||||
        confirmButton.show();
 | 
			
		||||
 | 
			
		||||
        needConfirm = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void noConfirm() {
 | 
			
		||||
        confirmButton.hide();
 | 
			
		||||
 | 
			
		||||
        needConfirm = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void showNoPower() {
 | 
			
		||||
        confirmButton.hide();
 | 
			
		||||
        noPowerButton.show();
 | 
			
		||||
 | 
			
		||||
        needNoPower = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void hideNoPower() {
 | 
			
		||||
        noPowerButton.hide();
 | 
			
		||||
        needNoPower = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void enterInterrupt(Color color) {
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,6 @@ public void enter() {
 | 
			
		||||
    public void leave() {
 | 
			
		||||
        onLeave();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        settingsButton.hide();
 | 
			
		||||
 | 
			
		||||
        while (settingsDepth > 0) {
 | 
			
		||||
@@ -197,7 +196,13 @@ public void pressForward() {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (this instanceof GameView gameView) {
 | 
			
		||||
            app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
 | 
			
		||||
            if(gameView.needConfirm) {
 | 
			
		||||
                app.getModelSynchronize().confirm();
 | 
			
		||||
            } else if(gameView.needNoPower) {
 | 
			
		||||
                app.getModelSynchronize().confirm();
 | 
			
		||||
            } else {
 | 
			
		||||
                app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (this instanceof CeremonyView ceremonyView) {
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,8 @@
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.gamestate.TurnState;
 | 
			
		||||
import pp.mdga.game.BonusCard;
 | 
			
		||||
import pp.mdga.game.card.ShieldCard;
 | 
			
		||||
import pp.mdga.game.card.SwapCard;
 | 
			
		||||
import pp.mdga.message.client.AnimationEndMessage;
 | 
			
		||||
import pp.mdga.message.server.PlayCardMessage;
 | 
			
		||||
import pp.mdga.notification.PlayCardNotification;
 | 
			
		||||
@@ -13,7 +15,7 @@ public class PlayPowerCardState extends TurnStates {
 | 
			
		||||
    private final TurnState parent;
 | 
			
		||||
 | 
			
		||||
    private PlayCardMessage playCardMessage;
 | 
			
		||||
    private int animationCounter = 0;
 | 
			
		||||
    private int extraAnimationCounter = 0;
 | 
			
		||||
 | 
			
		||||
    public PlayPowerCardState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
@@ -22,11 +24,12 @@ public PlayPowerCardState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        animationCounter++;
 | 
			
		||||
        logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor() , playCardMessage.getCard().getCard()));
 | 
			
		||||
        if(!playCardMessage.getCard().getCard().equals(BonusCard.TURBO)){
 | 
			
		||||
            animationCounter++;
 | 
			
		||||
        if(playCardMessage.getCard() instanceof SwapCard) {
 | 
			
		||||
            extraAnimationCounter++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor() , playCardMessage.getCard().getCard()));
 | 
			
		||||
 | 
			
		||||
        handlePowerCard(playCardMessage);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -41,10 +44,12 @@ public void setPlayCard(PlayCardMessage playCardMessage) {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectAnimationEnd(){
 | 
			
		||||
        animationCounter--;
 | 
			
		||||
        if(animationCounter == 0){
 | 
			
		||||
            logic.send(new AnimationEndMessage());
 | 
			
		||||
            parent.setState(parent.getRollDice());
 | 
			
		||||
        if(extraAnimationCounter > 0) {
 | 
			
		||||
            extraAnimationCounter--;
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        logic.send(new AnimationEndMessage());
 | 
			
		||||
        parent.setState(parent.getRollDice());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,6 @@ public void exit() {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(SelectPieceMessage msg) {
 | 
			
		||||
        //TODO
 | 
			
		||||
        ArrayList<Piece> pieces = msg.getPieces().stream().map(piece -> logic.getGame().getPieceThroughUUID(piece.getUuid())).collect(Collectors.toCollection(ArrayList::new));
 | 
			
		||||
        parent.getSelectPiece().setPossiblePieces(pieces);
 | 
			
		||||
        ArrayList<UUID> listPiece = pieces.stream().map(Piece::getUuid).collect(Collectors.toCollection(ArrayList::new));
 | 
			
		||||
 
 | 
			
		||||
@@ -112,7 +112,6 @@ public void received(PossiblePieceMessage msg){
 | 
			
		||||
        if (msg.getEnemyPossiblePieces().isEmpty()){
 | 
			
		||||
            parent.getShield().setPossiblePieces(msg.getOwnPossiblePieces().stream().map(piece -> logic.getGame().getPieceThroughUUID(piece.getUuid())).collect(Collectors.toCollection(ArrayList::new)));
 | 
			
		||||
            parent.setState(parent.getShield());
 | 
			
		||||
            logic.addNotification(new SelectableShieldNotification(msg.getOwnPossiblePieces().stream().map(Piece::getUuid).toList()));
 | 
			
		||||
        } else {
 | 
			
		||||
            System.out.println("Should enter Swap State");
 | 
			
		||||
            parent.getSwap().setPossibleOwnPieces(msg.getOwnPossiblePieces().stream().map(piece -> logic.getGame().getPieceThroughUUID(piece.getUuid())).collect(Collectors.toCollection(ArrayList::new)));
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@
 | 
			
		||||
import pp.mdga.message.client.RequestPlayCardMessage;
 | 
			
		||||
import pp.mdga.message.client.SelectedPiecesMessage;
 | 
			
		||||
import pp.mdga.message.server.PlayCardMessage;
 | 
			
		||||
import pp.mdga.notification.SelectableShieldNotification;
 | 
			
		||||
 | 
			
		||||
import java.lang.System.Logger.Level;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@@ -27,8 +28,7 @@ public ShieldState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        logic.addNotification(null);
 | 
			
		||||
        //TODO: selectable piece notification
 | 
			
		||||
        logic.addNotification(new SelectableShieldNotification(possiblePieces.stream().map(Piece::getUuid).toList()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
 
 | 
			
		||||
@@ -94,8 +94,8 @@ public Game() {
 | 
			
		||||
     * This method initializes the draw pile with the predefined number of bonus cards.
 | 
			
		||||
     */
 | 
			
		||||
    private void initializeDrawPile() {
 | 
			
		||||
//        this.addBonusCards(new TurboCard(), AMOUNT_OF_TURBO_CARDS);
 | 
			
		||||
//        this.addBonusCards(new SwapCard(), AMOUNT_OF_SWAP_CARDS);
 | 
			
		||||
        this.addBonusCards(new TurboCard(), AMOUNT_OF_TURBO_CARDS);
 | 
			
		||||
        this.addBonusCards(new SwapCard(), AMOUNT_OF_SWAP_CARDS);
 | 
			
		||||
        this.addBonusCards(new ShieldCard(), AMOUNT_OF_SHIELD_CARDS);
 | 
			
		||||
        Collections.shuffle(this.drawPile);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user