mirror of
				https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
				synced 2025-11-04 10:36:15 +01:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			d6ce859fcd
			...
			6eeb6fd209
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					6eeb6fd209 | ||
| 
						 | 
					efba3c496a | ||
| 
						 | 
					27a0ab52e6 | 
@@ -221,7 +221,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the current configuration settings for the Battleship client.
 | 
			
		||||
     *
 | 
			
		||||
     * @return The {@link BattleshipClientConfig} instance.
 | 
			
		||||
     * @return The {@link BattleshipClientConfig} instance. //TODO Fehler im Kommentar
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public MonopolyAppConfig getConfig() {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,6 @@
 | 
			
		||||
package pp.monopoly.client.gui;
 | 
			
		||||
 | 
			
		||||
import java.util.concurrent.Executors;
 | 
			
		||||
import java.util.concurrent.ScheduledExecutorService;
 | 
			
		||||
import java.util.concurrent.TimeUnit;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.jme3.material.Material;
 | 
			
		||||
import com.jme3.math.ColorRGBA;
 | 
			
		||||
@@ -21,6 +19,7 @@ public class TestWorld {
 | 
			
		||||
 | 
			
		||||
    private final MonopolyApp app;
 | 
			
		||||
    private CameraController cameraController; // Steuert die Kamera
 | 
			
		||||
    private Toolbar toolbar;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Konstruktor für TestWorld.
 | 
			
		||||
@@ -51,7 +50,8 @@ public class TestWorld {
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        // Füge die Toolbar hinzu
 | 
			
		||||
        new Toolbar(app).open();
 | 
			
		||||
        toolbar = new Toolbar(app);
 | 
			
		||||
        toolbar.open();
 | 
			
		||||
        
 | 
			
		||||
        cameraController.setPosition(0);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
 | 
			
		||||
package pp.monopoly.client.gui;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Random;
 | 
			
		||||
 | 
			
		||||
import com.jme3.font.BitmapText;
 | 
			
		||||
@@ -18,20 +19,23 @@ import pp.dialog.Dialog;
 | 
			
		||||
import pp.monopoly.client.MonopolyApp;
 | 
			
		||||
import pp.monopoly.game.server.Player;
 | 
			
		||||
import pp.monopoly.game.server.PlayerHandler;
 | 
			
		||||
import pp.monopoly.message.client.RollDice;
 | 
			
		||||
import pp.monopoly.notification.DiceRollEvent;
 | 
			
		||||
import pp.monopoly.notification.GameEventListener;
 | 
			
		||||
import pp.monopoly.notification.Sound;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Toolbar Klasse, die am unteren Rand der Szene angezeigt wird.
 | 
			
		||||
 * Die Buttons bewegen den Würfel auf dem Spielfeld.
 | 
			
		||||
 */
 | 
			
		||||
public class Toolbar extends Dialog {
 | 
			
		||||
public class Toolbar extends Dialog implements GameEventListener{
 | 
			
		||||
 | 
			
		||||
    private final MonopolyApp app;
 | 
			
		||||
    private final Container toolbarContainer;
 | 
			
		||||
    private final BitmapText positionText; // Anzeige für die aktuelle Position
 | 
			
		||||
    private int currentPosition = 0; // Aktuelle Position auf dem Spielfeld
 | 
			
		||||
    private String diceOneImage = "Pictures/dice/one.png";
 | 
			
		||||
    private String diceTwoImage = "Pictures/dice/two.png";
 | 
			
		||||
    private Label imageLabel;
 | 
			
		||||
    private Label imageLabel2;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -43,6 +47,8 @@ public class Toolbar extends Dialog {
 | 
			
		||||
        super(app.getDialogManager());
 | 
			
		||||
        this.app = app;
 | 
			
		||||
 | 
			
		||||
        app.getGameLogic().addListener(this);
 | 
			
		||||
 | 
			
		||||
        // Erstelle die Toolbar
 | 
			
		||||
        toolbarContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y), "toolbar");
 | 
			
		||||
 | 
			
		||||
@@ -99,13 +105,13 @@ public class Toolbar extends Dialog {
 | 
			
		||||
        Container leftContainer = new Container();
 | 
			
		||||
        leftContainer.setPreferredSize(new Vector3f(100, 150, 0)); // Adjust size as needed
 | 
			
		||||
 | 
			
		||||
        Label imageLabel = new Label("");
 | 
			
		||||
        IconComponent icon = new IconComponent(diceOneImage); // Icon mit Textur erstellen
 | 
			
		||||
        imageLabel = new Label("");
 | 
			
		||||
        IconComponent icon = new IconComponent("Pictures/dice/one.png"); // Icon mit Textur erstellen
 | 
			
		||||
        icon.setIconSize(new Vector2f(100,100)); // Skalierung des Bildes
 | 
			
		||||
        imageLabel.setIcon(icon);
 | 
			
		||||
 | 
			
		||||
        Label imageLabel2 = new Label("");
 | 
			
		||||
        IconComponent icon2 = new IconComponent(diceTwoImage); // Icon mit Textur erstellen
 | 
			
		||||
        imageLabel2 = new Label("");
 | 
			
		||||
        IconComponent icon2 = new IconComponent("Pictures/dice/two.png"); // Icon mit Textur erstellen
 | 
			
		||||
        icon2.setIconSize(new Vector2f(100,100)); // Skalierung des Bildes
 | 
			
		||||
        imageLabel2.setIcon(icon2);
 | 
			
		||||
 | 
			
		||||
@@ -138,7 +144,7 @@ public class Toolbar extends Dialog {
 | 
			
		||||
        Button diceButton = new Button("Würfeln");
 | 
			
		||||
        diceButton.setPreferredSize(new Vector3f(200, 50, 0)); // Full width for Würfeln button
 | 
			
		||||
        diceButton.addClickCommands(s -> ifTopDialog(() -> {
 | 
			
		||||
            //TODO dice roll logic
 | 
			
		||||
            app.getGameLogic().send(new RollDice());
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        }));
 | 
			
		||||
        diceContainer.addChild(diceButton);
 | 
			
		||||
@@ -223,4 +229,46 @@ public class Toolbar extends Dialog {
 | 
			
		||||
    public void escape() {
 | 
			
		||||
        new SettingsMenu(app).open();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void receivedEvent(DiceRollEvent event) {
 | 
			
		||||
        updateDiceImages(event.a(), event.b());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    private void updateDiceImages(int a, int b) {
 | 
			
		||||
        IconComponent icon1 = new IconComponent(diceToString(a));
 | 
			
		||||
        IconComponent icon2 = new IconComponent(diceToString(b));
 | 
			
		||||
        icon1.setIconSize(new Vector2f(100, 100));
 | 
			
		||||
        icon2.setIconSize(new Vector2f(100, 100));
 | 
			
		||||
        imageLabel.setIcon(icon1);
 | 
			
		||||
        imageLabel2.setIcon(icon2);
 | 
			
		||||
        System.out.println("Dice images set");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String diceToString(int i) {
 | 
			
		||||
        switch (i) {
 | 
			
		||||
            case 1:
 | 
			
		||||
                return "Pictures/dice/one.png";
 | 
			
		||||
        
 | 
			
		||||
            case 2:
 | 
			
		||||
                return "Pictures/dice/two.png";
 | 
			
		||||
        
 | 
			
		||||
            case 3:
 | 
			
		||||
                return "Pictures/dice/three.png";
 | 
			
		||||
        
 | 
			
		||||
            case 4:
 | 
			
		||||
                return "Pictures/dice/four.png";
 | 
			
		||||
        
 | 
			
		||||
            case 5:
 | 
			
		||||
                return "Pictures/dice/five.png";
 | 
			
		||||
        
 | 
			
		||||
            case 6:
 | 
			
		||||
                return "Pictures/dice/six.png";
 | 
			
		||||
        
 | 
			
		||||
            default:
 | 
			
		||||
                throw new IllegalArgumentException("Invalid dice number: " + i);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,7 @@ import pp.monopoly.model.Board;
 | 
			
		||||
import pp.monopoly.model.IntPoint;
 | 
			
		||||
import pp.monopoly.model.fields.BoardManager;
 | 
			
		||||
import pp.monopoly.notification.ClientStateEvent;
 | 
			
		||||
import pp.monopoly.notification.DiceRollEvent;
 | 
			
		||||
import pp.monopoly.notification.GameEvent;
 | 
			
		||||
import pp.monopoly.notification.GameEventBroker;
 | 
			
		||||
import pp.monopoly.notification.GameEventListener;
 | 
			
		||||
@@ -214,9 +215,9 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DiceResult msg) {
 | 
			
		||||
    
 | 
			
		||||
        //Set the dice images
 | 
			
		||||
        playSound(Sound.DICE_ROLL);
 | 
			
		||||
        System.out.println("Message kam an");
 | 
			
		||||
        notifyListeners(new DiceRollEvent(msg.getRollResult().get(0), msg.getRollResult().get(1)));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -226,7 +227,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(EventDrawCard msg) {
 | 
			
		||||
    
 | 
			
		||||
        
 | 
			
		||||
        // Kartenlogik
 | 
			
		||||
        playSound(Sound.EVENT_CARD);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -395,6 +395,7 @@ public class Player implements FieldVisitor<Void>{
 | 
			
		||||
         * @return the result of a dice roll (1 to 6)
 | 
			
		||||
         */
 | 
			
		||||
        private static int rollDice() {
 | 
			
		||||
            System.out.println("Gewuerfelt");
 | 
			
		||||
            return random.nextInt(6) + 1;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -439,7 +440,7 @@ public class Player implements FieldVisitor<Void>{
 | 
			
		||||
        @Override
 | 
			
		||||
        public DiceResult rollDice() {
 | 
			
		||||
            List<Integer> roll = List.of(Dice.rollDice(), Dice.rollDice());
 | 
			
		||||
            rollResult = new DiceResult(roll);
 | 
			
		||||
            rollResult = new DiceResult(roll.get(0), roll.get(1));
 | 
			
		||||
            return rollResult;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -491,7 +492,7 @@ public class Player implements FieldVisitor<Void>{
 | 
			
		||||
        @Override
 | 
			
		||||
        public DiceResult rollDice() {
 | 
			
		||||
            List<Integer> roll = List.of(Dice.rollDice(), Dice.rollDice());
 | 
			
		||||
            rollResult = new DiceResult(roll);
 | 
			
		||||
            rollResult = new DiceResult(roll.get(0), roll.get(1));
 | 
			
		||||
            if (rollResult.isDoublets()) {
 | 
			
		||||
                state = new ActiveState();
 | 
			
		||||
            } else if (DoubletsCounter == 0) {
 | 
			
		||||
 
 | 
			
		||||
@@ -166,7 +166,6 @@ public class PlayerHandler {
 | 
			
		||||
     * @return the player with the required id
 | 
			
		||||
     */
 | 
			
		||||
    public Player getPlayerById(int id) {
 | 
			
		||||
        System.out.println("TEST");
 | 
			
		||||
        for (Player player : players) {
 | 
			
		||||
            if (player.getId() == id) return player;
 | 
			
		||||
            System.out.println(player.getId());
 | 
			
		||||
 
 | 
			
		||||
@@ -220,7 +220,8 @@ public class ServerGameLogic implements ClientInterpreter {
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(RollDice msg, int from) {
 | 
			
		||||
        Player player = playerHandler.getPlayerById(from);
 | 
			
		||||
        if (player != null && state == ServerState.INGAME) {
 | 
			
		||||
        if (player != null) {
 | 
			
		||||
            System.out.println("Ergebniss gesendet");
 | 
			
		||||
            send(player, player.rollDice());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ public class RollDice extends ClientMessage{
 | 
			
		||||
    /**
 | 
			
		||||
     * Default constructor for serialization purposes.
 | 
			
		||||
     */
 | 
			
		||||
    private RollDice() { /* empty */ }
 | 
			
		||||
    public RollDice() { /* empty */ }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void accept(ClientInterpreter interpreter, int from) {
 | 
			
		||||
 
 | 
			
		||||
@@ -7,19 +7,24 @@ import com.jme3.network.serializing.Serializable;
 | 
			
		||||
@Serializable
 | 
			
		||||
public class DiceResult extends ServerMessage{
 | 
			
		||||
 | 
			
		||||
    private List<Integer> rollResult;
 | 
			
		||||
    private final int a;
 | 
			
		||||
    private final int b;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Default constructor for serialization purposes.
 | 
			
		||||
     */
 | 
			
		||||
    private DiceResult() { /* empty */ }
 | 
			
		||||
    private DiceResult() {
 | 
			
		||||
        a = 1;
 | 
			
		||||
        b = 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public DiceResult(List<Integer> rollResult) {
 | 
			
		||||
        this.rollResult = rollResult;
 | 
			
		||||
    public DiceResult(int a, int b) {
 | 
			
		||||
        this.a = a;
 | 
			
		||||
        this.b = b;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public List<Integer> getRollResult() {
 | 
			
		||||
        return rollResult;
 | 
			
		||||
        return List.of(a,b);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -34,10 +39,10 @@ public class DiceResult extends ServerMessage{
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isDoublets() {
 | 
			
		||||
        return rollResult.get(0) == rollResult.get(1);
 | 
			
		||||
        return a == b;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int calcTotal() {
 | 
			
		||||
        return rollResult.get(0)+rollResult.get(1);
 | 
			
		||||
        return a+b;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -16,38 +16,38 @@ public class DeckHelper{
 | 
			
		||||
 | 
			
		||||
    public DeckHelper() {
 | 
			
		||||
        cards = new LinkedList<Card>();
 | 
			
		||||
        cards.add(new Card("Du wurdest mit einem Dienst KFZ geblitzt. Zahle: 800€", "dienst-kfz-blitzer"));
 | 
			
		||||
        cards.add(new Card("Du wurdest mit einem Dienst KFZ geblitzt. Zahle: 800 EUR", "dienst-kfz-blitzer"));
 | 
			
		||||
        cards.add(new Card("Die erste Spoparty steht bevor. Ziehe vor zum 23er.", "spoparty"));
 | 
			
		||||
        cards.add(new Card("Du kommst aus dem Gulak frei.", "gulak-frei-1"));
 | 
			
		||||
        cards.add(new Card("Du kommst aus dem Gulak frei.", "gulak-frei-2"));
 | 
			
		||||
        cards.add(new Card("Du hast den Dienstführerschein bestanden. Ziehe vor bis Teststrecke.", "dienstfuehrerschein"));
 | 
			
		||||
        cards.add(new Card("Malkmus läd zum Pubquiz ein. Rücke vor bis zum 20er.", "pubquiz"));
 | 
			
		||||
        cards.add(new Card("Du warst ohne Namensschild in der Truppenküche. Rücke vor zum 10er. Gehe nicht über Monatsgehalt. Ziehe keine 2000x€ ein.", "namensschild-truppenkueche"));
 | 
			
		||||
        cards.add(new Card("Du hast heute die Spendierhosen an und gibst eine Runde in der Unibar. Zahle jedem Spieler: 400€", "spendierhosen-unibar"));
 | 
			
		||||
        cards.add(new Card("Du warst ohne Namensschild in der Truppenküche. Rücke vor zum 10er. Gehe nicht über Monatsgehalt. Ziehe keine 2000x EUR ein.", "namensschild-truppenkueche"));
 | 
			
		||||
        cards.add(new Card("Du hast heute die Spendierhosen an und gibst eine Runde in der Unibar. Zahle jedem Spieler: 400 EUR", "spendierhosen-unibar"));
 | 
			
		||||
        cards.add(new Card("Du warst in der Prüfungsphase krank. Gehe 3 Felder zurück.", "pruefungsphase-krank"));
 | 
			
		||||
        cards.add(new Card("Ziehe vor bis zum nächsten Monatsgehalt.", "naechstes-monatsgehalt"));
 | 
			
		||||
        cards.add(new Card("Du hast ein Antreten verschlafen. Zahle: 500€", "antreten-verschlafen-1"));
 | 
			
		||||
        cards.add(new Card("Du hast den Maibock organisiert. Du erhältst: 3000€", "maibock-organisiert"));
 | 
			
		||||
        cards.add(new Card("Der Spieß macht eine unangekündigte Inventur. Zahle für jedes Haus: 400€ und jedes Hotel: 2800€", "inventur-haeuser-hotels"));
 | 
			
		||||
        cards.add(new Card("Du hast ein Antreten verschlafen. Zahle: 500 EUR", "antreten-verschlafen-1"));
 | 
			
		||||
        cards.add(new Card("Du hast den Maibock organisiert. Du erhältst: 3000 EUR", "maibock-organisiert"));
 | 
			
		||||
        cards.add(new Card("Der Spieß macht eine unangekündigte Inventur. Zahle für jedes Haus: 400 EUR und jedes Hotel: 2800 EUR", "inventur-haeuser-hotels"));
 | 
			
		||||
        cards.add(new Card("Es gab keine Mozzarella Bällchen mehr für Thoma. Alle Spieler ziehen vor auf Gym.", "dienstsport-gym"));
 | 
			
		||||
        cards.add(new Card("Auf deiner Stube wurde Schimmel gefunden. Gehe ins Gulak. Begib Dich direkt dorthin. Gehe nicht über Monatsgehalt. Ziehe nicht ein.", "schimmel-gulak"));
 | 
			
		||||
        cards.add(new Card("Deine Stube ist nach einer Partynacht nicht mehr bewohnbar. Du ziehst ins Gulak. Begib Dich direkt dorthin. Gehe nicht über Monatsgehalt. Ziehe nicht ein.", "partynacht-gulak"));
 | 
			
		||||
        cards.add(new Card("Das Jahresabschlussantreten steht an. Ziehe vor bis Schwimmhalle.", "jahresabschlussantreten"));
 | 
			
		||||
        cards.add(new Card("Du wurdest beim Verkaufen von Versicherungen erwischt. Zahle: 4000€", "verkaufen-versicherungen"));
 | 
			
		||||
        cards.add(new Card("Du wurdest beim Verkaufen von Versicherungen erwischt. Zahle: 4000 EUR", "verkaufen-versicherungen"));
 | 
			
		||||
        cards.add(new Card("Du musstest einen Rückstuferantrag stellen. Setze eine Runde aus.", "rueckstuferantrag"));
 | 
			
		||||
        cards.add(new Card("Auf einer Hausfeier bist du betrunken auf der Treppe gestürzt und dabei auf einen Kameraden gefallen. Zahle: 800€ und gehe zurück zu SanZ.", "hausfeier-sturz"));
 | 
			
		||||
        cards.add(new Card("Beförderung. Beim nächsten Monatsgehalt ziehst du ein: 3000€", "befoerderung"));
 | 
			
		||||
        cards.add(new Card("Du entscheidest dich für eine Dienstreise nach Lourd. Zahle: 1000€ und setze eine Runde aus.", "dienstreise-lourd"));
 | 
			
		||||
        cards.add(new Card("Auf einer Hausfeier bist du betrunken auf der Treppe gestürzt und dabei auf einen Kameraden gefallen. Zahle: 800 EUR und gehe zurück zu SanZ.", "hausfeier-sturz"));
 | 
			
		||||
        cards.add(new Card("Beförderung. Beim nächsten Monatsgehalt ziehst du ein: 3000 EUR", "befoerderung"));
 | 
			
		||||
        cards.add(new Card("Du entscheidest dich für eine Dienstreise nach Lourd. Zahle: 1000 EUR und setze eine Runde aus.", "dienstreise-lourd"));
 | 
			
		||||
        cards.add(new Card("Du warst fleißig Blutspenden und erhältst einen Tag Sonderurlaub. Du bist nochmal an der Reihe.", "blutspenden-sonderurlaub"));
 | 
			
		||||
        cards.add(new Card("Dir wurde auf dem Oktoberfest dein Geldbeutel geklaut. Gebe 10% deines Vermögens ab.", "geldbeutel-oktoberfest"));
 | 
			
		||||
        cards.add(new Card("Du wirst von deinem Chef für vorbildliches Verhalten gelobt. Du erhältst: 4000€", "lob-chef"));
 | 
			
		||||
        cards.add(new Card("Deine Bekanntschaft von letzter Nacht war eine Spo. Lasse dich testen und zahle: 200€", "spo-testen"));
 | 
			
		||||
        cards.add(new Card("Du wirst von deinem Chef für vorbildliches Verhalten gelobt. Du erhältst: 4000 EUR", "lob-chef"));
 | 
			
		||||
        cards.add(new Card("Deine Bekanntschaft von letzter Nacht war eine Spo. Lasse dich testen und zahle: 200 EUR", "spo-testen"));
 | 
			
		||||
        cards.add(new Card("Du wurdest von Kranz geexmattet. Gehe zurück zu Prüfungsamt.", "kranz-exmatrikulation"));
 | 
			
		||||
        cards.add(new Card("Die letzte Party ist ein wenig eskaliert. Setze eine Runde aus.", "party-eskaliert"));
 | 
			
		||||
        cards.add(new Card("Du wurdest zur VP gewählt und schmeißt eine Einstandsparty. Zahle: 800€", "vp-einstandsparty"));
 | 
			
		||||
        cards.add(new Card("Du hast eine Party veranstaltet und dick Gewinn gemacht. Ziehe ein: 1500€", "party-gewinn"));
 | 
			
		||||
        cards.add(new Card("Du wurdest zur VP gewählt und schmeißt eine Einstandsparty. Zahle: 800 EUR", "vp-einstandsparty"));
 | 
			
		||||
        cards.add(new Card("Du hast eine Party veranstaltet und dick Gewinn gemacht. Ziehe ein: 1500 EUR", "party-gewinn"));
 | 
			
		||||
        cards.add(new Card("Zur falschen Zeit am falschen Ort. Du musst einen Bergmarsch planen und setzt eine Runde aus.", "bergmarsch"));
 | 
			
		||||
        cards.add(new Card("Dein Jodel eines Eispenis mit Unterhodenbeleuchtung geht viral. Ziehe ein: 1000€", "jodel-eispenis"));
 | 
			
		||||
        cards.add(new Card("Dein Jodel eines Eispenis mit Unterhodenbeleuchtung geht viral. Ziehe ein: 1000 EUR", "jodel-eispenis"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void visit(Card card, Player player) {
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
package pp.monopoly.notification;
 | 
			
		||||
 | 
			
		||||
public record DiceRollEvent(int a, int b) implements GameEvent{
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void notifyListener(GameEventListener listener) {
 | 
			
		||||
        listener.receivedEvent(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -45,4 +45,6 @@ public interface GameEventListener {
 | 
			
		||||
     * @param event the received event
 | 
			
		||||
     */
 | 
			
		||||
    default void receivedEvent(ClientStateEvent event) { /* do nothing */ }
 | 
			
		||||
 | 
			
		||||
    default void receivedEvent(DiceRollEvent event) { /*Do nothing */}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,37 +6,37 @@
 | 
			
		||||
########################################
 | 
			
		||||
#
 | 
			
		||||
monopoly.name=Monopoly
 | 
			
		||||
button.play=Start Game
 | 
			
		||||
button.ready=Ready
 | 
			
		||||
button.rotate=Rotate
 | 
			
		||||
server.connection.failed=Failed to establish a server connection.
 | 
			
		||||
its.your.turn=It's your turn! Click on the opponent's field to shoot...
 | 
			
		||||
lost.connection.to.server=Lost connection to server. The game terminated.
 | 
			
		||||
place.ships.in.your.map=Place ships in your map.
 | 
			
		||||
wait.for.an.opponent=Wait for an opponent!
 | 
			
		||||
wait.for.opponent=Wait for your opponent!
 | 
			
		||||
confirm.leaving=Would you really like to leave the game?
 | 
			
		||||
you.lost.the.game=You lost the game!
 | 
			
		||||
you.won.the.game=You won the game!
 | 
			
		||||
button.yes=Yes
 | 
			
		||||
button.no=No
 | 
			
		||||
button.play=Spiel starten
 | 
			
		||||
button.ready=Bereit
 | 
			
		||||
button.rotate=Drehen
 | 
			
		||||
server.connection.failed=Fehler beim Herstellen einer Serververbindung.
 | 
			
		||||
its.your.turn=Du bist am Zug! Klicke auf das Feld des Gegners, um zu schießen...
 | 
			
		||||
lost.connection.to.server=Verbindung zum Server verloren. Das Spiel wurde beendet.
 | 
			
		||||
place.ships.in.your.map=Platziere Schiffe auf deiner Karte.
 | 
			
		||||
wait.for.an.opponent=Warte auf einen Gegner!
 | 
			
		||||
wait.for.opponent=Warte auf deinen Gegner!
 | 
			
		||||
confirm.leaving=Möchtest du das Spiel wirklich beenden?
 | 
			
		||||
you.lost.the.game=Du hast das Spiel verloren!
 | 
			
		||||
you.won.the.game=Du hast das Spiel gewonnen!
 | 
			
		||||
button.yes=Ja
 | 
			
		||||
button.no=Nein
 | 
			
		||||
button.ok=Ok
 | 
			
		||||
button.connect=Connect
 | 
			
		||||
button.cancel=Cancel
 | 
			
		||||
button.connect=Verbinden
 | 
			
		||||
button.cancel=Abbrechen
 | 
			
		||||
server.dialog=Server
 | 
			
		||||
host.name=Host
 | 
			
		||||
port.number=Port
 | 
			
		||||
wait.its.not.your.turn=Wait, it's not your turn!!
 | 
			
		||||
menu.quit=Quit game
 | 
			
		||||
menu.return-to-game=Return to game
 | 
			
		||||
menu.sound-enabled=Sound switched on
 | 
			
		||||
menu.background-sound-enabled=Background music switched on
 | 
			
		||||
menu.map.load=Load map from file...
 | 
			
		||||
menu.map.save=Save map in file...
 | 
			
		||||
label.file=File:
 | 
			
		||||
label.connecting=Connecting...
 | 
			
		||||
dialog.error=Error
 | 
			
		||||
dialog.question=Question
 | 
			
		||||
port.must.be.integer=Port must be an integer number
 | 
			
		||||
map.doesnt.fit=The map doesn't fit to this game
 | 
			
		||||
client.server-start=Start server
 | 
			
		||||
wait.its.not.your.turn=Warte, es ist nicht dein Zug!!
 | 
			
		||||
menu.quit=Spiel beenden
 | 
			
		||||
menu.return-to-game=Zum Spiel zurückkehren
 | 
			
		||||
menu.sound-enabled=Ton eingeschaltet
 | 
			
		||||
menu.background-sound-enabled=Hintergrundmusik eingeschaltet
 | 
			
		||||
menu.map.load=Karte aus Datei laden...
 | 
			
		||||
menu.map.save=Karte in Datei speichern...
 | 
			
		||||
label.file=Datei:
 | 
			
		||||
label.connecting=Verbinde...
 | 
			
		||||
dialog.error=Fehler
 | 
			
		||||
dialog.question=Frage
 | 
			
		||||
port.must.be.integer=Port muss eine ganze Zahl sein
 | 
			
		||||
map.doesnt.fit=Die Karte passt nicht zu diesem Spiel
 | 
			
		||||
client.server-start=Server starten
 | 
			
		||||
 
 | 
			
		||||
@@ -37,6 +37,7 @@ import pp.monopoly.message.client.RollDice;
 | 
			
		||||
import pp.monopoly.message.client.TradeOffer;
 | 
			
		||||
import pp.monopoly.message.client.TradeResponse;
 | 
			
		||||
import pp.monopoly.message.client.ViewAssetsRequest;
 | 
			
		||||
import pp.monopoly.message.server.DiceResult;
 | 
			
		||||
import pp.monopoly.message.server.GameStart;
 | 
			
		||||
import pp.monopoly.message.server.NextPlayerTurn;
 | 
			
		||||
import pp.monopoly.message.server.ServerMessage;
 | 
			
		||||
@@ -130,6 +131,7 @@ public class MonopolyServer implements MessageListener<HostedConnection>, Connec
 | 
			
		||||
        Serializer.registerClass(Player.class);
 | 
			
		||||
        Serializer.registerClass(Figure.class);
 | 
			
		||||
        Serializer.registerClass(PlayerHandler.class);
 | 
			
		||||
        Serializer.registerClass(DiceResult.class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void registerListeners() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user