added TODOÃ's for presentation

This commit is contained in:
Cedric Beck
2024-10-12 17:45:30 +02:00
parent bb1e3858bb
commit 67b99317d2
10 changed files with 13 additions and 3 deletions

View File

@@ -20,6 +20,7 @@
* EffectHandler manages the creation and manipulation of particle effects in the Battleship application.
*/
public class EffectHandler {
//TODO: Ex. 12 EffectHandler
private final BattleshipApp app;
private final Map<Battleship, List<ParticleEmitter>> effects;

View File

@@ -14,6 +14,7 @@
* An application state that plays sounds.
*/
public class GameMusic extends AbstractAppState {
//TODO: Ex. 10 GameMusic
private static final Preferences PREFERENCES = getPreferences(GameMusic.class);
private static final String ENABLED_PREF = "enabled";
private static final String VOLUME_PREF = "volume";

View File

@@ -48,7 +48,7 @@ public Menu(BattleshipApp app) {
addChild(new Label(lookup("battleship.name"), new ElementId("header"))); //NON-NLS
addChild(new Checkbox(lookup("menu.sound-enabled"),
new StateCheckboxModel(app, GameSound.class)));
//TODO: Ex. 10 VolumeSlider
addChild(new Checkbox(lookup("menu.music-enabled"), new StateCheckboxModel(app, GameMusic.class)));
addChild(volumeSlider);

View File

@@ -61,6 +61,7 @@ class NetworkDialog extends SimpleDialog {
input.addChild(host, 1);
input.addChild(new Label(lookup("port.number") + ": "));
input.addChild(port, 1);
//TODO: Ex. 11 ClientHost Checkbox
clientHostCheckbox = new Checkbox("Host Server");
input.addChild(clientHostCheckbox);
DialogBuilder.simple(app.getDialogManager())

View File

@@ -126,6 +126,7 @@ public Spatial visit(Battleship ship) {
*/
@Override
public Spatial visit(Shell shell) {
//TODO: Ex. 13 2D Shell
final ColorRGBA color = ColorRGBA.Black;
Geometry ellipse = new Geometry("ellipse", new Sphere(50, 50, MapView.FIELD_SIZE / 2 * 0.8f));
Material mat = new Material(view.getApp().getAssetManager(), UNSHADED); //NON-NLS

View File

@@ -92,7 +92,7 @@ private Spatial handleMiss(Shot shot) {
private Spatial handleHit(Shot shot) {
final Battleship ship = requireNonNull(map.findShipAt(shot), "Missing ship");
final Node shipNode = requireNonNull((Node) getSpatial(ship), "Missing ship node");
//TODO: Ex. 12 Hit
shipNode.getControl(ShipControl.class).hit(shot);
if (ship.isDestroyed()) {
shipNode.getControl(ShipControl.class).destroyed();
@@ -149,6 +149,7 @@ public Spatial visit(Battleship ship) {
final float x = 0.5f * (ship.getMinY() + ship.getMaxY() + 1f);
final float z = 0.5f * (ship.getMinX() + ship.getMaxX() + 1f);
node.setLocalTranslation(x, 0f, z);
//TODO: Ex. 12 ShipControl
node.addControl(new ShipControl(ship, node, app.getEffectHandler()));
return node;
}
@@ -162,6 +163,7 @@ public Spatial visit(Battleship ship) {
*/
@Override
public Spatial visit(Shell shell) {
//TODO: Ex. 13 3D Shell
final Spatial model = app.getAssetManager().loadModel("Models/Shell/shell.j3o");
model.setLocalScale(.05f);
model.setShadowMode(ShadowMode.CastAndReceive);

View File

@@ -57,9 +57,10 @@ public void receivedEffect(EffectMessage msg) {
myTurn = msg.isMyTurn();
logic.setInfoText(msg.getInfoTextKey());
//TODO: Ex. 13 add shell -> ItemAddedEvent
Shell shell = new Shell(msg.getShot());
affectedMap(msg).add(shell);
//TODO: Ex. 13 Shell sound -> GameSound
logic.playSound(Sound.SHELL_FLYING);
logic.setState(new ShootingState(logic, shell, myTurn, msg));
}

View File

@@ -26,6 +26,7 @@ public class ShootingState extends ClientState {
* @param msg the effect message associated with the shooting action
*/
public ShootingState(ClientGameLogic logic, Shell shell, boolean myTurn, EffectMessage msg) {
//TODO: Ex. 13 ShootingState
super(logic);
this.msg = msg;
this.myTurn = myTurn;

View File

@@ -221,6 +221,7 @@ private boolean checkMap(List<Battleship> ships) {
*/
@Override
public void received(ShootMessage msg, int from) {
//TODO: Ex. 13 Server State
if (state != ServerState.BATTLE)
LOGGER.log(Level.ERROR, "shoot not allowed in {0}", state); //NON-NLS
else{

View File

@@ -9,6 +9,7 @@
* a Bezier curve.
*/
public class Shell implements Item {
//TODO: Ex. 13 Shell
/**
* Initial position of the shell
*/