mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 23:59:44 +01:00
fixed bugs, game now compiles
This commit is contained in:
parent
17533112a1
commit
86b8297c9d
@ -31,10 +31,6 @@ public class GameSound extends AbstractAppState implements GameEventListener {
|
|||||||
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 AudioNode splashSound;
|
|
||||||
private AudioNode shipDestroyedSound;
|
|
||||||
private AudioNode explosionSound;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if sound is enabled in the preferences.
|
* Checks if sound is enabled in the preferences.
|
||||||
*
|
*
|
||||||
@ -75,9 +71,6 @@ public class GameSound extends AbstractAppState implements GameEventListener {
|
|||||||
@Override
|
@Override
|
||||||
public void initialize(AppStateManager stateManager, Application app) {
|
public void initialize(AppStateManager stateManager, Application app) {
|
||||||
super.initialize(stateManager, app);
|
super.initialize(stateManager, app);
|
||||||
shipDestroyedSound = loadSound(app, "Sound/Effects/sunken.wav"); //NON-NLS
|
|
||||||
splashSound = loadSound(app, "Sound/Effects/splash.wav"); //NON-NLS
|
|
||||||
explosionSound = loadSound(app, "Sound/Effects/explosion.wav"); //NON-NLS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,36 +93,10 @@ public class GameSound extends AbstractAppState implements GameEventListener {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Plays the splash sound effect.
|
|
||||||
*/
|
|
||||||
public void splash() {
|
|
||||||
if (isEnabled() && splashSound != null)
|
|
||||||
splashSound.playInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Plays the explosion sound effect.
|
|
||||||
*/
|
|
||||||
public void explosion() {
|
|
||||||
if (isEnabled() && explosionSound != null)
|
|
||||||
explosionSound.playInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Plays sound effect when a ship has been destroyed.
|
|
||||||
*/
|
|
||||||
public void shipDestroyed() {
|
|
||||||
if (isEnabled() && shipDestroyedSound != null)
|
|
||||||
shipDestroyedSound.playInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receivedEvent(SoundEvent event) {
|
public void receivedEvent(SoundEvent event) {
|
||||||
switch (event.sound()) {
|
switch (event.sound()) {
|
||||||
case EXPLOSION -> explosion();
|
|
||||||
case SPLASH -> splash();
|
|
||||||
case DESTROYED_SHIP -> shipDestroyed();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
|||||||
*/
|
*/
|
||||||
private AppSettings makeSettings() {
|
private AppSettings makeSettings() {
|
||||||
final AppSettings settings = new AppSettings(true);
|
final AppSettings settings = new AppSettings(true);
|
||||||
settings.setTitle(lookup("Monopoly.name"));
|
settings.setTitle(lookup("monopoly.name"));
|
||||||
settings.setResolution(config.getResolutionWidth(), config.getResolutionHeight());
|
settings.setResolution(config.getResolutionWidth(), config.getResolutionHeight());
|
||||||
settings.setFullscreen(config.fullScreen());
|
settings.setFullscreen(config.fullScreen());
|
||||||
settings.setUseRetinaFrameBuffer(config.useRetinaFrameBuffer());
|
settings.setUseRetinaFrameBuffer(config.useRetinaFrameBuffer());
|
||||||
|
@ -7,7 +7,6 @@ import com.simsilica.lemur.Label;
|
|||||||
import com.simsilica.lemur.style.ElementId;
|
import com.simsilica.lemur.style.ElementId;
|
||||||
import pp.dialog.Dialog;
|
import pp.dialog.Dialog;
|
||||||
import pp.monopoly.client.MonopolyApp;
|
import pp.monopoly.client.MonopolyApp;
|
||||||
import pp.monopoly.client.StartMenu;
|
|
||||||
|
|
||||||
public class GameMenu extends Dialog {
|
public class GameMenu extends Dialog {
|
||||||
private final MonopolyApp app;
|
private final MonopolyApp app;
|
||||||
@ -17,7 +16,7 @@ public class GameMenu extends Dialog {
|
|||||||
*
|
*
|
||||||
* @param app the MonopolyApp instance
|
* @param app the MonopolyApp instance
|
||||||
*/
|
*/
|
||||||
public SettingsMenu(MonopolyApp app) {
|
public GameMenu(MonopolyApp app) {
|
||||||
super(app.getDialogManager());
|
super(app.getDialogManager());
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
@ -41,10 +40,6 @@ public class GameMenu extends Dialog {
|
|||||||
// You can add more settings components here, like checkboxes or sliders.
|
// You can add more settings components here, like checkboxes or sliders.
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameMenu(MonopolyApp app) {
|
|
||||||
super(app.getDialogManager());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns to the StartMenu when the back button is clicked.
|
* Returns to the StartMenu when the back button is clicked.
|
||||||
*/
|
*/
|
||||||
|
@ -39,7 +39,9 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
|||||||
private Board ownMap;
|
private Board ownMap;
|
||||||
private Board harbor;
|
private Board harbor;
|
||||||
private Board opponentMap;
|
private Board opponentMap;
|
||||||
private ClientState state = null;
|
private ClientState state = new ClientState(this) {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a ClientGameLogic with the specified sender object.
|
* Constructs a ClientGameLogic with the specified sender object.
|
||||||
|
@ -5,7 +5,38 @@
|
|||||||
## (c) Mark Minas (mark.minas@unibw.de)
|
## (c) Mark Minas (mark.minas@unibw.de)
|
||||||
########################################
|
########################################
|
||||||
#
|
#
|
||||||
battleship.name=Battleship
|
monopoly.name=Monopoly
|
||||||
button.ready=Ready
|
|
||||||
button.play=Start Game
|
button.play=Start Game
|
||||||
|
button.ready=Ready
|
||||||
|
button.rotate=Rotate
|
||||||
|
server.connection.failed=Failed to establish a server connection.
|
||||||
|
its.your.turn=It's your turn! Click on the opponent's field to shoot...
|
||||||
|
lost.connection.to.server=Lost connection to server. The game terminated.
|
||||||
|
place.ships.in.your.map=Place ships in your map.
|
||||||
|
wait.for.an.opponent=Wait for an opponent!
|
||||||
|
wait.for.opponent=Wait for your opponent!
|
||||||
|
confirm.leaving=Would you really like to leave the game?
|
||||||
|
you.lost.the.game=You lost the game!
|
||||||
|
you.won.the.game=You won the game!
|
||||||
|
button.yes=Yes
|
||||||
|
button.no=No
|
||||||
|
button.ok=Ok
|
||||||
|
button.connect=Connect
|
||||||
|
button.cancel=Cancel
|
||||||
|
server.dialog=Server
|
||||||
|
host.name=Host
|
||||||
|
port.number=Port
|
||||||
|
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.sound-enabled=Sound switched on
|
||||||
|
menu.background-sound-enabled=Background music switched on
|
||||||
|
menu.map.load=Load map from file...
|
||||||
|
menu.map.save=Save map in file...
|
||||||
|
label.file=File:
|
||||||
|
label.connecting=Connecting...
|
||||||
|
dialog.error=Error
|
||||||
|
dialog.question=Question
|
||||||
|
port.must.be.integer=Port must be an integer number
|
||||||
|
map.doesnt.fit=The map doesn't fit to this game
|
||||||
|
client.server-start=Start server
|
||||||
|
@ -6,4 +6,37 @@
|
|||||||
########################################
|
########################################
|
||||||
#
|
#
|
||||||
monopoly.name=Monopoly
|
monopoly.name=Monopoly
|
||||||
button.ready=Bereit
|
button.play=Start Game
|
||||||
|
button.ready=Ready
|
||||||
|
button.rotate=Rotate
|
||||||
|
server.connection.failed=Failed to establish a server connection.
|
||||||
|
its.your.turn=It's your turn! Click on the opponent's field to shoot...
|
||||||
|
lost.connection.to.server=Lost connection to server. The game terminated.
|
||||||
|
place.ships.in.your.map=Place ships in your map.
|
||||||
|
wait.for.an.opponent=Wait for an opponent!
|
||||||
|
wait.for.opponent=Wait for your opponent!
|
||||||
|
confirm.leaving=Would you really like to leave the game?
|
||||||
|
you.lost.the.game=You lost the game!
|
||||||
|
you.won.the.game=You won the game!
|
||||||
|
button.yes=Yes
|
||||||
|
button.no=No
|
||||||
|
button.ok=Ok
|
||||||
|
button.connect=Connect
|
||||||
|
button.cancel=Cancel
|
||||||
|
server.dialog=Server
|
||||||
|
host.name=Host
|
||||||
|
port.number=Port
|
||||||
|
wait.its.not.your.turn=Wait, it's not your turn!!
|
||||||
|
menu.quit=Quit game
|
||||||
|
menu.return-to-game=Return to game
|
||||||
|
menu.sound-enabled=Sound switched on
|
||||||
|
menu.background-sound-enabled=Background music switched on
|
||||||
|
menu.map.load=Load map from file...
|
||||||
|
menu.map.save=Save map in file...
|
||||||
|
label.file=File:
|
||||||
|
label.connecting=Connecting...
|
||||||
|
dialog.error=Error
|
||||||
|
dialog.question=Question
|
||||||
|
port.must.be.integer=Port must be an integer number
|
||||||
|
map.doesnt.fit=The map doesn't fit to this game
|
||||||
|
client.server-start=Start server
|
||||||
|
Loading…
Reference in New Issue
Block a user