added MainVolume slider in the menu
added the logic so that the volume of music or sound is multiplied by the main volume created the class MainVolume to handle the logic of the main volume adjusted methods in GameSounds and BackgroundMusic to integrate main volume
This commit is contained in:
		
						parent
						
							586251b2ad
						
					
				
				
					commit
					52673dfbce
				
			@@ -33,15 +33,14 @@ public class BackgroundMusic implements GameEventListener {
 | 
				
			|||||||
    private boolean musicEnabled;
 | 
					    private boolean musicEnabled;
 | 
				
			||||||
    private float volume;
 | 
					    private float volume;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private Application app;
 | 
					    private final BattleshipApp app;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Initializes and controls the BackgroundMusic
 | 
					     * Initializes and controls the BackgroundMusic
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param app The main Application
 | 
					     * @param app The main Application
 | 
				
			||||||
     * @param musicFilePath The Path for the specific background music
 | 
					 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public BackgroundMusic(Application app, String musicFilePath) {
 | 
					    public BackgroundMusic(BattleshipApp app) {
 | 
				
			||||||
        this.volume = prefs.getFloat(VOLUME_PREF, 1.0f);
 | 
					        this.volume = prefs.getFloat(VOLUME_PREF, 1.0f);
 | 
				
			||||||
        this.musicEnabled = prefs.getBoolean(MUSIC_ENABLED_PREF, true);
 | 
					        this.musicEnabled = prefs.getBoolean(MUSIC_ENABLED_PREF, true);
 | 
				
			||||||
        this.app = app;
 | 
					        this.app = app;
 | 
				
			||||||
@@ -69,7 +68,7 @@ public BackgroundMusic(Application app, String musicFilePath) {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private AudioNode createAudioNode(String musicFilePath) {
 | 
					    private AudioNode createAudioNode(String musicFilePath) {
 | 
				
			||||||
        AudioNode audioNode = new AudioNode(app.getAssetManager(), musicFilePath, DataType.Stream);
 | 
					        AudioNode audioNode = new AudioNode(app.getAssetManager(), musicFilePath, DataType.Stream);
 | 
				
			||||||
        audioNode.setVolume(volume);
 | 
					        audioNode.setVolume(volume * app.getMainVolume().getMainVolume());
 | 
				
			||||||
        audioNode.setPositional(false);
 | 
					        audioNode.setPositional(false);
 | 
				
			||||||
        audioNode.setLooping(true);
 | 
					        audioNode.setLooping(true);
 | 
				
			||||||
        audioNode.setName(musicFilePath);
 | 
					        audioNode.setName(musicFilePath);
 | 
				
			||||||
@@ -135,6 +134,16 @@ public void toogleMusic() {
 | 
				
			|||||||
        prefs.putBoolean(MUSIC_ENABLED_PREF, musicEnabled);
 | 
					        prefs.putBoolean(MUSIC_ENABLED_PREF, musicEnabled);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * this method is used when the main volume changes
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public void setVolume(){
 | 
				
			||||||
 | 
					        float mainVolume = app.getMainVolume().getMainVolume();
 | 
				
			||||||
 | 
					        menuMusic.setVolume(volume * mainVolume);
 | 
				
			||||||
 | 
					        battleMusic.setVolume(volume * mainVolume);
 | 
				
			||||||
 | 
					        gameOverMusicL.setVolume(volume * mainVolume);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Method to set the volume for the music
 | 
					     * Method to set the volume for the music
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@@ -142,9 +151,10 @@ public void toogleMusic() {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public void setVolume(float volume) {
 | 
					    public void setVolume(float volume) {
 | 
				
			||||||
        this.volume = volume;
 | 
					        this.volume = volume;
 | 
				
			||||||
        menuMusic.setVolume(volume);
 | 
					        float mainVolume = app.getMainVolume().getMainVolume();
 | 
				
			||||||
        battleMusic.setVolume(volume);
 | 
					        menuMusic.setVolume(volume * mainVolume);
 | 
				
			||||||
        gameOverMusicL.setVolume(volume);
 | 
					        battleMusic.setVolume(volume * mainVolume);
 | 
				
			||||||
 | 
					        gameOverMusicL.setVolume(volume * mainVolume);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        prefs.putFloat(VOLUME_PREF, volume);
 | 
					        prefs.putFloat(VOLUME_PREF, volume);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -127,6 +127,11 @@ public class BattleshipApp extends SimpleApplication implements BattleshipClient
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private BackgroundMusic backgroundMusic;
 | 
					    private BackgroundMusic backgroundMusic;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * The object that handles the main volume
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private MainVolume mainVolume;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static {
 | 
					    static {
 | 
				
			||||||
        // Configure logging
 | 
					        // Configure logging
 | 
				
			||||||
        LogManager manager = LogManager.getLogManager();
 | 
					        LogManager manager = LogManager.getLogManager();
 | 
				
			||||||
@@ -231,7 +236,8 @@ public void simpleInitApp() {
 | 
				
			|||||||
        setupGui();
 | 
					        setupGui();
 | 
				
			||||||
        serverConnection.connect();
 | 
					        serverConnection.connect();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        backgroundMusic = new BackgroundMusic(this, "Music/MainMenu/Dark_Intro.ogg");
 | 
					        mainVolume = new MainVolume(this);
 | 
				
			||||||
 | 
					        backgroundMusic = new BackgroundMusic(this);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -443,4 +449,13 @@ public BackgroundMusic getBackgroundMusic(){
 | 
				
			|||||||
        logic.addListener(backgroundMusic);
 | 
					        logic.addListener(backgroundMusic);
 | 
				
			||||||
        return backgroundMusic;
 | 
					        return backgroundMusic;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * this method returns the object which handles the main volume
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return an object of MainVolume
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public MainVolume getMainVolume(){
 | 
				
			||||||
 | 
					        return mainVolume;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,11 +30,16 @@ public class GameSound extends AbstractAppState implements GameEventListener {
 | 
				
			|||||||
    static final Logger LOGGER = System.getLogger(GameSound.class.getName());
 | 
					    static final Logger LOGGER = System.getLogger(GameSound.class.getName());
 | 
				
			||||||
    private static final Preferences PREFERENCES = getPreferences(GameSound.class);
 | 
					    private static final Preferences PREFERENCES = getPreferences(GameSound.class);
 | 
				
			||||||
    private static final String ENABLED_PREF = "enabled"; //NON-NLS
 | 
					    private static final String ENABLED_PREF = "enabled"; //NON-NLS
 | 
				
			||||||
 | 
					    private static final String SOUND_VOLUME_PREF = "volume";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private float volume;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private AudioNode splashSound;
 | 
					    private AudioNode splashSound;
 | 
				
			||||||
    private AudioNode shipDestroyedSound;
 | 
					    private AudioNode shipDestroyedSound;
 | 
				
			||||||
    private AudioNode explosionSound;
 | 
					    private AudioNode explosionSound;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private BattleshipApp app;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Checks if sound is enabled in the preferences.
 | 
					     * Checks if sound is enabled in the preferences.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@@ -75,9 +80,11 @@ public void setEnabled(boolean enabled) {
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void initialize(AppStateManager stateManager, Application app) {
 | 
					    public void initialize(AppStateManager stateManager, Application app) {
 | 
				
			||||||
        super.initialize(stateManager, app);
 | 
					        super.initialize(stateManager, app);
 | 
				
			||||||
 | 
					        this.app = (BattleshipApp) app;
 | 
				
			||||||
        shipDestroyedSound = loadSound(app, "Sound/Effects/sunken.wav"); //NON-NLS
 | 
					        shipDestroyedSound = loadSound(app, "Sound/Effects/sunken.wav"); //NON-NLS
 | 
				
			||||||
        splashSound = loadSound(app, "Sound/Effects/splash.wav"); //NON-NLS
 | 
					        splashSound = loadSound(app, "Sound/Effects/splash.wav"); //NON-NLS
 | 
				
			||||||
        explosionSound = loadSound(app, "Sound/Effects/explosion.wav"); //NON-NLS
 | 
					        explosionSound = loadSound(app, "Sound/Effects/explosion.wav"); //NON-NLS
 | 
				
			||||||
 | 
					        volume = PREFERENCES.getFloat(SOUND_VOLUME_PREF, 1.0f);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -124,6 +131,40 @@ public void shipDestroyed() {
 | 
				
			|||||||
            shipDestroyedSound.playInstance();
 | 
					            shipDestroyedSound.playInstance();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * this method sets the sound volume of the sounds
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param volume the volume to be set to
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public void setSoundVolume(float volume) {
 | 
				
			||||||
 | 
					        float mainVolume = app.getMainVolume().getMainVolume();
 | 
				
			||||||
 | 
					        shipDestroyedSound.setVolume(volume);
 | 
				
			||||||
 | 
					        splashSound.setVolume(volume);
 | 
				
			||||||
 | 
					        explosionSound.setVolume(volume);
 | 
				
			||||||
 | 
					        this.volume = volume;
 | 
				
			||||||
 | 
					        PREFERENCES.putFloat(SOUND_VOLUME_PREF, volume);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * this method will be used if the main volume changes
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public void setSoundVolume() {
 | 
				
			||||||
 | 
					        float mainVolume = app.getMainVolume().getMainVolume();
 | 
				
			||||||
 | 
					        shipDestroyedSound.setVolume(volume * mainVolume);
 | 
				
			||||||
 | 
					        splashSound.setVolume(volume * mainVolume);
 | 
				
			||||||
 | 
					        explosionSound.setVolume(volume * mainVolume);
 | 
				
			||||||
 | 
					        PREFERENCES.putFloat(SOUND_VOLUME_PREF, volume);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * this method returns the sound
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public float getVolume(){
 | 
				
			||||||
 | 
					        return volume;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void receivedEvent(SoundEvent event) {
 | 
					    public void receivedEvent(SoundEvent event) {
 | 
				
			||||||
        switch (event.sound()) {
 | 
					        switch (event.sound()) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,34 @@
 | 
				
			|||||||
 | 
					package pp.battleship.client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import pp.battleship.model.Battleship;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.lang.System.Logger;
 | 
				
			||||||
 | 
					import java.lang.System.Logger.Level;
 | 
				
			||||||
 | 
					import java.util.prefs.Preferences;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class MainVolume {
 | 
				
			||||||
 | 
					    private Preferences prefs = Preferences.userNodeForPackage(MainVolume.class);
 | 
				
			||||||
 | 
					    private static final String MAIN_VOLUME_PREFS = "MainVolume";
 | 
				
			||||||
 | 
					    static final Logger LOGGER = System.getLogger(MainVolume.class.getName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private float mainVolume;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private BattleshipApp app;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public MainVolume(BattleshipApp app) {
 | 
				
			||||||
 | 
					        this.mainVolume = prefs.getFloat(MAIN_VOLUME_PREFS, 1.0f);
 | 
				
			||||||
 | 
					        this.app = app;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setMainVolume(float mainVolume) {
 | 
				
			||||||
 | 
					        LOGGER.log(Level.DEBUG, "setMainVolume: mainVolume = {0}", mainVolume);
 | 
				
			||||||
 | 
					        app.getBackgroundMusic().setVolume();
 | 
				
			||||||
 | 
					        app.getStateManager().getState(GameSound.class).setSoundVolume();
 | 
				
			||||||
 | 
					        this.mainVolume = mainVolume;
 | 
				
			||||||
 | 
					        prefs.putFloat(MAIN_VOLUME_PREFS, mainVolume);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public float getMainVolume() {
 | 
				
			||||||
 | 
					        return mainVolume;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -37,7 +37,13 @@ class Menu extends Dialog {
 | 
				
			|||||||
    private final Button loadButton = new Button(lookup("menu.map.load"));
 | 
					    private final Button loadButton = new Button(lookup("menu.map.load"));
 | 
				
			||||||
    private final Button saveButton = new Button(lookup("menu.map.save"));
 | 
					    private final Button saveButton = new Button(lookup("menu.map.save"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static final double SLIDER_DELTA = 0.1;
 | 
				
			||||||
 | 
					    private static final double SLIDER_MIN_VALUE = 0.0;
 | 
				
			||||||
 | 
					    private static final double SLIDER_MAX_VALUE = 2.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final VersionedReference<Double> volumeRef;
 | 
					    private final VersionedReference<Double> volumeRef;
 | 
				
			||||||
 | 
					    private final VersionedReference<Double> soundVolumeRef;
 | 
				
			||||||
 | 
					    private final VersionedReference<Double> mainVolumeRef;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Constructs the Menu dialog for the Battleship application.
 | 
					     * Constructs the Menu dialog for the Battleship application.
 | 
				
			||||||
@@ -48,22 +54,32 @@ public Menu(BattleshipApp app) {
 | 
				
			|||||||
        super(app.getDialogManager());
 | 
					        super(app.getDialogManager());
 | 
				
			||||||
        this.app = app;
 | 
					        this.app = app;
 | 
				
			||||||
        addChild(new Label(lookup("battleship.name"), new ElementId("header"))); //NON-NLS
 | 
					        addChild(new Label(lookup("battleship.name"), new ElementId("header"))); //NON-NLS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        addChild(new Label(lookup("menu.main.volume"), new ElementId("label")));
 | 
				
			||||||
 | 
					        Slider mainVolumeSlider = new Slider();
 | 
				
			||||||
 | 
					        mainVolumeSlider.setModel(new DefaultRangedValueModel(SLIDER_MIN_VALUE, SLIDER_MAX_VALUE, app.getMainVolume().getMainVolume()));
 | 
				
			||||||
 | 
					        mainVolumeSlider.setDelta(SLIDER_DELTA);
 | 
				
			||||||
 | 
					        addChild(mainVolumeSlider);
 | 
				
			||||||
 | 
					        mainVolumeRef = mainVolumeSlider.getModel().createReference();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        addChild(new Label(lookup("menu.sound.volume"), new ElementId("label")));
 | 
				
			||||||
        addChild(new Checkbox(lookup("menu.sound-enabled"),
 | 
					        addChild(new Checkbox(lookup("menu.sound-enabled"),
 | 
				
			||||||
                              new StateCheckboxModel(app, GameSound.class)));
 | 
					                              new StateCheckboxModel(app, GameSound.class)));
 | 
				
			||||||
 | 
					        Slider soundSlider = new Slider();
 | 
				
			||||||
 | 
					        soundSlider.setModel(new DefaultRangedValueModel(SLIDER_MIN_VALUE, SLIDER_MAX_VALUE, app.getStateManager().getState(GameSound.class).getVolume()));
 | 
				
			||||||
 | 
					        soundSlider.setDelta(SLIDER_DELTA);
 | 
				
			||||||
 | 
					        addChild(soundSlider);
 | 
				
			||||||
 | 
					        soundVolumeRef = soundSlider.getModel().createReference();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        addChild(new Label(lookup("menu.volume"), new ElementId("label")));
 | 
				
			||||||
        Checkbox musicToggle = new Checkbox(lookup("menu.music.toggle"));
 | 
					        Checkbox musicToggle = new Checkbox(lookup("menu.music.toggle"));
 | 
				
			||||||
        musicToggle.setChecked(app.getBackgroundMusic().isMusicEnabled());
 | 
					        musicToggle.setChecked(app.getBackgroundMusic().isMusicEnabled());
 | 
				
			||||||
        musicToggle.addClickCommands(s -> toggleMusic());
 | 
					        musicToggle.addClickCommands(s -> toggleMusic());
 | 
				
			||||||
 | 
					 | 
				
			||||||
        addChild(musicToggle);
 | 
					        addChild(musicToggle);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        addChild(new Label(lookup("menu.volume")));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Slider volumeSlider = new Slider();
 | 
					        Slider volumeSlider = new Slider();
 | 
				
			||||||
        volumeSlider.setModel(new DefaultRangedValueModel(0.0 , 2.0, app.getBackgroundMusic().getVolume()));
 | 
					        volumeSlider.setModel(new DefaultRangedValueModel(SLIDER_MIN_VALUE, SLIDER_MAX_VALUE, app.getBackgroundMusic().getVolume()));
 | 
				
			||||||
        volumeSlider.setDelta(0.1);
 | 
					        volumeSlider.setDelta(SLIDER_DELTA);
 | 
				
			||||||
        addChild(volumeSlider);
 | 
					        addChild(volumeSlider);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        volumeRef = volumeSlider.getModel().createReference();
 | 
					        volumeRef = volumeSlider.getModel().createReference();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        addChild(loadButton)
 | 
					        addChild(loadButton)
 | 
				
			||||||
@@ -85,8 +101,24 @@ public Menu(BattleshipApp app) {
 | 
				
			|||||||
    public void update(float tpf){
 | 
					    public void update(float tpf){
 | 
				
			||||||
        if(volumeRef.update()){
 | 
					        if(volumeRef.update()){
 | 
				
			||||||
            double newVolume = volumeRef.get();
 | 
					            double newVolume = volumeRef.get();
 | 
				
			||||||
            adjustVolume(newVolume);
 | 
					            adjustMusicVolume(newVolume);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        else if (soundVolumeRef.update()) {
 | 
				
			||||||
 | 
					            double newSoundVolume = soundVolumeRef.get();
 | 
				
			||||||
 | 
					            adjustSoundVolume(newSoundVolume);
 | 
				
			||||||
 | 
					        } else if (mainVolumeRef.update()) {
 | 
				
			||||||
 | 
					            double newMainVolume = mainVolumeRef.get();
 | 
				
			||||||
 | 
					            adjustMainVolume(newMainVolume);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * this method adjusts the main volume
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param newVolume the volume to be set as main volume
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void adjustMainVolume(double newVolume) {
 | 
				
			||||||
 | 
					        app.getMainVolume().setMainVolume((float) newVolume);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -94,10 +126,19 @@ public void update(float tpf){
 | 
				
			|||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param volume is the double value of the volume
 | 
					     * @param volume is the double value of the volume
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private void adjustVolume(double volume) {
 | 
					    private void adjustMusicVolume(double volume) {
 | 
				
			||||||
        app.getBackgroundMusic().setVolume((float) volume);
 | 
					        app.getBackgroundMusic().setVolume((float) volume);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * this method adjusts the volume for the sound
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param volume is a double value of the sound volume
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void adjustSoundVolume(double volume) {
 | 
				
			||||||
 | 
					        app.getStateManager().getState(GameSound.class).setSoundVolume((float) volume);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * this method toggles the background music on and off
 | 
					     * this method toggles the background music on and off
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,12 +29,14 @@ port.number=Port
 | 
				
			|||||||
wait.its.not.your.turn=Wait, it's not your turn!!
 | 
					wait.its.not.your.turn=Wait, it's not your turn!!
 | 
				
			||||||
menu.quit=Quit game
 | 
					menu.quit=Quit game
 | 
				
			||||||
menu.return-to-game=Return to game
 | 
					menu.return-to-game=Return to game
 | 
				
			||||||
menu.sound-enabled=Sound switched on
 | 
					menu.sound-enabled=Toggle the sound
 | 
				
			||||||
 | 
					menu.main.volume= Main volume
 | 
				
			||||||
menu.map.load=Load map from file...
 | 
					menu.map.load=Load map from file...
 | 
				
			||||||
menu.map.save=Save map in file...
 | 
					menu.map.save=Save map in file...
 | 
				
			||||||
menu.music.toggle=Toggle the music
 | 
					menu.music.toggle=Toggle the music
 | 
				
			||||||
invalid.map=Your submitted map was invalid
 | 
					invalid.map=Your submitted map was invalid
 | 
				
			||||||
menu.volume=Volume
 | 
					menu.volume=Music volume
 | 
				
			||||||
 | 
					menu.sound.volume=Sound volume
 | 
				
			||||||
label.file=File:
 | 
					label.file=File:
 | 
				
			||||||
label.connecting=Connecting...
 | 
					label.connecting=Connecting...
 | 
				
			||||||
dialog.error=Error
 | 
					dialog.error=Error
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,12 +29,14 @@ port.number=Port
 | 
				
			|||||||
wait.its.not.your.turn=Warte, Du bist nicht dran!!
 | 
					wait.its.not.your.turn=Warte, Du bist nicht dran!!
 | 
				
			||||||
menu.quit=Spiel beenden
 | 
					menu.quit=Spiel beenden
 | 
				
			||||||
menu.return-to-game=Zurück zum Spiel
 | 
					menu.return-to-game=Zurück zum Spiel
 | 
				
			||||||
menu.sound-enabled=Sound eingeschaltet
 | 
					menu.sound-enabled=An/Ausschalten des Sounds
 | 
				
			||||||
 | 
					menu.main.volume=Gesammt Lautst<73>rke
 | 
				
			||||||
menu.map.load=Karte von Datei laden...
 | 
					menu.map.load=Karte von Datei laden...
 | 
				
			||||||
menu.map.save=Karte in Datei speichern...
 | 
					menu.map.save=Karte in Datei speichern...
 | 
				
			||||||
menu.music.toggle=An/Ausschalten der Musik
 | 
					menu.music.toggle=An/Ausschalten der Musik
 | 
				
			||||||
invalid.map=Die angegebene Karte war ung<6E>ltig
 | 
					invalid.map=Die angegebene Karte war ung<6E>ltig
 | 
				
			||||||
menu.volume=Lautst<EFBFBD>rke
 | 
					menu.volume=Lautst<EFBFBD>rke der Musik
 | 
				
			||||||
 | 
					menu.sound.volume=Lautst<EFBFBD>rke des Sounds
 | 
				
			||||||
label.file=Datei:
 | 
					label.file=Datei:
 | 
				
			||||||
label.connecting=Verbindung wird aufgebaut...
 | 
					label.connecting=Verbindung wird aufgebaut...
 | 
				
			||||||
dialog.error=Fehler
 | 
					dialog.error=Fehler
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,6 +36,7 @@
 | 
				
			|||||||
selector("label", "pp") {
 | 
					selector("label", "pp") {
 | 
				
			||||||
    insets = new Insets3f(2, 2, 2, 2)
 | 
					    insets = new Insets3f(2, 2, 2, 2)
 | 
				
			||||||
    color = buttonEnabledColor
 | 
					    color = buttonEnabledColor
 | 
				
			||||||
 | 
					    textHAlignment = HAlignment.Center
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
selector("header", "pp") {
 | 
					selector("header", "pp") {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user