@Override protected void processTouch(TouchEvent touch) { super.processTouch(touch); if (getMessage() != null) { return; } if (touch.type == TouchEvent.TOUCH_DOWN && touch.pointer == 0) { startX = touch.x; startY = lastY = touch.y; } if (touch.type == TouchEvent.TOUCH_DRAGGED && touch.pointer == 0) { if (touch.x > (1920 - NavigationBar.SIZE)) { return; } yPosition += lastY - touch.y; if (yPosition < 0) { yPosition = 0; } if (yPosition > maxY) { yPosition = maxY; } lastY = touch.y; } if (touch.type == TouchEvent.TOUCH_UP && touch.pointer == 0) { if (Math.abs(startX - touch.x) < 20 && Math.abs(startY - touch.y) < 20) { if (done.isTouched(touch.x, touch.y)) { assignState((Alite) game); ((Alite) game).getNavigationBar().setActive(true); ((Alite) game).getNavigationBar().setActiveIndex(2); newScreen = new StatusScreen(game); SoundManager.play(Assets.click); } else { for (int i = 0; i < 256; i++) { Button b = values[i]; b.setSelected(false); if (b.isTouched(touch.x, touch.y)) { b.setSelected(true); if ((i % 16) < 8) { newScreen = new HexNumberPadScreen(this, game, 975, 180, i); } else { newScreen = new HexNumberPadScreen(this, game, 60, 180, i); } SoundManager.play(Assets.click); } } } } } if (touch.type == TouchEvent.TOUCH_SWEEP) { deltaY = touch.y2; } }
public HackerScreen(Game game) { super(game); offset = game.getGraphics().getTextWidth("MM", Assets.titleFont) - 8; ((Alite) game).getNavigationBar().setActive(false); initializeState((Alite) game); done = new Button(1720, 880, 200, 200, "Done", Assets.titleFont, null); done.setGradient(true); int counter = 0; for (int y = 0; y < 16; y++) { int yPos = (int) (140 + 80 * (y + 1) - Assets.titleFont.getSize()); for (int x = 0; x < 16; x++) { values[counter] = new Button( 5 + offset * (x + 1), yPos, offset, 80, String.format("%02X", state.values[counter]), Assets.titleFont, null); values[counter].setUseBorder(false); counter++; } } }
@Override public void present(float deltaTime) { if (disposed) { return; } Graphics g = game.getGraphics(); g.clear(AliteColors.get().background()); displayWideTitle("Hacker v2.0"); for (int i = 0; i < 16; i++) { String hex = String.format("%02X", i); g.drawText( hex, 20 + offset * (i + 1), 140, AliteColors.get().additionalText(), Assets.titleFont); } if (deltaY != 0) { deltaY += deltaY > 0 ? -1 : 1; yPosition -= deltaY; if (yPosition < 0) { yPosition = 0; } if (yPosition > maxY) { yPosition = maxY; } } g.setClip(0, 60, -1, 930); for (int i = 0; i < 16; i++) { String hex = String.format("%X0", i); int y = 140 - yPosition + 80 * (i + 1); g.drawText(hex, 20, y, AliteColors.get().additionalText(), Assets.titleFont); } int count = 0; for (Button b : values) { b.setYOffset(-yPosition); long color = b.isSelected() ? AliteColors.get().baseInformation() : ((count / 16) + (count % 16)) % 2 == 0 ? AliteColors.get().informationText() : AliteColors.get().mainText(); b.setTextColor(color); b.render(g); count++; } g.setClip(-1, -1, -1, -1); done.render(g); }
@Override public void present(float deltaTime) { if (disposed) { return; } Graphics g = game.getGraphics(); g.clear(AliteColors.get().background()); displayTitle("Gameplay Options"); difficultyLevel.render(g); String text = getDifficultyDescription(); centerText(text, 315, Assets.regularFont, AliteColors.get().mainText()); autoId.render(g); dockingSpeed.render(g); laserAutoFire.render(g); keyboardLayout.render(g); back.render(g); }
@Override protected void processTouch(TouchEvent touch) { if (touch.type == TouchEvent.TOUCH_UP) { if (difficultyLevel.isTouched(touch.x, touch.y)) { SoundManager.play(Assets.click); Settings.difficultyLevel++; if (Settings.difficultyLevel > 5) { Settings.difficultyLevel = 0; } difficultyLevel.setText("Difficulty Level: " + getDifficultyString()); Settings.save(game.getFileIO()); } else if (autoId.isTouched(touch.x, touch.y)) { SoundManager.play(Assets.click); Settings.autoId = !Settings.autoId; autoId.setText("Auto Id: " + (Settings.autoId ? "On" : "Off")); Settings.save(game.getFileIO()); } else if (keyboardLayout.isTouched(touch.x, touch.y)) { SoundManager.play(Assets.click); if ("QWERTY".equals(Settings.keyboardLayout)) { Settings.keyboardLayout = "QWERTZ"; } else { Settings.keyboardLayout = "QWERTY"; } keyboardLayout.setText("Keyboard: " + Settings.keyboardLayout); Settings.save(game.getFileIO()); } else if (dockingSpeed.isTouched(touch.x, touch.y)) { SoundManager.play(Assets.click); Settings.dockingComputerSpeed++; if (Settings.dockingComputerSpeed > 2) { Settings.dockingComputerSpeed = 0; } dockingSpeed.setText( "Docking Computer: " + (Settings.dockingComputerSpeed == 0 ? "Slow" : (Settings.dockingComputerSpeed == 1 ? "Medium" : "Fast"))); Settings.save(game.getFileIO()); } else if (laserAutoFire.isTouched(touch.x, touch.y)) { SoundManager.play(Assets.click); Settings.laserButtonAutofire = !Settings.laserButtonAutofire; laserAutoFire.setText( "Laser: " + (Settings.laserButtonAutofire ? "Auto Fire" : "Single Shot")); Settings.save(game.getFileIO()); } else if (back.isTouched(touch.x, touch.y)) { SoundManager.play(Assets.click); newScreen = new OptionsScreen(game); } } }