diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/Acoustic/AcousticHandler.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/Acoustic/AcousticHandler.java index 0cd2d463..d97ed77f 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/Acoustic/AcousticHandler.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/Acoustic/AcousticHandler.java @@ -23,6 +23,7 @@ public class AcousticHandler { private GameMusic playing = null; // Currently playing track private GameMusic scheduled = null; // Scheduled track to play next private GameMusic old = null; // Old track being faded out + private ArrayList queue = new ArrayList<>(); private float mainVolume = 1.0f; private float musicVolume = 1.0f; @@ -169,6 +170,12 @@ private float lerp(float start, float end, float t) { * - Ensures no NullPointerException occurs by validating track states before invoking methods. */ private void updateVolumeAndTrack() { + if(!fading) { + if(!queue.isEmpty()) { + scheduled = queue.removeFirst(); + } + } + if (scheduled == null && !fading && playing == null) { // Nothing to play or fade, early exit return; @@ -283,7 +290,8 @@ private void updateGameTracks() { MusicAsset nextTrack = gameTracks.remove(0); - scheduled = new GameMusic(app, nextTrack, getMusicVolumeTotal(), nextTrack.getSubVolume(), nextTrack.getLoop(), 0.0f); + GameMusic music = new GameMusic(app, nextTrack, getMusicVolumeTotal(), nextTrack.getSubVolume(), nextTrack.getLoop(), 0.0f); + queue.add(music); } } diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/Dialog/Dialog.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/Dialog/Dialog.java index 088434ee..bd467242 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/Dialog/Dialog.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/Dialog/Dialog.java @@ -9,6 +9,8 @@ public abstract class Dialog { protected MdgaApp app; + protected int xOffset = 0; + protected int yOffset = 0; public Dialog(MdgaApp app) { this.app = app; @@ -17,5 +19,13 @@ public Dialog(MdgaApp app) { public abstract void show(); public abstract void hide(); public abstract void addButton(MdgaButton button); + + public void setYOffset(int yOffset) { + this.yOffset = yOffset; + } + + public void setXOffset(int xOffset) { + this.xOffset = xOffset; + } } diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/Dialog/HorizontalButtonDialog.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/Dialog/HorizontalButtonDialog.java index 3f5c7cce..006f3515 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/Dialog/HorizontalButtonDialog.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/Dialog/HorizontalButtonDialog.java @@ -10,6 +10,8 @@ public class HorizontalButtonDialog extends Dialog { private Node row = new Node(); + private int offset = 0; + public HorizontalButtonDialog(MdgaApp app) { super(app); @@ -22,7 +24,7 @@ public HorizontalButtonDialog(MdgaApp app) { public void show() { app.getGuiNode().attachChild(row); - row.setLocalTranslation(app.getCamera().getWidth() / 2, app.getCamera().getHeight() / 2, 0); + row.setLocalTranslation((app.getCamera().getWidth() / 2) + xOffset, (app.getCamera().getHeight() / 2) + yOffset, 0); } @Override diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/Dialog/VerticalButtonDialog.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/Dialog/VerticalButtonDialog.java index b862a14e..727c8770 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/Dialog/VerticalButtonDialog.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/Dialog/VerticalButtonDialog.java @@ -25,8 +25,8 @@ public void show() { app.getGuiNode().attachChild(container); container.setLocalTranslation( - app.getCamera().getWidth() / 2 - container.getPreferredSize().x / 2, - app.getCamera().getHeight() / 2 + container.getPreferredSize().y / 2, + (app.getCamera().getWidth() / 2 - container.getPreferredSize().x / 2) + xOffset, + (app.getCamera().getHeight() / 2 + container.getPreferredSize().y / 2) + yOffset, 0 ); } diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/MdgaApp.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/MdgaApp.java index f79690d9..c7b2563d 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/MdgaApp.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/MdgaApp.java @@ -15,9 +15,6 @@ public class MdgaApp extends SimpleApplication { MdgaView view = null; private MdgaState state = MdgaState.MAIN; - //TODO - private NanoTimer test = new NanoTimer(); - public static void main(String[] args) { AppSettings settings = new AppSettings(true); settings.setSamples(128); @@ -44,19 +41,6 @@ public void simpleInitApp() { @Override public void simpleUpdate(float tpf) { acousticHandler.update(); - - if(test.getTimeInSeconds() < 8) { - return; - } - - switch (state) { - case LOBBY: - //enter(MdgaState.GAME); - break; - case GAME: - //enter(MdgaState.CEREMONY); - break; - } } public void enter(MdgaState state) { @@ -72,11 +56,9 @@ public void enter(MdgaState state) { break; case LOBBY: view = new LobbyView(this); - test.reset(); break; case GAME: view = new GameView(this); - test.reset(); break; case CEREMONY: view = new CeremonyView(this); diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/View/LobbyView.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/View/LobbyView.java index 20441ae5..623ec854 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/View/LobbyView.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/View/LobbyView.java @@ -31,7 +31,7 @@ public LobbyView(MdgaApp app) { dialog = new HorizontalButtonDialog(app); float buttonWidth = 150; - float spacing = 60; + float spacing = 80; float startX = -((3 * buttonWidth + 2 * spacing) / 2); float currentX = startX; @@ -44,6 +44,8 @@ public LobbyView(MdgaApp app) { dialog.addButton(button); } + dialog.setXOffset(-100); + //Button weiterButton = createButton("Weiter", new Vector3f(150, 50, 0), ColorRGBA.Blue, ColorRGBA.Cyan); //weiterButton.setLocalTranslation(app.getCamera().getWidth() - 200, 100, 0);