From 2fb70da6530102cfd3b720e9bcf51512440d95e2 Mon Sep 17 00:00:00 2001 From: Ahmad Abu-Aysha <111224176+The-AhmadAA@users.noreply.github.com> Date: Mon, 16 Oct 2023 22:28:59 +1000 Subject: [PATCH] more tidying --- .../game/input/BuildInputComponent.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/input/BuildInputComponent.java b/source/core/src/main/com/csse3200/game/input/BuildInputComponent.java index cd59f8f87..d19eaa60c 100644 --- a/source/core/src/main/com/csse3200/game/input/BuildInputComponent.java +++ b/source/core/src/main/com/csse3200/game/input/BuildInputComponent.java @@ -13,8 +13,6 @@ import com.csse3200.game.screens.TowerType; import com.csse3200.game.services.CurrencyService; import com.csse3200.game.services.ServiceLocator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** @@ -22,7 +20,6 @@ * DropInputComponent */ public class BuildInputComponent extends InputComponent { - private static final Logger logger = LoggerFactory.getLogger(BuildInputComponent.class); private final EntityService entityService; private final Camera camera; private final String[] sounds = { @@ -108,30 +105,35 @@ public boolean touchDown(int screenX, int screenY, int pointer, int button) { @Override public boolean keyUp(int keycode) { switch (keycode) { - case Input.Keys.NUM_1: + case Input.Keys.NUM_1 -> { ServiceLocator.getCurrencyService().setTowerType(towers.get(0)); return true; - case Input.Keys.NUM_2: + } + case Input.Keys.NUM_2 -> { ServiceLocator.getCurrencyService().setTowerType(towers.get(1)); return true; - case Input.Keys.NUM_3: + } + case Input.Keys.NUM_3 -> { ServiceLocator.getCurrencyService().setTowerType(towers.get(2)); return true; - case Input.Keys.NUM_4: + } + case Input.Keys.NUM_4 -> { ServiceLocator.getCurrencyService().setTowerType(towers.get(3)); return true; - case Input.Keys.NUM_5: + } + case Input.Keys.NUM_5 -> { ServiceLocator.getCurrencyService().setTowerType(towers.get(4)); return true; - case Input.Keys.CONTROL_LEFT: + } + case Input.Keys.CONTROL_LEFT -> { // After multiple placement, deselect tower and prevent further builds ServiceLocator.getCurrencyService().setTowerType(null); multipleTowerBuild = false; return true; - case Input.Keys.ESCAPE: - - default: + } + default -> { return false; + } } }