mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-04-17 12:40:59 +02:00
Compare commits
No commits in common. "737576e0ca5431eac2548eed5ea3359701b1e496" and "e93791e6e80c876d820cfde0fa42827f7f954826" have entirely different histories.
737576e0ca
...
e93791e6e8
@ -131,39 +131,6 @@ public class TestWorld implements GameEventListener {
|
||||
app.getRootNode().addLight(ambient);
|
||||
}
|
||||
|
||||
private com.jme3.math.Quaternion calculateRotationForField(int fieldID) {
|
||||
com.jme3.math.Quaternion rotation = new com.jme3.math.Quaternion();
|
||||
|
||||
// Berechne die Rotation basierend auf der Feld-ID
|
||||
if (fieldID >= 0 && fieldID <= 9) {
|
||||
// Untere Seite (0-9)
|
||||
rotation.fromAngleAxis(0, Vector3f.UNIT_Y); // Richtung: nach oben
|
||||
} else if (fieldID >= 10 && fieldID <= 19) {
|
||||
// Rechte Seite (10-19)
|
||||
rotation.fromAngleAxis(FastMath.HALF_PI, Vector3f.UNIT_Y); // Richtung: nach links
|
||||
} else if (fieldID >= 20 && fieldID <= 29) {
|
||||
// Obere Seite (20-29)
|
||||
rotation.fromAngleAxis(FastMath.PI, Vector3f.UNIT_Y); // Richtung: nach unten
|
||||
} else if (fieldID >= 30 && fieldID <= 39) {
|
||||
// Linke Seite (30-39)
|
||||
rotation.fromAngleAxis(3 * FastMath.HALF_PI, Vector3f.UNIT_Y); // Richtung: nach rechts
|
||||
}
|
||||
|
||||
// Korrigiere die Richtung für die Quadranten 10–19 und 30–39 (gegenüberliegende Richtung)
|
||||
if ((fieldID >= 10 && fieldID <= 19) || (fieldID >= 30 && fieldID <= 39)) {
|
||||
com.jme3.math.Quaternion oppositeDirection = new com.jme3.math.Quaternion();
|
||||
oppositeDirection.fromAngleAxis(FastMath.PI, Vector3f.UNIT_Y); // 180° drehen
|
||||
rotation = rotation.multLocal(oppositeDirection);
|
||||
}
|
||||
|
||||
// Füge zusätzliche 90° nach links hinzu
|
||||
com.jme3.math.Quaternion leftTurn = new com.jme3.math.Quaternion();
|
||||
leftTurn.fromAngleAxis(FastMath.HALF_PI, Vector3f.UNIT_Y); // 90° nach links
|
||||
rotation = rotation.multLocal(leftTurn);
|
||||
|
||||
return rotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Erstellt die Spielfiguren basierend auf der bereits bekannten Spielerliste.
|
||||
*/
|
||||
@ -174,14 +141,17 @@ public class TestWorld implements GameEventListener {
|
||||
com.jme3.scene.Spatial model = app.getAssetManager().loadModel(
|
||||
"models/" + "Spielfiguren/" + player.getFigure().getType() + "/" + player.getFigure().getType() + ".j3o");
|
||||
|
||||
// Setze das Material mit silberner Farbe
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
|
||||
//mat.setColor("Diffuse", new com.jme3.math.ColorRGBA(0.45f, 0.45f, 0.45f, 1.0f)); // Silberne Farbe
|
||||
//mat.setColor("Specular", new com.jme3.math.ColorRGBA(0.6f, 0.6f, 0.6f, 1.0f)); // Glanzlicht
|
||||
//mat.setFloat("Shininess", 64f); // Höhere Werte machen das Material glänzender
|
||||
//model.setMaterial(mat);
|
||||
|
||||
// Skaliere und positioniere das Modell
|
||||
model.setLocalScale(0.5f);
|
||||
Vector3f startPosition = calculateFieldPosition(player.getFieldID(), player.getId());
|
||||
model.setLocalTranslation(startPosition);
|
||||
|
||||
// Setze die Rotation basierend auf der Feld-ID
|
||||
model.setLocalRotation(calculateRotationForField(player.getFieldID()));
|
||||
|
||||
model.setName("PlayerFigure_" + player.getId());
|
||||
|
||||
// Füge das Modell zur Szene hinzu
|
||||
@ -253,21 +223,27 @@ public class TestWorld implements GameEventListener {
|
||||
com.jme3.scene.Spatial figure = app.getRootNode().getChild(figureName);
|
||||
|
||||
if (figure != null) {
|
||||
// Füge einen Delay hinzu (z.B. 3 Sekunden)
|
||||
// Berechne das aktuelle Feld basierend auf der Position der Figur
|
||||
int startFieldID = getFieldIDFromPosition(figure.getLocalTranslation());
|
||||
int targetFieldID = player.getFieldID();
|
||||
|
||||
// Bewege die Figur nur, wenn das Ziel-Feld unterschiedlich ist
|
||||
if (startFieldID != targetFieldID) {
|
||||
// Verzögerung vor Start der Animation (z.B. 3 Sekunden)
|
||||
Timer timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
app.enqueue(() -> {
|
||||
// Setze die Position
|
||||
Vector3f targetPosition = calculateFieldPosition(player.getFieldID(), player.getId());
|
||||
figure.setLocalTranslation(targetPosition);
|
||||
// Berechne den Pfad basierend auf den Feld-IDs
|
||||
List<Vector3f> pathPoints = calculatePath(startFieldID, targetFieldID, playerIndexOnField);
|
||||
|
||||
// Aktualisiere die Rotation basierend auf der Feld-ID
|
||||
figure.setLocalRotation(calculateRotationForField(player.getFieldID()));
|
||||
});
|
||||
// Starte die Animation entlang des Pfads
|
||||
animateMovementAlongPath(figure, pathPoints);
|
||||
}
|
||||
}, 3000); // Verzögerung von 3000ms (3 Sekunden)
|
||||
} else {
|
||||
System.out.println("Figur für Spieler " + player.getId() + " bleibt auf dem gleichen Feld.");
|
||||
}
|
||||
}, 3000); // 3000 Millisekunden Delay
|
||||
} else {
|
||||
System.err.println("Figur für Spieler " + player.getId() + " nicht gefunden.");
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public class TradeMenu extends Dialog {
|
||||
.getBoardManager()
|
||||
.getPropertyFields(app.getGameLogic()
|
||||
.getPlayerHandler()
|
||||
.getPlayerById(isLeft ? tradeHandler.getSender().getId() : tradeHandler.getReceiver().getId())
|
||||
.getPlayerById(isLeft ? tradeHandler.getReceiver().getId() : tradeHandler.getSender().getId())
|
||||
.getProperties());
|
||||
}
|
||||
|
||||
|
@ -67,19 +67,19 @@ public class BuildingPropertyCard extends Dialog {
|
||||
// Beenden-Button
|
||||
Button quitButton = buildingPropertyContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
quitButton.setFontSize(32);
|
||||
quitButton.addClickCommands(s -> {
|
||||
quitButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
System.err.println("Button does something?");
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
close();
|
||||
});
|
||||
}));
|
||||
// Kaufen-Button
|
||||
Button buyButton = buildingPropertyContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
buyButton.setFontSize(32);
|
||||
buyButton.addClickCommands(s -> {
|
||||
buyButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
close();
|
||||
app.getGameLogic().send(new BuyPropertyResponse());
|
||||
});
|
||||
}));
|
||||
|
||||
// Zentriere das Popup
|
||||
buildingPropertyContainer.setLocalTranslation(
|
||||
|
@ -13,7 +13,6 @@ import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import com.simsilica.lemur.style.ElementId;
|
||||
import pp.dialog.Dialog;
|
||||
import pp.monopoly.client.MonopolyApp;
|
||||
import pp.monopoly.notification.Sound;
|
||||
|
||||
/**
|
||||
* EventCardPopup is a popup which appears when a certain EventCard is triggered by entering a EventCardField
|
||||
@ -63,10 +62,7 @@ public class EventCardPopup extends Dialog {
|
||||
// Beenden-Button
|
||||
Button quitButton = eventCardContainer.addChild(new Button("Jawohl", new ElementId("button")));
|
||||
quitButton.setFontSize(32);
|
||||
quitButton.addClickCommands(source -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
close();
|
||||
});
|
||||
quitButton.addClickCommands(source -> close());
|
||||
|
||||
// Zentriere das Popup
|
||||
eventCardContainer.setLocalTranslation(
|
||||
|
@ -77,18 +77,18 @@ public class FoodFieldCard extends Dialog {
|
||||
// Beenden-Button
|
||||
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
quitButton.setFontSize(32);
|
||||
quitButton.addClickCommands(s -> {
|
||||
quitButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
close();
|
||||
});
|
||||
}));
|
||||
// Kaufen-Button
|
||||
Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
buyButton.setFontSize(32);
|
||||
buyButton.addClickCommands(s -> {
|
||||
buyButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
app.getGameLogic().send(new BuyPropertyResponse());
|
||||
close();
|
||||
});
|
||||
}));
|
||||
|
||||
// Zentriere das Popup
|
||||
foodFieldContainer.setLocalTranslation(
|
||||
|
@ -69,18 +69,18 @@ public class GateFieldCard extends Dialog {
|
||||
// Beenden-Button
|
||||
Button quitButton = gateFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
quitButton.setFontSize(32);
|
||||
quitButton.addClickCommands(s -> {
|
||||
quitButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
close();
|
||||
});
|
||||
}));
|
||||
// Kaufen-Button
|
||||
Button buyButton = gateFieldContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
buyButton.setFontSize(32);
|
||||
buyButton.addClickCommands(s -> {
|
||||
buyButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
app.getGameLogic().send(new BuyPropertyResponse());
|
||||
close();
|
||||
});
|
||||
}));
|
||||
|
||||
// Zentriere das Popup
|
||||
gateFieldContainer.setLocalTranslation(
|
||||
|
@ -208,9 +208,7 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
String name = msg.getName();
|
||||
String truc = name.length() > 15 ? name.substring(0, 15) : name;
|
||||
player.setName(truc);
|
||||
player.setName(msg.getName());
|
||||
player.setFigure(new Figure(1, -10, -10, Rotation.LEFT, msg.getFigure()));
|
||||
//TODO add figure to the map
|
||||
playerHandler.setPlayerReady(player, true);
|
||||
@ -300,7 +298,7 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
receiver.addJailCard();
|
||||
}
|
||||
|
||||
for (int i = 0; i < tradeHandler.getRequestedJailCards(); i++) {
|
||||
for (int i = 0; i < tradeHandler.getRequestedAmount(); i++) {
|
||||
sender.addJailCard();
|
||||
receiver.removeJailCard();
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ public class DeckHelper{
|
||||
}
|
||||
|
||||
private void jahresabschlussantreten(Player player) {
|
||||
player.setPositionWithMoney(16);
|
||||
player.setPositionWithMoney(17);
|
||||
}
|
||||
|
||||
private void verkaufenVersicherungen(Player player) {
|
||||
|
Loading…
Reference in New Issue
Block a user