mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-29 03:09:46 +01:00
cleanup
This commit is contained in:
parent
89587a4c78
commit
156e76fe0a
@ -205,7 +205,6 @@ public class ChoosePartner extends Dialog {
|
|||||||
public void update(float tpf) {
|
public void update(float tpf) {
|
||||||
if (selectionRef.update()) {
|
if (selectionRef.update()) {
|
||||||
String selected = selectionRef.get().toString();
|
String selected = selectionRef.get().toString();
|
||||||
System.out.println(selected);
|
|
||||||
listener.onSelectionChanged(selected);
|
listener.onSelectionChanged(selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,7 +234,6 @@ public class ChoosePartner extends Dialog {
|
|||||||
* Callback for when the dropdown selection changes.
|
* Callback for when the dropdown selection changes.
|
||||||
*/
|
*/
|
||||||
private void onDropdownSelectionChanged(String selected) {
|
private void onDropdownSelectionChanged(String selected) {
|
||||||
System.out.println("Selected: " + selected);
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
int idStart = selected.indexOf("(ID: ") + 5; // Find start of the ID
|
int idStart = selected.indexOf("(ID: ") + 5; // Find start of the ID
|
||||||
int idEnd = selected.indexOf(")", idStart); // Find end of the ID
|
int idEnd = selected.indexOf(")", idStart); // Find end of the ID
|
||||||
@ -247,9 +245,6 @@ public class ChoosePartner extends Dialog {
|
|||||||
|
|
||||||
if (selectedPlayer != null) {
|
if (selectedPlayer != null) {
|
||||||
tradeHandler.setReceiver(selectedPlayer); // Set the receiver in TradeHandler
|
tradeHandler.setReceiver(selectedPlayer); // Set the receiver in TradeHandler
|
||||||
System.out.println("Receiver set to: " + selectedPlayer.getName() + " (ID: " + selectedPlayer.getId() + ")");
|
|
||||||
} else {
|
|
||||||
System.err.println("Player with ID " + playerId + " not found.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +241,6 @@ public class LobbyMenu extends Dialog {
|
|||||||
public void update(float tpf) {
|
public void update(float tpf) {
|
||||||
if (selectionRef.update()) {
|
if (selectionRef.update()) {
|
||||||
String selected = selectionRef.get().toString();
|
String selected = selectionRef.get().toString();
|
||||||
System.out.println(selected);
|
|
||||||
listener.onSelectionChanged(selected);
|
listener.onSelectionChanged(selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,7 +269,6 @@ public class LobbyMenu extends Dialog {
|
|||||||
* Callback for when the dropdown selection changes.
|
* Callback for when the dropdown selection changes.
|
||||||
*/
|
*/
|
||||||
private void onDropdownSelectionChanged(String selected) {
|
private void onDropdownSelectionChanged(String selected) {
|
||||||
System.out.println("Selected: " + selected);
|
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
switch (selected) {
|
switch (selected) {
|
||||||
case "[0]":
|
case "[0]":
|
||||||
|
@ -223,7 +223,6 @@ public class Toolbar extends Dialog implements GameEventListener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
overviewContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
overviewContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||||
System.out.println("pdate");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -236,7 +235,6 @@ public class Toolbar extends Dialog implements GameEventListener{
|
|||||||
icon2.setIconSize(new Vector2f(100, 100));
|
icon2.setIconSize(new Vector2f(100, 100));
|
||||||
imageLabel.setIcon(icon1);
|
imageLabel.setIcon(icon1);
|
||||||
imageLabel2.setIcon(icon2);
|
imageLabel2.setIcon(icon2);
|
||||||
System.out.println("Dice images set");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String diceToString(int i) {
|
private String diceToString(int i) {
|
||||||
|
@ -146,7 +146,6 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
|||||||
LOGGER.log(Level.ERROR, "trying to send {0} with sender==null", msg); //NON-NLS
|
LOGGER.log(Level.ERROR, "trying to send {0} with sender==null", msg); //NON-NLS
|
||||||
} else {
|
} else {
|
||||||
clientSender.send(msg);
|
clientSender.send(msg);
|
||||||
System.out.println("Message gesendet");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +215,6 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
|||||||
@Override
|
@Override
|
||||||
public void received(DiceResult msg) {
|
public void received(DiceResult msg) {
|
||||||
playSound(Sound.DICE_ROLL);
|
playSound(Sound.DICE_ROLL);
|
||||||
System.out.println("Message kam an");
|
|
||||||
notifyListeners(new DiceRollEvent(msg.getRollResult().get(0), msg.getRollResult().get(1)));
|
notifyListeners(new DiceRollEvent(msg.getRollResult().get(0), msg.getRollResult().get(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +342,6 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
|||||||
@Override
|
@Override
|
||||||
public void received(NextPlayerTurn msg) {
|
public void received(NextPlayerTurn msg) {
|
||||||
|
|
||||||
System.out.println("Du bsit am zug message empfangen");
|
|
||||||
setState(new ActiveState(this));
|
setState(new ActiveState(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,6 @@ public class Player implements FieldVisitor<Void>{
|
|||||||
* @return the result of a dice roll (1 to 6)
|
* @return the result of a dice roll (1 to 6)
|
||||||
*/
|
*/
|
||||||
private static int rollDice() {
|
private static int rollDice() {
|
||||||
System.out.println("Gewuerfelt");
|
|
||||||
return random.nextInt(6) + 1;
|
return random.nextInt(6) + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,6 @@ public class PlayerHandler {
|
|||||||
public Player getPlayerById(int id) {
|
public Player getPlayerById(int id) {
|
||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
if (player.getId() == id) return player;
|
if (player.getId() == id) return player;
|
||||||
System.out.println(player.getId());
|
|
||||||
}
|
}
|
||||||
throw new NoSuchElementException("Player mit id "+id+" existiert nicht");
|
throw new NoSuchElementException("Player mit id "+id+" existiert nicht");
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,6 @@ public class ServerGameLogic implements ClientInterpreter {
|
|||||||
|
|
||||||
playerHandler.addPlayer(player);
|
playerHandler.addPlayer(player);
|
||||||
LOGGER.log(Level.DEBUG, "Player added: {0}", player.getId());
|
LOGGER.log(Level.DEBUG, "Player added: {0}", player.getId());
|
||||||
System.out.println("Anzahl Spieler verbunden:"+ playerHandler.getPlayerCount());
|
|
||||||
|
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
@ -221,7 +220,6 @@ public class ServerGameLogic implements ClientInterpreter {
|
|||||||
public void received(RollDice msg, int from) {
|
public void received(RollDice msg, int from) {
|
||||||
Player player = playerHandler.getPlayerById(from);
|
Player player = playerHandler.getPlayerById(from);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
System.out.println("Ergebniss gesendet");
|
|
||||||
send(player, player.rollDice());
|
send(player, player.rollDice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,10 +104,10 @@ public class TradeHandler {
|
|||||||
*/
|
*/
|
||||||
public boolean initiateTrade() {
|
public boolean initiateTrade() {
|
||||||
if (!validateTrade()) {
|
if (!validateTrade()) {
|
||||||
System.out.println("Trade offer is invalid.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
System.out.println("Trade initiated by " + sender.getName() + " to " + receiver.getName());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,14 +138,14 @@ public class TradeHandler {
|
|||||||
transferJailCards(sender, receiver, offeredJailCards);
|
transferJailCards(sender, receiver, offeredJailCards);
|
||||||
transferJailCards(receiver, sender, requestedJailCards);
|
transferJailCards(receiver, sender, requestedJailCards);
|
||||||
|
|
||||||
System.out.println("Trade completed between " + sender.getName() + " and " + receiver.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rejects the trade.
|
* Rejects the trade.
|
||||||
*/
|
*/
|
||||||
public void rejectTrade() {
|
public void rejectTrade() {
|
||||||
System.out.println(receiver.getName() + " rejected the trade.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,13 +156,13 @@ public class TradeHandler {
|
|||||||
private boolean validateTrade() {
|
private boolean validateTrade() {
|
||||||
// Validate sender's ability to offer money
|
// Validate sender's ability to offer money
|
||||||
if (sender.getAccountBalance() < offeredAmount) {
|
if (sender.getAccountBalance() < offeredAmount) {
|
||||||
System.out.println("Sender does not have enough money to offer.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate receiver's ability to fulfill the requested amount
|
// Validate receiver's ability to fulfill the requested amount
|
||||||
if (receiver.getAccountBalance() < requestedAmount) {
|
if (receiver.getAccountBalance() < requestedAmount) {
|
||||||
System.out.println("Receiver does not have enough money to fulfill the request.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ public class TradeHandler {
|
|||||||
if (offeredProperties != null) {
|
if (offeredProperties != null) {
|
||||||
for (PropertyField property : offeredProperties) {
|
for (PropertyField property : offeredProperties) {
|
||||||
if (!sender.getProperties().contains(property)) {
|
if (!sender.getProperties().contains(property)) {
|
||||||
System.out.println("Sender does not own property: " + property.getName());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ public class TradeHandler {
|
|||||||
if (requestedProperties != null) {
|
if (requestedProperties != null) {
|
||||||
for (PropertyField property : requestedProperties) {
|
for (PropertyField property : requestedProperties) {
|
||||||
if (!receiver.getProperties().contains(property)) {
|
if (!receiver.getProperties().contains(property)) {
|
||||||
System.out.println("Receiver does not own property: " + property.getName());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,11 +186,11 @@ public class TradeHandler {
|
|||||||
|
|
||||||
// Validate jail cards
|
// Validate jail cards
|
||||||
if (sender.getNumJailCard() < offeredJailCards) {
|
if (sender.getNumJailCard() < offeredJailCards) {
|
||||||
System.out.println("Sender does not have enough jail cards to offer.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (receiver.getNumJailCard() < requestedJailCards) {
|
if (receiver.getNumJailCard() < requestedJailCards) {
|
||||||
System.out.println("Receiver does not have enough jail cards to fulfill the request.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ public class TradeHandler {
|
|||||||
from.sellProperty(property);
|
from.sellProperty(property);
|
||||||
to.buyProperty(property);
|
to.buyProperty(property);
|
||||||
property.setOwner(to);
|
property.setOwner(to);
|
||||||
System.out.println("Property " + property.getName() + " transferred from " + from.getName() + " to " + to.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -223,7 +223,7 @@ public class TradeHandler {
|
|||||||
from.removeJailCard();
|
from.removeJailCard();
|
||||||
to.addJailCard();
|
to.addJailCard();
|
||||||
}
|
}
|
||||||
System.out.println(numCards + " jail card(s) transferred from " + from.getName() + " to " + to.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOfferedAmount(int offeredAmount) {
|
public void setOfferedAmount(int offeredAmount) {
|
||||||
|
@ -147,7 +147,6 @@ public class MonopolyServer implements MessageListener<HostedConnection>, Connec
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void messageReceived(HostedConnection source, Message message) {
|
public void messageReceived(HostedConnection source, Message message) {
|
||||||
System.out.println("Message recieved");
|
|
||||||
LOGGER.log(Level.INFO, "message received from {0}: {1}", source.getId(), message); //NON-NLS
|
LOGGER.log(Level.INFO, "message received from {0}: {1}", source.getId(), message); //NON-NLS
|
||||||
if (message instanceof ClientMessage clientMessage)
|
if (message instanceof ClientMessage clientMessage)
|
||||||
pendingMessages.add(new ReceivedMessage(clientMessage, source.getId()));
|
pendingMessages.add(new ReceivedMessage(clientMessage, source.getId()));
|
||||||
@ -157,7 +156,6 @@ public class MonopolyServer implements MessageListener<HostedConnection>, Connec
|
|||||||
public void connectionAdded(Server server, HostedConnection hostedConnection) {
|
public void connectionAdded(Server server, HostedConnection hostedConnection) {
|
||||||
LOGGER.log(Level.INFO, "New connection established: {0}", hostedConnection); //NON-NLS
|
LOGGER.log(Level.INFO, "New connection established: {0}", hostedConnection); //NON-NLS
|
||||||
logic.addPlayer(hostedConnection.getId());
|
logic.addPlayer(hostedConnection.getId());
|
||||||
System.out.println("Spieler verbunden: ID = " + hostedConnection.getId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user