merge development into test #26
@@ -54,7 +54,8 @@ public void simpleInitApp() {
|
|||||||
inputSynchronizer = new InputSynchronizer(this);
|
inputSynchronizer = new InputSynchronizer(this);
|
||||||
modelSyncronizer = new ModelSyncronizer(this);
|
modelSyncronizer = new ModelSyncronizer(this);
|
||||||
|
|
||||||
enter(state);
|
modelSyncronizer.enter(MdgaState.CEREMONY);
|
||||||
|
//enter(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package pp.mdga.client;
|
package pp.mdga.client;
|
||||||
|
|
||||||
|
import pp.mdga.client.view.CeremonyView;
|
||||||
import pp.mdga.client.view.LobbyView;
|
import pp.mdga.client.view.LobbyView;
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
|
|
||||||
@@ -68,5 +69,13 @@ public void leave() {
|
|||||||
public void enter(MdgaState state) {
|
public void enter(MdgaState state) {
|
||||||
System.out.println("enter:" + state);
|
System.out.println("enter:" + state);
|
||||||
app.enter(state);
|
app.enter(state);
|
||||||
|
|
||||||
|
if(state == MdgaState.CEREMONY) {
|
||||||
|
CeremonyView ceremonyView = (CeremonyView) app.getView();
|
||||||
|
ceremonyView.addCeremonyParticipant(Color.AIRFORCE, 1, "ugidffdg");
|
||||||
|
ceremonyView.addCeremonyParticipant(Color.ARMY, 2, "ugidffdg");
|
||||||
|
ceremonyView.addCeremonyParticipant(Color.NAVY, 3, "ugidffdg");
|
||||||
|
ceremonyView.addCeremonyParticipant(Color.CYBER, 4, "ugidffdg");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package pp.mdga.client;
|
package pp.mdga.client;
|
||||||
|
|
||||||
|
import pp.mdga.client.view.CeremonyView;
|
||||||
import pp.mdga.client.view.GameView;
|
import pp.mdga.client.view.GameView;
|
||||||
import pp.mdga.client.view.LobbyView;
|
import pp.mdga.client.view.LobbyView;
|
||||||
|
import pp.mdga.game.Color;
|
||||||
import pp.mdga.notification.*;
|
import pp.mdga.notification.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -75,6 +77,11 @@ private void handleGame(Notification notification) {
|
|||||||
gameView.getGuiHandler().setActivePlayer(n.getColor());
|
gameView.getGuiHandler().setActivePlayer(n.getColor());
|
||||||
} else if (notification instanceof CeremonyNotification) {
|
} else if (notification instanceof CeremonyNotification) {
|
||||||
app.enter(MdgaState.CEREMONY);
|
app.enter(MdgaState.CEREMONY);
|
||||||
|
CeremonyView ceremonyView = (CeremonyView) app.getView();
|
||||||
|
ceremonyView.addCeremonyParticipant(Color.AIRFORCE, 1, "ugidffdg");
|
||||||
|
ceremonyView.addCeremonyParticipant(Color.ARMY, 2, "ugidffdg");
|
||||||
|
ceremonyView.addCeremonyParticipant(Color.NAVY, 3, "ugidffdg");
|
||||||
|
ceremonyView.addCeremonyParticipant(Color.CYBER, 4, "ugidffdg");
|
||||||
} else if (notification instanceof DiceNowNotification) {
|
} else if (notification instanceof DiceNowNotification) {
|
||||||
// Handle DiceNowNotification
|
// Handle DiceNowNotification
|
||||||
} else if (notification instanceof DicingNotification) {
|
} else if (notification instanceof DicingNotification) {
|
||||||
|
|||||||
@@ -0,0 +1,176 @@
|
|||||||
|
package pp.mdga.client.button;
|
||||||
|
|
||||||
|
import com.jme3.material.Material;
|
||||||
|
import com.jme3.math.ColorRGBA;
|
||||||
|
import com.jme3.math.Quaternion;
|
||||||
|
import com.jme3.math.Vector2f;
|
||||||
|
import com.jme3.math.Vector3f;
|
||||||
|
import com.jme3.renderer.queue.RenderQueue;
|
||||||
|
import com.jme3.scene.Node;
|
||||||
|
import com.jme3.scene.Spatial;
|
||||||
|
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||||
|
import pp.mdga.client.Asset;
|
||||||
|
import pp.mdga.client.MdgaApp;
|
||||||
|
import pp.mdga.game.Color;
|
||||||
|
|
||||||
|
public class CeremonyButton extends ClickButton {
|
||||||
|
public enum Pos {
|
||||||
|
FIRST,
|
||||||
|
SECOND,
|
||||||
|
THIRD,
|
||||||
|
LOST,
|
||||||
|
}
|
||||||
|
|
||||||
|
static final float WIDTH = 4.0f;
|
||||||
|
|
||||||
|
private final Node node3d;
|
||||||
|
|
||||||
|
private boolean rotate = false;
|
||||||
|
private Spatial model;
|
||||||
|
private float rot = 180;
|
||||||
|
|
||||||
|
private LobbyButton.Taken taken = LobbyButton.Taken.NOT;
|
||||||
|
|
||||||
|
private LabelButton label;
|
||||||
|
|
||||||
|
public CeremonyButton(MdgaApp app, Node node, Node node3d, Color tsk, Pos pos, String name) {
|
||||||
|
super(app, node, () -> {} , "", new Vector2f(WIDTH, 7), new Vector2f(0, 0));
|
||||||
|
|
||||||
|
this.node3d = node3d;
|
||||||
|
|
||||||
|
label = new LabelButton(app, node, name, new Vector2f( WIDTH, 1), new Vector2f(0, 0));
|
||||||
|
|
||||||
|
final float mid = HORIZONTAL / 2;
|
||||||
|
final float uiSpacing = 1.4f;
|
||||||
|
final float figSpacingX = 0.9f;
|
||||||
|
final float figSpacingY = 0.25f;
|
||||||
|
|
||||||
|
float uiX = mid;
|
||||||
|
float uiY = 6;
|
||||||
|
float figX = 0;
|
||||||
|
float figY = -0.32f;
|
||||||
|
|
||||||
|
Asset asset = switch (tsk) {
|
||||||
|
case CYBER -> {
|
||||||
|
instance.setText("CIR");
|
||||||
|
yield Asset.cir;
|
||||||
|
}
|
||||||
|
case AIRFORCE -> {
|
||||||
|
instance.setText("Luftwaffe");
|
||||||
|
yield Asset.lw;
|
||||||
|
}
|
||||||
|
case ARMY -> {
|
||||||
|
instance.setText("Heer");
|
||||||
|
yield Asset.heer;
|
||||||
|
}
|
||||||
|
case NAVY -> {
|
||||||
|
instance.setText("Marine");
|
||||||
|
yield Asset.marine;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (pos) {
|
||||||
|
case FIRST:
|
||||||
|
rotate = true;
|
||||||
|
uiX = 0;
|
||||||
|
uiY -= 0;
|
||||||
|
figX = 0;
|
||||||
|
figY -= 1 * figSpacingY;
|
||||||
|
break;
|
||||||
|
case SECOND:
|
||||||
|
adjust = true;
|
||||||
|
label.adjust = true;
|
||||||
|
uiX -= uiSpacing;
|
||||||
|
uiY -= 1;
|
||||||
|
figX -= figSpacingX;
|
||||||
|
figY -= 2 * figSpacingY;
|
||||||
|
figY -= 0.1f;
|
||||||
|
break;
|
||||||
|
case THIRD:
|
||||||
|
uiX += uiSpacing;
|
||||||
|
uiY -= 1.5f;
|
||||||
|
figX += figSpacingX;
|
||||||
|
figY -= 3 * figSpacingY;
|
||||||
|
figY -= 0.07f;
|
||||||
|
break;
|
||||||
|
case LOST:
|
||||||
|
adjust = true;
|
||||||
|
label.adjust = true;
|
||||||
|
uiX -= 1 * uiSpacing + 0.4f;
|
||||||
|
uiX -= WIDTH / 2;
|
||||||
|
uiY -= 2;
|
||||||
|
figX -= 2 * figSpacingX;
|
||||||
|
figY -= 4 * figSpacingY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
setPos(new Vector2f(uiX, uiY));
|
||||||
|
label.setPos(new Vector2f(uiX, uiY + 1));
|
||||||
|
|
||||||
|
createModel(asset, new Vector3f(figX, figY, 6));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHover() {
|
||||||
|
ColorRGBA buttonNormal = ColorRGBA.Gray.clone();// BUTTON_NORMAL.clone();
|
||||||
|
buttonNormal.a = 0.01f;
|
||||||
|
|
||||||
|
QuadBackgroundComponent background = new QuadBackgroundComponent(buttonNormal);
|
||||||
|
instance.setBackground(background);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUnHover() {
|
||||||
|
ColorRGBA buttonNormal = ColorRGBA.Gray.clone();// BUTTON_NORMAL.clone();
|
||||||
|
buttonNormal.a = 0.01f;
|
||||||
|
|
||||||
|
QuadBackgroundComponent background = new QuadBackgroundComponent(buttonNormal);
|
||||||
|
instance.setBackground(background);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
calculateRelative();
|
||||||
|
setRelative();
|
||||||
|
|
||||||
|
node.attachChild(instance);
|
||||||
|
node3d.attachChild(model);
|
||||||
|
|
||||||
|
label.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hide() {
|
||||||
|
node.detachChild(instance);
|
||||||
|
node3d.detachChild(model);
|
||||||
|
|
||||||
|
label.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(float tpf) {
|
||||||
|
if(rotate) {
|
||||||
|
rot += 140.0f * tpf;
|
||||||
|
rot %= 360;
|
||||||
|
} else {
|
||||||
|
rot = 180;
|
||||||
|
}
|
||||||
|
|
||||||
|
model.setLocalRotation(new Quaternion().fromAngles((float) Math.toRadians(90), (float) Math.toRadians(rot), (float) Math.toRadians(180)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createModel(Asset asset, Vector3f pos) {
|
||||||
|
String modelName = asset.getModelPath();
|
||||||
|
String texName = asset.getDiffPath();
|
||||||
|
|
||||||
|
model = app.getAssetManager().loadModel(modelName);
|
||||||
|
model.scale(asset.getSize() / 2);
|
||||||
|
model.rotate((float) Math.toRadians(90), (float) Math.toRadians(rot), (float) Math.toRadians(180));
|
||||||
|
model.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
|
||||||
|
|
||||||
|
model.setLocalTranslation(pos);
|
||||||
|
|
||||||
|
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
|
||||||
|
mat.setTexture("DiffuseMap", app.getAssetManager().loadTexture(texName));
|
||||||
|
model.setMaterial(mat);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,6 +35,7 @@ public abstract class ClickButton extends AbstractButton {
|
|||||||
instance.addCommands(Button.ButtonAction.HighlightOff, (button) -> release());
|
instance.addCommands(Button.ButtonAction.HighlightOff, (button) -> release());
|
||||||
|
|
||||||
instance.setFont(font);
|
instance.setFont(font);
|
||||||
|
instance.setFocusColor(TEXT_NORMAL);
|
||||||
|
|
||||||
calculateRelative();
|
calculateRelative();
|
||||||
setRelative();
|
setRelative();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
|
|
||||||
public class LabelButton extends ClickButton{
|
public class LabelButton extends ClickButton{
|
||||||
LabelButton(MdgaApp app, Node node, String label, Vector2f size, Vector2f pos) {
|
public LabelButton(MdgaApp app, Node node, String label, Vector2f size, Vector2f pos) {
|
||||||
super(app, node, () -> {}, label, size, pos);
|
super(app, node, () -> {}, label, size, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,6 @@ private void createModel(Asset asset, Vector3f pos) {
|
|||||||
model = app.getAssetManager().loadModel(modelName);
|
model = app.getAssetManager().loadModel(modelName);
|
||||||
model.scale(asset.getSize() / 2);
|
model.scale(asset.getSize() / 2);
|
||||||
model.rotate((float) Math.toRadians(90), (float) Math.toRadians(rot), (float) Math.toRadians(180));
|
model.rotate((float) Math.toRadians(90), (float) Math.toRadians(rot), (float) Math.toRadians(180));
|
||||||
model.setLocalTranslation(pos);
|
|
||||||
model.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
|
model.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
|
||||||
|
|
||||||
model.setLocalTranslation(pos);
|
model.setLocalTranslation(pos);
|
||||||
|
|||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package pp.mdga.client.button;
|
||||||
|
|
||||||
|
import com.jme3.math.Vector2f;
|
||||||
|
import com.jme3.math.Vector3f;
|
||||||
|
import com.jme3.scene.Node;
|
||||||
|
import com.simsilica.lemur.*;
|
||||||
|
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||||
|
import pp.mdga.client.MdgaApp;
|
||||||
|
|
||||||
|
public class SliderButton extends AbstractButton {
|
||||||
|
private Label label;
|
||||||
|
|
||||||
|
private Slider slider;
|
||||||
|
|
||||||
|
private Container container = new Container();
|
||||||
|
|
||||||
|
protected Vector2f size;
|
||||||
|
|
||||||
|
public SliderButton(MdgaApp app, Node node, String label) {
|
||||||
|
super(app, node);
|
||||||
|
|
||||||
|
this.label = new Label(label);
|
||||||
|
|
||||||
|
this.label.setColor(TEXT_NORMAL);
|
||||||
|
|
||||||
|
slider = new Slider("slider");
|
||||||
|
|
||||||
|
slider.getDecrementButton().setText(" - ");
|
||||||
|
slider.getDecrementButton().setFont(font);
|
||||||
|
slider.getDecrementButton().setFocusColor(TEXT_NORMAL);
|
||||||
|
slider.getDecrementButton().setTextVAlignment(VAlignment.Bottom);
|
||||||
|
slider.getDecrementButton().setColor(TEXT_NORMAL);
|
||||||
|
slider.getDecrementButton().setHighlightColor(TEXT_NORMAL);
|
||||||
|
|
||||||
|
slider.getIncrementButton().setText(" + ");
|
||||||
|
slider.getIncrementButton().setFont(font);
|
||||||
|
slider.getIncrementButton().setFocusColor(TEXT_NORMAL);
|
||||||
|
slider.getIncrementButton().setTextVAlignment(VAlignment.Bottom);
|
||||||
|
slider.getIncrementButton().setColor(TEXT_NORMAL);
|
||||||
|
slider.getIncrementButton().setHighlightColor(TEXT_NORMAL);
|
||||||
|
|
||||||
|
slider.getThumbButton().setText("X");
|
||||||
|
slider.getThumbButton().setFont(font);
|
||||||
|
slider.getThumbButton().setFocusColor(TEXT_NORMAL);
|
||||||
|
slider.getThumbButton().setColor(TEXT_NORMAL);
|
||||||
|
slider.getThumbButton().setHighlightColor(TEXT_NORMAL);
|
||||||
|
|
||||||
|
QuadBackgroundComponent background = new QuadBackgroundComponent(BUTTON_NORMAL);
|
||||||
|
slider.setBackground(background);
|
||||||
|
|
||||||
|
this.label.setFont(font);
|
||||||
|
|
||||||
|
pos = new Vector2f( 0, 0);
|
||||||
|
size = new Vector2f(5.5f, 1);
|
||||||
|
|
||||||
|
container.addChild(this.label);
|
||||||
|
|
||||||
|
container.addChild(slider);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
calculateRelative();
|
||||||
|
setRelative();
|
||||||
|
|
||||||
|
node.attachChild(container);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hide() {
|
||||||
|
node.detachChild(container);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setRelative() {
|
||||||
|
this.label.setFontSize(fontSize);
|
||||||
|
|
||||||
|
slider.getDecrementButton().setFontSize(fontSize);
|
||||||
|
slider.getIncrementButton().setFontSize(fontSize);
|
||||||
|
slider.getThumbButton().setFontSize(fontSize);
|
||||||
|
|
||||||
|
slider.setPreferredSize(new Vector3f(size.x * widthStep, size.y * heightStep, 0));
|
||||||
|
|
||||||
|
float xAdjust = 0.0f;
|
||||||
|
if(adjust) {
|
||||||
|
xAdjust = container.getPreferredSize().x;
|
||||||
|
}
|
||||||
|
|
||||||
|
container.setLocalTranslation(pos.x * horizontalStep - xAdjust, pos.y * verticalStep, -1);
|
||||||
|
|
||||||
|
final float horizontalMid = ((float)app.getCamera().getWidth() / 2) - (container.getPreferredSize().x / 2);
|
||||||
|
final float verticalMid = ((float)app.getCamera().getHeight() / 2) - container.getPreferredSize().y / 2;
|
||||||
|
|
||||||
|
if(0 == pos.x) {
|
||||||
|
container.setLocalTranslation(horizontalMid, container.getLocalTranslation().y, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(0 == pos.y) {
|
||||||
|
container.setLocalTranslation(container.getLocalTranslation().x, verticalMid, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getPercent() {
|
||||||
|
return (float) slider.getModel().getPercent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPercent(float percent) {
|
||||||
|
slider.getModel().setPercent(percent);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,82 @@
|
|||||||
package pp.mdga.client.dialog;
|
package pp.mdga.client.dialog;
|
||||||
|
|
||||||
public class AudioSettingsDialog {
|
import com.jme3.math.Vector2f;
|
||||||
|
import com.jme3.scene.Node;
|
||||||
|
import pp.mdga.client.MdgaApp;
|
||||||
|
import pp.mdga.client.button.MenuButton;
|
||||||
|
import pp.mdga.client.button.SliderButton;
|
||||||
|
import pp.mdga.client.view.MdgaView;
|
||||||
|
|
||||||
|
public class AudioSettingsDialog extends Dialog {
|
||||||
|
private final MdgaView view;
|
||||||
|
|
||||||
|
private SliderButton mainVolume;
|
||||||
|
private SliderButton musicVolume;
|
||||||
|
private SliderButton soundVolume;
|
||||||
|
|
||||||
|
private MenuButton backButton;
|
||||||
|
|
||||||
|
private boolean active = false;
|
||||||
|
|
||||||
|
public AudioSettingsDialog(MdgaApp app, Node node, MdgaView view) {
|
||||||
|
super(app, node);
|
||||||
|
|
||||||
|
this.view = view;
|
||||||
|
|
||||||
|
mainVolume = new SliderButton(app, node, "Gesamt Lautstärke");
|
||||||
|
musicVolume = new SliderButton(app, node, "Gesamt Lautstärke");
|
||||||
|
soundVolume = new SliderButton(app, node, "Gesamt Lautstärke");
|
||||||
|
|
||||||
|
backButton = new MenuButton(app, node, view::leaveAudioSettings, "Zurück");
|
||||||
|
|
||||||
|
float offset = 1.0f;
|
||||||
|
|
||||||
|
mainVolume.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||||
|
offset += 1.75f;
|
||||||
|
|
||||||
|
musicVolume.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||||
|
offset += 1.75f;
|
||||||
|
|
||||||
|
soundVolume.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||||
|
offset += 1.75f * 1.3f;
|
||||||
|
|
||||||
|
backButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||||
|
offset += 1.75f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onShow() {
|
||||||
|
active = true;
|
||||||
|
|
||||||
|
mainVolume.setPercent(app.getAcousticHandler().getMainVolume());
|
||||||
|
musicVolume.setPercent(app.getAcousticHandler().getMusicVolume());
|
||||||
|
soundVolume.setPercent(app.getAcousticHandler().getSoundVolume());
|
||||||
|
|
||||||
|
backButton.show();
|
||||||
|
|
||||||
|
mainVolume.show();
|
||||||
|
musicVolume.show();
|
||||||
|
soundVolume.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onHide() {
|
||||||
|
active = false;
|
||||||
|
|
||||||
|
backButton.hide();
|
||||||
|
|
||||||
|
mainVolume.hide();
|
||||||
|
musicVolume.hide();
|
||||||
|
soundVolume.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
if(!active) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
app.getAcousticHandler().setMainVolume(mainVolume.getPercent());
|
||||||
|
app.getAcousticHandler().setMusicVolume(musicVolume.getPercent());
|
||||||
|
app.getAcousticHandler().setSoundVolume(soundVolume.getPercent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package pp.mdga.client.dialog;
|
||||||
|
|
||||||
|
import com.jme3.math.Vector2f;
|
||||||
|
import com.jme3.scene.Node;
|
||||||
|
import pp.mdga.client.MdgaApp;
|
||||||
|
import pp.mdga.client.button.InputButton;
|
||||||
|
import pp.mdga.client.button.LabelButton;
|
||||||
|
import pp.mdga.client.button.MenuButton;
|
||||||
|
import pp.mdga.client.view.MainView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class CeremonyDialog extends Dialog {
|
||||||
|
private ArrayList<ArrayList<LabelButton>> labels;
|
||||||
|
|
||||||
|
public CeremonyDialog(MdgaApp app, Node node) {
|
||||||
|
super(app, node);
|
||||||
|
|
||||||
|
labels = new ArrayList<>();
|
||||||
|
labels.add(new ArrayList<>());
|
||||||
|
labels.add(new ArrayList<>());
|
||||||
|
labels.add(new ArrayList<>());
|
||||||
|
labels.add(new ArrayList<>());
|
||||||
|
labels.add(new ArrayList<>());
|
||||||
|
labels.add(new ArrayList<>());
|
||||||
|
|
||||||
|
float offsetX = 0.5f;
|
||||||
|
|
||||||
|
for (ArrayList<LabelButton> row : labels) {
|
||||||
|
|
||||||
|
float offsetY = 0.5f;
|
||||||
|
|
||||||
|
Vector2f size = new Vector2f(5, 1.2f);
|
||||||
|
row.add(new LabelButton(app, node, "", size, new Vector2f()));
|
||||||
|
row.add(new LabelButton(app, node, "Würfe", size, new Vector2f()));
|
||||||
|
row.add(new LabelButton(app, node, "Figuren rausgeworfen", size, new Vector2f()));
|
||||||
|
row.add(new LabelButton(app, node, "verwendete Bonuskarten", size, new Vector2f()));
|
||||||
|
row.add(new LabelButton(app, node, "gewürfelte 6en", size, new Vector2f()));
|
||||||
|
row.add(new LabelButton(app, node, "gelaufene Felder", size, new Vector2f()));
|
||||||
|
row.add(new LabelButton(app, node, "auf Bonusfeldern gelandet", size, new Vector2f()));
|
||||||
|
|
||||||
|
for (LabelButton b : row) {
|
||||||
|
b.setPos(new Vector2f(offsetX, MenuButton.VERTICAL - offsetY));
|
||||||
|
offsetY += 0.8f;
|
||||||
|
}
|
||||||
|
|
||||||
|
offsetX += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onShow() {
|
||||||
|
for (ArrayList<LabelButton> row : labels) {
|
||||||
|
for (LabelButton b : row) {
|
||||||
|
b.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onHide() {
|
||||||
|
for (ArrayList<LabelButton> row : labels) {
|
||||||
|
for (LabelButton b : row) {
|
||||||
|
b.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,52 @@
|
|||||||
package pp.mdga.client.dialog;
|
package pp.mdga.client.dialog;
|
||||||
|
|
||||||
public class SettingsDialog {
|
import com.jme3.math.Vector2f;
|
||||||
|
import com.jme3.scene.Node;
|
||||||
|
import pp.mdga.client.MdgaApp;
|
||||||
|
import pp.mdga.client.button.InputButton;
|
||||||
|
import pp.mdga.client.button.MenuButton;
|
||||||
|
import pp.mdga.client.view.MainView;
|
||||||
|
import pp.mdga.client.view.MdgaView;
|
||||||
|
|
||||||
|
public class SettingsDialog extends Dialog {
|
||||||
|
private MenuButton videoButton;
|
||||||
|
private MenuButton audioButton;
|
||||||
|
private MenuButton backButton;
|
||||||
|
|
||||||
|
private final MdgaView view;
|
||||||
|
|
||||||
|
public SettingsDialog(MdgaApp app, Node node, MdgaView view) {
|
||||||
|
super(app, node);
|
||||||
|
|
||||||
|
this.view = view;
|
||||||
|
|
||||||
|
videoButton = new MenuButton(app, node, view::enterVideoSettings, "Video");
|
||||||
|
audioButton = new MenuButton(app, node, view::enterAudioSettings, "Audio");
|
||||||
|
backButton = new MenuButton(app, node, view::leaveSettings, "Zurück");
|
||||||
|
|
||||||
|
float offset = 2.0f;
|
||||||
|
|
||||||
|
videoButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||||
|
offset += 1.25f;
|
||||||
|
|
||||||
|
audioButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||||
|
offset += 1.25f;
|
||||||
|
|
||||||
|
backButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||||
|
offset += 1.25f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onShow() {
|
||||||
|
videoButton.show();
|
||||||
|
audioButton.show();
|
||||||
|
backButton.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onHide() {
|
||||||
|
videoButton.hide();
|
||||||
|
audioButton.hide();
|
||||||
|
backButton.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,48 @@
|
|||||||
package pp.mdga.client.dialog;
|
package pp.mdga.client.dialog;
|
||||||
|
|
||||||
public class VideoSettingsDialog {
|
import com.jme3.math.Vector2f;
|
||||||
|
import com.jme3.scene.Node;
|
||||||
|
import pp.mdga.client.MdgaApp;
|
||||||
|
import pp.mdga.client.button.MenuButton;
|
||||||
|
import pp.mdga.client.view.MdgaView;
|
||||||
|
|
||||||
|
public class VideoSettingsDialog extends Dialog {
|
||||||
|
private MenuButton backButton;
|
||||||
|
|
||||||
|
private final MdgaView view;
|
||||||
|
|
||||||
|
private boolean active = false;
|
||||||
|
|
||||||
|
public VideoSettingsDialog(MdgaApp app, Node node, MdgaView view) {
|
||||||
|
super(app, node);
|
||||||
|
|
||||||
|
this.view = view;
|
||||||
|
|
||||||
|
backButton = new MenuButton(app, node, view::leaveVideoSettings, "Zurück");
|
||||||
|
|
||||||
|
float offset = 2.0f;
|
||||||
|
|
||||||
|
backButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||||
|
offset += 1.25f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onShow() {
|
||||||
|
active = true;
|
||||||
|
|
||||||
|
backButton.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onHide() {
|
||||||
|
active = false;
|
||||||
|
|
||||||
|
backButton.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
if(!active) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,18 @@
|
|||||||
package pp.mdga.client.view;
|
package pp.mdga.client.view;
|
||||||
|
|
||||||
|
import com.jme3.light.AmbientLight;
|
||||||
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.MdgaState;
|
import pp.mdga.client.MdgaState;
|
||||||
|
import pp.mdga.client.button.ButtonLeft;
|
||||||
|
import pp.mdga.client.button.ButtonRight;
|
||||||
|
import pp.mdga.client.button.CeremonyButton;
|
||||||
|
import pp.mdga.client.button.LobbyButton;
|
||||||
|
import pp.mdga.client.dialog.CeremonyDialog;
|
||||||
|
import pp.mdga.game.Color;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class CeremonyView extends MdgaView {
|
public class CeremonyView extends MdgaView {
|
||||||
private enum SubState {
|
private enum SubState {
|
||||||
@@ -14,17 +24,45 @@ private enum SubState {
|
|||||||
|
|
||||||
private Geometry background;
|
private Geometry background;
|
||||||
|
|
||||||
|
private ButtonLeft backButton;
|
||||||
|
private ButtonRight continueButton;
|
||||||
|
|
||||||
|
private ArrayList<CeremonyButton> ceremonyButtons;
|
||||||
|
|
||||||
|
private CeremonyDialog ceremonyDialog;
|
||||||
|
|
||||||
|
private AmbientLight ambient = new AmbientLight();
|
||||||
|
|
||||||
public CeremonyView(MdgaApp app) {
|
public CeremonyView(MdgaApp app) {
|
||||||
super(app);
|
super(app);
|
||||||
|
|
||||||
|
backButton = new ButtonLeft(app, guiNode, this::back, "Zurück", 1);
|
||||||
|
continueButton = new ButtonRight(app, guiNode, this::forward, "Weiter", 1);
|
||||||
|
|
||||||
|
ceremonyButtons = new ArrayList<>(4);
|
||||||
|
|
||||||
|
ceremonyDialog = new CeremonyDialog(app, guiNode);
|
||||||
|
|
||||||
|
ambient.setColor(new ColorRGBA(0.3f, 0.3f, 0.3f, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnter() {
|
public void onEnter() {
|
||||||
enterSub(SubState.AWARD_CEREMONY);
|
enterSub(SubState.AWARD_CEREMONY);
|
||||||
|
|
||||||
|
rootNode.addLight(ambient);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLeave() {
|
public void onLeave() {
|
||||||
|
backButton.hide();
|
||||||
|
continueButton.hide();
|
||||||
|
|
||||||
|
guiNode.detachChild(background);
|
||||||
|
|
||||||
|
ceremonyButtons.clear();
|
||||||
|
|
||||||
|
rootNode.removeLight(ambient);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -35,19 +73,40 @@ protected void onEnterOverlay(Overlay overlay) {
|
|||||||
protected void onLeaveOverlay(Overlay overlay) {
|
protected void onLeaveOverlay(Overlay overlay) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onUpdate(float tpf) {
|
||||||
|
for (CeremonyButton c : ceremonyButtons) {
|
||||||
|
c.update(tpf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void awardCeremony() {
|
private void awardCeremony() {
|
||||||
background = createBackground("Images/b1.png");
|
continueButton.show();
|
||||||
guiNode.attachChild(background);
|
|
||||||
|
for (CeremonyButton c : ceremonyButtons) {
|
||||||
|
c.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void statistics() {
|
private void statistics() {
|
||||||
background = createBackground("Images/b2.png");
|
background = createBackground("Images/b2.png");
|
||||||
guiNode.attachChild(background);
|
guiNode.attachChild(background);
|
||||||
|
|
||||||
|
backButton.show();
|
||||||
|
continueButton.show();
|
||||||
|
ceremonyDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enterSub(SubState state) {
|
private void enterSub(SubState state) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
|
|
||||||
|
backButton.hide();
|
||||||
|
continueButton.hide();
|
||||||
|
for (CeremonyButton c : ceremonyButtons) {
|
||||||
|
c.hide();
|
||||||
|
}
|
||||||
|
ceremonyDialog.hide();
|
||||||
|
|
||||||
if(null != background) {
|
if(null != background) {
|
||||||
guiNode.detachChild(background);
|
guiNode.detachChild(background);
|
||||||
}
|
}
|
||||||
@@ -83,4 +142,14 @@ private void back() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addCeremonyParticipant(Color color, int pos, String name) {
|
||||||
|
CeremonyButton button = new CeremonyButton(app, guiNode, rootNode, color, CeremonyButton.Pos.values()[pos - 1], name);
|
||||||
|
|
||||||
|
ceremonyButtons.add(button);
|
||||||
|
|
||||||
|
if(state.equals(SubState.AWARD_CEREMONY)) {
|
||||||
|
button.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,14 +17,11 @@ public class GameView extends MdgaView {
|
|||||||
private CameraHandler camera;
|
private CameraHandler camera;
|
||||||
private GuiHandler guiHandler;
|
private GuiHandler guiHandler;
|
||||||
|
|
||||||
private SettingsButton settingsButton;
|
|
||||||
|
|
||||||
private ButtonRight cheatButton; //TODO
|
private ButtonRight cheatButton; //TODO
|
||||||
|
|
||||||
public GameView(MdgaApp app) {
|
public GameView(MdgaApp app) {
|
||||||
super(app);
|
super(app);
|
||||||
|
|
||||||
settingsButton = new SettingsButton(app, guiNode, this::clickSettings);
|
|
||||||
cheatButton = new ButtonRight(app, guiNode, () -> app.getModelSyncronizer().enter(MdgaState.CEREMONY), "Weiter (CHEAT)", 1);
|
cheatButton = new ButtonRight(app, guiNode, () -> app.getModelSyncronizer().enter(MdgaState.CEREMONY), "Weiter (CHEAT)", 1);
|
||||||
|
|
||||||
FilterPostProcessor fpp = new FilterPostProcessor(app.getAssetManager());
|
FilterPostProcessor fpp = new FilterPostProcessor(app.getAssetManager());
|
||||||
@@ -46,7 +43,6 @@ public GameView(MdgaApp app) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnter() {
|
public void onEnter() {
|
||||||
settingsButton.show();
|
|
||||||
cheatButton.show();
|
cheatButton.show();
|
||||||
|
|
||||||
camera.init();
|
camera.init();
|
||||||
@@ -60,7 +56,6 @@ public void onLeave() {
|
|||||||
boardHandler.shutdown();
|
boardHandler.shutdown();
|
||||||
guiHandler.shutdown();
|
guiHandler.shutdown();
|
||||||
|
|
||||||
settingsButton.hide();
|
|
||||||
cheatButton.hide();
|
cheatButton.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,8 +88,4 @@ public BoardHandler getBoardHandler() {
|
|||||||
public GuiHandler getGuiHandler() {
|
public GuiHandler getGuiHandler() {
|
||||||
return guiHandler;
|
return guiHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clickSettings() {
|
|
||||||
//TODO play sound
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import com.jme3.asset.TextureKey;
|
import com.jme3.asset.TextureKey;
|
||||||
import com.jme3.light.AmbientLight;
|
import com.jme3.light.AmbientLight;
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
|
import com.jme3.renderer.Camera;
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import com.jme3.scene.Spatial;
|
import com.jme3.scene.Spatial;
|
||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
@@ -17,8 +18,6 @@
|
|||||||
public class LobbyView extends MdgaView {
|
public class LobbyView extends MdgaView {
|
||||||
private Geometry background;
|
private Geometry background;
|
||||||
|
|
||||||
private SettingsButton settingsButton;
|
|
||||||
|
|
||||||
private ButtonLeft leaveButton;
|
private ButtonLeft leaveButton;
|
||||||
private ButtonRight readyButton;
|
private ButtonRight readyButton;
|
||||||
|
|
||||||
@@ -27,17 +26,15 @@ public class LobbyView extends MdgaView {
|
|||||||
private LobbyButton armyButton;
|
private LobbyButton armyButton;
|
||||||
private LobbyButton navyButton;
|
private LobbyButton navyButton;
|
||||||
|
|
||||||
private AmbientLight ambient = new AmbientLight();;
|
private AmbientLight ambient = new AmbientLight();
|
||||||
|
|
||||||
public LobbyView(MdgaApp app) {
|
public LobbyView(MdgaApp app) {
|
||||||
super(app);
|
super(app);
|
||||||
|
|
||||||
TextureKey key = new TextureKey("Images/map3.png", false);
|
//TextureKey key = new TextureKey("lobby.png", false);
|
||||||
Texture skyTexture = app.getAssetManager().loadTexture(key);
|
//Texture skyTexture = app.getAssetManager().loadTexture(key);
|
||||||
Spatial sky = SkyFactory.createSky(app.getAssetManager(), skyTexture, SkyFactory.EnvMapType.SphereMap);
|
//Spatial sky = SkyFactory.createSky(app.getAssetManager(), skyTexture, SkyFactory.EnvMapType.SphereMap);
|
||||||
rootNode.attachChild(sky);
|
//rootNode.attachChild(sky);
|
||||||
|
|
||||||
settingsButton = new SettingsButton(app, guiNode, this::clickSettings);
|
|
||||||
|
|
||||||
leaveButton = new ButtonLeft(app, guiNode, this::leaveLobby, "Verlassen", 1);
|
leaveButton = new ButtonLeft(app, guiNode, this::leaveLobby, "Verlassen", 1);
|
||||||
readyButton = new ButtonRight(app, guiNode, this::ready, "Bereit", 1);
|
readyButton = new ButtonRight(app, guiNode, this::ready, "Bereit", 1);
|
||||||
@@ -52,12 +49,11 @@ public LobbyView(MdgaApp app) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnter() {
|
public void onEnter() {
|
||||||
app.getCamera().setParallelProjection(true);
|
//cam = new Camera(app.getCamera().getWidth(), app.getCamera().getHeight());
|
||||||
float aspect = (float) app.getCamera().getWidth() / app.getCamera().getHeight();
|
//cam.setParallelProjection(true);
|
||||||
float size = 1.65f;
|
//float aspect = (float) app.getCamera().getWidth() / app.getCamera().getHeight();
|
||||||
app.getCamera().setFrustum(-1000, 1000, -aspect * size, aspect * size, size, -size);
|
//float size = 1.65f;
|
||||||
|
//cam.setFrustum(-1000, 1000, -aspect * size, aspect * size, size, -size);
|
||||||
settingsButton.show();
|
|
||||||
|
|
||||||
leaveButton.show();
|
leaveButton.show();
|
||||||
readyButton.show();
|
readyButton.show();
|
||||||
@@ -72,8 +68,6 @@ public void onEnter() {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLeave() {
|
public void onLeave() {
|
||||||
settingsButton.hide();
|
|
||||||
|
|
||||||
leaveButton.hide();
|
leaveButton.hide();
|
||||||
readyButton.hide();
|
readyButton.hide();
|
||||||
|
|
||||||
@@ -173,8 +167,4 @@ private void leaveLobby() {
|
|||||||
app.getModelSyncronizer().leave();
|
app.getModelSyncronizer().leave();
|
||||||
//TODO: playSound
|
//TODO: playSound
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clickSettings() {
|
|
||||||
//TODO: playSound
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ private enum SubState {
|
|||||||
|
|
||||||
private Geometry background;
|
private Geometry background;
|
||||||
|
|
||||||
private SettingsButton settingsButton;
|
|
||||||
|
|
||||||
private StartDialog startDialog;
|
private StartDialog startDialog;
|
||||||
private JoinDialog joinDialog;
|
private JoinDialog joinDialog;
|
||||||
private HostDialog hostDialog;
|
private HostDialog hostDialog;
|
||||||
@@ -30,8 +28,6 @@ private enum SubState {
|
|||||||
public MainView(MdgaApp app) {
|
public MainView(MdgaApp app) {
|
||||||
super(app);
|
super(app);
|
||||||
|
|
||||||
settingsButton = new SettingsButton(app, guiNode, this::clickSettings);
|
|
||||||
|
|
||||||
startDialog = new StartDialog(app, guiNode, this);
|
startDialog = new StartDialog(app, guiNode, this);
|
||||||
joinDialog = new JoinDialog(app, guiNode, this);
|
joinDialog = new JoinDialog(app, guiNode, this);
|
||||||
hostDialog = new HostDialog(app, guiNode, this);
|
hostDialog = new HostDialog(app, guiNode, this);
|
||||||
@@ -42,8 +38,6 @@ public void onEnter() {
|
|||||||
background = createBackground("Images/main.png");
|
background = createBackground("Images/main.png");
|
||||||
guiNode.attachChild(background);
|
guiNode.attachChild(background);
|
||||||
|
|
||||||
settingsButton.show();
|
|
||||||
|
|
||||||
enterSub(SubState.MAIN);
|
enterSub(SubState.MAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,8 +47,6 @@ public void onLeave() {
|
|||||||
joinDialog.hide();
|
joinDialog.hide();
|
||||||
hostDialog.hide();
|
hostDialog.hide();
|
||||||
|
|
||||||
settingsButton.hide();
|
|
||||||
|
|
||||||
guiNode.detachChild(background);
|
guiNode.detachChild(background);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,6 +97,7 @@ private void tryHost() {
|
|||||||
port = Integer.parseInt(text);
|
port = Integer.parseInt(text);
|
||||||
|
|
||||||
if(port >= 1 && port <= 65535) {
|
if(port >= 1 && port <= 65535) {
|
||||||
|
app.getModelSyncronizer().setName(startDialog.getName());
|
||||||
app.getModelSyncronizer().setHost(port);
|
app.getModelSyncronizer().setHost(port);
|
||||||
//TODO: playSound
|
//TODO: playSound
|
||||||
return;
|
return;
|
||||||
@@ -118,6 +111,8 @@ private void tryHost() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void tryJoin() {
|
private void tryJoin() {
|
||||||
|
//TODO
|
||||||
|
app.getModelSyncronizer().setName(startDialog.getName());
|
||||||
app.getModelSyncronizer().setJoin("127.0.0.1", 1);
|
app.getModelSyncronizer().setJoin("127.0.0.1", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,11 +139,9 @@ private void enterSub(SubState state) {
|
|||||||
public void forward() {
|
public void forward() {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case HOST:
|
case HOST:
|
||||||
app.getModelSyncronizer().setName(startDialog.getName());
|
|
||||||
tryHost();
|
tryHost();
|
||||||
break;
|
break;
|
||||||
case JOIN:
|
case JOIN:
|
||||||
app.getModelSyncronizer().setName(startDialog.getName());
|
|
||||||
tryJoin();
|
tryJoin();
|
||||||
break;
|
break;
|
||||||
case MAIN:
|
case MAIN:
|
||||||
@@ -159,11 +152,9 @@ public void forward() {
|
|||||||
public void forward(boolean host) {
|
public void forward(boolean host) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case HOST:
|
case HOST:
|
||||||
app.getModelSyncronizer().setName(startDialog.getName());
|
|
||||||
tryHost();
|
tryHost();
|
||||||
break;
|
break;
|
||||||
case JOIN:
|
case JOIN:
|
||||||
app.getModelSyncronizer().setName(startDialog.getName());
|
|
||||||
tryJoin();
|
tryJoin();
|
||||||
break;
|
break;
|
||||||
case MAIN:
|
case MAIN:
|
||||||
@@ -193,9 +184,5 @@ public void back() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickSettings() {
|
|
||||||
//TODO: playSound
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@
|
|||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.button.*;
|
import pp.mdga.client.button.*;
|
||||||
|
import pp.mdga.client.dialog.AudioSettingsDialog;
|
||||||
|
import pp.mdga.client.dialog.SettingsDialog;
|
||||||
|
import pp.mdga.client.dialog.VideoSettingsDialog;
|
||||||
|
|
||||||
public abstract class MdgaView {
|
public abstract class MdgaView {
|
||||||
public enum Overlay {
|
public enum Overlay {
|
||||||
@@ -19,15 +22,29 @@ 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();
|
||||||
|
|
||||||
|
private SettingsButton settingsButton;
|
||||||
|
|
||||||
|
private SettingsDialog settingsDialog;
|
||||||
|
private VideoSettingsDialog videoSettingsDialog;
|
||||||
|
private AudioSettingsDialog audioSettingsDialog;
|
||||||
|
|
||||||
public MdgaView(MdgaApp app) {
|
public MdgaView(MdgaApp app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
settingsButton = new SettingsButton(app, guiNode, this::enterSettings);
|
||||||
|
|
||||||
|
settingsDialog = new SettingsDialog(app, settingsNode, this);
|
||||||
|
videoSettingsDialog = new VideoSettingsDialog(app, settingsNode, this);
|
||||||
|
audioSettingsDialog = new AudioSettingsDialog(app, settingsNode, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enter() {
|
public void enter() {
|
||||||
app.getRootNode().attachChild(rootNode);
|
app.getRootNode().attachChild(rootNode);
|
||||||
app.getGuiNode().attachChild(guiNode);
|
app.getGuiNode().attachChild(guiNode);
|
||||||
|
|
||||||
|
settingsButton.show();
|
||||||
|
|
||||||
onEnter();
|
onEnter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,6 +52,8 @@ public void leave() {
|
|||||||
app.getRootNode().detachChild(rootNode);
|
app.getRootNode().detachChild(rootNode);
|
||||||
app.getGuiNode().detachChild(guiNode);
|
app.getGuiNode().detachChild(guiNode);
|
||||||
|
|
||||||
|
settingsButton.hide();
|
||||||
|
|
||||||
onLeave();
|
onLeave();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,12 +71,15 @@ public void leaveOverlay(Overlay overlay) {
|
|||||||
|
|
||||||
public void update(float tpf) {
|
public void update(float tpf) {
|
||||||
//TODO is not necessary but will show misuse of nodes
|
//TODO is not necessary but will show misuse of nodes
|
||||||
app.getRootNode().detachAllChildren();
|
//app.getRootNode().detachAllChildren();
|
||||||
app.getGuiNode().detachAllChildren();
|
//app.getGuiNode().detachAllChildren();
|
||||||
app.getRootNode().attachChild(rootNode);
|
//app.getRootNode().attachChild(rootNode);
|
||||||
app.getGuiNode().attachChild(guiNode);
|
//app.getGuiNode().attachChild(guiNode);
|
||||||
//TODO ----------------------------------------------
|
//TODO ----------------------------------------------
|
||||||
|
|
||||||
|
videoSettingsDialog.update();
|
||||||
|
audioSettingsDialog.update();
|
||||||
|
|
||||||
onUpdate(tpf);
|
onUpdate(tpf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,8 +101,42 @@ protected Geometry createBackground(String texturePath) {
|
|||||||
|
|
||||||
Geometry background = new Geometry("Background", quad);
|
Geometry background = new Geometry("Background", quad);
|
||||||
background.setMaterial(mat);
|
background.setMaterial(mat);
|
||||||
background.setLocalTranslation(0, 0, -1);
|
background.setLocalTranslation(0, 0, -2);
|
||||||
|
|
||||||
return background;
|
return background;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void enterSettings() {
|
||||||
|
enterOverlay(Overlay.SETTINGS);
|
||||||
|
|
||||||
|
app.getGuiNode().attachChild(settingsNode);
|
||||||
|
settingsDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void leaveSettings() {
|
||||||
|
leaveOverlay(Overlay.SETTINGS);
|
||||||
|
|
||||||
|
app.getGuiNode().detachChild(settingsNode);
|
||||||
|
settingsDialog.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enterVideoSettings() {
|
||||||
|
settingsDialog.hide();
|
||||||
|
videoSettingsDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void leaveVideoSettings() {
|
||||||
|
settingsDialog.show();
|
||||||
|
videoSettingsDialog.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enterAudioSettings() {
|
||||||
|
settingsDialog.hide();
|
||||||
|
audioSettingsDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void leaveAudioSettings() {
|
||||||
|
settingsDialog.show();
|
||||||
|
audioSettingsDialog.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 3.1 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.4 MiB |
Reference in New Issue
Block a user