Minor Javadoc additions/edits.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
eb331360b9
commit
c58c128ec8
|
@ -51,10 +51,13 @@ import org.newdawn.slick.state.transition.FadeInTransition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic button menu state.
|
* Generic button menu state.
|
||||||
|
* <p>
|
||||||
|
* Displays a header and a set of defined options to the player.
|
||||||
*/
|
*/
|
||||||
public class ButtonMenu extends BasicGameState {
|
public class ButtonMenu extends BasicGameState {
|
||||||
/** Menu states. */
|
/** Menu states. */
|
||||||
public enum MenuState {
|
public enum MenuState {
|
||||||
|
/** The exit confirmation screen. */
|
||||||
EXIT (new Button[] { Button.YES, Button.NO }) {
|
EXIT (new Button[] { Button.YES, Button.NO }) {
|
||||||
@Override
|
@Override
|
||||||
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
||||||
|
@ -66,6 +69,7 @@ public class ButtonMenu extends BasicGameState {
|
||||||
Button.NO.click(container, game);
|
Button.NO.click(container, game);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/** The initial beatmap management screen. */
|
||||||
BEATMAP (new Button[] { Button.CLEAR_SCORES, Button.DELETE, Button.CANCEL }) {
|
BEATMAP (new Button[] { Button.CLEAR_SCORES, Button.DELETE, Button.CANCEL }) {
|
||||||
@Override
|
@Override
|
||||||
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
||||||
|
@ -86,6 +90,7 @@ public class ButtonMenu extends BasicGameState {
|
||||||
super.scroll(container, game, newValue);
|
super.scroll(container, game, newValue);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/** The beatmap deletion screen for a beatmap set with multiple beatmaps. */
|
||||||
BEATMAP_DELETE_SELECT (new Button[] { Button.DELETE_GROUP, Button.DELETE_SONG, Button.CANCEL_DELETE }) {
|
BEATMAP_DELETE_SELECT (new Button[] { Button.DELETE_GROUP, Button.DELETE_SONG, Button.CANCEL_DELETE }) {
|
||||||
@Override
|
@Override
|
||||||
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
||||||
|
@ -104,6 +109,7 @@ public class ButtonMenu extends BasicGameState {
|
||||||
MenuState.BEATMAP.scroll(container, game, newValue);
|
MenuState.BEATMAP.scroll(container, game, newValue);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/** The beatmap deletion screen for a single beatmap. */
|
||||||
BEATMAP_DELETE_CONFIRM (new Button[] { Button.DELETE_CONFIRM, Button.CANCEL_DELETE }) {
|
BEATMAP_DELETE_CONFIRM (new Button[] { Button.DELETE_CONFIRM, Button.CANCEL_DELETE }) {
|
||||||
@Override
|
@Override
|
||||||
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
||||||
|
@ -120,6 +126,7 @@ public class ButtonMenu extends BasicGameState {
|
||||||
MenuState.BEATMAP.scroll(container, game, newValue);
|
MenuState.BEATMAP.scroll(container, game, newValue);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/** The beatmap reloading confirmation screen. */
|
||||||
RELOAD (new Button[] { Button.RELOAD_CONFIRM, Button.RELOAD_CANCEL }) {
|
RELOAD (new Button[] { Button.RELOAD_CONFIRM, Button.RELOAD_CANCEL }) {
|
||||||
@Override
|
@Override
|
||||||
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
||||||
|
@ -140,6 +147,7 @@ public class ButtonMenu extends BasicGameState {
|
||||||
MenuState.BEATMAP.scroll(container, game, newValue);
|
MenuState.BEATMAP.scroll(container, game, newValue);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/** The score management screen. */
|
||||||
SCORE (new Button[] { Button.DELETE_SCORE, Button.CLOSE }) {
|
SCORE (new Button[] { Button.DELETE_SCORE, Button.CLOSE }) {
|
||||||
@Override
|
@Override
|
||||||
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
||||||
|
@ -156,6 +164,7 @@ public class ButtonMenu extends BasicGameState {
|
||||||
MenuState.BEATMAP.scroll(container, game, newValue);
|
MenuState.BEATMAP.scroll(container, game, newValue);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/** The game mod selection screen. */
|
||||||
MODS (new Button[] { Button.RESET_MODS, Button.CLOSE }) {
|
MODS (new Button[] { Button.RESET_MODS, Button.CLOSE }) {
|
||||||
@Override
|
@Override
|
||||||
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
public String[] getTitle(GameContainer container, StateBasedGame game) {
|
||||||
|
|
|
@ -68,6 +68,9 @@ import org.newdawn.slick.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Downloads menu.
|
* Downloads menu.
|
||||||
|
* <p>
|
||||||
|
* Players are able to download beatmaps off of various servers and import them
|
||||||
|
* from this state.
|
||||||
*/
|
*/
|
||||||
public class DownloadsMenu extends BasicGameState {
|
public class DownloadsMenu extends BasicGameState {
|
||||||
/** Delay time, in milliseconds, between each search. */
|
/** Delay time, in milliseconds, between each search. */
|
||||||
|
|
|
@ -42,11 +42,9 @@ import org.newdawn.slick.state.transition.FadeOutTransition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Game Pause/Fail" state.
|
* "Game Pause/Fail" state.
|
||||||
* <ul>
|
* <p>
|
||||||
* <li>[Continue] - unpause game (return to game state)
|
* Players are able to continue the game (if applicable), retry the beatmap,
|
||||||
* <li>[Retry] - restart game (return to game state)
|
* or return to the song menu from this state.
|
||||||
* <li>[Back] - return to song menu state
|
|
||||||
* </ul>
|
|
||||||
*/
|
*/
|
||||||
public class GamePauseMenu extends BasicGameState {
|
public class GamePauseMenu extends BasicGameState {
|
||||||
/** Music fade-out time, in milliseconds. */
|
/** Music fade-out time, in milliseconds. */
|
||||||
|
|
|
@ -50,10 +50,9 @@ import org.newdawn.slick.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Game Ranking" (score card) state.
|
* "Game Ranking" (score card) state.
|
||||||
* <ul>
|
* <p>
|
||||||
* <li>[Retry] - restart game (return to game state)
|
* Players are able to view their score statistics, retry the beatmap (if applicable),
|
||||||
* <li>[Replay] - watch replay (return to game state)
|
* or watch a replay of the game from this state.
|
||||||
* <li>[Back] - return to song menu state
|
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public class GameRanking extends BasicGameState {
|
public class GameRanking extends BasicGameState {
|
||||||
|
|
|
@ -58,10 +58,8 @@ import org.newdawn.slick.state.transition.FadeOutTransition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Main Menu" state.
|
* "Main Menu" state.
|
||||||
* <ul>
|
* <p>
|
||||||
* <li>[Play] - move to song selection menu
|
* Players are able to enter the song menu or downloads menu from this state.
|
||||||
* <li>[Exit] - move to confirm exit menu
|
|
||||||
* </ul>
|
|
||||||
*/
|
*/
|
||||||
public class MainMenu extends BasicGameState {
|
public class MainMenu extends BasicGameState {
|
||||||
/** Idle time, in milliseconds, before returning the logo to its original position. */
|
/** Idle time, in milliseconds, before returning the logo to its original position. */
|
||||||
|
|
|
@ -47,6 +47,8 @@ import org.newdawn.slick.state.transition.FadeInTransition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Game Options" state.
|
* "Game Options" state.
|
||||||
|
* <p>
|
||||||
|
* Players are able to view and change various game settings in this state.
|
||||||
*/
|
*/
|
||||||
public class OptionsMenu extends BasicGameState {
|
public class OptionsMenu extends BasicGameState {
|
||||||
/** Option tabs. */
|
/** Option tabs. */
|
||||||
|
|
|
@ -78,10 +78,9 @@ import org.newdawn.slick.state.transition.FadeOutTransition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Song Selection" state.
|
* "Song Selection" state.
|
||||||
* <ul>
|
* <p>
|
||||||
* <li>[Song] - start game (move to game state)
|
* Players are able to select a beatmap to play, view previous scores, choose game mods,
|
||||||
* <li>[Back] - return to main menu
|
* manage beatmaps, or change game options from this state.
|
||||||
* </ul>
|
|
||||||
*/
|
*/
|
||||||
public class SongMenu extends BasicGameState {
|
public class SongMenu extends BasicGameState {
|
||||||
/** The max number of song buttons to be shown on each screen. */
|
/** The max number of song buttons to be shown on each screen. */
|
||||||
|
@ -263,7 +262,7 @@ public class SongMenu extends BasicGameState {
|
||||||
private StarStream starStream;
|
private StarStream starStream;
|
||||||
|
|
||||||
/** Whether the menu is currently scrolling to the focus node (blocks other actions). */
|
/** Whether the menu is currently scrolling to the focus node (blocks other actions). */
|
||||||
private boolean isScrollingToFocus = false;
|
private boolean isScrollingToFocusNode = false;
|
||||||
|
|
||||||
// game-related variables
|
// game-related variables
|
||||||
private GameContainer container;
|
private GameContainer container;
|
||||||
|
@ -690,12 +689,12 @@ public class SongMenu extends BasicGameState {
|
||||||
|
|
||||||
// scrolling
|
// scrolling
|
||||||
songScrolling.update(delta);
|
songScrolling.update(delta);
|
||||||
if (isScrollingToFocus) {
|
if (isScrollingToFocusNode) {
|
||||||
float distanceDiff = Math.abs(songScrolling.getPosition() - songScrolling.getTargetPosition());
|
float distanceDiff = Math.abs(songScrolling.getPosition() - songScrolling.getTargetPosition());
|
||||||
if (distanceDiff <= buttonOffset / 8f) { // close enough, stop blocking input
|
if (distanceDiff <= buttonOffset / 8f) { // close enough, stop blocking input
|
||||||
songScrolling.scrollToPosition(songScrolling.getTargetPosition());
|
songScrolling.scrollToPosition(songScrolling.getTargetPosition());
|
||||||
songScrolling.setSpeedMultiplier(1f);
|
songScrolling.setSpeedMultiplier(1f);
|
||||||
isScrollingToFocus = false;
|
isScrollingToFocusNode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateDrawnSongPosition();
|
updateDrawnSongPosition();
|
||||||
|
@ -746,7 +745,7 @@ public class SongMenu extends BasicGameState {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(int button, int x, int y) {
|
public void mousePressed(int button, int x, int y) {
|
||||||
if (isScrollingToFocus)
|
if (isScrollingToFocusNode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
songScrolling.pressed();
|
songScrolling.pressed();
|
||||||
|
@ -755,7 +754,7 @@ public class SongMenu extends BasicGameState {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(int button, int x, int y) {
|
public void mouseReleased(int button, int x, int y) {
|
||||||
if (isScrollingToFocus)
|
if (isScrollingToFocusNode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
songScrolling.released();
|
songScrolling.released();
|
||||||
|
@ -888,7 +887,7 @@ public class SongMenu extends BasicGameState {
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(int key, char c) {
|
public void keyPressed(int key, char c) {
|
||||||
// block input
|
// block input
|
||||||
if ((reloadThread != null && !(key == Input.KEY_ESCAPE || key == Input.KEY_F12)) || beatmapMenuTimer > -1 || isScrollingToFocus)
|
if ((reloadThread != null && !(key == Input.KEY_ESCAPE || key == Input.KEY_F12)) || beatmapMenuTimer > -1 || isScrollingToFocusNode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -1101,7 +1100,7 @@ public class SongMenu extends BasicGameState {
|
||||||
selectOptionsButton.resetHover();
|
selectOptionsButton.resetHover();
|
||||||
hoverOffset.setTime(0);
|
hoverOffset.setTime(0);
|
||||||
hoverIndex = null;
|
hoverIndex = null;
|
||||||
isScrollingToFocus = false;
|
isScrollingToFocusNode = false;
|
||||||
songScrolling.released();
|
songScrolling.released();
|
||||||
songScrolling.setSpeedMultiplier(1f);
|
songScrolling.setSpeedMultiplier(1f);
|
||||||
startScorePos.setPosition(0);
|
startScorePos.setPosition(0);
|
||||||
|
@ -1378,7 +1377,7 @@ public class SongMenu extends BasicGameState {
|
||||||
if (startNode == null || game.getCurrentStateID() != Opsu.STATE_SONGMENU)
|
if (startNode == null || game.getCurrentStateID() != Opsu.STATE_SONGMENU)
|
||||||
songScrolling.setPosition((node.index - 1) * buttonOffset);
|
songScrolling.setPosition((node.index - 1) * buttonOffset);
|
||||||
else {
|
else {
|
||||||
isScrollingToFocus = true;
|
isScrollingToFocusNode = true;
|
||||||
songScrolling.setSpeedMultiplier(2f);
|
songScrolling.setSpeedMultiplier(2f);
|
||||||
songScrolling.released();
|
songScrolling.released();
|
||||||
}
|
}
|
||||||
|
@ -1551,7 +1550,7 @@ public class SongMenu extends BasicGameState {
|
||||||
* @return true if blocking input
|
* @return true if blocking input
|
||||||
*/
|
*/
|
||||||
private boolean isInputBlocked() {
|
private boolean isInputBlocked() {
|
||||||
return (reloadThread != null || beatmapMenuTimer > -1 || isScrollingToFocus);
|
return (reloadThread != null || beatmapMenuTimer > -1 || isScrollingToFocusNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user