This commit is contained in:
Johannes Schmelz 2024-12-09 13:55:04 +01:00
parent e337303408
commit e98e17f6d7
11 changed files with 23 additions and 34 deletions

View File

@ -99,7 +99,6 @@ public class BoardAppState extends MonopolyAppState {
setupScene();
if (bobTheBuilder == null) {
bobTheBuilder = new BobTheBuilder(getApp(), sceneNode);
System.out.println("LISTENER IS REGISTEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD");
getGameLogic().addListener(bobTheBuilder);
}
getApp().getRootNode().attachChild(viewNode);

View File

@ -1,24 +1,27 @@
package pp.monopoly.client.gui;
import com.jme3.math.FastMath;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.AbstractControl;
import pp.monopoly.client.MonopolyApp;
import pp.monopoly.game.client.ClientGameLogic;
import pp.monopoly.model.Figure;
import pp.monopoly.notification.GameEventListener;
import pp.monopoly.notification.UpdatePlayerView;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.util.LinkedList;
import java.util.Queue;
public class FigureControl extends AbstractControl implements GameEventListener {
private static final Logger LOGGER = System.getLogger(FigureControl.class.getName());
private final Figure figure;
private final Node spatial;
private final MonopolyApp app;
@ -47,14 +50,14 @@ public class FigureControl extends AbstractControl implements GameEventListener
return; // Warte, bis die Verzögerung abgeschlossen ist
}
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()) {
// Hole das nächste Ziel aus dem Pfad
currentTarget = path.poll();
animationTime = 0f;
System.out.println("Next target: " + currentTarget);
LOGGER.log(Level.DEBUG, "Next target: {0}", currentTarget);
}
if (currentTarget != null) {
@ -76,7 +79,8 @@ public class FigureControl extends AbstractControl implements GameEventListener
spatial.setLocalTranslation(currentTarget);
figure.moveTo(currentTarget); // Synchronisiere die interne Position
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) {
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();
for (int fieldId = startField; fieldId != endField; fieldId = (fieldId + 1) % 40) {
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);
}
Vector3f finalPosition = figure.calculateFieldPosition(endField);
path.add(finalPosition);
System.out.println("Final position added to path: " + finalPosition);
System.out.println("Path size: " + path.size());
LOGGER.log(Level.DEBUG, "Final position added to path: {0}", finalPosition);
LOGGER.log(Level.TRACE, "Path size: {0}", path.size());
}
@Override
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 currentField = figure.getCurrentFieldID();
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;
}
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);
delayTime = 3f; // Verzögerung zurücksetzen

View File

@ -325,7 +325,6 @@ public class LobbyMenu extends Dialog {
figure = selector.getSelectedItem();
break;
}
System.out.println("FIGUR:::::"+figure);
}
/**

View File

@ -381,7 +381,7 @@ public class Toolbar extends Dialog implements GameEventListener {
showFinalDiceResult(latestDiceRollEvent);
}
} catch (InterruptedException e) {
System.err.println("Dice animation interrupted: " + e.getMessage());
e.printStackTrace();
}
}).start();
}
@ -527,7 +527,6 @@ public class Toolbar extends Dialog implements GameEventListener {
*/
@Override
public void receivedEvent(ButtonStatusEvent event) {
System.out.println("Button status event received: " + event.buttonsEnabled()+ "GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG");
boolean enabled = event.buttonsEnabled();
canRollDice = enabled;
tradeButton.setEnabled(enabled);

View File

@ -910,7 +910,6 @@
}
sliderhorsetup();
adjustothercolumnmodel();
// System.out.println("Columns available: " +availableColumns);
}
@StyleAttribute(value="visibleColumns")
@ -923,7 +922,6 @@
sliderhorsetup();
grid.refreshGrid();
refreshSelector();
// System.out.println("Columns visble: " +grid.getVisibleColumns());
}
// Column Operations

View File

@ -78,7 +78,6 @@ public class BuildingPropertyCard extends Dialog {
Button quitButton = buildingPropertyContainer.addChild(new Button("Beenden", new ElementId("button")));
quitButton.setFontSize(32);
quitButton.addClickCommands(s -> ifTopDialog( () -> {
System.err.println("Button does something?");
app.getGameLogic().playSound(Sound.BUTTON);
close();
}));

View File

@ -119,13 +119,7 @@ public class SellHouse extends Dialog {
confirmButton.addClickCommands(s -> ifTopDialog( () -> {
app.getGameLogic().playSound(Sound.BUTTON);
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()));
for (Integer integer : msg.getProperties()) {
System.out.println("ID des verkaufs: "+integer);
}
app.getGameLogic().send(msg);
close();
}));

View File

@ -253,7 +253,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
@Override
public void received(PlayerStatusUpdate msg) {
playerHandler = msg.getPlayerHandler();
System.out.println("Update Player");
LOGGER.log(Level.TRACE, "Update Player View triggerd with message: {0}", msg);
notifyListeners(new UpdatePlayerView());
}
@ -317,7 +317,6 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
@Override
public void received(BuildInfo msg) {
System.out.println("TRIGGER BUILD INFO");
if (msg.isAdded()) {
BuildingProperty property = ((BuildingProperty)boardManager.getFieldAtIndex(msg.getId()));
if (property.getHotel() == 1 ) {

View File

@ -168,7 +168,6 @@ public class ServerGameLogic implements ClientInterpreter {
PropertyField property = (PropertyField) boardManager.getFieldAtIndex(player.getFieldID()); // Assuming player position for property
player.buyProperty(property);
System.out.println("Properties:" +player.getProperties().toString());
LOGGER.log(Level.INFO, "Player {0} bought property {1}", player.getName(), property.getName());
}
updateAllPlayers();

View File

@ -150,7 +150,7 @@ public class Figure implements Item{
float zOffset = new Random().nextFloat();
//TODO adjust y pos
return new Vector3f(baseX , 1, baseZ );
return new Vector3f(baseX , 0, baseZ );
}
public int getCurrentFieldID() {
@ -158,7 +158,6 @@ public class Figure implements Item{
for (int fieldID = 0; fieldID < 40; fieldID++) {
Vector3f fieldPosition = calculateFieldPosition(fieldID);
if (pos.distance(fieldPosition) < 0.1f) { // Toleranz für Positionsvergleich
System.out.println("Current field ID: " + fieldID);
return fieldID;
}
}

View File

@ -801,8 +801,6 @@ public class ServerGameLogicTest {
player.buyProperty(property);
System.out.println("Player Balance: " + player.getAccountBalance());
System.out.println("Player Properties: " + player.getProperties());
assertEquals(14000, player.getAccountBalance());
assertTrue(player.getProperties().contains(property.getId()));
}