Finish buttons
This commit is contained in:
		@@ -2,39 +2,52 @@
 | 
			
		||||
 | 
			
		||||
import com.jme3.math.ColorRGBA;
 | 
			
		||||
import com.jme3.math.Vector3f;
 | 
			
		||||
import com.jme3.scene.Node;
 | 
			
		||||
import com.simsilica.lemur.Button;
 | 
			
		||||
import com.simsilica.lemur.Container;
 | 
			
		||||
import com.simsilica.lemur.HAlignment;
 | 
			
		||||
import com.simsilica.lemur.VAlignment;
 | 
			
		||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
 | 
			
		||||
import com.simsilica.lemur.core.GuiComponent;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
 | 
			
		||||
public abstract class Dialog {
 | 
			
		||||
    protected final ColorRGBA COLOR_DEFAULT = ColorRGBA.Gray;
 | 
			
		||||
    protected final ColorRGBA COLOR_HOVER = ColorRGBA.DarkGray;
 | 
			
		||||
 | 
			
		||||
    protected MdgaApp app;
 | 
			
		||||
    protected Container container;
 | 
			
		||||
 | 
			
		||||
    public Dialog(MdgaApp app) {
 | 
			
		||||
    protected final MdgaApp app;
 | 
			
		||||
    private final Node node;
 | 
			
		||||
 | 
			
		||||
    protected final float vertical_step;
 | 
			
		||||
    protected final float horitontal_step;
 | 
			
		||||
 | 
			
		||||
    public Dialog(MdgaApp app, Node node) {
 | 
			
		||||
        this.app = app;
 | 
			
		||||
        this.node = node;
 | 
			
		||||
        this.container = new Container();
 | 
			
		||||
 | 
			
		||||
        this.horitontal_step = app.getCamera().getWidth() / 16;
 | 
			
		||||
        this.vertical_step = app.getCamera().getHeight() / 9;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void show() {
 | 
			
		||||
        app.getGuiNode().attachChild(container);
 | 
			
		||||
        node.attachChild(container);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void hide () {
 | 
			
		||||
        app.getGuiNode().detachChild(container);
 | 
			
		||||
        node.detachChild(container);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void createButton(String label, Runnable action, Vector3f size) {
 | 
			
		||||
        Button button = new Button(label);
 | 
			
		||||
        button.addClickCommands(source -> action.run());
 | 
			
		||||
        button.setSize(size);
 | 
			
		||||
        button.setFontSize(35);
 | 
			
		||||
        button.setHighlightColor(ColorRGBA.White);
 | 
			
		||||
        button.setColor(ColorRGBA.Black);
 | 
			
		||||
        button.setPreferredSize(size);
 | 
			
		||||
        button.setTextHAlignment(HAlignment.Center);
 | 
			
		||||
        button.setTextVAlignment(VAlignment.Center);
 | 
			
		||||
 | 
			
		||||
        QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
 | 
			
		||||
        background.setMargin(5, 5);
 | 
			
		||||
@@ -44,12 +57,16 @@ protected void createButton(String label, Runnable action, Vector3f size) {
 | 
			
		||||
            QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
 | 
			
		||||
            hoverBackground.setMargin(5, 5);
 | 
			
		||||
            source.setBackground(hoverBackground);
 | 
			
		||||
            button.setHighlightColor(ColorRGBA.White);
 | 
			
		||||
            button.setColor(ColorRGBA.Black);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
 | 
			
		||||
            QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
 | 
			
		||||
            normalBackground.setMargin(5, 5);
 | 
			
		||||
            source.setBackground(normalBackground);
 | 
			
		||||
            button.setHighlightColor(ColorRGBA.White);
 | 
			
		||||
            button.setColor(ColorRGBA.Black);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        container.addChild(button);
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,88 @@
 | 
			
		||||
package pp.mdga.client.Dialog;
 | 
			
		||||
 | 
			
		||||
import com.jme3.math.ColorRGBA;
 | 
			
		||||
import com.jme3.math.Vector3f;
 | 
			
		||||
import com.jme3.scene.Node;
 | 
			
		||||
import com.jme3.texture.Texture;
 | 
			
		||||
import com.simsilica.lemur.*;
 | 
			
		||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
 | 
			
		||||
import com.simsilica.lemur.component.SpringGridLayout;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
 | 
			
		||||
public class InputButtonDialog extends Dialog {
 | 
			
		||||
    private TextField nameInput;
 | 
			
		||||
 | 
			
		||||
    public InputButtonDialog(MdgaApp app, Node node) {
 | 
			
		||||
        super(app, node);
 | 
			
		||||
 | 
			
		||||
        QuadBackgroundComponent quad1 = new QuadBackgroundComponent(ColorRGBA.Gray);
 | 
			
		||||
        quad1.setMargin(100, 50);
 | 
			
		||||
        container.setBackground(quad1);
 | 
			
		||||
 | 
			
		||||
        Texture texture = app.getAssetManager().loadTexture("mdga_logo.png");
 | 
			
		||||
 | 
			
		||||
        QuadBackgroundComponent b = new QuadBackgroundComponent(texture);
 | 
			
		||||
 | 
			
		||||
        Panel imagePanel = new Panel();
 | 
			
		||||
        imagePanel.setBackground(b);
 | 
			
		||||
 | 
			
		||||
        container.addChild(imagePanel).setPreferredSize(new Vector3f(texture.getImage().getWidth() / 4, texture.getImage().getHeight() / 4, 0));
 | 
			
		||||
 | 
			
		||||
        //abstandshalter
 | 
			
		||||
        container.addChild(new Panel(100, 50, ColorRGBA.Gray));
 | 
			
		||||
 | 
			
		||||
        createTextField();
 | 
			
		||||
 | 
			
		||||
        //abstandshalter
 | 
			
		||||
        container.addChild(new Panel(100, 50, ColorRGBA.Gray));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void show() {
 | 
			
		||||
        super.show();
 | 
			
		||||
 | 
			
		||||
        container.setLocalTranslation(
 | 
			
		||||
            app.getCamera().getWidth() / 2 - container.getPreferredSize().x / 2,
 | 
			
		||||
            app.getCamera().getHeight() / 2 + container.getPreferredSize().y / 2,
 | 
			
		||||
            0
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void hide() {
 | 
			
		||||
        super.hide();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void addButton(String label, Runnable action, Vector3f size) {
 | 
			
		||||
        createButton(label, action, size);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void createTextField() {
 | 
			
		||||
        Container subContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
 | 
			
		||||
 | 
			
		||||
        Label nameLabel = new Label("Name:\t");
 | 
			
		||||
        nameLabel.setFontSize(35);
 | 
			
		||||
        nameLabel.setColor(ColorRGBA.Black);
 | 
			
		||||
 | 
			
		||||
        nameInput = new TextField("");
 | 
			
		||||
 | 
			
		||||
        nameInput.setColor(ColorRGBA.Black);
 | 
			
		||||
        nameInput.setTextHAlignment(HAlignment.Left);
 | 
			
		||||
        nameInput.setFontSize(35);
 | 
			
		||||
        nameInput.setSingleLine(true);
 | 
			
		||||
 | 
			
		||||
        QuadBackgroundComponent grayBackground = new QuadBackgroundComponent(ColorRGBA.DarkGray);
 | 
			
		||||
        nameInput.setBackground(grayBackground);
 | 
			
		||||
 | 
			
		||||
        subContainer.addChild(nameLabel);
 | 
			
		||||
        subContainer.addChild(nameInput);
 | 
			
		||||
 | 
			
		||||
        container.addChild(subContainer);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getName() {
 | 
			
		||||
        return nameInput.getText();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -1,4 +1,32 @@
 | 
			
		||||
package pp.mdga.client.Dialog;
 | 
			
		||||
 | 
			
		||||
public class LobbyButtonDialog {
 | 
			
		||||
import com.jme3.math.Vector3f;
 | 
			
		||||
import com.jme3.scene.Node;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
 | 
			
		||||
public class LobbyButtonDialog extends Dialog {
 | 
			
		||||
    private final int pos;
 | 
			
		||||
 | 
			
		||||
    public LobbyButtonDialog(MdgaApp app, Node node, String label, Runnable action, int pos) {
 | 
			
		||||
        super(app, node);
 | 
			
		||||
 | 
			
		||||
        this.pos = pos;
 | 
			
		||||
 | 
			
		||||
        createButton(label, action, new Vector3f(170, 250, 0));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void show() {
 | 
			
		||||
        super.show();
 | 
			
		||||
 | 
			
		||||
        float x = ((2 + (4 * pos)) * horitontal_step) - ((0.33333333f * pos) * container.getPreferredSize().x);
 | 
			
		||||
        float y = 6 * vertical_step;
 | 
			
		||||
 | 
			
		||||
        container.setLocalTranslation(x, y, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void hide() {
 | 
			
		||||
        super.hide();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,78 @@
 | 
			
		||||
package pp.mdga.client.Dialog;
 | 
			
		||||
 | 
			
		||||
public class SettingsButtonDialog {
 | 
			
		||||
import com.jme3.math.ColorRGBA;
 | 
			
		||||
import com.jme3.math.Vector3f;
 | 
			
		||||
import com.jme3.scene.Node;
 | 
			
		||||
import com.jme3.texture.Texture;
 | 
			
		||||
import com.simsilica.lemur.Button;
 | 
			
		||||
import com.simsilica.lemur.HAlignment;
 | 
			
		||||
import com.simsilica.lemur.Panel;
 | 
			
		||||
import com.simsilica.lemur.VAlignment;
 | 
			
		||||
import com.simsilica.lemur.component.IconComponent;
 | 
			
		||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
 | 
			
		||||
public class SettingsButtonDialog extends Dialog {
 | 
			
		||||
    private IconComponent icon;
 | 
			
		||||
 | 
			
		||||
    public SettingsButtonDialog(MdgaApp app, Node node, String label, Runnable action) {
 | 
			
		||||
        super(app, node);
 | 
			
		||||
 | 
			
		||||
        icon = new IconComponent("zahnrad.png");
 | 
			
		||||
        icon.setIconScale(0.1f);
 | 
			
		||||
 | 
			
		||||
        createButton(label, action, new Vector3f(60, 60, 0));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void show() {
 | 
			
		||||
        super.show();
 | 
			
		||||
 | 
			
		||||
        float x = (15.5f * horitontal_step) - container.getPreferredSize().x;
 | 
			
		||||
        float y = 8.5f * vertical_step;
 | 
			
		||||
 | 
			
		||||
        container.setLocalTranslation(x, y, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void hide() {
 | 
			
		||||
        super.hide();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void createButton(String label, Runnable action, Vector3f size) {
 | 
			
		||||
        Button button = new Button(label);
 | 
			
		||||
        button.addClickCommands(source -> action.run());
 | 
			
		||||
        button.setFontSize(35);
 | 
			
		||||
        button.setHighlightColor(ColorRGBA.White);
 | 
			
		||||
        button.setColor(ColorRGBA.Black);
 | 
			
		||||
        button.setPreferredSize(size);
 | 
			
		||||
        button.setTextHAlignment(HAlignment.Center);
 | 
			
		||||
        button.setTextVAlignment(VAlignment.Center);
 | 
			
		||||
 | 
			
		||||
        QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
 | 
			
		||||
        background.setMargin(5, 5);
 | 
			
		||||
        button.setBackground(background);
 | 
			
		||||
        button.setIcon(icon);
 | 
			
		||||
 | 
			
		||||
        button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
 | 
			
		||||
            QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
 | 
			
		||||
            hoverBackground.setMargin(5, 5);
 | 
			
		||||
            source.setBackground(hoverBackground);
 | 
			
		||||
            button.setHighlightColor(ColorRGBA.White);
 | 
			
		||||
            button.setColor(ColorRGBA.Black);
 | 
			
		||||
            button.setIcon(icon);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
 | 
			
		||||
            QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
 | 
			
		||||
            normalBackground.setMargin(5, 5);
 | 
			
		||||
            source.setBackground(normalBackground);
 | 
			
		||||
            button.setHighlightColor(ColorRGBA.White);
 | 
			
		||||
            button.setColor(ColorRGBA.Black);
 | 
			
		||||
            button.setIcon(icon);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        container.addChild(button);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,24 +1,22 @@
 | 
			
		||||
package pp.mdga.client.Dialog;
 | 
			
		||||
 | 
			
		||||
import com.jme3.math.Vector3f;
 | 
			
		||||
import com.jme3.scene.Node;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
 | 
			
		||||
public class SingleButtonLeftDialog extends Dialog {
 | 
			
		||||
    public SingleButtonLeftDialog(MdgaApp app, String label, Runnable action) {
 | 
			
		||||
        super(app);
 | 
			
		||||
    public SingleButtonLeftDialog(MdgaApp app, Node node, String label, Runnable action) {
 | 
			
		||||
        super(app, node);
 | 
			
		||||
 | 
			
		||||
        createButton(label, action, new Vector3f(1, 1, 1));
 | 
			
		||||
        createButton(label, action, new Vector3f(170, 60, 0));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void show() {
 | 
			
		||||
        super.show();
 | 
			
		||||
 | 
			
		||||
        float vertical = app.getCamera().getWidth() / 16 - container.getPreferredSize().x / 16;
 | 
			
		||||
        float horitontal = app.getCamera().getHeight() / 12 + container.getPreferredSize().y / 12;
 | 
			
		||||
 | 
			
		||||
        float x = 2 * vertical;
 | 
			
		||||
        float y = 2 * horitontal;
 | 
			
		||||
        float x = 2 * horitontal_step;
 | 
			
		||||
        float y = 1.8f * vertical_step;
 | 
			
		||||
 | 
			
		||||
        container.setLocalTranslation(x, y, 0);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,28 +1,22 @@
 | 
			
		||||
package pp.mdga.client.Dialog;
 | 
			
		||||
 | 
			
		||||
import com.jme3.math.ColorRGBA;
 | 
			
		||||
import com.jme3.math.Vector3f;
 | 
			
		||||
import com.simsilica.lemur.Button;
 | 
			
		||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
 | 
			
		||||
import com.simsilica.lemur.core.GuiLayout;
 | 
			
		||||
import com.jme3.scene.Node;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
 | 
			
		||||
public class SingleButtonRightDialog extends Dialog {
 | 
			
		||||
    public SingleButtonRightDialog(MdgaApp app, String label, Runnable action) {
 | 
			
		||||
        super(app);
 | 
			
		||||
    public SingleButtonRightDialog(MdgaApp app, Node node, String label, Runnable action) {
 | 
			
		||||
        super(app, node);
 | 
			
		||||
 | 
			
		||||
        createButton(label, action, new Vector3f(1, 1, 1));
 | 
			
		||||
        createButton(label, action, new Vector3f(170, 60, 0));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void show() {
 | 
			
		||||
        super.show();
 | 
			
		||||
 | 
			
		||||
        float vertical = app.getCamera().getWidth() / 16 - container.getPreferredSize().x / 16;
 | 
			
		||||
        float horitontal = app.getCamera().getHeight() / 12 + container.getPreferredSize().y / 12;
 | 
			
		||||
 | 
			
		||||
        float x = 14 * vertical;
 | 
			
		||||
        float y = 2 * horitontal;
 | 
			
		||||
        float x = (14 * horitontal_step) - container.getPreferredSize().x;
 | 
			
		||||
        float y = 1.8f * vertical_step;
 | 
			
		||||
 | 
			
		||||
        container.setLocalTranslation(x, y, 0);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,40 +0,0 @@
 | 
			
		||||
package pp.mdga.client.Dialog;
 | 
			
		||||
 | 
			
		||||
import com.jme3.math.ColorRGBA;
 | 
			
		||||
import com.jme3.math.Vector3f;
 | 
			
		||||
import com.simsilica.lemur.Button;
 | 
			
		||||
import com.simsilica.lemur.Container;
 | 
			
		||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
 | 
			
		||||
public class VerticalButtonDialog extends Dialog {
 | 
			
		||||
    public VerticalButtonDialog(MdgaApp app) {
 | 
			
		||||
        super(app);
 | 
			
		||||
 | 
			
		||||
        QuadBackgroundComponent quad1 = new QuadBackgroundComponent(ColorRGBA.Gray);
 | 
			
		||||
        quad1.setMargin(10, 10);
 | 
			
		||||
        container.setBackground(quad1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void show() {
 | 
			
		||||
        super.show();
 | 
			
		||||
 | 
			
		||||
        container.setLocalTranslation(
 | 
			
		||||
            app.getCamera().getWidth() / 2 - container.getPreferredSize().x / 2,
 | 
			
		||||
            app.getCamera().getHeight() / 2 + container.getPreferredSize().y / 2,
 | 
			
		||||
            0
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void hide() {
 | 
			
		||||
        super.hide();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void addButton(String label, Runnable action, Vector3f size) {
 | 
			
		||||
        createButton(label, action, size);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -21,11 +21,13 @@ private enum SubState {
 | 
			
		||||
    private SingleButtonRightDialog continueButton;
 | 
			
		||||
    private SingleButtonLeftDialog backButton;
 | 
			
		||||
 | 
			
		||||
    private Geometry background;
 | 
			
		||||
 | 
			
		||||
    public CeremonyView(MdgaApp app) {
 | 
			
		||||
        super(app);
 | 
			
		||||
 | 
			
		||||
        continueButton = new SingleButtonRightDialog(app, "Weiter", () -> forward());
 | 
			
		||||
        backButton = new SingleButtonLeftDialog(app, "Zurück", () -> back());
 | 
			
		||||
        continueButton = new SingleButtonRightDialog(app, node, "Weiter", () -> forward());
 | 
			
		||||
        backButton = new SingleButtonLeftDialog(app, node, "Zurück", () -> back());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -40,9 +42,7 @@ public void onLeave() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void awardCeremony() {
 | 
			
		||||
        node.detachAllChildren();
 | 
			
		||||
 | 
			
		||||
        Geometry background = createBackground("b1.png");
 | 
			
		||||
        background = createBackground("b1.png");
 | 
			
		||||
        node.attachChild(background);
 | 
			
		||||
 | 
			
		||||
        continueButton.show();
 | 
			
		||||
@@ -50,9 +50,7 @@ private void awardCeremony() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void statistics() {
 | 
			
		||||
        node.detachAllChildren();
 | 
			
		||||
 | 
			
		||||
        Geometry background = createBackground("b2.png");
 | 
			
		||||
        background = createBackground("b2.png");
 | 
			
		||||
        node.attachChild(background);
 | 
			
		||||
 | 
			
		||||
        continueButton.show();
 | 
			
		||||
@@ -62,6 +60,13 @@ private void statistics() {
 | 
			
		||||
    private void enterSub(SubState state) {
 | 
			
		||||
        this.state = state;
 | 
			
		||||
 | 
			
		||||
        if(null != background) {
 | 
			
		||||
            node.detachChild(background);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        backButton.hide();
 | 
			
		||||
        continueButton.hide();
 | 
			
		||||
 | 
			
		||||
        switch (state) {
 | 
			
		||||
            case AWARD_CEREMONY:
 | 
			
		||||
                awardCeremony();
 | 
			
		||||
 
 | 
			
		||||
@@ -16,18 +16,18 @@ public GameView(MdgaApp app) {
 | 
			
		||||
 | 
			
		||||
        this.boardHandler = new BoardHandler(app);
 | 
			
		||||
 | 
			
		||||
        continueButton = new SingleButtonRightDialog(app, "Weiter", () -> app.enter(MdgaState.CEREMONY));
 | 
			
		||||
        continueButton = new SingleButtonRightDialog(app, node, "Weiter", () -> app.enter(MdgaState.CEREMONY));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
    public void onEnter() {
 | 
			
		||||
        boardHandler.init();
 | 
			
		||||
 | 
			
		||||
        continueButton.show();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void leave() {
 | 
			
		||||
    public void onLeave() {
 | 
			
		||||
        continueButton.hide();
 | 
			
		||||
 | 
			
		||||
        boardHandler.shutdown();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,36 +1,55 @@
 | 
			
		||||
package pp.mdga.client.View;
 | 
			
		||||
 | 
			
		||||
import com.jme3.scene.Geometry;
 | 
			
		||||
import pp.mdga.client.Dialog.LobbyButtonDialog;
 | 
			
		||||
import pp.mdga.client.Dialog.SettingsButtonDialog;
 | 
			
		||||
import pp.mdga.client.Dialog.SingleButtonLeftDialog;
 | 
			
		||||
import pp.mdga.client.Dialog.SingleButtonRightDialog;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
import pp.mdga.client.MdgaState;
 | 
			
		||||
import pp.mdga.game.Color;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
public class LobbyView extends MdgaView {
 | 
			
		||||
    private Geometry background;
 | 
			
		||||
 | 
			
		||||
    private SingleButtonRightDialog readyButton;
 | 
			
		||||
    private SingleButtonLeftDialog leaveButton;
 | 
			
		||||
 | 
			
		||||
    private ArrayList<LobbyButtonDialog> lobbyButtons = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    public LobbyView(MdgaApp app) {
 | 
			
		||||
        super(app);
 | 
			
		||||
 | 
			
		||||
        background = createBackground("lobby.png");
 | 
			
		||||
        node.attachChild(background);
 | 
			
		||||
 | 
			
		||||
        readyButton = new SingleButtonRightDialog(app, "Fertig", () -> app.enter(MdgaState.GAME));
 | 
			
		||||
        leaveButton = new SingleButtonLeftDialog(app, "Verlassen", () -> app.enter(MdgaState.MAIN));
 | 
			
		||||
        readyButton = new SingleButtonRightDialog(app, node, "Fertig", () -> app.enter(MdgaState.GAME));
 | 
			
		||||
        leaveButton = new SingleButtonLeftDialog(app, node, "Verlassen", () -> app.enter(MdgaState.MAIN));
 | 
			
		||||
 | 
			
		||||
        lobbyButtons.add(new LobbyButtonDialog(app, node, "CIR", () -> System.out.println("cir"), 0));
 | 
			
		||||
        lobbyButtons.add(new LobbyButtonDialog(app, node, "LUFTWAFFE", () -> System.out.println("lw"), 1));
 | 
			
		||||
        lobbyButtons.add(new LobbyButtonDialog(app, node, "HEER", () -> System.out.println("heer"), 2));
 | 
			
		||||
        lobbyButtons.add(new LobbyButtonDialog(app, node, "MARINE", () -> System.out.println("marine"), 3));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onEnter() {
 | 
			
		||||
        readyButton.show();
 | 
			
		||||
        leaveButton.show();
 | 
			
		||||
 | 
			
		||||
        for (LobbyButtonDialog b : lobbyButtons) {
 | 
			
		||||
            b.show();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onLeave() {
 | 
			
		||||
        for (LobbyButtonDialog b : lobbyButtons) {
 | 
			
		||||
            b.hide();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        readyButton.hide();
 | 
			
		||||
        leaveButton.hide();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,8 @@
 | 
			
		||||
package pp.mdga.client.View;
 | 
			
		||||
 | 
			
		||||
import com.jme3.scene.Geometry;
 | 
			
		||||
import pp.mdga.client.Dialog.VerticalButtonDialog;
 | 
			
		||||
import pp.mdga.client.Dialog.InputButtonDialog;
 | 
			
		||||
import pp.mdga.client.Dialog.SettingsButtonDialog;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
import pp.mdga.client.MdgaState;
 | 
			
		||||
 | 
			
		||||
@@ -9,7 +10,8 @@
 | 
			
		||||
 | 
			
		||||
public class MainView extends MdgaView {
 | 
			
		||||
    private Geometry background;
 | 
			
		||||
    VerticalButtonDialog dialog;
 | 
			
		||||
 | 
			
		||||
    private InputButtonDialog dialog;
 | 
			
		||||
 | 
			
		||||
    public MainView(MdgaApp app) {
 | 
			
		||||
        super(app);
 | 
			
		||||
@@ -17,8 +19,8 @@ public MainView(MdgaApp app) {
 | 
			
		||||
        background = createBackground("powercards.png");
 | 
			
		||||
        node.attachChild(background);
 | 
			
		||||
 | 
			
		||||
        Vector3f size = new Vector3f(1, 1, 1);
 | 
			
		||||
        dialog = new VerticalButtonDialog(app);
 | 
			
		||||
        Vector3f size = new Vector3f(280, 60, 0);
 | 
			
		||||
        dialog = new InputButtonDialog(app, node);
 | 
			
		||||
        dialog.addButton("Spiel beitreten", () -> app.enter(MdgaState.LOBBY), size);
 | 
			
		||||
        dialog.addButton("Spiel hosten", () -> app.enter(MdgaState.LOBBY), size);
 | 
			
		||||
        dialog.addButton("Einstellungen", () -> System.out.println("Einstellungen"), size);
 | 
			
		||||
 
 | 
			
		||||
@@ -6,31 +6,40 @@
 | 
			
		||||
import com.jme3.scene.Node;
 | 
			
		||||
import com.jme3.scene.shape.Quad;
 | 
			
		||||
import com.jme3.texture.Texture;
 | 
			
		||||
import pp.mdga.client.Dialog.SettingsButtonDialog;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
 | 
			
		||||
public abstract class MdgaView {
 | 
			
		||||
    protected MdgaApp app;
 | 
			
		||||
    protected Node node;
 | 
			
		||||
 | 
			
		||||
    private SettingsButtonDialog settings;
 | 
			
		||||
 | 
			
		||||
    public MdgaView(MdgaApp app) {
 | 
			
		||||
        this.app = app;
 | 
			
		||||
        this.node = new Node();
 | 
			
		||||
 | 
			
		||||
        settings = new SettingsButtonDialog(app, node, "", () -> System.out.println("Einstellungen"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        app.getGuiNode().attachChild(node);
 | 
			
		||||
 | 
			
		||||
        settings.show();
 | 
			
		||||
 | 
			
		||||
        onEnter();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void leave() {
 | 
			
		||||
        onLeave();
 | 
			
		||||
 | 
			
		||||
        settings.hide();
 | 
			
		||||
 | 
			
		||||
        app.getGuiNode().detachChild(node);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void onEnter() {}
 | 
			
		||||
    protected void onLeave() {}
 | 
			
		||||
    protected abstract void onEnter();
 | 
			
		||||
    protected abstract void onLeave();
 | 
			
		||||
 | 
			
		||||
    protected Geometry createBackground(String texturePath) {
 | 
			
		||||
        TextureKey key = new TextureKey(texturePath, true);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Projekte/mdga/client/src/main/resources/mdga_logo.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Projekte/mdga/client/src/main/resources/mdga_logo.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 24 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Projekte/mdga/client/src/main/resources/zahnrad.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Projekte/mdga/client/src/main/resources/zahnrad.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 48 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Projekte/mdga/client/src/main/resources/zahnrad.png~
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Projekte/mdga/client/src/main/resources/zahnrad.png~
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 50 KiB  | 
		Reference in New Issue
	
	Block a user