mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-19 04:56:15 +01:00
Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui
This commit is contained in:
commit
5143e21ba6
@ -38,7 +38,18 @@ import static pp.monopoly.Resources.lookup;
|
|||||||
import pp.monopoly.client.gui.SettingsMenu;
|
import pp.monopoly.client.gui.SettingsMenu;
|
||||||
import pp.monopoly.client.gui.StartMenu;
|
import pp.monopoly.client.gui.StartMenu;
|
||||||
import pp.monopoly.client.gui.TestWorld;
|
import pp.monopoly.client.gui.TestWorld;
|
||||||
import pp.monopoly.client.gui.popups.*;
|
import pp.monopoly.client.gui.popups.Bankrupt;
|
||||||
|
import pp.monopoly.client.gui.popups.BuildingPropertyCard;
|
||||||
|
import pp.monopoly.client.gui.popups.BuyCard;
|
||||||
|
import pp.monopoly.client.gui.popups.BuyHouse;
|
||||||
|
import pp.monopoly.client.gui.popups.EventCardPopup;
|
||||||
|
import pp.monopoly.client.gui.popups.FoodFieldCard;
|
||||||
|
import pp.monopoly.client.gui.popups.GateFieldCard;
|
||||||
|
import pp.monopoly.client.gui.popups.LooserPopUp;
|
||||||
|
import pp.monopoly.client.gui.popups.RepayMortage;
|
||||||
|
import pp.monopoly.client.gui.popups.SellHouse;
|
||||||
|
import pp.monopoly.client.gui.popups.TakeMortage;
|
||||||
|
import pp.monopoly.client.gui.popups.TimeOut;
|
||||||
import pp.monopoly.game.client.ClientGameLogic;
|
import pp.monopoly.game.client.ClientGameLogic;
|
||||||
import pp.monopoly.game.client.MonopolyClient;
|
import pp.monopoly.game.client.MonopolyClient;
|
||||||
import pp.monopoly.game.client.ServerConnection;
|
import pp.monopoly.game.client.ServerConnection;
|
||||||
@ -335,10 +346,10 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
|||||||
logic.update(tpf);
|
logic.update(tpf);
|
||||||
stateManager.update(tpf);
|
stateManager.update(tpf);
|
||||||
|
|
||||||
//TODO testing replace later
|
// //TODO testing replace later
|
||||||
if (testWorld != null) {
|
// if (testWorld != null) {
|
||||||
testWorld.update(tpf);
|
// testWorld.update(tpf);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,22 +1,24 @@
|
|||||||
package pp.monopoly.client.gui;
|
package pp.monopoly.client.gui;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
import com.jme3.math.FastMath;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
|
import com.jme3.renderer.RenderManager;
|
||||||
|
import com.jme3.renderer.ViewPort;
|
||||||
|
import com.jme3.scene.control.AbstractControl;
|
||||||
|
|
||||||
import pp.monopoly.client.MonopolyApp;
|
import pp.monopoly.client.MonopolyApp;
|
||||||
import pp.monopoly.client.gui.popups.BuyCard;
|
import pp.monopoly.client.gui.popups.BuyCard;
|
||||||
import pp.monopoly.client.gui.popups.ConfirmTrade;
|
|
||||||
import pp.monopoly.client.gui.popups.EventCardPopup;
|
import pp.monopoly.client.gui.popups.EventCardPopup;
|
||||||
import pp.monopoly.client.gui.popups.FoodFieldCard;
|
import pp.monopoly.client.gui.popups.FoodFieldCard;
|
||||||
import pp.monopoly.client.gui.popups.GateFieldCard;
|
import pp.monopoly.client.gui.popups.GateFieldCard;
|
||||||
import pp.monopoly.client.gui.popups.LooserPopUp;
|
import pp.monopoly.client.gui.popups.LooserPopUp;
|
||||||
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.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;
|
||||||
@ -31,7 +33,7 @@ import pp.monopoly.notification.UpdatePlayerView;
|
|||||||
public class TestWorld implements GameEventListener {
|
public class TestWorld implements GameEventListener {
|
||||||
|
|
||||||
private final MonopolyApp app;
|
private final MonopolyApp app;
|
||||||
private PlayerHandler playerHandler; // Liste der Spieler, bereits aus GameStart geladen
|
private PlayerHandler playerHandler;
|
||||||
private CameraController cameraController;
|
private CameraController cameraController;
|
||||||
private Toolbar toolbar;
|
private Toolbar toolbar;
|
||||||
|
|
||||||
@ -43,9 +45,9 @@ public class TestWorld implements GameEventListener{
|
|||||||
*/
|
*/
|
||||||
public TestWorld(MonopolyApp app) {
|
public TestWorld(MonopolyApp app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.playerHandler = app.getGameLogic().getPlayerHandler();
|
this.playerHandler = app.getGameLogic().getPlayerHandler(); // Hole den PlayerHandler
|
||||||
app.getGameLogic().addListener(this);
|
app.getGameLogic().addListener(this);
|
||||||
cameraController = new CameraController(app.getCamera());
|
cameraController = new CameraController(app.getCamera(), playerHandler); // Übergebe PlayerHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,10 +60,10 @@ public class TestWorld implements GameEventListener{
|
|||||||
|
|
||||||
System.out.println("Szene initialisiert.");
|
System.out.println("Szene initialisiert.");
|
||||||
|
|
||||||
// Initialisiere Szene
|
//Füge Inhalte ein
|
||||||
setSkyColor();
|
setSkyColor();
|
||||||
createBoard();
|
createBoard();
|
||||||
createPlayerFigures(); // Lädt Figuren aus der bereits vorhandenen Liste
|
createPlayerFigures();
|
||||||
toolbar = new Toolbar(app);
|
toolbar = new Toolbar(app);
|
||||||
toolbar.open();
|
toolbar.open();
|
||||||
}
|
}
|
||||||
@ -78,21 +80,23 @@ public class TestWorld implements GameEventListener{
|
|||||||
*/
|
*/
|
||||||
private void createBoard() {
|
private void createBoard() {
|
||||||
try {
|
try {
|
||||||
// Erstelle das Spielfeld als flaches Rechteck
|
com.jme3.scene.shape.Box box = new com.jme3.scene.shape.Box(10, 0.1f, 10);
|
||||||
com.jme3.scene.shape.Box box = new com.jme3.scene.shape.Box(10, 0.1f, 10); // Breite, Höhe, Tiefe
|
|
||||||
com.jme3.scene.Geometry geom = new com.jme3.scene.Geometry("Board", box);
|
com.jme3.scene.Geometry geom = new com.jme3.scene.Geometry("Board", box);
|
||||||
|
|
||||||
// Lade und setze das Material mit der Textur
|
|
||||||
com.jme3.material.Material mat = new com.jme3.material.Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
com.jme3.material.Material mat = new com.jme3.material.Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
||||||
com.jme3.texture.Texture texture = app.getAssetManager().loadTexture("Pictures/board2.png");
|
com.jme3.texture.Texture texture = app.getAssetManager().loadTexture("Pictures/board2.png");
|
||||||
mat.setTexture("ColorMap", texture);
|
mat.setTexture("ColorMap", texture);
|
||||||
geom.setMaterial(mat);
|
geom.setMaterial(mat);
|
||||||
|
|
||||||
// Positioniere das Spielfeld in der Szene
|
geom.setLocalTranslation(0, -0.1f, 0);
|
||||||
geom.setLocalTranslation(0, -0.1f, 0); // Direkt auf der Grundebene
|
|
||||||
|
com.jme3.math.Quaternion rotation = new com.jme3.math.Quaternion();
|
||||||
|
rotation.fromAngleAxis(com.jme3.math.FastMath.HALF_PI, com.jme3.math.Vector3f.UNIT_Y);
|
||||||
|
geom.setLocalRotation(rotation);
|
||||||
|
|
||||||
app.getRootNode().attachChild(geom);
|
app.getRootNode().attachChild(geom);
|
||||||
|
|
||||||
System.out.println("Spielbrett erfolgreich erstellt und hinzugefügt.");
|
System.out.println("Spielbrett erfolgreich erstellt, gedreht und hinzugefügt.");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("Fehler beim Erstellen des Spielfelds: " + e.getMessage());
|
System.err.println("Fehler beim Erstellen des Spielfelds: " + e.getMessage());
|
||||||
}
|
}
|
||||||
@ -105,38 +109,173 @@ public class TestWorld implements GameEventListener{
|
|||||||
for (int i = 0; i < playerHandler.getPlayers().size(); i++) {
|
for (int i = 0; i < playerHandler.getPlayers().size(); i++) {
|
||||||
Player player = playerHandler.getPlayers().get(i);
|
Player player = playerHandler.getPlayers().get(i);
|
||||||
try {
|
try {
|
||||||
// Lade das 3D-Modell der Spielfigur
|
com.jme3.scene.Spatial model = app.getAssetManager().loadModel(
|
||||||
com.jme3.scene.Spatial model = app.getAssetManager().loadModel("Models/" + player.getFigure().getType() + "/" + player.getFigure().getType() + ".j3o");
|
"Models/" + player.getFigure().getType() + "/" + player.getFigure().getType() + ".j3o"
|
||||||
model.setLocalScale(0.5f); // Skaliere das Modell
|
);
|
||||||
|
model.setLocalScale(0.5f);
|
||||||
|
|
||||||
// Positioniere die Figur unten rechts
|
Vector3f startPosition = calculateFieldPosition(player.getFieldID(), i);
|
||||||
float startX = 9.1f; // X-Koordinate für die Ecke unten rechts
|
model.setLocalTranslation(startPosition);
|
||||||
float startZ = -9.1f; // Z-Koordinate für die Ecke unten rechts
|
|
||||||
float spacing = 0.4f; // Abstand zwischen den Figuren
|
|
||||||
model.setLocalTranslation(startX, 0, startZ - (i * spacing)); // Position anpassen
|
|
||||||
|
|
||||||
|
model.setName("PlayerFigure_" + player.getId());
|
||||||
app.getRootNode().attachChild(model);
|
app.getRootNode().attachChild(model);
|
||||||
System.out.println("Figur für Spieler " + player.getId() + " positioniert bei (" + startX + ", 0, " + (startZ - (i * spacing)) + ")");
|
|
||||||
|
System.out.println("Figur für Spieler " + player.getId() + " erstellt bei " + startPosition);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("Fehler beim Laden des Modells für Spieler " + player.getId() + ": " + e.getMessage());
|
System.err.println("Fehler beim Laden des Modells für Spieler " + player.getId() + ": " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Vector3f calculateFieldPosition(int fieldID, int playerIndex) {
|
||||||
|
float offset = 0.1f;
|
||||||
|
float baseX = 0.0f;
|
||||||
|
float baseZ = 0.0f;
|
||||||
|
|
||||||
|
switch (fieldID) {
|
||||||
|
case 0: baseX = -9.1f; baseZ = -9.1f; break;
|
||||||
|
case 1: baseX = -6.5f; baseZ = -9.1f; break;
|
||||||
|
case 2: baseX = -4.9f; baseZ = -9.1f; break;
|
||||||
|
case 3: baseX = -3.3f; baseZ = -9.1f; break;
|
||||||
|
case 4: baseX = -1.6f; baseZ = -9.1f; break;
|
||||||
|
case 5: baseX = 0.0f; baseZ = -9.1f; break;
|
||||||
|
case 6: baseX = 1.6f; baseZ = -9.1f; break;
|
||||||
|
case 7: baseX = 3.3f; baseZ = -9.1f; break;
|
||||||
|
case 8: baseX = 4.9f; baseZ = -9.1f; break;
|
||||||
|
case 9: baseX = 6.5f; baseZ = -9.1f; break;
|
||||||
|
case 10: baseX = 9.1f; baseZ = -9.1f; break;
|
||||||
|
case 11: baseX = 9.1f; baseZ = -6.5f; break;
|
||||||
|
case 12: baseX = 9.1f; baseZ = -4.9f; break;
|
||||||
|
case 13: baseX = 9.1f; baseZ = -3.3f; break;
|
||||||
|
case 14: baseX = 9.1f; baseZ = -1.6f; break;
|
||||||
|
case 15: baseX = 9.1f; baseZ = 0.0f; break;
|
||||||
|
case 16: baseX = 9.1f; baseZ = 1.6f; break;
|
||||||
|
case 17: baseX = 9.1f; baseZ = 3.3f; break;
|
||||||
|
case 18: baseX = 9.1f; baseZ = 4.9f; break;
|
||||||
|
case 19: baseX = 9.1f; baseZ = 6.5f; break;
|
||||||
|
case 20: baseX = 9.1f; baseZ = 9.1f; break;
|
||||||
|
case 21: baseX = 6.5f; baseZ = 9.1f; break;
|
||||||
|
case 22: baseX = 4.9f; baseZ = 9.1f; break;
|
||||||
|
case 23: baseX = 3.3f; baseZ = 9.1f; break;
|
||||||
|
case 24: baseX = 1.6f; baseZ = 9.1f; break;
|
||||||
|
case 25: baseX = 0.0f; baseZ = 9.1f; break;
|
||||||
|
case 26: baseX = -1.6f; baseZ = 9.1f; break;
|
||||||
|
case 27: baseX = -3.3f; baseZ = 9.1f; break;
|
||||||
|
case 28: baseX = -4.9f; baseZ = 9.1f; break;
|
||||||
|
case 29: baseX = -6.5f; baseZ = 9.1f; break;
|
||||||
|
case 30: baseX = -9.1f; baseZ = 9.1f; break;
|
||||||
|
case 31: baseX = -9.1f; baseZ = 6.5f; break;
|
||||||
|
case 32: baseX = -9.1f; baseZ = 4.9f; break;
|
||||||
|
case 33: baseX = -9.1f; baseZ = 3.3f; break;
|
||||||
|
case 34: baseX = -9.1f; baseZ = 1.6f; break;
|
||||||
|
case 35: baseX = -9.1f; baseZ = 0.0f; break;
|
||||||
|
case 36: baseX = -9.1f; baseZ = -1.6f; break;
|
||||||
|
case 37: baseX = -9.1f; baseZ = -3.3f; break;
|
||||||
|
case 38: baseX = -9.1f; baseZ = -4.9f; break;
|
||||||
|
case 39: baseX = -9.1f; baseZ = -6.5f; break;
|
||||||
|
default: throw new IllegalArgumentException("Ungültige Feld-ID: " + fieldID);
|
||||||
|
}
|
||||||
|
|
||||||
|
float xOffset = (playerIndex % 2) * offset;
|
||||||
|
float zOffset = (playerIndex / 2) * offset;
|
||||||
|
|
||||||
|
return new Vector3f(baseX + xOffset, 0, baseZ + zOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void movePlayerFigure(Player player) {
|
||||||
|
int fieldID = player.getFieldID();
|
||||||
|
int playerIndex = playerHandler.getPlayers().indexOf(player); // Spielerindex holen
|
||||||
|
Vector3f targetPosition = calculateFieldPosition(fieldID, playerIndex);
|
||||||
|
|
||||||
|
String figureName = "PlayerFigure_" + player.getId();
|
||||||
|
com.jme3.scene.Spatial figure = app.getRootNode().getChild(figureName);
|
||||||
|
|
||||||
|
if (figure != null) {
|
||||||
|
Vector3f startPosition = figure.getLocalTranslation();
|
||||||
|
Vector3f cornerPosition = calculateCornerPosition(startPosition, targetPosition); // Berechne Eckpunkt
|
||||||
|
float animationDuration = 3.0f; // Gesamtdauer der Animation
|
||||||
|
float[] elapsedTime = {0.0f}; // Verstrichene Zeit
|
||||||
|
|
||||||
|
Timer timer = new Timer();
|
||||||
|
timer.schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
app.enqueue(() -> {
|
||||||
|
app.getRootNode().addControl(new AbstractControl() {
|
||||||
|
@Override
|
||||||
|
protected void controlUpdate(float tpf) {
|
||||||
|
elapsedTime[0] += tpf;
|
||||||
|
float progress = Math.min(elapsedTime[0] / animationDuration, 1.0f);
|
||||||
|
|
||||||
|
Vector3f interpolatedPosition;
|
||||||
|
if (progress < 0.5f) {
|
||||||
|
// Erste Hälfte der Animation: Bewegung zur Ecke
|
||||||
|
float localProgress = progress / 0.5f; // Normiere auf [0, 1]
|
||||||
|
interpolatedPosition = new Vector3f(
|
||||||
|
FastMath.interpolateLinear(localProgress, startPosition.x, cornerPosition.x),
|
||||||
|
FastMath.interpolateLinear(localProgress, startPosition.y, cornerPosition.y),
|
||||||
|
FastMath.interpolateLinear(localProgress, startPosition.z, cornerPosition.z)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Zweite Hälfte der Animation: Bewegung vom Eckpunkt zum Ziel
|
||||||
|
float localProgress = (progress - 0.5f) / 0.5f; // Normiere auf [0, 1]
|
||||||
|
interpolatedPosition = new Vector3f(
|
||||||
|
FastMath.interpolateLinear(localProgress, cornerPosition.x, targetPosition.x),
|
||||||
|
FastMath.interpolateLinear(localProgress, cornerPosition.y, targetPosition.y),
|
||||||
|
FastMath.interpolateLinear(localProgress, cornerPosition.z, targetPosition.z)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
figure.setLocalTranslation(interpolatedPosition);
|
||||||
|
|
||||||
|
// Animation beenden, wenn sie fertig ist
|
||||||
|
if (progress >= 1.0f) {
|
||||||
|
this.setEnabled(false);
|
||||||
|
app.getRootNode().removeControl(this);
|
||||||
|
System.out.println("Spieler " + player.getId() + " hat das Ziel erreicht: " + targetPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void controlRender(RenderManager rm, ViewPort vp) {
|
||||||
|
// Keine spezielle Renderlogik notwendig
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, (long) 2000); // Verzögerung in Millisekunden
|
||||||
|
} else {
|
||||||
|
System.err.println("Figur für Spieler " + player.getId() + " nicht gefunden.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wird bei jedem Frame aufgerufen, um die Szene zu aktualisieren.
|
* Berechnet den Eckpunkt basierend auf Start- und Zielposition.
|
||||||
*
|
*
|
||||||
* @param tpf Zeit seit dem letzten Frame in Sekunden
|
* @param startPosition Die Startposition der Figur.
|
||||||
|
* @param targetPosition Die Zielposition der Figur.
|
||||||
|
* @return Die Position der Ecke, die passiert werden muss.
|
||||||
*/
|
*/
|
||||||
public void update(float tpf) {
|
private Vector3f calculateCornerPosition(Vector3f startPosition, Vector3f targetPosition) {
|
||||||
if (cameraController != null) {
|
if (Math.abs(startPosition.x - targetPosition.x) > Math.abs(startPosition.z - targetPosition.z)) {
|
||||||
cameraController.update(tpf); // Aktualisiere die Kameraposition
|
// Bewegung entlang der X-Achse zuerst, dann Z-Achse
|
||||||
|
return new Vector3f(targetPosition.x, 0, startPosition.z);
|
||||||
|
} else {
|
||||||
|
// Bewegung entlang der Z-Achse zuerst, dann X-Achse
|
||||||
|
return new Vector3f(startPosition.x, 0, targetPosition.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receivedEvent(PopUpEvent event) {
|
public void receivedEvent(PopUpEvent event) {
|
||||||
if (event.msg().equals("Buy")) {
|
if (event.msg().equals("Buy")) {
|
||||||
|
// Erstelle einen Timer, um den Delay umzusetzen
|
||||||
|
Timer timer = new Timer();
|
||||||
|
timer.schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// GUI-Operationen im jMonkey-Thread ausführen
|
||||||
|
app.enqueue(() -> {
|
||||||
int field = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getFieldID();
|
int field = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getFieldID();
|
||||||
Object fieldObject = app.getGameLogic().getBoardManager().getFieldAtIndex(field);
|
Object fieldObject = app.getGameLogic().getBoardManager().getFieldAtIndex(field);
|
||||||
|
|
||||||
@ -147,28 +286,37 @@ public class TestWorld implements GameEventListener{
|
|||||||
} else if (fieldObject instanceof FoodField) {
|
} else if (fieldObject instanceof FoodField) {
|
||||||
new FoodFieldCard(app).open();
|
new FoodFieldCard(app).open();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 5000); // Verzögerung in Millisekunden
|
||||||
} else if (event.msg().equals("Winner")) {
|
} else if (event.msg().equals("Winner")) {
|
||||||
new WinnerPopUp(app).open();
|
new WinnerPopUp(app).open();
|
||||||
} else if (event.msg().equals("Looser")) {
|
} else if (event.msg().equals("Looser")) {
|
||||||
new LooserPopUp(app).open();
|
new LooserPopUp(app).open();
|
||||||
} else if (event.msg().equals("timeout")) {
|
} else if (event.msg().equals("timeout")) {
|
||||||
new TimeOut(app).open();
|
new TimeOut(app).open();
|
||||||
} else if (event.msg().equals("tradeRequest")) {
|
|
||||||
new ConfirmTrade(app).open();
|
|
||||||
} else if(event.msg().equals("rent")) {
|
|
||||||
new Rent(app, ( (NotificationMessage) event.message()).getRentOwner(), ( (NotificationMessage) event.message()).getRentAmount() ).open();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receivedEvent(EventCardEvent event) {
|
public void receivedEvent(EventCardEvent event) {
|
||||||
new EventCardPopup(app, event.description()).open();
|
Timer timer = new Timer();
|
||||||
|
timer.schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
app.enqueue(() -> new EventCardPopup(app, event.description()).open());
|
||||||
}
|
}
|
||||||
|
}, 5000); // 5 Sekunden Verzögerung für Event-Popups
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receivedEvent(UpdatePlayerView event) {
|
public void receivedEvent(UpdatePlayerView event) {
|
||||||
this.playerHandler = app.getGameLogic().getPlayerHandler();
|
this.playerHandler = app.getGameLogic().getPlayerHandler();
|
||||||
cameraController.setPosition(playerHandler.getPlayerById(app.getId()).getFieldID());
|
|
||||||
cameraController.update(0);
|
// Aktualisiere die Position aller Spielerfiguren
|
||||||
|
for (Player player : playerHandler.getPlayers()) {
|
||||||
|
movePlayerFigure(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ public class DeckHelper{
|
|||||||
cards.add(new Card("Du kommst aus dem Gulak frei!", "gulak-frei-2"));
|
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("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("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 2000 EUR ein.", "namensschild-truppenkueche"));
|
cards.add(new Card("Deine IGF-Daten sind verschwunden, statte Padubrin einen Besuch ab und gib ihm einen Jägermeister aus.", "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 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("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("Ziehe vor bis zum nächsten Monatsgehalt.", "naechstes-monatsgehalt"));
|
||||||
@ -205,7 +205,8 @@ public class DeckHelper{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void namensschildTruppenkueche(Player player) {
|
private void namensschildTruppenkueche(Player player) {
|
||||||
//TODO 10 existiert nicht mehr
|
player.setPosition(24);
|
||||||
|
player.pay(25);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spendierhosenUnibar(Player player) {
|
private void spendierhosenUnibar(Player player) {
|
||||||
@ -236,9 +237,7 @@ public class DeckHelper{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void dienstsportGym(Player player) {
|
private void dienstsportGym(Player player) {
|
||||||
for (Player p : player.getHandler().getPlayers()) {
|
player.setPosition(1);
|
||||||
p.setPosition(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void schimmelGulak(Player player) {
|
private void schimmelGulak(Player player) {
|
||||||
@ -294,7 +293,7 @@ public class DeckHelper{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void kranzExmatrikulation(Player player) {
|
private void kranzExmatrikulation(Player player) {
|
||||||
player.setPosition(5);
|
player.setPosition(29);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void partyEskaliert(Player player) {
|
private void partyEskaliert(Player player) {
|
||||||
|
Loading…
Reference in New Issue
Block a user