Merge work #7

Merged
fkoppe merged 31 commits from dev/client_koppe into dev/client 2024-11-20 13:50:01 +01:00
5 changed files with 69 additions and 24 deletions
Showing only changes of commit 34415bc9f2 - Show all commits

View File

@@ -1,4 +1,30 @@
package pp.mdga.client.Dialog; package pp.mdga.client.Dialog;
public class SingleButtonLeftDialog { import com.jme3.math.Vector3f;
import pp.mdga.client.MdgaApp;
public class SingleButtonLeftDialog extends Dialog {
public SingleButtonLeftDialog(MdgaApp app, String label, Runnable action) {
super(app);
createButton(label, action, new Vector3f(1, 1, 1));
}
@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;
container.setLocalTranslation(x, y, 0);
}
@Override
public void hide() {
super.hide();
}
} }

View File

@@ -19,10 +19,10 @@ public void show() {
super.show(); super.show();
float vertical = app.getCamera().getWidth() / 16 - container.getPreferredSize().x / 16; float vertical = app.getCamera().getWidth() / 16 - container.getPreferredSize().x / 16;
float horitontal = app.getCamera().getHeight() / 9 + container.getPreferredSize().y / 9; float horitontal = app.getCamera().getHeight() / 12 + container.getPreferredSize().y / 12;
float x = 12 * vertical; float x = 14 * vertical;
float y = 1 * horitontal; float y = 2 * horitontal;
container.setLocalTranslation(x, y, 0); container.setLocalTranslation(x, y, 0);
} }

View File

@@ -0,0 +1,4 @@
package pp.mdga.client;
public class ModelSyncronizer {
}

View File

@@ -4,6 +4,7 @@
import com.jme3.scene.Geometry; import com.jme3.scene.Geometry;
import com.simsilica.lemur.Container; import com.simsilica.lemur.Container;
import com.simsilica.lemur.Label; import com.simsilica.lemur.Label;
import pp.mdga.client.Dialog.SingleButtonLeftDialog;
import pp.mdga.client.Dialog.SingleButtonRightDialog; import pp.mdga.client.Dialog.SingleButtonRightDialog;
import pp.mdga.client.MdgaApp; import pp.mdga.client.MdgaApp;
import pp.mdga.client.MdgaState; import pp.mdga.client.MdgaState;
@@ -13,29 +14,29 @@ public class CeremonyView extends MdgaView {
private enum SubState { private enum SubState {
AWARD_CEREMONY, AWARD_CEREMONY,
STATISTICS, STATISTICS,
MAIN,
} }
private SubState state; private SubState state;
private SingleButtonRightDialog continueButton; private SingleButtonRightDialog continueButton;
private SingleButtonLeftDialog backButton;
public CeremonyView(MdgaApp app) { public CeremonyView(MdgaApp app) {
super(app); super(app);
continueButton = new SingleButtonRightDialog(app, "Weiter", () -> next()); continueButton = new SingleButtonRightDialog(app, "Weiter", () -> forward());
backButton = new SingleButtonLeftDialog(app, "Zurück", () -> back());
} }
@Override @Override
public void onEnter() { public void onEnter() {
state = SubState.AWARD_CEREMONY; enterSub(SubState.AWARD_CEREMONY);
continueButton.show();
} }
@Override @Override
public void onLeave() { public void onLeave() {
continueButton.hide(); continueButton.hide();
backButton.hide();
} }
private void awardCeremony() { private void awardCeremony() {
@@ -44,7 +45,8 @@ private void awardCeremony() {
Geometry background = createBackground("b1.png"); Geometry background = createBackground("b1.png");
node.attachChild(background); node.attachChild(background);
continueButton.show();
backButton.hide();
} }
private void statistics() { private void statistics() {
@@ -53,10 +55,13 @@ private void statistics() {
Geometry background = createBackground("b2.png"); Geometry background = createBackground("b2.png");
node.attachChild(background); node.attachChild(background);
continueButton.show();
backButton.show();
} }
private void into() { private void enterSub(SubState state) {
this.state = state;
switch (state) { switch (state) {
case AWARD_CEREMONY: case AWARD_CEREMONY:
awardCeremony(); awardCeremony();
@@ -64,23 +69,28 @@ private void into() {
case STATISTICS: case STATISTICS:
statistics(); statistics();
break; break;
case MAIN:
app.enter(MdgaState.MAIN);
break;
} }
} }
private void next() { private void forward() {
switch (state) { switch (state) {
case AWARD_CEREMONY: case AWARD_CEREMONY:
enterSub(SubState.STATISTICS);
break; break;
case STATISTICS: case STATISTICS:
break;
case MAIN:
app.enter(MdgaState.MAIN); app.enter(MdgaState.MAIN);
break; break;
} }
} }
private void back() {
switch (state) {
case AWARD_CEREMONY:
//nothing
break;
case STATISTICS:
enterSub(SubState.AWARD_CEREMONY);
break;
}
}
} }

View File

@@ -1,6 +1,7 @@
package pp.mdga.client.View; package pp.mdga.client.View;
import com.jme3.scene.Geometry; import com.jme3.scene.Geometry;
import pp.mdga.client.Dialog.SingleButtonLeftDialog;
import pp.mdga.client.Dialog.SingleButtonRightDialog; import pp.mdga.client.Dialog.SingleButtonRightDialog;
import pp.mdga.client.MdgaApp; import pp.mdga.client.MdgaApp;
import pp.mdga.client.MdgaState; import pp.mdga.client.MdgaState;
@@ -9,7 +10,8 @@
public class LobbyView extends MdgaView { public class LobbyView extends MdgaView {
private Geometry background; private Geometry background;
private SingleButtonRightDialog continueButton; private SingleButtonRightDialog readyButton;
private SingleButtonLeftDialog leaveButton;
public LobbyView(MdgaApp app) { public LobbyView(MdgaApp app) {
super(app); super(app);
@@ -17,17 +19,20 @@ public LobbyView(MdgaApp app) {
background = createBackground("lobby.png"); background = createBackground("lobby.png");
node.attachChild(background); node.attachChild(background);
continueButton = new SingleButtonRightDialog(app, "Weiter", () -> app.enter(MdgaState.GAME)); readyButton = new SingleButtonRightDialog(app, "Fertig", () -> app.enter(MdgaState.GAME));
leaveButton = new SingleButtonLeftDialog(app, "Verlassen", () -> app.enter(MdgaState.MAIN));
} }
@Override @Override
public void onEnter() { public void onEnter() {
continueButton.show(); readyButton.show();
leaveButton.show();
} }
@Override @Override
public void onLeave() { public void onLeave() {
continueButton.hide(); readyButton.hide();
leaveButton.hide();
} }
} }