mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-18 22:56:15 +01:00
du kommst ins Gulag Popup
This commit is contained in:
parent
b702e3a14d
commit
11f4560745
@ -292,6 +292,8 @@ public class TestWorld implements GameEventListener {
|
||||
new TimeOut(app).open();
|
||||
} else if(event.msg().equals("tradeRequest")) {
|
||||
new ConfirmTrade(app).open();
|
||||
} else if (event.msg().equals("goingToJail")) {
|
||||
new Gulag(app).open();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,10 +261,8 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
@Override
|
||||
public void received(JailEvent msg) {
|
||||
if (msg.isGoingToJail()) {
|
||||
|
||||
playSound(Sound.GULAG);
|
||||
} else {
|
||||
System.out.println("NO MORE JAIL");
|
||||
notifyListeners(new PopUpEvent("goingToJail", msg));
|
||||
}
|
||||
}
|
||||
|
||||
@ -345,6 +343,8 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
public void received(NotificationMessage msg) {
|
||||
if (msg.getKeyWord().equals("rent")) {
|
||||
notifyListeners(new PopUpEvent("rent", msg));
|
||||
} else if (msg.getKeyWord().equals("jailpay")) {
|
||||
notifyListeners(new PopUpEvent(msg.getKeyWord(), msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -624,10 +624,7 @@ public class Player implements FieldVisitor<Void>{
|
||||
public void payBail() {
|
||||
if (accountBalance >= 500) {
|
||||
pay(500);
|
||||
handler.getLogic().send(Player.this, new NotificationMessage(""));
|
||||
state = new ActiveState();
|
||||
} else {
|
||||
handler.getLogic().send(Player.this, new NotificationMessage(""));
|
||||
}
|
||||
}
|
||||
|
||||
@ -635,10 +632,7 @@ public class Player implements FieldVisitor<Void>{
|
||||
public void useJailCard() {
|
||||
if (getOutOfJailCard > 0) {
|
||||
removeJailCard();
|
||||
handler.getLogic().send(Player.this, new NotificationMessage(""));
|
||||
state = new ActiveState();
|
||||
} else {
|
||||
handler.getLogic().send(Player.this, new NotificationMessage(""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import pp.monopoly.message.client.AlterProperty;
|
||||
import pp.monopoly.message.client.BuyPropertyResponse;
|
||||
import pp.monopoly.message.client.ClientInterpreter;
|
||||
import pp.monopoly.message.client.EndTurn;
|
||||
import pp.monopoly.message.client.NotificationAnswer;
|
||||
import pp.monopoly.message.client.PlayerReady;
|
||||
import pp.monopoly.message.client.RollDice;
|
||||
import pp.monopoly.message.client.TradeOffer;
|
||||
@ -400,5 +401,18 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateAllPlayers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(NotificationAnswer msg, int from) {
|
||||
if(msg.getKeyword().equals("UseJailCard")) {
|
||||
playerHandler.getPlayerById(from).useJailCard();
|
||||
} else if (msg.getKeyword().equals("PayJail")) {
|
||||
playerHandler.getPlayerById(from).payBail();
|
||||
}
|
||||
|
||||
updateAllPlayers();
|
||||
}
|
||||
}
|
||||
|
@ -74,4 +74,12 @@ public interface ClientInterpreter {
|
||||
* @param from the connection ID from which the message was received
|
||||
*/
|
||||
void received(AlterProperty msg, int from);
|
||||
|
||||
/**
|
||||
* Processes a received NotificationAnswer.
|
||||
*
|
||||
* @param msg the NotificationAnswer to be processed
|
||||
* @param from the connection ID from which the message was received
|
||||
*/
|
||||
void received(NotificationAnswer msg, int from);
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package pp.monopoly.message.client;
|
||||
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
@Serializable
|
||||
public class NotificationAnswer extends ClientMessage{
|
||||
|
||||
private String keyword;
|
||||
|
||||
private NotificationAnswer() {}
|
||||
|
||||
public NotificationAnswer(String keyword) {
|
||||
this.keyword = keyword;
|
||||
}
|
||||
|
||||
public String getKeyword() {
|
||||
return keyword;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(ClientInterpreter interpreter, int from) {
|
||||
interpreter.received(this, from);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user