Fix some errors
This commit is contained in:
		@@ -43,6 +43,7 @@ public class InputSynchronizer {
 | 
			
		||||
 | 
			
		||||
    private void setupInput() {
 | 
			
		||||
        inputManager.addMapping("Settings", new KeyTrigger(KeyInput.KEY_ESCAPE));
 | 
			
		||||
        inputManager.addMapping("Forward", new KeyTrigger(KeyInput.KEY_RETURN));
 | 
			
		||||
 | 
			
		||||
        inputManager.addMapping("RotateRightMouse", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
 | 
			
		||||
        inputManager.addMapping("MouseLeft", new MouseAxisTrigger(MouseInput.AXIS_X, false)); // Left movement
 | 
			
		||||
@@ -54,7 +55,7 @@ private void setupInput() {
 | 
			
		||||
        inputManager.addMapping("Click", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        inputManager.addListener(actionListener, "Settings", "RotateRightMouse", "Click", "Test");
 | 
			
		||||
        inputManager.addListener(actionListener, "Settings", "Forward", "RotateRightMouse", "Click", "Test");
 | 
			
		||||
        inputManager.addListener(analogListener, "MouseLeft", "MouseRight", "MouseScrollUp", "MouseScrollDown");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -64,7 +65,10 @@ private void setupInput() {
 | 
			
		||||
        @Override
 | 
			
		||||
        public void onAction(String name, boolean isPressed, float tpf) {
 | 
			
		||||
            if (name.equals("Settings") && isPressed) {
 | 
			
		||||
                //app.getView().pressEscape();
 | 
			
		||||
                app.getView().pressEscape();
 | 
			
		||||
            }
 | 
			
		||||
            if (name.equals("Forward") && isPressed) {
 | 
			
		||||
                app.getView().pressForward();
 | 
			
		||||
            }
 | 
			
		||||
            if (name.equals("RotateRightMouse")) {
 | 
			
		||||
                rightMousePressed = isPressed;
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ public JoinDialog(MdgaApp app, Node node, MainView view) {
 | 
			
		||||
        ipInput = new InputButton(app, node, "Ip: ", 15);
 | 
			
		||||
        portInput = new InputButton(app, node, "Port: ", 5);
 | 
			
		||||
        portInput.setString(prefs.get("joinPort", "11111"));
 | 
			
		||||
        ipInput.setString(prefs.get("jostIp", ""));
 | 
			
		||||
        ipInput.setString(prefs.get("joinIp", ""));
 | 
			
		||||
 | 
			
		||||
        joinButton = new ButtonRight(app, node, view::forward, "Spiel beitreten", 10);
 | 
			
		||||
        backButton = new ButtonLeft(app, node, view::back, "Zurück", 10);
 | 
			
		||||
 
 | 
			
		||||
@@ -126,7 +126,7 @@ private void enterSub(SubState state) {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void forward() {
 | 
			
		||||
    public void forward() {
 | 
			
		||||
        switch (state) {
 | 
			
		||||
            case AWARD_CEREMONY:
 | 
			
		||||
                enterSub(SubState.STATISTICS);
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,7 @@
 | 
			
		||||
import pp.mdga.client.board.BoardHandler;
 | 
			
		||||
import pp.mdga.client.board.CameraHandler;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
import pp.mdga.client.button.ButtonLeft;
 | 
			
		||||
import pp.mdga.client.button.ButtonRight;
 | 
			
		||||
import pp.mdga.client.button.SettingsButton;
 | 
			
		||||
import pp.mdga.client.gui.GuiHandler;
 | 
			
		||||
@@ -34,6 +35,8 @@ public class GameView extends MdgaView {
 | 
			
		||||
 | 
			
		||||
    private ButtonRight cheatButton; //TODO
 | 
			
		||||
 | 
			
		||||
    private ButtonLeft leaveButton;
 | 
			
		||||
 | 
			
		||||
    private Color ownColor = null;
 | 
			
		||||
 | 
			
		||||
    private FilterPostProcessor fpp;
 | 
			
		||||
@@ -41,7 +44,8 @@ public class GameView extends MdgaView {
 | 
			
		||||
    public GameView(MdgaApp app) {
 | 
			
		||||
        super(app);
 | 
			
		||||
 | 
			
		||||
        cheatButton = new ButtonRight(app, guiNode, () -> app.getModelSyncronizer().enter(MdgaState.CEREMONY), "Weiter (CHEAT)", 1);
 | 
			
		||||
        cheatButton = new ButtonRight(app, settingsNode, () -> app.getModelSyncronizer().enter(MdgaState.CEREMONY), "CHEAT", 1);
 | 
			
		||||
        leaveButton = new ButtonLeft(app, settingsNode, () -> app.getModelSyncronizer().leave(), "Spiel verlassen", 1);
 | 
			
		||||
 | 
			
		||||
        fpp = new FilterPostProcessor(app.getAssetManager());
 | 
			
		||||
        this.camera = new CameraHandler(app, fpp);
 | 
			
		||||
@@ -56,8 +60,6 @@ public void onEnter() {
 | 
			
		||||
        boardHandler.init();
 | 
			
		||||
        guiHandler.init();
 | 
			
		||||
 | 
			
		||||
        cheatButton.show();
 | 
			
		||||
 | 
			
		||||
        app.getViewPort().addProcessor(fpp);
 | 
			
		||||
 | 
			
		||||
        app.getAcousticHandler().playSound(MdgaSound.START);
 | 
			
		||||
@@ -69,8 +71,6 @@ public void onLeave() {
 | 
			
		||||
        boardHandler.shutdown();
 | 
			
		||||
        guiHandler.shutdown();
 | 
			
		||||
 | 
			
		||||
        cheatButton.hide();
 | 
			
		||||
 | 
			
		||||
        app.getViewPort().removeProcessor(fpp);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -81,13 +81,18 @@ public void onUpdate(float tpf) {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void onEnterOverlay(Overlay overlay) {
 | 
			
		||||
 | 
			
		||||
        if(overlay == Overlay.SETTINGS) {
 | 
			
		||||
            leaveButton.show();
 | 
			
		||||
            cheatButton.show();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void onLeaveOverlay(Overlay overlay)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    protected void onLeaveOverlay(Overlay overlay) {
 | 
			
		||||
        if(overlay == Overlay.SETTINGS) {
 | 
			
		||||
            leaveButton.hide();
 | 
			
		||||
            cheatButton.hide();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void leaveGame() {
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@
 | 
			
		||||
import com.jme3.scene.shape.Quad;
 | 
			
		||||
import com.jme3.texture.Texture;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
import pp.mdga.client.acoustic.MdgaSound;
 | 
			
		||||
import pp.mdga.client.button.*;
 | 
			
		||||
import pp.mdga.client.dialog.AudioSettingsDialog;
 | 
			
		||||
import pp.mdga.client.dialog.SettingsDialog;
 | 
			
		||||
@@ -22,7 +23,7 @@ public enum Overlay {
 | 
			
		||||
    protected MdgaApp app;
 | 
			
		||||
    protected Node rootNode = new Node();
 | 
			
		||||
    protected Node guiNode = new Node();
 | 
			
		||||
    private Node settingsNode = new Node();
 | 
			
		||||
    protected Node settingsNode = new Node();
 | 
			
		||||
 | 
			
		||||
    private SettingsButton settingsButton;
 | 
			
		||||
 | 
			
		||||
@@ -30,6 +31,8 @@ public enum Overlay {
 | 
			
		||||
    private VideoSettingsDialog videoSettingsDialog;
 | 
			
		||||
    private AudioSettingsDialog audioSettingsDialog;
 | 
			
		||||
 | 
			
		||||
    private int settingsDepth = 0;
 | 
			
		||||
 | 
			
		||||
    public MdgaView(MdgaApp app) {
 | 
			
		||||
        this.app = app;
 | 
			
		||||
        settingsButton = new SettingsButton(app, guiNode, this::enterSettings);
 | 
			
		||||
@@ -54,6 +57,10 @@ public void leave() {
 | 
			
		||||
 | 
			
		||||
        settingsButton.hide();
 | 
			
		||||
 | 
			
		||||
        while (settingsDepth > 0) {
 | 
			
		||||
            pressEscape();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        onLeave();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -104,6 +111,8 @@ public void enterSettings() {
 | 
			
		||||
 | 
			
		||||
        app.getGuiNode().attachChild(settingsNode);
 | 
			
		||||
        settingsDialog.show();
 | 
			
		||||
 | 
			
		||||
        settingsDepth++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void leaveSettings() {
 | 
			
		||||
@@ -111,25 +120,71 @@ public void leaveSettings() {
 | 
			
		||||
 | 
			
		||||
        app.getGuiNode().detachChild(settingsNode);
 | 
			
		||||
        settingsDialog.hide();
 | 
			
		||||
 | 
			
		||||
        settingsDepth--;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void enterVideoSettings() {
 | 
			
		||||
        settingsDialog.hide();
 | 
			
		||||
        videoSettingsDialog.show();
 | 
			
		||||
 | 
			
		||||
        settingsDepth++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void leaveVideoSettings() {
 | 
			
		||||
        settingsDialog.show();
 | 
			
		||||
        videoSettingsDialog.hide();
 | 
			
		||||
 | 
			
		||||
        settingsDepth--;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void enterAudioSettings() {
 | 
			
		||||
        settingsDialog.hide();
 | 
			
		||||
        audioSettingsDialog.show();
 | 
			
		||||
 | 
			
		||||
        settingsDepth++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void leaveAudioSettings() {
 | 
			
		||||
        settingsDialog.show();
 | 
			
		||||
        audioSettingsDialog.hide();
 | 
			
		||||
 | 
			
		||||
        settingsDepth--;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void leaveAdvanced() {
 | 
			
		||||
        settingsDialog.show();
 | 
			
		||||
        audioSettingsDialog.hide();
 | 
			
		||||
        videoSettingsDialog.hide();
 | 
			
		||||
        settingsDepth--;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void pressEscape() {
 | 
			
		||||
        if(settingsDepth == 0) {
 | 
			
		||||
            enterSettings();
 | 
			
		||||
        } else if(settingsDepth == 1) {
 | 
			
		||||
            leaveSettings();
 | 
			
		||||
        } else {
 | 
			
		||||
            leaveAdvanced();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void pressForward() {
 | 
			
		||||
        if(this instanceof MainView mainView) {
 | 
			
		||||
            mainView.forward(false);
 | 
			
		||||
            app.getAcousticHandler().playSound(MdgaSound.BUTTON_PRESSED);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if(this instanceof LobbyView lobbyView) {
 | 
			
		||||
            app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if(this instanceof GameView gameView) {
 | 
			
		||||
            app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if(this instanceof CeremonyView ceremonyView) {
 | 
			
		||||
            ceremonyView.forward();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user