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