@Override public void click(GameContainer container, StateBasedGame game) { SoundController.playSound(SoundEffect.MENUHIT); ((SongMenu) game.getState(Opsu.STATE_SONGMENU)).doStateActionOnLoad(MenuState.RELOAD); game.enterState( Opsu.STATE_SONGMENU, new EmptyTransition(), new FadeInTransition(Color.black)); }
@Override public void click(GameContainer container, StateBasedGame game) { SoundController.playSound(SoundEffect.MENUCLICK); for (GameMod mod : GameMod.values()) { if (mod.isActive()) mod.toggle(false); } }
@Override public void click(GameContainer container, StateBasedGame game) { SoundController.playSound(SoundEffect.MENUHIT); ScoreData scoreData = ((ButtonMenu) game.getState(Opsu.STATE_BUTTONMENU)).getScoreData(); ((SongMenu) game.getState(Opsu.STATE_SONGMENU)) .doStateActionOnLoad(MenuState.SCORE, scoreData); game.enterState( Opsu.STATE_SONGMENU, new EmptyTransition(), new FadeInTransition(Color.black)); }
@Override public void click(GameContainer container, StateBasedGame game) { SoundController.playSound(SoundEffect.MENUHIT); BeatmapSetNode node = ((ButtonMenu) game.getState(Opsu.STATE_BUTTONMENU)).getNode(); ((SongMenu) game.getState(Opsu.STATE_SONGMENU)) .doStateActionOnLoad(MenuState.BEATMAP_DELETE_SELECT, node); game.enterState( Opsu.STATE_SONGMENU, new EmptyTransition(), new FadeInTransition(Color.black)); }
@Override public void keyPressed(int key, char c) { switch (key) { case Input.KEY_ESCAPE: case Input.KEY_Q: ((ButtonMenu) game.getState(Opsu.STATE_BUTTONMENU)).setMenuState(MenuState.EXIT); game.enterState(Opsu.STATE_BUTTONMENU); break; case Input.KEY_P: SoundController.playSound(SoundEffect.MENUHIT); if (!logoClicked) { logoClicked = true; logoTimer = 0; playButton.getImage().setAlpha(0f); exitButton.getImage().setAlpha(0f); } else enterSongMenu(); break; case Input.KEY_D: SoundController.playSound(SoundEffect.MENUHIT); game.enterState( Opsu.STATE_DOWNLOADSMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black)); break; case Input.KEY_R: nextTrack(); break; case Input.KEY_UP: UI.changeVolume(1); break; case Input.KEY_DOWN: UI.changeVolume(-1); break; case Input.KEY_F7: Options.setNextFPS(container); break; case Input.KEY_F10: Options.toggleMouseDisabled(); break; case Input.KEY_F12: Utils.takeScreenShot(); break; } }
@Override public void click(GameContainer container, StateBasedGame game) { SoundController.playSound(SoundEffect.MENUHIT); BeatmapSetNode node = ((ButtonMenu) game.getState(Opsu.STATE_BUTTONMENU)).getNode(); MenuState ms = (node.beatmapIndex == -1 || node.getBeatmapSet().size() == 1) ? MenuState.BEATMAP_DELETE_CONFIRM : MenuState.BEATMAP_DELETE_SELECT; ((ButtonMenu) game.getState(Opsu.STATE_BUTTONMENU)).setMenuState(ms, node); game.enterState(Opsu.STATE_BUTTONMENU); }
@Override public void click(GameContainer container, StateBasedGame game, int cx, int cy) { super.click(container, game, cx, cy); for (GameMod mod : GameMod.values()) { if (mod.contains(cx, cy)) { boolean prevState = mod.isActive(); mod.toggle(true); if (mod.isActive() != prevState) SoundController.playSound(SoundEffect.MENUCLICK); return; } } }
@Override public void click(GameContainer container, StateBasedGame game) { SoundController.playSound(SoundEffect.MENUBACK); game.enterState( Opsu.STATE_SONGMENU, new EmptyTransition(), new FadeInTransition(Color.black)); }
@Override public void mousePressed(int button, int x, int y) { // check mouse button if (button == Input.MOUSE_MIDDLE_BUTTON) return; // music position bar if (MusicController.isPlaying()) { if (musicPositionBarContains(x, y)) { float pos = (x - musicBarX) / musicBarWidth; MusicController.setPosition((int) (pos * MusicController.getDuration())); return; } } // music button actions if (musicPlay.contains(x, y)) { if (MusicController.isPlaying()) { MusicController.pause(); UI.sendBarNotification("Pause"); } else if (!MusicController.isTrackLoading()) { MusicController.resume(); UI.sendBarNotification("Play"); } } else if (musicNext.contains(x, y)) { nextTrack(); UI.sendBarNotification(">> Next"); } else if (musicPrevious.contains(x, y)) { if (!previous.isEmpty()) { SongMenu menu = (SongMenu) game.getState(Opsu.STATE_SONGMENU); menu.setFocus(BeatmapSetList.get().getBaseNode(previous.pop()), -1, true, false); if (Options.isDynamicBackgroundEnabled()) bgAlpha = 0f; } else MusicController.setPosition(0); UI.sendBarNotification("<< Previous"); } // downloads button actions else if (downloadsButton.contains(x, y)) { SoundController.playSound(SoundEffect.MENUHIT); game.enterState( Opsu.STATE_DOWNLOADSMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black)); } // repository button actions else if (repoButton != null && repoButton.contains(x, y)) { try { Desktop.getDesktop().browse(Options.REPOSITORY_URI); } catch (IOException e) { ErrorHandler.error("Could not browse to repository URI.", e, false); } } // update button actions else if (Updater.get().showButton() && updateButton.contains(x, y)) { switch (Updater.get().getStatus()) { case UPDATE_AVAILABLE: SoundController.playSound(SoundEffect.MENUHIT); Updater.get().startDownload(); break; case UPDATE_DOWNLOADED: SoundController.playSound(SoundEffect.MENUHIT); Updater.get().prepareUpdate(); container.setForceExit(false); container.exit(); break; default: break; } } // start moving logo (if clicked) else if (!logoClicked) { if (logo.contains(x, y, 0.25f)) { logoClicked = true; logoTimer = 0; playButton.getImage().setAlpha(0f); exitButton.getImage().setAlpha(0f); SoundController.playSound(SoundEffect.MENUHIT); } } // other button actions (if visible) else if (logoClicked) { if (logo.contains(x, y, 0.25f) || playButton.contains(x, y, 0.25f)) { SoundController.playSound(SoundEffect.MENUHIT); enterSongMenu(); } else if (exitButton.contains(x, y, 0.25f)) { container.exit(); } else if (optionsButton.contains(x, y, 0.25f)) { enterOptionsMenu(); } } }