Compare commits

...

2 Commits

Author SHA1 Message Date
Johannes Schmelz
9e88353bd5 show bankrupt popup once 2024-12-03 00:17:23 +01:00
Johannes Schmelz
6db96f0a1d trigger demo mode 2024-12-03 00:12:22 +01:00
2 changed files with 19 additions and 34 deletions

View File

@ -30,18 +30,16 @@ import com.jme3.system.AppSettings;
import com.simsilica.lemur.GuiGlobals; import com.simsilica.lemur.GuiGlobals;
import com.simsilica.lemur.style.BaseStyles; import com.simsilica.lemur.style.BaseStyles;
import pp.dialog.Dialog;
import pp.dialog.DialogBuilder; import pp.dialog.DialogBuilder;
import pp.dialog.DialogManager; import pp.dialog.DialogManager;
import pp.graphics.Draw; import pp.graphics.Draw;
import static pp.monopoly.Resources.lookup; import static pp.monopoly.Resources.lookup;
import pp.monopoly.client.gui.SettingsMenu; import pp.monopoly.client.gui.SettingsMenu;
import pp.monopoly.client.gui.StartMenu; import pp.monopoly.client.gui.StartMenu;
import pp.monopoly.client.gui.TestWorld;
import pp.monopoly.client.gui.popups.*;
import pp.monopoly.game.client.ClientGameLogic; import pp.monopoly.game.client.ClientGameLogic;
import pp.monopoly.game.client.MonopolyClient; import pp.monopoly.game.client.MonopolyClient;
import pp.monopoly.game.client.ServerConnection; import pp.monopoly.game.client.ServerConnection;
import pp.monopoly.message.client.NotificationAnswer;
import pp.monopoly.notification.ClientStateEvent; import pp.monopoly.notification.ClientStateEvent;
import pp.monopoly.notification.GameEventListener; import pp.monopoly.notification.GameEventListener;
import pp.monopoly.notification.InfoTextEvent; import pp.monopoly.notification.InfoTextEvent;
@ -123,22 +121,10 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
*/ */
private final ActionListener escapeListener = (name, isPressed, tpf) -> escape(isPressed); private final ActionListener escapeListener = (name, isPressed, tpf) -> escape(isPressed);
//TODO temp for testing /**
private EventCardPopup eventCard; * Listener for handeling Demo Mode (Minas mode)
private BuildingPropertyCard buildingProperty; */
private FoodFieldCard foodField; private final ActionListener f8Listener = (name, isPressed, tpf) -> handleF8(isPressed);
private GateFieldCard gateField;
private LooserPopUp looserpopup;
private Bankrupt bankrupt;
private TimeOut timeOut;
private SellHouse sellHouse;
private BuyHouse buyHouse;
private TakeMortage takeMortage;
private RepayMortage repayMortage;
private boolean isBuyCardPopupOpen = false;
private final ActionListener BListener = (name, isPressed, tpf) -> handleB(isPressed);
private TestWorld testWorld;
static { static {
// Configure logging // Configure logging
@ -267,20 +253,20 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
inputManager.setCursorVisible(false); inputManager.setCursorVisible(false);
inputManager.addMapping(ESC, new KeyTrigger(KeyInput.KEY_ESCAPE)); inputManager.addMapping(ESC, new KeyTrigger(KeyInput.KEY_ESCAPE));
inputManager.addMapping(CLICK, new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); inputManager.addMapping(CLICK, new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addMapping("F8", new KeyTrigger(KeyInput.KEY_F8));
inputManager.addListener(f8Listener, "F8");
inputManager.addListener(escapeListener, ESC); inputManager.addListener(escapeListener, ESC);
//TODO tmp for testing
// inputManager.addMapping("B", new KeyTrigger(KeyInput.KEY_B));
// inputManager.addListener(BListener, "B");
// inputManager.addMapping("T", new KeyTrigger(KeyInput.KEY_T));
} }
//logik zum wechselnden erscheinen und verschwinden beim drücken von B //TODO später entfernen /**
private void handleB(boolean isPressed) { * Handles the action on alt m for demo mode
* @param isPressed {@code true} is alt + m is pressed, {@code false} otherwise
*/
private void handleF8(boolean isPressed) {
if (isPressed) { if (isPressed) {
Dialog tmp = new GulagInfo(this, 3); LOGGER.log(Level.INFO, "F detected."); // Debug logging
tmp.open(); getGameLogic().send(new NotificationAnswer("hack"));
} }
} }
@ -333,11 +319,6 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
dialogManager.update(tpf); dialogManager.update(tpf);
logic.update(tpf); logic.update(tpf);
stateManager.update(tpf); stateManager.update(tpf);
// //TODO testing replace later
// if (testWorld != null) {
// testWorld.update(tpf);
// }
} }
/** /**

View File

@ -103,6 +103,8 @@ public class Toolbar extends Dialog implements GameEventListener {
*/ */
private volatile DiceRollEvent latestDiceRollEvent = null; private volatile DiceRollEvent latestDiceRollEvent = null;
private boolean bankruptPopUp = false;
/** /**
* Constructs the toolbar for the Monopoly application. * Constructs the toolbar for the Monopoly application.
* <p> * <p>
@ -256,9 +258,11 @@ public class Toolbar extends Dialog implements GameEventListener {
endTurnButton.setPreferredSize(new Vector3f(150, 50, 0)); endTurnButton.setPreferredSize(new Vector3f(150, 50, 0));
endTurnButton.addClickCommands(s -> ifTopDialog(() -> { endTurnButton.addClickCommands(s -> ifTopDialog(() -> {
app.getGameLogic().playSound(Sound.BUTTON); app.getGameLogic().playSound(Sound.BUTTON);
if (app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getAccountBalance() < 0) { if (app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getAccountBalance() < 0 && !bankruptPopUp) {
new Bankrupt(app).open(); new Bankrupt(app).open();
bankruptPopUp = true;
} else { } else {
bankruptPopUp = false;
app.getGameLogic().send(new EndTurn()); app.getGameLogic().send(new EndTurn());
receivedEvent(new ButtonStatusEvent(false)); receivedEvent(new ButtonStatusEvent(false));
} }