added testing shortcuts

This commit is contained in:
Johannes Schmelz 2024-11-25 04:09:48 +01:00
parent 8474c9f5bc
commit 2e42f3afac

View File

@ -23,12 +23,19 @@ import com.simsilica.lemur.style.BaseStyles;
import pp.monopoly.game.client.MonopolyClient;
import pp.monopoly.client.gui.SettingsMenu;
import pp.monopoly.client.gui.StartMenu;
import pp.monopoly.client.gui.TestWorld;
import pp.monopoly.client.gui.popups.BuildingPropertyCard;
import pp.monopoly.client.gui.popups.BuyCard;
import pp.monopoly.client.gui.popups.EventCard;
import pp.monopoly.client.gui.popups.FoodFieldCard;
import pp.monopoly.client.gui.popups.GateFieldCard;
import pp.monopoly.game.client.ClientGameLogic;
import pp.monopoly.game.client.ServerConnection;
import pp.monopoly.notification.ClientStateEvent;
import pp.monopoly.notification.GameEventListener;
import pp.monopoly.notification.InfoTextEvent;
import pp.monopoly.notification.Sound;
import pp.dialog.Dialog;
import pp.dialog.DialogBuilder;
import pp.dialog.DialogManager;
import pp.graphics.Draw;
@ -120,6 +127,16 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
*/
private final ActionListener escapeListener = (name, isPressed, tpf) -> escape(isPressed);
//TODO temp for testing
private EventCard eventCard;
private BuildingPropertyCard buildingProperty;
private FoodFieldCard foodField;
private GateFieldCard gateField;
private BuyCard buyCard;
private boolean isBuyCardPopupOpen = false;
private final ActionListener BListener = (name, isPressed, tpf) -> handleB(isPressed);
private final ActionListener TListener = (name, isPressed, tpf) -> handleT(isPressed);
static {
// Configure logging
LogManager manager = LogManager.getLogManager();
@ -248,8 +265,44 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
inputManager.addMapping(ESC, new KeyTrigger(KeyInput.KEY_ESCAPE));
inputManager.addMapping(CLICK, new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
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));
inputManager.addListener(TListener, "T");
}
//logik zum wechselnden erscheinen und verschwinden beim drücken von B //TODO süäter entfernen
private void handleB(boolean isPressed) {
if (isPressed) {
Dialog tmp = new BuyCard(this);
if (eventCard != null && isBuyCardPopupOpen) {
// Schließe das SettingsMenu
System.out.println("Schließe BuyCardPopup...");
eventCard.close();
eventCard = null;
tmp.open();
} else {
// Öffne das SettingsMenu
System.out.println("Öffne BuyCardPopup...");
eventCard = new EventCard(this);
eventCard.open();
dialogManager.close(tmp);
}
}
}
//logik zum wechselnden erscheinen und verschwinden beim drücken von B //TODO süäter entfernen
private void handleT(boolean isPressed) {
if (isPressed) {
TestWorld tmp = new TestWorld(this);
tmp.initializeScene();
}
}
/**
* Initializes and attaches the necessary application states for the game.
*/