mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-08-06 11:45:51 +02:00
fixed sizes of the boats
This commit is contained in:
@@ -25,6 +25,7 @@ import pp.battleship.client.gui.EditorAppState;
|
||||
import pp.battleship.client.gui.SeaAppState;
|
||||
import pp.battleship.game.client.BattleshipClient;
|
||||
import pp.battleship.game.client.ClientGameLogic;
|
||||
import pp.battleship.game.client.GameMusic;
|
||||
import pp.battleship.game.client.ServerConnection;
|
||||
import pp.battleship.game.singlemode.BattleshipClientConfig;
|
||||
import pp.battleship.game.singlemode.ServerConnectionMockup;
|
||||
@@ -265,13 +266,21 @@ public class BattleshipApp extends SimpleApplication implements BattleshipClient
|
||||
flyCam.setEnabled(false);
|
||||
stateManager.detach(stateManager.getState(StatsAppState.class));
|
||||
stateManager.detach(stateManager.getState(DebugKeysAppState.class));
|
||||
atttachGameMusic();
|
||||
|
||||
attachGameSound();
|
||||
stateManager.attachAll(new EditorAppState(), new BattleAppState(), new SeaAppState());
|
||||
}
|
||||
|
||||
private void attachGameMusic() {
|
||||
final GameMusic gameMusic = new GameMusic();
|
||||
gameMusic.setEnabled(GameMusic.enabledInPreferences());
|
||||
stateManager.attach(gameMusic);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches the game sound state and sets its initial enabled state.
|
||||
*
|
||||
*/
|
||||
private void attachGameSound() {
|
||||
final GameSound gameSound = new GameSound();
|
||||
|
@@ -11,6 +11,7 @@ import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Checkbox;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.style.ElementId;
|
||||
import pp.battleship.game.client.GameMusic;
|
||||
import pp.dialog.Dialog;
|
||||
import pp.dialog.StateCheckboxModel;
|
||||
import pp.dialog.TextInputDialog;
|
||||
@@ -30,6 +31,8 @@ import static pp.util.PreferencesUtils.getPreferences;
|
||||
class Menu extends Dialog {
|
||||
private static final Preferences PREFERENCES = getPreferences(Menu.class);
|
||||
private static final String LAST_PATH = "last.file.path";
|
||||
|
||||
private final VolumeSlider slider;
|
||||
private final BattleshipApp app;
|
||||
private final Button loadButton = new Button(lookup("menu.map.load"));
|
||||
private final Button saveButton = new Button(lookup("menu.map.save"));
|
||||
@@ -45,6 +48,7 @@ class Menu extends Dialog {
|
||||
addChild(new Label(lookup("battleship.name"), new ElementId("header"))); //NON-NLS
|
||||
addChild(new Checkbox(lookup("menu.sound-enabled"),
|
||||
new StateCheckboxModel(app, GameSound.class)));
|
||||
slider = new VolumeSlider(app.getStateManager().getState(GameMusic.class));
|
||||
addChild(loadButton)
|
||||
.addClickCommands(s -> ifTopDialog(this::loadDialog));
|
||||
addChild(saveButton)
|
||||
@@ -54,6 +58,12 @@ class Menu extends Dialog {
|
||||
addChild(new Button(lookup("menu.quit")))
|
||||
.addClickCommands(s -> ifTopDialog(app::closeApp));
|
||||
update();
|
||||
addChild(new Checkbox(lookup("menu.sound-enabled"), new StateCheckboxModel(app, GameSound.class)));
|
||||
|
||||
addChild(new Checkbox(lookup("menu.background-sound-enabled"), new StateCheckboxModel(app, GameMusic.class)));
|
||||
|
||||
addChild(slider);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,6 +74,10 @@ class Menu extends Dialog {
|
||||
loadButton.setEnabled(app.getGameLogic().mayLoadMap());
|
||||
saveButton.setEnabled(app.getGameLogic().maySaveMap());
|
||||
}
|
||||
@Override
|
||||
public void update(float delta){
|
||||
slider.update();
|
||||
}
|
||||
|
||||
/**
|
||||
* As an escape action, this method closes the menu if it is the top dialog.
|
||||
|
Reference in New Issue
Block a user