Skip to content

Commit

Permalink
Merge pull request #676 from UQcsse3200/team4-670
Browse files Browse the repository at this point in the history
Pressing Enter to advance when handling tutorialskeys and cleanups
  • Loading branch information
shravya132 authored Oct 17, 2024
2 parents d2538ac + b20a8a6 commit c3a18d3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ public void addActors() {
updateDocketSizes();

table.setZIndex((int)getZIndex());
printOrderList();
}

private void printOrderList() {
logger.info("Current List of Orders:");
for (int i = 0; i < stringArrayList.size(); i++) {
logger.info("Order {}: {}", i + 1, stringArrayList.get(i));
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,21 +270,21 @@ public void update() {

private void handleMovementKeys() {
if (Gdx.input.isKeyJustPressed(Input.Keys.W) || Gdx.input.isKeyJustPressed(Input.Keys.A) ||
Gdx.input.isKeyJustPressed(Input.Keys.S) || Gdx.input.isKeyJustPressed(Input.Keys.D)) {
Gdx.input.isKeyJustPressed(Input.Keys.S) || Gdx.input.isKeyJustPressed(Input.Keys.D) || Gdx.input.isKeyJustPressed(Input.Keys.ENTER)) {
advanceTutorialStep();
}
}

private void handleInteractionKey() {
if (Gdx.input.isKeyJustPressed(Input.Keys.E)) {
if (Gdx.input.isKeyJustPressed(Input.Keys.E) || Gdx.input.isKeyJustPressed(Input.Keys.ENTER)) {
advanceTutorialStep();
}
}

private void handleDocketSwitch() {
textDisplay.setText("Now use [ and ] keys to switch dockets.");

if (Gdx.input.isKeyJustPressed(Input.Keys.LEFT_BRACKET) || Gdx.input.isKeyJustPressed(Input.Keys.RIGHT_BRACKET)) {
if (Gdx.input.isKeyJustPressed(Input.Keys.LEFT_BRACKET) || Gdx.input.isKeyJustPressed(Input.Keys.RIGHT_BRACKET) || Gdx.input.isKeyJustPressed(Input.Keys.ENTER)) {
docketsShifted = true;
logger.debug("Dockets shifted");
}
Expand All @@ -295,25 +295,25 @@ private void handleDocketSwitch() {
}

private void handleReloadKey() {
if (Gdx.input.isKeyJustPressed(Input.Keys.R)) {
if (Gdx.input.isKeyJustPressed(Input.Keys.R) || Gdx.input.isKeyJustPressed(Input.Keys.ENTER)) {
advanceTutorialStep();
}
}

private void handleWeaponChangeKey() {
if (Gdx.input.isKeyJustPressed(Input.Keys.Q)) {
if (Gdx.input.isKeyJustPressed(Input.Keys.Q) || Gdx.input.isKeyJustPressed(Input.Keys.ENTER)) {
advanceTutorialStep();
}
}

private void handleSpecialActionKey() {
if (Gdx.input.isKeyJustPressed(Input.Keys.K)) {
if (Gdx.input.isKeyJustPressed(Input.Keys.K) || Gdx.input.isKeyJustPressed(Input.Keys.ENTER)) {
advanceTutorialStep();
}
}

private void handleSecondaryActionKey() {
if (Gdx.input.isKeyJustPressed(Input.Keys.J)) {
if (Gdx.input.isKeyJustPressed(Input.Keys.J) || Gdx.input.isKeyJustPressed(Input.Keys.ENTER)) {
advanceTutorialStep();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,50 +106,17 @@ public class TutorialScreen extends MainGameScreen {

private static final Vector2 CAMERA_POSITION = new Vector2(7f, 4.5f);

//private final GdxGame game;
// private final Renderer renderer;
// private final PhysicsEngine physicsEngine;
// private boolean isPaused = false;
// private ResourceService resourceService;

public TutorialScreen(GdxGame game) {
super(game);
// this.game = game;

// if (this.game == null) {
// logger.error("TutGame null");
// } else {
// logger.info("TutGame object initialized successfully: " + this.game);
// }

MainGameOrderTicketDisplay.resetOrderNumb();

logger.debug("Initialising main game screen services");
ServiceLocator.registerTimeSource(new GameTime());

// PhysicsService physicsService = new PhysicsService();
// ServiceLocator.registerPhysicsService(physicsService);
// physicsEngine = physicsService.getPhysics();
//
//ServiceLocator.registerInputService(new InputService());
//ServiceLocator.registerResourceService(new ResourceService());
//ServiceLocator.registerPlayerService(new PlayerService());
//
// ServiceLocator.registerEntityService(new EntityService());
// ServiceLocator.registerRenderService(new RenderService());
// ServiceLocator.registerDocketService(new DocketService());
//
// ServiceLocator.registerDayNightService(new DayNightService());
// ServiceLocator.registerRandomComboService(new RandomComboService());
// ServiceLocator.registerLevelService(new LevelService());
// ServiceLocator.registerMapLayout(new MapLayout());

logger.warn("Is SaveService null? " + (ServiceLocator.getSaveLoadService() == null));
//ServiceLocator.registerSaveLoadService(new SaveLoadService());
ServiceLocator.registerGameScreen(this);

//ServiceLocator.registerTicketDetails(new TicketDetails());

renderer = RenderFactory.createRenderer();
renderer.getCamera().getEntity().setPosition(CAMERA_POSITION);
renderer.getDebug().renderPhysicsWorld(physicsEngine.getWorld());
Expand Down Expand Up @@ -241,25 +208,16 @@ void createUI() {
ui.addComponent(new GameBackgroundDisplay())
.addComponent(new InputDecorator(stage, 10))
.addComponent(docketLineDisplay = new DocketLineDisplay())
.addComponent(new DocketLineDisplay())
.addComponent(new PerformanceDisplay())
.addComponent(new MainGameActions(game, UIFactory.createDocketUI()))
.addComponent(new KeybindsButtonDisplay())
.addComponent(new MainGameExitDisplay())
//.addComponent(new MainGameExitDisplay())
.addComponent(new Terminal())
.addComponent(inputComponent)
.addComponent(new TerminalDisplay())
.addComponent(new OrderActions())
//.addComponent(inputComponent)
// .addComponent(new TerminalDisplay())
//.addComponent(new OrderActions())
// .addComponent(new PauseMenuActions(this.game))
.addComponent(new OrderActions())
.addComponent(new RageUpgrade())
// .addComponent(new LoanUpgrade())
// .addComponent(new SpeedBootsUpgrade())
// .addComponent(new ExtortionUpgrade())
// .addComponent(new DancePartyUpgrade())
.addComponent(new TutorialScreenDisplay(game))
.addComponent(new TextDisplay(this));

Expand Down

0 comments on commit c3a18d3

Please sign in to comment.