mirror of
				https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
				synced 2025-11-04 07:06:16 +01:00 
			
		
		
		
	TradeReplay popup
This commit is contained in:
		@@ -12,6 +12,7 @@ import com.jme3.renderer.ViewPort;
 | 
				
			|||||||
import com.jme3.scene.control.AbstractControl;
 | 
					import com.jme3.scene.control.AbstractControl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import pp.monopoly.client.MonopolyApp;
 | 
					import pp.monopoly.client.MonopolyApp;
 | 
				
			||||||
 | 
					import pp.monopoly.client.gui.popups.AcceptTrade;
 | 
				
			||||||
import pp.monopoly.client.gui.popups.BuildingPropertyCard;
 | 
					import pp.monopoly.client.gui.popups.BuildingPropertyCard;
 | 
				
			||||||
import pp.monopoly.client.gui.popups.ConfirmTrade;
 | 
					import pp.monopoly.client.gui.popups.ConfirmTrade;
 | 
				
			||||||
import pp.monopoly.client.gui.popups.EventCardPopup;
 | 
					import pp.monopoly.client.gui.popups.EventCardPopup;
 | 
				
			||||||
@@ -21,12 +22,14 @@ import pp.monopoly.client.gui.popups.Gulag;
 | 
				
			|||||||
import pp.monopoly.client.gui.popups.GulagInfo;
 | 
					import pp.monopoly.client.gui.popups.GulagInfo;
 | 
				
			||||||
import pp.monopoly.client.gui.popups.LooserPopUp;
 | 
					import pp.monopoly.client.gui.popups.LooserPopUp;
 | 
				
			||||||
import pp.monopoly.client.gui.popups.NoMoneyWarning;
 | 
					import pp.monopoly.client.gui.popups.NoMoneyWarning;
 | 
				
			||||||
 | 
					import pp.monopoly.client.gui.popups.RejectTrade;
 | 
				
			||||||
import pp.monopoly.client.gui.popups.Rent;
 | 
					import pp.monopoly.client.gui.popups.Rent;
 | 
				
			||||||
import pp.monopoly.client.gui.popups.TimeOut;
 | 
					import pp.monopoly.client.gui.popups.TimeOut;
 | 
				
			||||||
import pp.monopoly.client.gui.popups.WinnerPopUp;
 | 
					import pp.monopoly.client.gui.popups.WinnerPopUp;
 | 
				
			||||||
import pp.monopoly.game.server.Player;
 | 
					import pp.monopoly.game.server.Player;
 | 
				
			||||||
import pp.monopoly.game.server.PlayerHandler;
 | 
					import pp.monopoly.game.server.PlayerHandler;
 | 
				
			||||||
import pp.monopoly.message.server.NotificationMessage;
 | 
					import pp.monopoly.message.server.NotificationMessage;
 | 
				
			||||||
 | 
					import pp.monopoly.message.server.TradeReply;
 | 
				
			||||||
import pp.monopoly.model.fields.BuildingProperty;
 | 
					import pp.monopoly.model.fields.BuildingProperty;
 | 
				
			||||||
import pp.monopoly.model.fields.FoodField;
 | 
					import pp.monopoly.model.fields.FoodField;
 | 
				
			||||||
import pp.monopoly.model.fields.GateField;
 | 
					import pp.monopoly.model.fields.GateField;
 | 
				
			||||||
@@ -385,7 +388,11 @@ public class TestWorld implements GameEventListener {
 | 
				
			|||||||
            new GulagInfo(app, 1).open();
 | 
					            new GulagInfo(app, 1).open();
 | 
				
			||||||
        } else if (event.msg().equals("jailpay")) {
 | 
					        } else if (event.msg().equals("jailpay")) {
 | 
				
			||||||
            new GulagInfo(app, 3).open();
 | 
					            new GulagInfo(app, 3).open();
 | 
				
			||||||
        }
 | 
					        } else if (event.msg().equals("tradepos")) {
 | 
				
			||||||
 | 
					            new AcceptTrade(app, (TradeReply) event.message()).open();
 | 
				
			||||||
 | 
					        } else if (event.msg().equals("tradeneg")) {
 | 
				
			||||||
 | 
					            new RejectTrade(app, (TradeReply) event.message()).open();
 | 
				
			||||||
 | 
					        } 
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,8 @@ import com.simsilica.lemur.component.QuadBackgroundComponent;
 | 
				
			|||||||
import com.simsilica.lemur.style.ElementId;
 | 
					import com.simsilica.lemur.style.ElementId;
 | 
				
			||||||
import pp.dialog.Dialog;
 | 
					import pp.dialog.Dialog;
 | 
				
			||||||
import pp.monopoly.client.MonopolyApp;
 | 
					import pp.monopoly.client.MonopolyApp;
 | 
				
			||||||
 | 
					import pp.monopoly.message.server.TradeReply;
 | 
				
			||||||
 | 
					import pp.monopoly.notification.Sound;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Bankrupt is a Warning-Popup which appears when the balance is negative at the end of a player´s turn
 | 
					 * Bankrupt is a Warning-Popup which appears when the balance is negative at the end of a player´s turn
 | 
				
			||||||
@@ -25,7 +27,7 @@ public class AcceptTrade extends Dialog {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public AcceptTrade(MonopolyApp app) {
 | 
					    public AcceptTrade(MonopolyApp app, TradeReply msg) {
 | 
				
			||||||
        super(app.getDialogManager());
 | 
					        super(app.getDialogManager());
 | 
				
			||||||
        this.app = app;
 | 
					        this.app = app;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -55,7 +57,7 @@ public class AcceptTrade extends Dialog {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // Text, der im Popup steht
 | 
					        // Text, der im Popup steht
 | 
				
			||||||
        Container textContainer = noMoneyWarningContainer.addChild(new Container());
 | 
					        Container textContainer = noMoneyWarningContainer.addChild(new Container());
 | 
				
			||||||
        textContainer.addChild(new Label("Du hast Spieler XXX einen Handel vorgeschlagen", new ElementId("label-Text")));
 | 
					        textContainer.addChild(new Label("Du hast Spieler"+ msg.getTradeHandler().getReceiver().getName() + "einen Handel vorgeschlagen", new ElementId("label-Text")));
 | 
				
			||||||
        textContainer.addChild(new Label("", new ElementId("label-Text")));
 | 
					        textContainer.addChild(new Label("", new ElementId("label-Text")));
 | 
				
			||||||
        textContainer.addChild(new Label("Der Handel wurde angenommen", new ElementId("label-Text")));
 | 
					        textContainer.addChild(new Label("Der Handel wurde angenommen", new ElementId("label-Text")));
 | 
				
			||||||
        textContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
 | 
					        textContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
 | 
				
			||||||
@@ -66,7 +68,10 @@ public class AcceptTrade extends Dialog {
 | 
				
			|||||||
        // Beenden-Button
 | 
					        // Beenden-Button
 | 
				
			||||||
        Button quitButton = noMoneyWarningContainer.addChild(new Button("Bestätigen", new ElementId("button")));
 | 
					        Button quitButton = noMoneyWarningContainer.addChild(new Button("Bestätigen", new ElementId("button")));
 | 
				
			||||||
        quitButton.setFontSize(32);
 | 
					        quitButton.setFontSize(32);
 | 
				
			||||||
        quitButton.addClickCommands(source -> close());
 | 
					        quitButton.addClickCommands(source -> ifTopDialog(() -> {
 | 
				
			||||||
 | 
					            app.getGameLogic().playSound(Sound.BUTTON);
 | 
				
			||||||
 | 
					            close();
 | 
				
			||||||
 | 
					        }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Zentriere das Popup
 | 
					        // Zentriere das Popup
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,8 @@ import com.simsilica.lemur.component.QuadBackgroundComponent;
 | 
				
			|||||||
import com.simsilica.lemur.style.ElementId;
 | 
					import com.simsilica.lemur.style.ElementId;
 | 
				
			||||||
import pp.dialog.Dialog;
 | 
					import pp.dialog.Dialog;
 | 
				
			||||||
import pp.monopoly.client.MonopolyApp;
 | 
					import pp.monopoly.client.MonopolyApp;
 | 
				
			||||||
 | 
					import pp.monopoly.message.server.TradeReply;
 | 
				
			||||||
 | 
					import pp.monopoly.notification.Sound;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Bankrupt is a Warning-Popup which appears when the balance is negative at the end of a player´s turn
 | 
					 * Bankrupt is a Warning-Popup which appears when the balance is negative at the end of a player´s turn
 | 
				
			||||||
@@ -25,7 +27,7 @@ public class RejectTrade extends Dialog {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public RejectTrade(MonopolyApp app) {
 | 
					    public RejectTrade(MonopolyApp app, TradeReply msg) {
 | 
				
			||||||
        super(app.getDialogManager());
 | 
					        super(app.getDialogManager());
 | 
				
			||||||
        this.app = app;
 | 
					        this.app = app;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -55,7 +57,7 @@ public class RejectTrade extends Dialog {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // Text, der im Popup steht
 | 
					        // Text, der im Popup steht
 | 
				
			||||||
        Container textContainer = noMoneyWarningContainer.addChild(new Container());
 | 
					        Container textContainer = noMoneyWarningContainer.addChild(new Container());
 | 
				
			||||||
        textContainer.addChild(new Label("Du hast Spieler XXX einen Handel vorgeschlagen", new ElementId("label-Text")));
 | 
					        textContainer.addChild(new Label("Du hast Spieler"+ msg.getTradeHandler().getReceiver().getName() + "einen Handel vorgeschlagen", new ElementId("label-Text")));
 | 
				
			||||||
        textContainer.addChild(new Label("", new ElementId("label-Text")));
 | 
					        textContainer.addChild(new Label("", new ElementId("label-Text")));
 | 
				
			||||||
        textContainer.addChild(new Label("Der Handel wurde abgelehnt", new ElementId("label-Text")));
 | 
					        textContainer.addChild(new Label("Der Handel wurde abgelehnt", new ElementId("label-Text")));
 | 
				
			||||||
        textContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
 | 
					        textContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
 | 
				
			||||||
@@ -66,7 +68,10 @@ public class RejectTrade extends Dialog {
 | 
				
			|||||||
        // Beenden-Button
 | 
					        // Beenden-Button
 | 
				
			||||||
        Button quitButton = noMoneyWarningContainer.addChild(new Button("Bestätigen", new ElementId("button")));
 | 
					        Button quitButton = noMoneyWarningContainer.addChild(new Button("Bestätigen", new ElementId("button")));
 | 
				
			||||||
        quitButton.setFontSize(32);
 | 
					        quitButton.setFontSize(32);
 | 
				
			||||||
        quitButton.addClickCommands(source -> close());
 | 
					        quitButton.addClickCommands(source -> ifTopDialog(() -> {
 | 
				
			||||||
 | 
					            app.getGameLogic().playSound(Sound.BUTTON);
 | 
				
			||||||
 | 
					            close();
 | 
				
			||||||
 | 
					        }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Zentriere das Popup
 | 
					        // Zentriere das Popup
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -307,8 +307,10 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
 | 
				
			|||||||
    public void received(TradeReply msg) {
 | 
					    public void received(TradeReply msg) {
 | 
				
			||||||
        if (msg.isAccepted()) {
 | 
					        if (msg.isAccepted()) {
 | 
				
			||||||
            playSound(Sound.TRADE_ACCEPTED);
 | 
					            playSound(Sound.TRADE_ACCEPTED);
 | 
				
			||||||
 | 
					            notifyListeners(new PopUpEvent("tradepos", msg));
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            playSound(Sound.TRADE_REJECTED);
 | 
					            playSound(Sound.TRADE_REJECTED);
 | 
				
			||||||
 | 
					            notifyListeners(new PopUpEvent("tradeneg", msg));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user