mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-19 00:06:16 +01:00
cleanup
This commit is contained in:
parent
e337303408
commit
e98e17f6d7
@ -99,7 +99,6 @@ public class BoardAppState extends MonopolyAppState {
|
|||||||
setupScene();
|
setupScene();
|
||||||
if (bobTheBuilder == null) {
|
if (bobTheBuilder == null) {
|
||||||
bobTheBuilder = new BobTheBuilder(getApp(), sceneNode);
|
bobTheBuilder = new BobTheBuilder(getApp(), sceneNode);
|
||||||
System.out.println("LISTENER IS REGISTEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD");
|
|
||||||
getGameLogic().addListener(bobTheBuilder);
|
getGameLogic().addListener(bobTheBuilder);
|
||||||
}
|
}
|
||||||
getApp().getRootNode().attachChild(viewNode);
|
getApp().getRootNode().attachChild(viewNode);
|
||||||
|
@ -1,24 +1,27 @@
|
|||||||
package pp.monopoly.client.gui;
|
package pp.monopoly.client.gui;
|
||||||
|
|
||||||
import com.jme3.math.FastMath;
|
import com.jme3.math.FastMath;
|
||||||
import com.jme3.math.Quaternion;
|
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.renderer.RenderManager;
|
import com.jme3.renderer.RenderManager;
|
||||||
import com.jme3.renderer.ViewPort;
|
import com.jme3.renderer.ViewPort;
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import com.jme3.scene.Spatial;
|
|
||||||
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.game.client.ClientGameLogic;
|
||||||
import pp.monopoly.model.Figure;
|
import pp.monopoly.model.Figure;
|
||||||
import pp.monopoly.notification.GameEventListener;
|
import pp.monopoly.notification.GameEventListener;
|
||||||
import pp.monopoly.notification.UpdatePlayerView;
|
import pp.monopoly.notification.UpdatePlayerView;
|
||||||
|
|
||||||
|
import java.lang.System.Logger;
|
||||||
|
import java.lang.System.Logger.Level;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
|
||||||
|
|
||||||
public class FigureControl extends AbstractControl implements GameEventListener {
|
public class FigureControl extends AbstractControl implements GameEventListener {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = System.getLogger(FigureControl.class.getName());
|
||||||
private final Figure figure;
|
private final Figure figure;
|
||||||
private final Node spatial;
|
private final Node spatial;
|
||||||
private final MonopolyApp app;
|
private final MonopolyApp app;
|
||||||
@ -47,14 +50,14 @@ public class FigureControl extends AbstractControl implements GameEventListener
|
|||||||
return; // Warte, bis die Verzögerung abgeschlossen ist
|
return; // Warte, bis die Verzögerung abgeschlossen ist
|
||||||
}
|
}
|
||||||
delayTime = 0; // Verzögerung abgeschlossen
|
delayTime = 0; // Verzögerung abgeschlossen
|
||||||
System.out.println("Delay completed. Starting animation...");
|
LOGGER.log(Level.DEBUG, "Delay completed. Starting animation...");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentTarget == null && !path.isEmpty()) {
|
if (currentTarget == null && !path.isEmpty()) {
|
||||||
// Hole das nächste Ziel aus dem Pfad
|
// Hole das nächste Ziel aus dem Pfad
|
||||||
currentTarget = path.poll();
|
currentTarget = path.poll();
|
||||||
animationTime = 0f;
|
animationTime = 0f;
|
||||||
System.out.println("Next target: " + currentTarget);
|
LOGGER.log(Level.DEBUG, "Next target: {0}", currentTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentTarget != null) {
|
if (currentTarget != null) {
|
||||||
@ -76,7 +79,8 @@ public class FigureControl extends AbstractControl implements GameEventListener
|
|||||||
spatial.setLocalTranslation(currentTarget);
|
spatial.setLocalTranslation(currentTarget);
|
||||||
figure.moveTo(currentTarget); // Synchronisiere die interne Position
|
figure.moveTo(currentTarget); // Synchronisiere die interne Position
|
||||||
currentTarget = null; // Setze Ziel zurück
|
currentTarget = null; // Setze Ziel zurück
|
||||||
System.out.println("Target reached.");
|
|
||||||
|
LOGGER.log(Level.DEBUG, "Target reached. Remaining path: {0}", path.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,33 +101,35 @@ public class FigureControl extends AbstractControl implements GameEventListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setPath(int startField, int endField) {
|
public void setPath(int startField, int endField) {
|
||||||
System.out.println("setPath called with startField: " + startField + ", endField: " + endField);
|
LOGGER.log(Level.TRACE, "setPath called with startField: {0} to endField {1}", startField, endField);
|
||||||
path.clear();
|
path.clear();
|
||||||
for (int fieldId = startField; fieldId != endField; fieldId = (fieldId + 1) % 40) {
|
for (int fieldId = startField; fieldId != endField; fieldId = (fieldId + 1) % 40) {
|
||||||
Vector3f position = figure.calculateFieldPosition(fieldId);
|
Vector3f position = figure.calculateFieldPosition(fieldId);
|
||||||
System.out.println("Adding position to path: " + position);
|
LOGGER.log(Level.DEBUG, "Adding postition to path: {0}", position);
|
||||||
path.add(position);
|
path.add(position);
|
||||||
}
|
}
|
||||||
Vector3f finalPosition = figure.calculateFieldPosition(endField);
|
Vector3f finalPosition = figure.calculateFieldPosition(endField);
|
||||||
path.add(finalPosition);
|
path.add(finalPosition);
|
||||||
System.out.println("Final position added to path: " + finalPosition);
|
LOGGER.log(Level.DEBUG, "Final position added to path: {0}", finalPosition);
|
||||||
|
|
||||||
System.out.println("Path size: " + path.size());
|
|
||||||
|
LOGGER.log(Level.TRACE, "Path size: {0}", path.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receivedEvent(UpdatePlayerView event) {
|
public void receivedEvent(UpdatePlayerView event) {
|
||||||
System.out.println("Event received: " + event);
|
LOGGER.log(Level.TRACE, "receivedEvent called with event: {0}", event);
|
||||||
|
|
||||||
int newPos = app.getGameLogic().getPlayerHandler().getPlayerById(figure.getId()).getFieldID();
|
int newPos = app.getGameLogic().getPlayerHandler().getPlayerById(figure.getId()).getFieldID();
|
||||||
int currentField = figure.getCurrentFieldID();
|
int currentField = figure.getCurrentFieldID();
|
||||||
|
|
||||||
if (currentField == newPos) {
|
if (currentField == newPos) {
|
||||||
System.out.println("Figure is already at the correct position. No path set.");
|
LOGGER.log(Level.DEBUG, "No movement required. Current field: {0}, New field: {1}", currentField, newPos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Movement required. Current field: " + currentField + ", New field: " + newPos);
|
LOGGER.log(Level.DEBUG, "Movement required. Current field: {0}, New field: {1}", currentField, newPos);
|
||||||
|
|
||||||
|
|
||||||
setPath(currentField, newPos);
|
setPath(currentField, newPos);
|
||||||
delayTime = 3f; // Verzögerung zurücksetzen
|
delayTime = 3f; // Verzögerung zurücksetzen
|
||||||
|
@ -325,7 +325,6 @@ public class LobbyMenu extends Dialog {
|
|||||||
figure = selector.getSelectedItem();
|
figure = selector.getSelectedItem();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
System.out.println("FIGUR:::::"+figure);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -381,7 +381,7 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
showFinalDiceResult(latestDiceRollEvent);
|
showFinalDiceResult(latestDiceRollEvent);
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
System.err.println("Dice animation interrupted: " + e.getMessage());
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
@ -527,7 +527,6 @@ public class Toolbar extends Dialog implements GameEventListener {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void receivedEvent(ButtonStatusEvent event) {
|
public void receivedEvent(ButtonStatusEvent event) {
|
||||||
System.out.println("Button status event received: " + event.buttonsEnabled()+ "GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG");
|
|
||||||
boolean enabled = event.buttonsEnabled();
|
boolean enabled = event.buttonsEnabled();
|
||||||
canRollDice = enabled;
|
canRollDice = enabled;
|
||||||
tradeButton.setEnabled(enabled);
|
tradeButton.setEnabled(enabled);
|
||||||
|
@ -910,7 +910,6 @@
|
|||||||
}
|
}
|
||||||
sliderhorsetup();
|
sliderhorsetup();
|
||||||
adjustothercolumnmodel();
|
adjustothercolumnmodel();
|
||||||
// System.out.println("Columns available: " +availableColumns);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@StyleAttribute(value="visibleColumns")
|
@StyleAttribute(value="visibleColumns")
|
||||||
@ -923,7 +922,6 @@
|
|||||||
sliderhorsetup();
|
sliderhorsetup();
|
||||||
grid.refreshGrid();
|
grid.refreshGrid();
|
||||||
refreshSelector();
|
refreshSelector();
|
||||||
// System.out.println("Columns visble: " +grid.getVisibleColumns());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Column Operations
|
// Column Operations
|
||||||
|
@ -78,7 +78,6 @@ public class BuildingPropertyCard extends Dialog {
|
|||||||
Button quitButton = buildingPropertyContainer.addChild(new Button("Beenden", new ElementId("button")));
|
Button quitButton = buildingPropertyContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||||
quitButton.setFontSize(32);
|
quitButton.setFontSize(32);
|
||||||
quitButton.addClickCommands(s -> ifTopDialog( () -> {
|
quitButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||||
System.err.println("Button does something?");
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
close();
|
close();
|
||||||
}));
|
}));
|
||||||
|
@ -119,13 +119,7 @@ public class SellHouse extends Dialog {
|
|||||||
confirmButton.addClickCommands(s -> ifTopDialog( () -> {
|
confirmButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
AlterProperty msg = new AlterProperty("SellHouse");
|
AlterProperty msg = new AlterProperty("SellHouse");
|
||||||
for (String string : selectedProperties) {
|
|
||||||
System.out.println(string);
|
|
||||||
}
|
|
||||||
msg.setProperties(selectedProperties.stream().map(p -> app.getGameLogic().getBoardManager().getFieldByName(p).getId()).map(p -> (Integer) p).collect(Collectors.toSet()));
|
msg.setProperties(selectedProperties.stream().map(p -> app.getGameLogic().getBoardManager().getFieldByName(p).getId()).map(p -> (Integer) p).collect(Collectors.toSet()));
|
||||||
for (Integer integer : msg.getProperties()) {
|
|
||||||
System.out.println("ID des verkaufs: "+integer);
|
|
||||||
}
|
|
||||||
app.getGameLogic().send(msg);
|
app.getGameLogic().send(msg);
|
||||||
close();
|
close();
|
||||||
}));
|
}));
|
||||||
|
@ -253,7 +253,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
|||||||
@Override
|
@Override
|
||||||
public void received(PlayerStatusUpdate msg) {
|
public void received(PlayerStatusUpdate msg) {
|
||||||
playerHandler = msg.getPlayerHandler();
|
playerHandler = msg.getPlayerHandler();
|
||||||
System.out.println("Update Player");
|
LOGGER.log(Level.TRACE, "Update Player View triggerd with message: {0}", msg);
|
||||||
notifyListeners(new UpdatePlayerView());
|
notifyListeners(new UpdatePlayerView());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +317,6 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void received(BuildInfo msg) {
|
public void received(BuildInfo msg) {
|
||||||
System.out.println("TRIGGER BUILD INFO");
|
|
||||||
if (msg.isAdded()) {
|
if (msg.isAdded()) {
|
||||||
BuildingProperty property = ((BuildingProperty)boardManager.getFieldAtIndex(msg.getId()));
|
BuildingProperty property = ((BuildingProperty)boardManager.getFieldAtIndex(msg.getId()));
|
||||||
if (property.getHotel() == 1 ) {
|
if (property.getHotel() == 1 ) {
|
||||||
|
@ -168,7 +168,6 @@ public class ServerGameLogic implements ClientInterpreter {
|
|||||||
PropertyField property = (PropertyField) boardManager.getFieldAtIndex(player.getFieldID()); // Assuming player position for property
|
PropertyField property = (PropertyField) boardManager.getFieldAtIndex(player.getFieldID()); // Assuming player position for property
|
||||||
|
|
||||||
player.buyProperty(property);
|
player.buyProperty(property);
|
||||||
System.out.println("Properties:" +player.getProperties().toString());
|
|
||||||
LOGGER.log(Level.INFO, "Player {0} bought property {1}", player.getName(), property.getName());
|
LOGGER.log(Level.INFO, "Player {0} bought property {1}", player.getName(), property.getName());
|
||||||
}
|
}
|
||||||
updateAllPlayers();
|
updateAllPlayers();
|
||||||
|
@ -150,7 +150,7 @@ public class Figure implements Item{
|
|||||||
float zOffset = new Random().nextFloat();
|
float zOffset = new Random().nextFloat();
|
||||||
|
|
||||||
//TODO adjust y pos
|
//TODO adjust y pos
|
||||||
return new Vector3f(baseX , 1, baseZ );
|
return new Vector3f(baseX , 0, baseZ );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrentFieldID() {
|
public int getCurrentFieldID() {
|
||||||
@ -158,7 +158,6 @@ public class Figure implements Item{
|
|||||||
for (int fieldID = 0; fieldID < 40; fieldID++) {
|
for (int fieldID = 0; fieldID < 40; fieldID++) {
|
||||||
Vector3f fieldPosition = calculateFieldPosition(fieldID);
|
Vector3f fieldPosition = calculateFieldPosition(fieldID);
|
||||||
if (pos.distance(fieldPosition) < 0.1f) { // Toleranz für Positionsvergleich
|
if (pos.distance(fieldPosition) < 0.1f) { // Toleranz für Positionsvergleich
|
||||||
System.out.println("Current field ID: " + fieldID);
|
|
||||||
return fieldID;
|
return fieldID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -801,8 +801,6 @@ public class ServerGameLogicTest {
|
|||||||
|
|
||||||
player.buyProperty(property);
|
player.buyProperty(property);
|
||||||
|
|
||||||
System.out.println("Player Balance: " + player.getAccountBalance());
|
|
||||||
System.out.println("Player Properties: " + player.getProperties());
|
|
||||||
assertEquals(14000, player.getAccountBalance());
|
assertEquals(14000, player.getAccountBalance());
|
||||||
assertTrue(player.getProperties().contains(property.getId()));
|
assertTrue(player.getProperties().contains(property.getId()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user