mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 02:44:50 +00:00
Fixed audio not getting correct volume at settings loading. Added back background music
This commit is contained in:
@@ -11,6 +11,8 @@ import javafx.scene.Scene;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.stage.Stage;
|
||||
import org.toop.framework.asset.resources.SettingsAsset;
|
||||
import org.toop.framework.audio.events.AudioEvents;
|
||||
import org.toop.framework.eventbus.EventFlow;
|
||||
import org.toop.local.AppSettings;
|
||||
|
||||
import java.io.File;
|
||||
@@ -65,6 +67,8 @@ public final class App extends Application {
|
||||
|
||||
App.isQuitting = false;
|
||||
|
||||
new EventFlow().addPostEvent(new AudioEvents.StartBackgroundMusic()).postEvent();
|
||||
|
||||
activate(new MainLayer());
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class OptionsLayer extends Layer {
|
||||
container.addSlider(100, currentVolume, (volume) -> {
|
||||
currentVolume = volume;
|
||||
settings.setVolume(volume);
|
||||
new EventFlow().addPostEvent(new AudioEvents.ChangeVolume(volume.doubleValue() / 100.0)).asyncPostEvent();
|
||||
new EventFlow().addPostEvent(new AudioEvents.ChangeVolume(volume.doubleValue())).asyncPostEvent();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package org.toop.local;
|
||||
|
||||
import org.toop.app.App;
|
||||
import org.toop.framework.asset.resources.SettingsAsset;
|
||||
import org.toop.framework.audio.events.AudioEvents;
|
||||
import org.toop.framework.eventbus.EventFlow;
|
||||
import org.toop.framework.settings.Settings;
|
||||
|
||||
import java.io.File;
|
||||
@@ -20,6 +22,8 @@ public class AppSettings {
|
||||
|
||||
AppContext.setLocale(Locale.of(settingsData.locale));
|
||||
App.setFullscreen(settingsData.fullScreen);
|
||||
new EventFlow().addPostEvent(new AudioEvents.ChangeVolume(settingsData.volume)).asyncPostEvent();
|
||||
|
||||
}
|
||||
|
||||
public SettingsAsset getPath() {
|
||||
|
||||
BIN
app/src/main/resources/assets/audio/music/gladius.mp3
Normal file
BIN
app/src/main/resources/assets/audio/music/gladius.mp3
Normal file
Binary file not shown.
Reference in New Issue
Block a user